# 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; }
In reply to Use a module only if it is available by jordi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |