NAME
if::prog - use
a Perl module if program matches
VERSION
This document describes version 0.01 of if::prog (from Perl distribution if-Pragmas), released on 2014-10-09.
SYNOPSIS
In Perl script:
use if::prog 'foo|bar', MODULE => ARGUMENTS;
On command-line:
perl -Mif::prog='foo,Devel::EndStats::LoadedMods' foo ...
In crontab:
PERL5OPT='-Mif::prog=foo,Devel::EndStats::LoadedMods'
# this Perl program will load Devel::EndStats::LoadedMods
0 0 * * * foo some arg
# this Perl program won't
1 1 * * * bar other args
DESCRIPTION
use if::prog $prog, MODULE => ARGUMENTS;
is a shortcut for:
use if $0 =~ $prog, MODULE => ARGUMENTS;
The reason this pragma is created is to make it easier to specify on command-line (especially using the -M
perl switch or in PERL5OPT
).
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/if-Pragmas.
SOURCE
Source repository is at https://github.com/perlancar/perl-if-Pragmas.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=if-Pragmas
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.