In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/67aeb789549061db20a014b38255a83cef779fef?hp=419d89744c528882284e8c1f6db945501a4ca7b6>
- Log ----------------------------------------------------------------- commit 67aeb789549061db20a014b38255a83cef779fef Author: Father Chrysostomos <[email protected]> Date: Sat Mar 12 12:56:12 2011 -0800 perlunicode: double space M pod/perlunicode.pod commit ed0d1802ce3cc63f60a6de522c13210091d6bc6b Author: David Leadbeater <[email protected]> Date: Tue Mar 8 21:49:54 2011 +0000 Switch Storable to IO::File from FileHandle, only load if needed On blead IO::File would be autoloaded but can't rely on this as Storable is dual life. M dist/Storable/Storable.pm commit 1541ec63cc0fc67dec1359c36eb41355ba46aef2 Author: David Leadbeater <[email protected]> Date: Tue Mar 8 21:45:48 2011 +0000 Stop using AutoLoader in Storable Storable isn't that large by today's standards; using AutoLoader doesn't make much sense now. Although barely significant this shaves about 1% off the execution time of the tests on my machine. M dist/Storable/Storable.pm commit 71a4863636f7f084c39fe81ade983a3016fee61f Author: David Leadbeater <[email protected]> Date: Tue Mar 8 21:41:51 2011 +0000 Switch Storable to XSLoader from DynaLoader M dist/Storable/Storable.pm ----------------------------------------------------------------------- Summary of changes: dist/Storable/Storable.pm | 59 ++++++++++++++++++++------------------------ pod/perlunicode.pod | 2 +- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/dist/Storable/Storable.pm b/dist/Storable/Storable.pm index 6954613..44b85db 100644 --- a/dist/Storable/Storable.pm +++ b/dist/Storable/Storable.pm @@ -5,9 +5,9 @@ # in the README file that comes with the distribution. # -require DynaLoader; +require XSLoader; require Exporter; -package Storable; @ISA = qw(Exporter DynaLoader); +package Storable; @ISA = qw(Exporter); @EXPORT = qw(store retrieve); @EXPORT_OK = qw( @@ -19,23 +19,30 @@ package Storable; @ISA = qw(Exporter DynaLoader); file_magic read_magic ); -use AutoLoader; -use FileHandle; use vars qw($canonical $forgive_me $VERSION); -$VERSION = '2.26'; -*AUTOLOAD = \&AutoLoader::AUTOLOAD; # Grrr... +$VERSION = '2.27'; -# -# Use of Log::Agent is optional -# +BEGIN { + if (eval { local $SIG{__DIE__}; require Log::Agent; 1 }) { + Log::Agent->import; + } + # + # Use of Log::Agent is optional. If it hasn't imported these subs then + # provide a fallback implementation. + # + else { + require Carp; -{ - local $SIG{__DIE__}; - eval "use Log::Agent"; -} + *logcroak = sub { + Carp::croak(@_); + }; -require Carp; + *logcarp = sub { + Carp::carp(@_); + }; + } +} # # They might miss :flock in Fcntl @@ -57,28 +64,12 @@ sub CLONE { Storable::init_perinterp(); } -# Can't Autoload cleanly as this clashes 8.3 with &retrieve -sub retrieve_fd { &fd_retrieve } # Backward compatibility - # By default restricted hashes are downgraded on earlier perls. $Storable::downgrade_restricted = 1; $Storable::accept_future_minor = 1; -bootstrap Storable; -1; -__END__ -# -# Use of Log::Agent is optional. If it hasn't imported these subs then -# Autoloader will kindly supply our fallback implementation. -# - -sub logcroak { - Carp::croak(@_); -} -sub logcarp { - Carp::carp(@_); -} +XSLoader::load 'Storable', $Storable::VERSION; # # Determine whether locking is possible, but only when needed. @@ -116,8 +107,10 @@ EOM } sub file_magic { + require IO::File; + my $file = shift; - my $fh = new FileHandle; + my $fh = IO::File->new; open($fh, "<". $file) || die "Can't open '$file': $!"; binmode($fh); defined(sysread($fh, my $buf, 32)) || die "Can't read from '$file': $!"; @@ -407,6 +400,8 @@ sub fd_retrieve { return $self; } +sub retrieve_fd { &fd_retrieve } # Backward compatibility + # # thaw # diff --git a/pod/perlunicode.pod b/pod/perlunicode.pod index 97ac89e..15f27f1 100644 --- a/pod/perlunicode.pod +++ b/pod/perlunicode.pod @@ -801,7 +801,7 @@ the value of the flag, and one set of values will immutably be in effect for all case-sensitive matches; the other set for all case-insensitive matches. -Note that if the regular expression is tainted, then perl will die rather +Note that if the regular expression is tainted, then perl will die rather than calling the subroutine, where the name of the subroutine is determined by the tainted data. -- Perl5 Master Repository
