source: trunk/third/perl/lib/subs.pm @ 14545

Revision 14545, 818 bytes checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14544, which included commits to RCS files with non-trunk default branches.
Line 
1package subs;
2
3=head1 NAME
4
5subs - Perl pragma to predeclare sub names
6
7=head1 SYNOPSIS
8
9    use subs qw(frob);
10    frob 3..10;
11
12=head1 DESCRIPTION
13
14This will predeclare all the subroutine whose names are
15in the list, allowing you to use them without parentheses
16even before they're declared.
17
18Unlike pragmas that affect the C<$^H> hints variable, the C<use vars> and
19C<use subs> declarations are not BLOCK-scoped.  They are thus effective
20for the entire file in which they appear.  You may not rescind such
21declarations with C<no vars> or C<no subs>.
22
23See L<perlmodlib/Pragmatic Modules> and L<strict/strict subs>.
24
25=cut
26
27require 5.000;
28
29sub import {
30    my $callpack = caller;
31    my $pack = shift;
32    my @imports = @_;
33    foreach $sym (@imports) {
34        *{"${callpack}::$sym"} = \&{"${callpack}::$sym"};
35    }
36};
37
381;
Note: See TracBrowser for help on using the repository browser.