Simply changing our to my will avoid the package variable if that's what you meant by global. There's nothing wrong with this particular var being global (whether my or our).
You're using indirect object notation (method Class @args) which is iffy. Class->method(@args) is more reliable, better recognized and more readable.
You don't need new_from_fd at all unless you plan on passing the handle to child processes.
Don't need to include the line number in a message destined to the user.
use IO::Handle qw( ); my $LOGFH; if ( $opt_s ) { $LOGFH = \*STDOUT; } else { $opt_l = $DEFAULT_LOG_FILE if !defined($opt_l); open( $LOGFH, '>>', $opt_l ) or die("Could not open logfile \" $opt_l\": $!\n"); } $LOGFH->autoflush(1); #autoflush on
In reply to Re: Best method for opening/using a log
by ikegami
in thread Best method for opening/using a log
by automandc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |