This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test for the { and { ? commands.
[perl5.git] / lib / subs.pm
CommitLineData
a0d0e21e
LW
1package subs;
2
104a6083 3our $VERSION = '1.01';
b75c8c73 4
f06db76b
AD
5=head1 NAME
6
7subs - 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
16This will predeclare all the subroutine whose names are
17in the list, allowing you to use them without parentheses
18even before they're declared.
19
55497cff 20Unlike pragmas that affect the C<$^H> hints variable, the C<use vars> and
21C<use subs> declarations are not BLOCK-scoped. They are thus effective
e023355f 22for the entire package in which they appear. You may not rescind such
55497cff 23declarations with C<no vars> or C<no subs>.
24
ee580363 25See L<perlmodlib/Pragmatic Modules> and L<strict/strict subs>.
f06db76b
AD
26
27=cut
3fe9a6f1 28
a0d0e21e
LW
29require 5.000;
30
a0d0e21e
LW
31sub import {
32 my $callpack = caller;
33 my $pack = shift;
34 my @imports = @_;
35 foreach $sym (@imports) {
36 *{"${callpack}::$sym"} = \&{"${callpack}::$sym"};
37 }
38};
39
401;