r54016 - in /branches/upstream/libfreezethaw-perl/current: Changes FreezeThaw.pm META.yml t/FreezeThaw.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Wed Mar 10 01:12:39 UTC 2010
Author: jawnsy-guest
Date: Wed Mar 10 01:12:32 2010
New Revision: 54016
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54016
Log:
[svn-upgrade] Integrating new upstream version, libfreezethaw-perl (0.50)
Modified:
branches/upstream/libfreezethaw-perl/current/Changes
branches/upstream/libfreezethaw-perl/current/FreezeThaw.pm
branches/upstream/libfreezethaw-perl/current/META.yml
branches/upstream/libfreezethaw-perl/current/t/FreezeThaw.t
Modified: branches/upstream/libfreezethaw-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfreezethaw-perl/current/Changes?rev=54016&op=diff
==============================================================================
--- branches/upstream/libfreezethaw-perl/current/Changes (original)
+++ branches/upstream/libfreezethaw-perl/current/Changes Wed Mar 10 01:12:32 2010
@@ -30,3 +30,7 @@
Version 0.45:
Maxpointer decimal width was wrongly calculated on 64bit machines with
narrow NVs.
+Version 0.5
+ Support RExes of 5.11 and later (XXXX but not yet reblessed ones...)
+ (prototype by Andreas Koenig)
+
Modified: branches/upstream/libfreezethaw-perl/current/FreezeThaw.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfreezethaw-perl/current/FreezeThaw.pm?rev=54016&op=diff
==============================================================================
--- branches/upstream/libfreezethaw-perl/current/FreezeThaw.pm (original)
+++ branches/upstream/libfreezethaw-perl/current/FreezeThaw.pm Wed Mar 10 01:12:32 2010
@@ -285,7 +285,7 @@
use Exporter;
@ISA = qw(Exporter);
-$VERSION = '0.45';
+$VERSION = '0.50';
@EXPORT_OK = qw(freeze thaw cmpStr cmpStrHard safeFreeze);
use strict;
@@ -309,6 +309,17 @@
qw( $uninitOK ), # Localized in thawScalar()
qw( @uninit ), # Localized in thaw()
qw($safe); # Localized in safeFreeze()
+
+BEGIN { # allow optimization away
+ my $haveIsRex = defined &re::is_regexp;
+ my $RexIsREGEXP = ($haveIsRex and 'REGEXP' eq ref qr/1/); # First-class REX
+ eval <<EOE or die;
+sub haveIsRex () {$haveIsRex}
+sub RexIsREGEXP () {$RexIsREGEXP}
+1
+EOE
+}
+
my (%saved);
my %Empty = ( ARRAY => sub {[]}, HASH => sub {{}},
@@ -316,7 +327,9 @@
REF => sub {my $undef; \$undef},
CODE => 1, # 1 means atomic
GLOB => 1,
- Regexp => 0,
+ (RexIsREGEXP
+ ? (REGEXP => sub {my $qr = qr//})
+ : (Regexp => 0)),
);
# This should better be done via pos() and \G, but apparently \G is not
@@ -370,7 +383,7 @@
}
sub _2rex ($);
-if (eval '"Regexp" eq ref qr/1/') {
+if (eval 'ref qr/1/') {
eval 'sub _2rex ($) {my $r = shift; qr/$r/} 1' or die;
} else {
eval 'sub _2rex ($) { shift } 1' or die;
@@ -462,7 +475,8 @@
}
return &freezeArray if $ref eq 'ARRAY';
return &freezeHash if $ref eq 'HASH';
- return &freezeREx if $ref eq 'Regexp' and not defined ${$_[0]};
+ return &freezeREx if haveIsRex ? re::is_regexp($_[0])
+ : ($ref eq 'Regexp' and not defined ${$_[0]});
$string .= "*", return &freezeString
if $ref eq 'GLOB' and !$safe;
$string .= "&", return &freezeString
@@ -653,6 +667,9 @@
@$first = @$second;
} elsif ($ref eq 'HASH') {
%$first = %$second;
+ } elsif (haveIsRex ? re::is_regexp($second)
+ : ($ref eq 'Regexp' and not defined $$second)) {
+ $first = qr/$second/;
} else {
croak "Don't know how to copyContents of type `$ref'";
}
@@ -830,13 +847,15 @@
sub UNIVERSAL::FreezeInstance {
my($obj,$cooky) = @_;
- return if (ref $obj and ref $obj eq 'Regexp' and not defined $$obj); # Regexp
+ return if !RexIsREGEXP # Special-case non-1st-class RExes
+ and ref $obj and (haveIsRex ? re::is_regexp($obj)
+ : (ref $obj eq 'Regexp' and not defined $$obj)); # Regexp
$obj->Freeze($cooky);
}
sub UNIVERSAL::Instantiate {
my($package,$pre,$cooky) = @_;
- return if $package eq 'Regexp';
+ return if !RexIsREGEXP and $package eq 'Regexp';
my $obj = $package->Thaw($cooky);
# SvAMAGIC() is a property of a reference, not of a referent!
# Thus we cannot use $pre here if $obj was overloaded...
@@ -859,7 +878,7 @@
} elsif ($e) {
freezeScalar($obj,1,1); # Atomic
undef;
- } elsif (defined $e and not defined $$obj) { # Regexp
+ } elsif (!RexIsREGEXP and defined $e and not defined $$obj) { # REx pre-5.11
freezeREx($obj);
undef;
} else {
Modified: branches/upstream/libfreezethaw-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfreezethaw-perl/current/META.yml?rev=54016&op=diff
==============================================================================
--- branches/upstream/libfreezethaw-perl/current/META.yml (original)
+++ branches/upstream/libfreezethaw-perl/current/META.yml Wed Mar 10 01:12:32 2010
@@ -1,10 +1,21 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: FreezeThaw
-version: 0.45
-version_from: FreezeThaw.pm
-installdirs: site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+--- #YAML:1.0
+name: FreezeThaw
+version: 0.50
+abstract: ~
+author:
+ - Ilya Zakharevich <ilyaz at cpan.org>
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
+requires: {}
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.54
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: branches/upstream/libfreezethaw-perl/current/t/FreezeThaw.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfreezethaw-perl/current/t/FreezeThaw.t?rev=54016&op=diff
==============================================================================
--- branches/upstream/libfreezethaw-perl/current/t/FreezeThaw.t (original)
+++ branches/upstream/libfreezethaw-perl/current/t/FreezeThaw.t Wed Mar 10 01:12:32 2010
@@ -210,7 +210,7 @@
090230047702789306640625 \Z /x;
print "ok 27\n";
-if (eval '"Regexp" eq ref qr/1/') { # Have qr//
+if (eval 'ref qr/1/') { # Have qr//
eval <<'EOE';
my $rex = qr/^abc/mi;
my $f = freeze [$rex, $rex, 11];
More information about the Pkg-perl-cvs-commits
mailing list