home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / lib / perl / 5.8.8 / POSIX.pm < prev    next >
Encoding:
Perl POD Document  |  2007-03-05  |  1.4 KB  |  62 lines

  1. package POSIX;
  2.  
  3. our(@ISA, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD) = ();
  4.  
  5. our $VERSION = "1.09";
  6.  
  7. use AutoLoader;
  8.  
  9. use XSLoader ();
  10.  
  11. # Grandfather old foo_h form to new :foo_h form
  12. my $loaded;
  13.  
  14. sub import {
  15.     load_imports() unless $loaded++;
  16.     my $this = shift;
  17.     my @list = map { m/^\w+_h$/ ? ":$_" : $_ } @_;
  18.     local $Exporter::ExportLevel = 1;
  19.     Exporter::import($this,@list);
  20. }
  21.  
  22. sub croak { require Carp;  goto &Carp::croak }
  23. # declare usage to assist AutoLoad
  24. sub usage;
  25.  
  26. XSLoader::load 'POSIX', $VERSION;
  27.  
  28. my %NON_CONSTS = (map {($_,1)}
  29.                   qw(S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG WEXITSTATUS
  30.                      WIFEXITED WIFSIGNALED WIFSTOPPED WSTOPSIG WTERMSIG));
  31.  
  32. sub AUTOLOAD {
  33.     if ($AUTOLOAD =~ /::(_?[a-z])/) {
  34.     # require AutoLoader;
  35.     $AutoLoader::AUTOLOAD = $AUTOLOAD;
  36.     goto &AutoLoader::AUTOLOAD
  37.     }
  38.     local $! = 0;
  39.     my $constname = $AUTOLOAD;
  40.     $constname =~ s/.*:://;
  41.     if ($NON_CONSTS{$constname}) {
  42.         my ($val, $error) = &int_macro_int($constname, $_[0]);
  43.         croak $error if $error;
  44.         *$AUTOLOAD = sub { &int_macro_int($constname, $_[0]) };
  45.     } else {
  46.         my ($error, $val) = constant($constname);
  47.         croak $error if $error;
  48.     *$AUTOLOAD = sub { $val };
  49.     }
  50.  
  51.     goto &$AUTOLOAD;
  52. }
  53.  
  54. package POSIX::SigAction;
  55.  
  56. use AutoLoader 'AUTOLOAD';
  57. sub new { bless {HANDLER => $_[1], MASK => $_[2], FLAGS => $_[3] || 0, SAFE => 0}, $_[0] }
  58.  
  59. package POSIX;
  60.  
  61. 1;
  62.