dagolden / Capture-Tiny

(Perl) Capture STDOUT and STDERR from Perl, XS or external programs
http://search.cpan.org/dist/Capture-Tiny/
39 stars 19 forks source link

capture causes error in/from Unix.pm #57

Open spoonervt opened 5 years ago

spoonervt commented 5 years ago

I am trying a

my ($out,$err) = capture { system ('executable perl file')}

to capture stdout, and stderr.

It works, but what I also get is this Use of uninitialized value in string ne at /tool/pandora64/.package/perl-5.18.1/lib/site_perl/5.18.1/x86_64-linux/File/Spec/Unix.pm line 176. Use of uninitialized value in string ne at /tool/pandora64/.package/perl-5.18.1/lib/site_perl/5.18.1/x86_64-linux/File/Spec/Unix.pm line 176. Use of uninitialized value in string ne at /tool/pandora64/.package/perl-5.18.1/lib/site_perl/5.18.1/x86_64-linux/File/Spec/Unix.pm line 176. Use of uninitialized value $tmpenv{"TMPDIR"} in string ne at /tool/pandora64/.package/perl-5.18.1/lib/site_perl/5.18.1/x86_64-linux/File/Spec/Unix.pm line 176.

When I set TMPDIR (setenv TMPDIR /tmp) I can eliminate 3 of the messages, but I still get: Use of uninitialized value in string ne at /tool/pandora64/.package/perl-5.18.1/lib/site_perl/5.18.1/x86_64-linux/File/Spec/Unix.pm line 176.

The capture actually works, and I get this message only once. Any additional capture will not cause the message anymore.

Am I missing something crucial, or is this something caused by Unix.pm or Capture::Tiny? How do I fix it?

ps: perl 5.18.1, on x86_64 Centos 6.9 This is a host where I have user permissions only.