NAME
maybe - Use a Perl module and ignore error if can't be loaded
SYNOPSIS
use Getopt::Long;
use maybe 'Getopt::Long::Descriptive';
if (Getopt::Long::Descriptive->VERSION) { # run-time checking
Getopt::Long::Descriptive::describe_options("usage: %c %o", @options);
}
else {
Getopt::Long::GetOptions(\%options, @$opt_spec);
}
use maybe 'Carp' => 'confess';
use constant HAS_CARP => !! Carp->VERSION;
if (HAS_CARP) { # compilation-time checking
confess("Bum!");
}
else {
die("Bum!);
}
DESCRIPTION
This pragma loads a Perl module. If the module can't be loaded, the
error will be ignored. Otherwise, the module's import method is called
with unchanged caller stack.
AUTHOR
Piotr Roszatycki <
[email protected]>
COPYRIGHT
Copyright (C) 2008 by Piotr Roszatycki <
[email protected]>.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See
http://www.perl.com/perl/misc/Artistic.html