K
kj
ExtUtils::Install::install is making some unwanted noises ("Installing
blah-blah-blah", via STDOUT) that I want to turn off, and do so in
a portable way. My first stab was simply to close STDOUT:
perl -MExtUtils::Install -e '
close STDOUT; install( { "foo" => "bar" }, 0, 0, 0 )'
....but this results in *new* unwanted noises:
Filehandle STDOUT reopened as FH only for input at /usr/lib/perl5/5.8.6/File/Copy.pm line 118.
Filehandle STDOUT reopened as FH only for input at /usr/lib/perl5/5.8.6/File/Copy.pm line 118.
Filehandle STDOUT reopened as FH only for input at /usr/lib/perl5/5.8.6/File/Copy.pm line 118.
....etc., on such line for each file copied.
I tried adding 'no warnings "io";' to the script, but that failed
to silence the warnings (why?). The only portable solution I could
find is very long-winded:
perl -MExtUtils::Install -e '
$SIG{ __WARN__ } = sub{ warn @_ unless $_[ 0 ] =~ /STDOUT reopened/ };
close STDOUT;
install( { "foo" => "bar" }, 0, 0, 0 )'
A shorter solution is
perl -MExtUtils::Install -e '
open STDOUT, ">/dev/null";
install( { "foo" => "bar" }, 0, 0, 0 )'
....but I doubt that it is portable.
A third solution would be
perl -MExtUtils::Install -e '
close STDOUT;
open STDOUT, ">", \$toss;
install( { "foo" => "bar" }, 0, 0, 0 )'
but I believe this would bomb with versions of Perl older than 5.8,
so in a sense it is not very portable either.
Is there a more succinct solution than my __WARN__ hack above?
Thanks!
kj
blah-blah-blah", via STDOUT) that I want to turn off, and do so in
a portable way. My first stab was simply to close STDOUT:
perl -MExtUtils::Install -e '
close STDOUT; install( { "foo" => "bar" }, 0, 0, 0 )'
....but this results in *new* unwanted noises:
Filehandle STDOUT reopened as FH only for input at /usr/lib/perl5/5.8.6/File/Copy.pm line 118.
Filehandle STDOUT reopened as FH only for input at /usr/lib/perl5/5.8.6/File/Copy.pm line 118.
Filehandle STDOUT reopened as FH only for input at /usr/lib/perl5/5.8.6/File/Copy.pm line 118.
....etc., on such line for each file copied.
I tried adding 'no warnings "io";' to the script, but that failed
to silence the warnings (why?). The only portable solution I could
find is very long-winded:
perl -MExtUtils::Install -e '
$SIG{ __WARN__ } = sub{ warn @_ unless $_[ 0 ] =~ /STDOUT reopened/ };
close STDOUT;
install( { "foo" => "bar" }, 0, 0, 0 )'
A shorter solution is
perl -MExtUtils::Install -e '
open STDOUT, ">/dev/null";
install( { "foo" => "bar" }, 0, 0, 0 )'
....but I doubt that it is portable.
A third solution would be
perl -MExtUtils::Install -e '
close STDOUT;
open STDOUT, ">", \$toss;
install( { "foo" => "bar" }, 0, 0, 0 )'
but I believe this would bomb with versions of Perl older than 5.8,
so in a sense it is not very portable either.
Is there a more succinct solution than my __WARN__ hack above?
Thanks!
kj