6 my $method = shift() ? 'import' : 'unimport';
7 return unless shift; # CONDITION
8 my $p = shift; # PACKAGE
9 eval "require $p" or die; # Adds .pm etc if needed
10 $p->$method(@_) if $p->can($method);
13 sub import { shift; unshift @_, 1; goto &work }
14 sub unimport { shift; unshift @_, 0; goto &work }
21 if - C<use> a Perl module if a condition holds
25 use if CONDITION, MODULE => ARGUMENTS;
31 use if CONDITION, MODULE => ARGUMENTS;
33 has no effect unless C<CONDITION> is true. In this case the effect is
40 The current implementation does not allow specification of the
41 required version of the module.
45 Ilya Zakharevich L<mailto:perl-module-if@ilyaz.org>.