Subject: | warning from fail to exec piped program |
Date: | Fri, 26 Jun 2009 11:57:56 +1000 |
To: | bug-perl6-slurp [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
With Perl6::Slurp 0.03 and recent debian packaged perl 5.10.0, a little
program
use Perl6::Slurp;
print Perl6::Slurp::slurp ('-|', 'nosuchprogramname');
print "done\n";
prints
Can't exec "nosuchprogramname": No such file or directory at /usr/share/perl5/Perl6/Slurp.pm line 93.
Can't open 'nosuchprogramname': No such file or directory at foo.pl line 2
I think the first is a warning and the second is a croak. I hoped that
it wouldn't double-up like that, ie. that if slurp() is going to croak
on error that it wouldn't also print a warning.
The warning is fairly inconvenient when using an eval{} to trap the
error. I made myself a localized __WARN__ handler to suppress it, and
wondered if Perl6::Slurp might do that itself at a suitable point.
I see the warning is a documented feature of open() -- though you'd
probably think it ought to be enough for it to give its error return,
without further verbiage.