home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Database Designers / Rational Rose 2000 / Rational Setup.EXE / common / lib / MSWin32-x86 / Errno.pm < prev    next >
Encoding:
Perl POD Document  |  1999-01-26  |  3.5 KB  |  158 lines

  1. #
  2. # This file is auto-generated. ***ANY*** changes here will be lost
  3. #
  4.  
  5. package Errno;
  6. use vars qw(@EXPORT_OK %EXPORT_TAGS @ISA $VERSION %errno $AUTOLOAD);
  7. use Exporter ();
  8. use Config;
  9. use strict;
  10.  
  11. $Config{'myarchname'} eq "MSWin32" or
  12.     die "Errno architecture (MSWin32) does not match executable architecture ($Config{'myarchname'})";
  13.  
  14. $VERSION = "1.09";
  15. @ISA = qw(Exporter);
  16.  
  17. @EXPORT_OK = qw(EFAULT ENOSYS EILSEQ EACCES EAGAIN ENOEXEC ENOSPC
  18.     ENAMETOOLONG ENOENT ECHILD EDEADLK EEXIST EBADF EMFILE ERANGE ENFILE
  19.     EXDEV ENOLCK EMLINK EISDIR ENODEV ENOMEM EINTR ENOTTY ENXIO EDOM
  20.     ENOTEMPTY ESPIPE EBUSY E2BIG EPIPE ENOTDIR ESRCH EPERM EDEADLOCK EFBIG
  21.     EIO EROFS EINVAL);
  22.  
  23. %EXPORT_TAGS = (
  24.     POSIX => [qw(
  25.     E2BIG EACCES EAGAIN EBADF EBUSY ECHILD EDEADLK EDOM EEXIST EFAULT
  26.     EFBIG EINTR EINVAL EIO EISDIR EMFILE EMLINK ENAMETOOLONG ENFILE ENODEV
  27.     ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS ENOTDIR ENOTEMPTY ENOTTY
  28.     ENXIO EPERM EPIPE ERANGE EROFS ESPIPE ESRCH EXDEV
  29.     )]
  30. );
  31.  
  32. sub EPERM () { 1 }
  33. sub ENOENT () { 2 }
  34. sub ESRCH () { 3 }
  35. sub EINTR () { 4 }
  36. sub EIO () { 5 }
  37. sub ENXIO () { 6 }
  38. sub E2BIG () { 7 }
  39. sub ENOEXEC () { 8 }
  40. sub EBADF () { 9 }
  41. sub ECHILD () { 10 }
  42. sub EAGAIN () { 11 }
  43. sub ENOMEM () { 12 }
  44. sub EACCES () { 13 }
  45. sub EFAULT () { 14 }
  46. sub EBUSY () { 16 }
  47. sub EEXIST () { 17 }
  48. sub EXDEV () { 18 }
  49. sub ENODEV () { 19 }
  50. sub ENOTDIR () { 20 }
  51. sub EISDIR () { 21 }
  52. sub EINVAL () { 22 }
  53. sub ENFILE () { 23 }
  54. sub EMFILE () { 24 }
  55. sub ENOTTY () { 25 }
  56. sub EFBIG () { 27 }
  57. sub ENOSPC () { 28 }
  58. sub ESPIPE () { 29 }
  59. sub EROFS () { 30 }
  60. sub EMLINK () { 31 }
  61. sub EPIPE () { 32 }
  62. sub EDOM () { 33 }
  63. sub ERANGE () { 34 }
  64. sub EDEADLK () { 36 }
  65. sub EDEADLOCK () { 36 }
  66. sub ENAMETOOLONG () { 38 }
  67. sub ENOLCK () { 39 }
  68. sub ENOSYS () { 40 }
  69. sub ENOTEMPTY () { 41 }
  70. sub EILSEQ () { 42 }
  71.  
  72. sub TIEHASH { bless [] }
  73.  
  74. sub FETCH {
  75.     my ($self, $errname) = @_;
  76.     my $proto = prototype("Errno::$errname");
  77.     if (defined($proto) && $proto eq "") {
  78.     no strict 'refs';
  79.         return $! == &$errname;
  80.     }
  81.     require Carp;
  82.     Carp::confess("No errno $errname");
  83.  
  84. sub STORE {
  85.     require Carp;
  86.     Carp::confess("ERRNO hash is read only!");
  87. }
  88.  
  89. *CLEAR = \&STORE;
  90. *DELETE = \&STORE;
  91.  
  92. sub NEXTKEY {
  93.     my($k,$v);
  94.     while(($k,$v) = each %Errno::) {
  95.     my $proto = prototype("Errno::$k");
  96.     last if (defined($proto) && $proto eq "");
  97.     
  98.     }
  99.     $k
  100. }
  101.  
  102. sub FIRSTKEY {
  103.     my $s = scalar keys %Errno::;
  104.     goto &NEXTKEY;
  105. }
  106.  
  107. sub EXISTS {
  108.     my ($self, $errname) = @_;
  109.     my $proto = prototype($errname);
  110.     defined($proto) && $proto eq "";
  111. }
  112.  
  113. tie %!, __PACKAGE__;
  114.  
  115. 1;
  116. __END__
  117.  
  118. =head1 NAME
  119.  
  120. Errno - System errno constants
  121.  
  122. =head1 SYNOPSIS
  123.  
  124.     use Errno qw(EINTR EIO :POSIX);
  125.  
  126. =head1 DESCRIPTION
  127.  
  128. C<Errno> defines and conditionally exports all the error constants
  129. defined in your system C<errno.h> include file. It has a single export
  130. tag, C<:POSIX>, which will export all POSIX defined error numbers.
  131.  
  132. C<Errno> also makes C<%!> magic such that each element of C<%!> has a non-zero
  133. value only if C<$!> is set to that value, eg
  134.  
  135.     use Errno;
  136.     
  137.     unless (open(FH, "/fangorn/spouse")) {
  138.         if ($!{ENOENT}) {
  139.             warn "Get a wife!\n";
  140.         } else {
  141.             warn "This path is barred: $!";
  142.         } 
  143.     } 
  144.  
  145. =head1 AUTHOR
  146.  
  147. Graham Barr <gbarr@pobox.com>
  148.  
  149. =head1 COPYRIGHT
  150.  
  151. Copyright (c) 1997-8 Graham Barr. All rights reserved.
  152. This program is free software; you can redistribute it and/or modify it
  153. under the same terms as Perl itself.
  154.  
  155. =cut
  156.  
  157.