Require-Util
view release on metacpan or search on metacpan
This document describes version 0.002 of Require::Util (from Perl
distribution Require-Util), released on 2021-06-29.
SYNOPSIS
use Require::Util qw(require_any try_require);
if (try_require "Foo::Bar") {
# use Foo::Bar's function
}
my $modname = require_any "Foo::Bar", "Baz/Qux.pm", "Quux";
DESCRIPTION
EXPERIMENTAL.
FUNCTIONS
require_any
Usage:
my $res = require_any $modname1, $modname2, ...;
Example:
my $res = require_any "Foo::Bar", "Baz/Qux.pm";
Require modules listed as arguments, stopping after the first success.
If all modules cannot be loaded, will die. Module name can be specified
as "Foo::Bar" syntax or as "Foo/Bar.pm" syntax. Unlike "require()" which
just returns true, upon success the function will return the module name
that gets loaded.
try_require
Usage:
lib/Require/Util.pm view on Meta::CPAN
This document describes version 0.002 of Require::Util (from Perl distribution Require-Util), released on 2021-06-29.
=head1 SYNOPSIS
use Require::Util qw(require_any try_require);
if (try_require "Foo::Bar") {
# use Foo::Bar's function
}
my $modname = require_any "Foo::Bar", "Baz/Qux.pm", "Quux";
=head1 DESCRIPTION
B<EXPERIMENTAL.>
=head1 FUNCTIONS
=head2 require_any
Usage:
my $res = require_any $modname1, $modname2, ...;
Example:
my $res = require_any "Foo::Bar", "Baz/Qux.pm";
Require modules listed as arguments, stopping after the first success. If all
modules cannot be loaded, will die. Module name can be specified as C<Foo::Bar>
syntax or as C<Foo/Bar.pm> syntax. Unlike C<require()> which just returns true,
upon success the function will return the module name that gets loaded.
=head2 try_require
Usage:
( run in 0.351 second using v1.01-cache-2.11-cpan-0d8aa00de5b )