in reply to stop me from embarrassing myself
if ($opts{h} || $opts{u}) { exec "perldoc $0" };
you might want to check out the Pod::Usage module. For example (copied straight from the docs)
use Pod::Usage;
use Getopt::Long;
## Parse options
GetOptions("help", "man", "flag1") || pod2usage(-verbose => 0);
pod2usage(-verbose => 1) if ($opt_help);
pod2usage(-verbose => 2) if ($opt_man);
pod2usage(-verbose => 2, -message => "$0: $error_msg.\n")
if $some_error
The neat thing about this module, is that it can handle
your 'usage' message (runrig), or display a full man
page without you having to do it your self, or setting off
an exec to do it for you.
if ($opts{f}) { $conf = $opts{f} };
# if no conf file specified, use "/etc/errreporter.conf as
# the default ...
unless ($conf) { $conf = "/etc/errreporter.conf"
Simpler (or at least more idiomatic) may be
$conf = $opts{f} if exists $opts{f};
$conf ||= "/etc/errreporter.conf";
or even
$conf = $opts{f} || "/etc/errreporter.conf";
Mind out for the gotcha though... $conf
will get set to the default if $opts{f} doesn't exist, isn't defined, or if it is just logically false (0 or empty string)
if ($identifier =~ /$_/)... if ($ignore =~ /yes/)...What's wrong with plain old
if ($ignore eq 'yes')...That's what 'eq' is for
Good luck with it :)
Update corrected $ignore eq /yes/ to $ignore eq 'yes'. Thanks chipmunk for pointing that out... it was a typo... honest!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: stop me from embarrassing myself
by blueflashlight (Pilgrim) on Feb 28, 2001 at 00:15 UTC | |
|
Re: Re: stop me from embarrassing myself
by blueflashlight (Pilgrim) on Feb 28, 2001 at 00:21 UTC |