1*0Sstevel@tonic-gatepackage subs; 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateour $VERSION = '1.00'; 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gate=head1 NAME 6*0Sstevel@tonic-gate 7*0Sstevel@tonic-gatesubs - Perl pragma to predeclare sub names 8*0Sstevel@tonic-gate 9*0Sstevel@tonic-gate=head1 SYNOPSIS 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gate use subs qw(frob); 12*0Sstevel@tonic-gate frob 3..10; 13*0Sstevel@tonic-gate 14*0Sstevel@tonic-gate=head1 DESCRIPTION 15*0Sstevel@tonic-gate 16*0Sstevel@tonic-gateThis will predeclare all the subroutine whose names are 17*0Sstevel@tonic-gatein the list, allowing you to use them without parentheses 18*0Sstevel@tonic-gateeven before they're declared. 19*0Sstevel@tonic-gate 20*0Sstevel@tonic-gateUnlike pragmas that affect the C<$^H> hints variable, the C<use vars> and 21*0Sstevel@tonic-gateC<use subs> declarations are not BLOCK-scoped. They are thus effective 22*0Sstevel@tonic-gatefor the entire file in which they appear. You may not rescind such 23*0Sstevel@tonic-gatedeclarations with C<no vars> or C<no subs>. 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gateSee L<perlmodlib/Pragmatic Modules> and L<strict/strict subs>. 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate=cut 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gaterequire 5.000; 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gatesub import { 32*0Sstevel@tonic-gate my $callpack = caller; 33*0Sstevel@tonic-gate my $pack = shift; 34*0Sstevel@tonic-gate my @imports = @_; 35*0Sstevel@tonic-gate foreach $sym (@imports) { 36*0Sstevel@tonic-gate *{"${callpack}::$sym"} = \&{"${callpack}::$sym"}; 37*0Sstevel@tonic-gate } 38*0Sstevel@tonic-gate}; 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate1; 41