Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
818 B

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