1package subs; 2 3our $VERSION = '1.03'; 4 5=head1 NAME 6 7subs - Perl pragma to predeclare subroutine names 8 9=head1 SYNOPSIS 10 11 use subs qw(frob); 12 frob 3..10; 13 14=head1 DESCRIPTION 15 16This will predeclare all the subroutines whose names are 17in the list, allowing you to use them without parentheses (as list operators) 18even before they're declared. 19 20Unlike pragmas that affect the C<$^H> hints variable, the C<use vars> and 21C<use subs> declarations are not lexically scoped to the block they appear 22in: they affect 23the entire package in which they appear. It is not possible to rescind these 24declarations with C<no vars> or C<no subs>. 25 26See L<perlmodlib/Pragmatic Modules> and L<strict/strict subs>. 27 28=cut 29 30require 5.000; 31 32sub import { 33 my $callpack = caller; 34 my $pack = shift; 35 my @imports = @_; 36 foreach my $sym (@imports) { 37 *{"${callpack}::$sym"} = \&{"${callpack}::$sym"}; 38 } 39}; 40 411; 42