This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Widen the feature bundle hint mask to 4 bits
[perl5.git] / lib / subs.pm
CommitLineData
a0d0e21e
LW
1package subs;
2
dca1ad46 3our $VERSION = '1.03';
b75c8c73 4
f06db76b
AD
5=head1 NAME
6
dca1ad46 7subs - Perl pragma to predeclare subroutine names
f06db76b
AD
8
9=head1 SYNOPSIS
10
11 use subs qw(frob);
12 frob 3..10;
13
14=head1 DESCRIPTION
15
dca1ad46
AC
16This will predeclare all the subroutines whose names are
17in the list, allowing you to use them without parentheses (as list operators)
f06db76b
AD
18even before they're declared.
19
55497cff 20Unlike pragmas that affect the C<$^H> hints variable, the C<use vars> and
dca1ad46
AC
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
55497cff 24declarations with C<no vars> or C<no subs>.
25
ee580363 26See L<perlmodlib/Pragmatic Modules> and L<strict/strict subs>.
f06db76b
AD
27
28=cut
3fe9a6f1 29
a0d0e21e
LW
30require 5.000;
31
a0d0e21e
LW
32sub import {
33 my $callpack = caller;
34 my $pack = shift;
35 my @imports = @_;
f2b2ac32 36 foreach my $sym (@imports) {
a0d0e21e
LW
37 *{"${callpack}::$sym"} = \&{"${callpack}::$sym"};
38 }
39};
40
411;