r21802 - in /branches/upstream/libspiffy-perl/current: Changes lib/Spiffy.pm t/field3.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Tue Jun 17 16:02:13 UTC 2008


Author: gregoa
Date: Tue Jun 17 16:02:13 2008
New Revision: 21802

URL: http://svn.debian.org/wsvn/?sc=1&rev=21802
Log:
[svn-upgrade] Integrating new upstream version, libspiffy-perl (0.30)

Modified:
    branches/upstream/libspiffy-perl/current/Changes
    branches/upstream/libspiffy-perl/current/lib/Spiffy.pm
    branches/upstream/libspiffy-perl/current/t/field3.t

Modified: branches/upstream/libspiffy-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libspiffy-perl/current/Changes?rev=21802&op=diff
==============================================================================
--- branches/upstream/libspiffy-perl/current/Changes (original)
+++ branches/upstream/libspiffy-perl/current/Changes Tue Jun 17 16:02:13 2008
@@ -1,3 +1,8 @@
+---
+version: 0.30
+date:    Sun Jan 29 12:18:02 PST 2006
+changes:
+- Use faster runtime code in `field`.
 ---
 version: 0.29
 date:    Thu Jan 19 08:12:06 PST 2006

Modified: branches/upstream/libspiffy-perl/current/lib/Spiffy.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libspiffy-perl/current/lib/Spiffy.pm?rev=21802&op=diff
==============================================================================
--- branches/upstream/libspiffy-perl/current/lib/Spiffy.pm (original)
+++ branches/upstream/libspiffy-perl/current/lib/Spiffy.pm Tue Jun 17 16:02:13 2008
@@ -4,7 +4,7 @@
 use warnings;
 use Carp;
 require Exporter;
-our $VERSION = '0.29';
+our $VERSION = '0.30';
 our @EXPORT = ();
 our @EXPORT_BASE = qw(field const stub super);
 our @EXPORT_OK = (@EXPORT_BASE, qw(id WWW XXX YYY ZZZ));
