Subject: | unwanted error output when 'lsof' binary not found in $PATH |
Hello,
Whne the 'lsof' binary is not found in $PATH, use of Unix::Lsof::lsof
prints some unwanted lines to STDERR::
$ type lsof
-bash: type: lsof: not found
$ perl -e 'use Unix::Lsof; $lsof=lsof("-i");'
Use of uninitialized value in -e at
/usr/perl5/site_perl/5.8.4/Unix/Lsof.pm line 62.
Use of uninitialized value in concatenation (.) or string at
/usr/perl5/site_perl/5.8.4/Unix/Lsof.pm line 63.
Cannot find lsof program : No such file or directory at
/usr/perl5/site_perl/5.8.4/Unix/Lsof.pm line 63.
There are a couple of issues here:
1) the "Use of uninitialized value ..." which should not happen
2) I'd like an option to make Unix::Lsof totally silent: when using
Unix::Lsof for writing application plugins, output should often be
formatted in a pre-defined way: it is the caller responsibility to
read the error from $lsof->errors() and (eventually) print it.
Thanks!
Regards,
Riccardo