This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
dumb bug in User::pwent.pm
[perl5.git] / lib / subs.pm
CommitLineData
a0d0e21e
LW
1package subs;
2
f06db76b
AD
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
55497cff 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<perlmod/Pragmatic Modules> and L<strict/strict subs>.
f06db76b
AD
24
25=cut
a0d0e21e
LW
26require 5.000;
27
a0d0e21e
LW
28sub import {
29 my $callpack = caller;
30 my $pack = shift;
31 my @imports = @_;
32 foreach $sym (@imports) {
33 *{"${callpack}::$sym"} = \&{"${callpack}::$sym"};
34 }
35};
36
371;