messages are more portable (another way
would be to muck around with LC_MESSAGES).
Problem reported in
To: perl5-porters@perl.org
Subject: [ID
19990719.003] LC_MESSAGES breaks h2xs autoloaded constants on AIX 4.1.4
Message-Id: <
9907192239.AA44990@pcr8.pcr.com>
p4raw-id: //depot/cfgperl@3716
use strict;
use Carp;
+use Errno;
require Tie::Hash;
@DB_File::HASHINFO::ISA = qw(Tie::Hash);
($constname = $AUTOLOAD) =~ s/.*:://;
my $val = constant($constname, @_ ? $_[0] : 0);
if ($! != 0) {
- if ($! =~ /Invalid/) {
+ if ($!{EINVAL} || $! =~ /Invalid/) {
$AutoLoader::AUTOLOAD = $AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
}
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
+use Errno;
require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);
(my $constname = $AUTOLOAD) =~ s/.*:://;
my $val = constant($constname, 0);
if ($! != 0) {
- if ($! =~ /Invalid/) {
+ if ($!{EINVAL} || $! =~ /Invalid/) {
$AutoLoader::AUTOLOAD = $AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
}
use vars qw($VERSION @ISA @EXPORT $AUTOLOAD);
require Carp;
+use Errno;
require Tie::Hash;
require Exporter;
use AutoLoader;
($constname = $AUTOLOAD) =~ s/.*:://;
my $val = constant($constname, @_ ? $_[0] : 0);
if ($! != 0) {
- if ($! =~ /Invalid/) {
+ if ($!{EINVAL} || $! =~ /Invalid/) {
$AutoLoader::AUTOLOAD = $AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
}
use strict;
use Carp;
+use Errno;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD $JVM @JVM_ARGS $JAVALIB);
require Exporter;
($constname = $AUTOLOAD) =~ s/.*:://;
my $val = constant($constname, @_ ? $_[0] : 0);
if ($! != 0) {
- if ($! =~ /Invalid/) {
+ if ($!{EINVAL} || $! =~ /Invalid/) {
$AutoLoader::AUTOLOAD = $AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
}
use AutoLoader;
use Carp;
+ use Errno;
sub AUTOLOAD {
my $sub = $AUTOLOAD;
(my $constname = $sub) =~ s/.*:://;
my $val = constant($constname, @_ ? $_[0] : 0);
if ($! != 0) {
- if ($! =~ /Invalid/) {
+ if ($!{EINVAL} || $! =~ /Invalid/) {
$AutoLoader::AUTOLOAD = $sub;
goto &AutoLoader::AUTOLOAD;
}
use Cwd ();
use DirHandle;
use Exporter ();
+use Errno ();
use ExtUtils::MakeMaker (); # $SelfLoader::DEBUG=1;
use File::Basename ();
use File::Copy ();
}
my $fh;
unless ($fh = FileHandle->new(">$lockfile")) {
- if ($! =~ /Permission/) {
+ if ($!{EACCES} || $! =~ /Permission/) {
my $incc = $INC{'CPAN/Config.pm'};
my $myincc = MM->catfile($ENV{HOME},'.cpan','CPAN','MyConfig.pm');
$CPAN::Frontend->myprint(qq{
The remaining locale category, C<LC_MESSAGES> (possibly supplemented
by others in particular implementations) is not currently used by
-Perl--except possibly to affect the behavior of library functions called
-by extensions outside the standard Perl distribution.
+Perl--except possibly to affect the behavior of library functions
+called by extensions outside the standard Perl distribution and by the
+operating system and its utilities. Note especially that the string
+value of C<$!> and the error messages given by external utilities may
+be changed by C<LC_MESSAGES>. If you want to have portable error
+codes, use the Errno extension.
=head1 SECURITY
Specify a prefix which should be removed from the Perl function names, e.g., S<-p sec_rgy_>
This sets up the XS B<PREFIX> keyword and removes the prefix from functions that are
-autoloaded via the C<constant()> mechansim.
+autoloaded via the C<constant()> mechanism.
=item B<-s> I<sub1,sub2>
# will want Carp.
print PM <<'END';
use Carp;
+use Errno;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
END
}
croak "&$module::constant not defined" if \$constname eq 'constant';
my \$val = constant(\$constname, \@_ ? \$_[0] : 0);
if (\$! != 0) {
- if (\$! =~ /Invalid/) {
+ if (\$!{EINVAL} || \$! =~ /Invalid/) {
\$AutoLoader::AUTOLOAD = \$AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
}