home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl501m.zip / lib / subs.pm < prev    next >
Text File  |  1995-07-03  |  585b  |  35 lines

  1. package subs;
  2.  
  3. =head1 NAME
  4.  
  5. subs - 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.  
  14. This will predeclare all the subroutine whose names are 
  15. in the list, allowing you to use them without parentheses
  16. even before they're declared.
  17.  
  18. See L<perlmod/Pragmatic Modules> and L<strict/subs>.
  19.  
  20. =cut
  21. require 5.000;
  22.  
  23. $ExportLevel = 0;
  24.  
  25. sub import {
  26.     my $callpack = caller;
  27.     my $pack = shift;
  28.     my @imports = @_;
  29.     foreach $sym (@imports) {
  30.     *{"${callpack}::$sym"} = \&{"${callpack}::$sym"};
  31.     }
  32. };
  33.  
  34. 1;
  35.