# This is equivalent to 'use Pod::Usage;', except that it does not fai +l if the # module is not available: eval { require Pod::Usage; import Pod::Usage; }; #.... # Usage just calls pod2usage, except in case the Pod::Usage module is +not # available. Then it tries to give some hint on what's going on. # sub usage { if (defined *pod2usage{CODE}) { pod2usage (@_); } else { print STDERR "Can't print error message because the ", "Pod::Usage Perl module is not available\n"; $"=", "; print STDERR "\nAdditional info: @_\n"; exit 3; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Use a module only if it is available
by chromatic (Archbishop) on Dec 30, 2001 at 08:45 UTC | |
|
Re: Use a module only if it is available
by ehdonhon (Curate) on Dec 30, 2001 at 10:43 UTC | |
by rob_au (Abbot) on Jan 19, 2003 at 12:25 UTC |