ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/staticperl/perl/lib/subs.pm
Revision: 1.1
Committed: Thu Jun 30 14:27:09 2005 UTC (21 years, 4 months ago) by root
Branch: MAIN
CVS Tags: PERL-5-8-7, HEAD
Branch point for: PERL
Log Message:
*** empty log message ***

File Contents

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