diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /systems/texlive/tlnet/tlpkg/tlperl/lib/subs.pm |
Initial commit
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tlperl/lib/subs.pm')
-rw-r--r-- | systems/texlive/tlnet/tlpkg/tlperl/lib/subs.pm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/subs.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/subs.pm new file mode 100644 index 0000000000..24814596ba --- /dev/null +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/subs.pm @@ -0,0 +1,41 @@ +package subs; + +our $VERSION = '1.03'; + +=head1 NAME + +subs - Perl pragma to predeclare subroutine names + +=head1 SYNOPSIS + + use subs qw(frob); + frob 3..10; + +=head1 DESCRIPTION + +This will predeclare all the subroutines whose names are +in the list, allowing you to use them without parentheses (as list operators) +even before they're declared. + +Unlike pragmas that affect the C<$^H> hints variable, the C<use vars> and +C<use subs> declarations are not lexically scoped to the block they appear +in: they affect +the entire package in which they appear. It is not possible to rescind these +declarations with C<no vars> or C<no subs>. + +See L<perlmodlib/Pragmatic Modules> and L<strict/strict subs>. + +=cut + +require 5.000; + +sub import { + my $callpack = caller; + my $pack = shift; + my @imports = @_; + foreach my $sym (@imports) { + *{"${callpack}::$sym"} = \&{"${callpack}::$sym"}; + } +}; + +1; |