@@ -176,26 +176,26 @@
 
 my %code = ( 
     sub_start => 
-      "sub {\n  my \$self = shift;\n",
+      "sub {\n",
     set_default => 
-      "  \$self->{%s} = %s\n    unless exists \$self->{%s};\n",
+      "  \$_[0]->{%s} = %s\n    unless exists \$_[0]->{%s};\n",
     init =>
-      "  return \$self->{%s} = do { %s }\n" .
-      "    unless \@_ or defined \$self->{%s};\n",
+      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
+      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
     weak_init =>
       "  return do {\n" .
-      "    \$self->{%s} = do { %s };\n" .
-      "    Scalar::Util::weaken(\$self->{%s}) if ref \$self->{%s};\n" .
-      "    \$self->{%s};\n" .
-      "  } unless \@_ or defined \$self->{%s};\n",
+      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
+      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
+      "    \$_[0]->{%s};\n" .
+      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
     return_if_get => 
-      "  return \$self->{%s} unless \@_;\n",
+      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
     set => 
-      "  \$self->{%s} = shift;\n",
+      "  \$_[0]->{%s} = \$_[1];\n",
     weaken => 
-      "  Scalar::Util::weaken(\$self->{%s}) if ref \$self->{%s};\n",
+      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
     sub_end => 
-      "  return \$self->{%s};\n}\n",
+      "  return \$_[0]->{%s};\n}\n",
 );
 
 sub field {

Modified: branches/upstream/libspiffy-perl/current/t/field3.t
URL: http://svn.debian.org/wsvn/branches/upstream/libspiffy-perl/current/t/field3.t?rev=21802&op=diff
==============================================================================
--- branches/upstream/libspiffy-perl/current/t/field3.t (original)
+++ branches/upstream/libspiffy-perl/current/t/field3.t Tue Jun 17 16:02:13 2008
@@ -24,79 +24,72 @@
 
 __DATA__
 sub {
-  my $self = shift;
-  $self->{test1} = []
-    unless exists $self->{test1};
-  return $self->{test1} unless @_;
-  $self->{test1} = shift;
-  return $self->{test1};
+  $_[0]->{test1} = []
+    unless exists $_[0]->{test1};
+  return $_[0]->{test1} unless $#_ > 0;
+  $_[0]->{test1} = $_[1];
+  return $_[0]->{test1};
 }
 ...
 sub {
-  my $self = shift;
-  $self->{test2} = {}
-    unless exists $self->{test2};
-  return $self->{test2} unless @_;
-  $self->{test2} = shift;
-  return $self->{test2};
+  $_[0]->{test2} = {}
+    unless exists $_[0]->{test2};
+  return $_[0]->{test2} unless $#_ > 0;
+  $_[0]->{test2} = $_[1];
+  return $_[0]->{test2};
 }
 ...
 sub {
-  my $self = shift;
-  $self->{test3} = [
+  $_[0]->{test3} = [
           1,
           2,
           3,
           4
         ]
 
-    unless exists $self->{test3};
-  return $self->{test3} unless @_;
-  $self->{test3} = shift;
-  return $self->{test3};
+    unless exists $_[0]->{test3};
+  return $_[0]->{test3} unless $#_ > 0;
+  $_[0]->{test3} = $_[1];
+  return $_[0]->{test3};
 }
 ...
 sub {
-  my $self = shift;
-  $self->{test4} = {
+  $_[0]->{test4} = {
           '1' => 2,
           '3' => 4
         }
 
-    unless exists $self->{test4};
-  return $self->{test4} unless @_;
-  $self->{test4} = shift;
-  return $self->{test4};
+    unless exists $_[0]->{test4};
+  return $_[0]->{test4} unless $#_ > 0;
+  $_[0]->{test4} = $_[1];
+  return $_[0]->{test4};
 }
 ...
 sub {
-  my $self = shift;
-  $self->{test5} = '-weaken'
+  $_[0]->{test5} = '-weaken'
 
-    unless exists $self->{test5};
-  return $self->{test5} unless @_;
-  $self->{test5} = shift;
-  return $self->{test5};
+    unless exists $_[0]->{test5};
+  return $_[0]->{test5} unless $#_ > 0;
+  $_[0]->{test5} = $_[1];
+  return $_[0]->{test5};
 }
 ...
 sub {
-  my $self = shift;
-  return $self->{test6} = do { $self->setup(@_) }
-    unless @_ or defined $self->{test6};
-  return $self->{test6} unless @_;
-  $self->{test6} = shift;
-  return $self->{test6};
+  return $_[0]->{test6} = do { my $self = $_[0]; $self->setup(@_) }
+    unless $#_ > 0 or defined $_[0]->{test6};
+  return $_[0]->{test6} unless $#_ > 0;
+  $_[0]->{test6} = $_[1];
+  return $_[0]->{test6};
 }
 ...
 sub {
-  my $self = shift;
   return do {
-    $self->{test7} = do { $self->setup(@_) };
-    Scalar::Util::weaken($self->{test7}) if ref $self->{test7};
-    $self->{test7};
-  } unless @_ or defined $self->{test7};
-  return $self->{test7} unless @_;
-  $self->{test7} = shift;
-  Scalar::Util::weaken($self->{test7}) if ref $self->{test7};
-  return $self->{test7};
+    $_[0]->{test7} = do { my $self = $_[0]; $self->setup(@_) };
+    Scalar::Util::weaken($_[0]->{test7}) if ref $_[0]->{test7};
+    $_[0]->{test7};
+  } unless $#_ > 0 or defined $_[0]->{test7};
+  return $_[0]->{test7} unless $#_ > 0;
+  $_[0]->{test7} = $_[1];
+  Scalar::Util::weaken($_[0]->{test7}) if ref $_[0]->{test7};
+  return $_[0]->{test7};
 }




More information about the Pkg-perl-cvs-commits mailing list