r11605 - in /branches/upstream/libclass-mop-perl/current: Changes META.yml README lib/Class/MOP.pm lib/Class/MOP/Attribute.pm lib/Class/MOP/Class.pm lib/Class/MOP/Immutable.pm t/073_make_mutable.t

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Tue Dec 25 22:13:41 UTC 2007


Author: gregoa-guest
Date: Tue Dec 25 22:13:40 2007
New Revision: 11605

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

Modified:
    branches/upstream/libclass-mop-perl/current/Changes
    branches/upstream/libclass-mop-perl/current/META.yml
    branches/upstream/libclass-mop-perl/current/README
    branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm
    branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm
    branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm
    branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Immutable.pm
    branches/upstream/libclass-mop-perl/current/t/073_make_mutable.t

Modified: branches/upstream/libclass-mop-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-mop-perl/current/Changes?rev=11605&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/Changes (original)
+++ branches/upstream/libclass-mop-perl/current/Changes Tue Dec 25 22:13:40 2007
@@ -1,7 +1,20 @@
 Revision history for Perl extension Class-MOP.
 
+0.50 Fri. Dec. 21, 2007
+    * Class::MOP::Class
+      - fixed bug in immutable to make sure that 
+        transformation arguments are saved 
+        correctly (mst)
+        - added tests for this
+        
+    * Class::MOP::Immutable
+      - fixed a bug (see above)
+      
+    * Class::MOP::Attribute
+      - some doc updates
+
 0.49 Fri. Dec. 14, 2007
-    !! Class::MOP now loads ~45% faster !!
+    !! Class::MOP now loads 2 x faster  !!
     !! with XS speedups (thanks konobi) !!
         
     * Class::MOP

Modified: branches/upstream/libclass-mop-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-mop-perl/current/META.yml?rev=11605&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/META.yml (original)
+++ branches/upstream/libclass-mop-perl/current/META.yml Tue Dec 25 22:13:40 2007
@@ -20,16 +20,16 @@
 provides: 
   Class::MOP: 
     file: lib/Class/MOP.pm
-    version: 0.49
+    version: 0.50
   Class::MOP::Attribute: 
     file: lib/Class/MOP/Attribute.pm
-    version: 0.20
+    version: 0.21
   Class::MOP::Class: 
     file: lib/Class/MOP/Class.pm
     version: 0.25
   Class::MOP::Immutable: 
     file: lib/Class/MOP/Immutable.pm
-    version: 0.02
+    version: 0.03
   Class::MOP::Instance: 
     file: lib/Class/MOP/Instance.pm
     version: 0.03
@@ -64,4 +64,4 @@
   Carp: 0
   Scalar::Util: 1.18
   Sub::Name: 0.02
-version: 0.49
+version: 0.50

Modified: branches/upstream/libclass-mop-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-mop-perl/current/README?rev=11605&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/README (original)
+++ branches/upstream/libclass-mop-perl/current/README Tue Dec 25 22:13:40 2007
@@ -1,4 +1,4 @@
-Class::MOP version 0.49
+Class::MOP version 0.50
 ===========================
 
 See the individual module documentation for more information

Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm?rev=11605&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm Tue Dec 25 22:13:40 2007
@@ -14,7 +14,7 @@
 use Class::MOP::Immutable;
 
 BEGIN {
-    our $VERSION   = '0.49';
+    our $VERSION   = '0.50';
     our $AUTHORITY = 'cpan:STEVAN';    
     
     use XSLoader;

Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm?rev=11605&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm Tue Dec 25 22:13:40 2007
@@ -9,7 +9,7 @@
 use Carp         'confess';
 use Scalar::Util 'blessed', 'reftype', 'weaken';
 
-our $VERSION   = '0.20';
+our $VERSION   = '0.21';
 our $AUTHORITY = 'cpan:STEVAN';
 
 use base 'Class::MOP::Object';
@@ -534,7 +534,7 @@
 
 =item B<has_value ($instance)>
 
-Returns a boolean indicating if the item in the C<$instance> has a value in it.
+Return a boolean indicating if the item in the C<$instance> has a value in it.
 This is basically what the default C<predicate> method calls.
 
 =item B<clear_value ($instance)>
@@ -570,13 +570,15 @@
 
 =item B<default (?$instance)>
 
-As noted in the documentation for C<new> above, if the I<default>
-value is a CODE reference, this accessor will pass a single additional
-argument C<$instance> into it and return the value.
+Return the default value for the attribute.
+
+If you pass in an C<$instance> argument to this accessor and the
+I<default> is a CODE reference, then the CODE reference will be
+executed with the C<$instance> as its argument.
 
 =item B<slots>
 
-Returns a list of slots required by the attribute. This is usually
+Return a list of slots required by the attribute. This is usually
 just one, which is the name of the attribute.
 
 =item B<get_read_method>

Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm?rev=11605&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm Tue Dec 25 22:13:40 2007
@@ -808,7 +808,7 @@
         $IMMUTABLE_TRANSFORMERS{$class} ||= $self->create_immutable_transformer;
         my $transformer = $IMMUTABLE_TRANSFORMERS{$class};
 
-        $transformer->make_metaclass_immutable($self, %options);
+        $transformer->make_metaclass_immutable($self, \%options);
         $IMMUTABLE_OPTIONS{$self->name} =
             { %options,  IMMUTABLE_TRANSFORMER => $transformer };
 
@@ -824,7 +824,7 @@
         my $options = delete $IMMUTABLE_OPTIONS{$self->name};
         confess "unable to find immutabilizing options" unless ref $options;
         my $transformer = delete $options->{IMMUTABLE_TRANSFORMER};
-        $transformer->make_metaclass_mutable($self, %$options);
+        $transformer->make_metaclass_mutable($self, $options);
     }
 }
 

Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Immutable.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Immutable.pm?rev=11605&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Immutable.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Immutable.pm Tue Dec 25 22:13:40 2007
@@ -9,7 +9,7 @@
 use Carp         'confess';
 use Scalar::Util 'blessed';
 
-our $VERSION   = '0.02';
+our $VERSION   = '0.03';
 our $AUTHORITY = 'cpan:STEVAN';
 
 sub new {
@@ -69,13 +69,19 @@
 # existing metaclass to an immutable
 # version of itself
 sub make_metaclass_immutable {
-    my ($self, $metaclass, %options) = @_;
-
-    $options{inline_accessors}   = 1     unless exists $options{inline_accessors};
-    $options{inline_constructor} = 1     unless exists $options{inline_constructor};
-    $options{inline_destructor}  = 0     unless exists $options{inline_destructor};
-    $options{constructor_name}   = 'new' unless exists $options{constructor_name};
-    $options{debug}              = 0     unless exists $options{debug};
+    my ($self, $metaclass, $options) = @_;
+
+    foreach my $pair (
+            [ inline_accessors   => 1     ],
+            [ inline_constructor => 1     ],
+            [ inline_destructor  => 0     ],
+            [ constructor_name   => 'new' ],
+            [ debug              => 0     ],
+        ) {
+        $options->{$pair->[0]} = $pair->[1] unless exists $options->{$pair->[0]};
+    }
+
+    my %options = %$options;
 
     if ($options{inline_accessors}) {
         foreach my $attr_name ($metaclass->get_attribute_list) {
@@ -141,7 +147,9 @@
 }
 
 sub make_metaclass_mutable {
-    my ($self, $immutable, %options) = @_;
+    my ($self, $immutable, $options) = @_;
+
+    my %options = %$options;
 
     my $original_class = $immutable->get_mutable_metaclass_name;
     delete $immutable->{'___original_class'} ;
@@ -180,7 +188,6 @@
     # 14:26 <@stevan> the only user of ::Method::Constructor is immutable
     # 14:27 <@stevan> if someone uses it outside of immutable,.. they are either: mst or groditi
     # 14:27 <@stevan> so I am not worried
-    $options{constructor_name} = 'new' unless exists $options{constructor_name};
     if ($options{inline_constructor}) {
         my $constructor_class = $options{constructor_class} || 'Class::MOP::Method::Constructor';
         $immutable->remove_method( $options{constructor_name}  )

Modified: branches/upstream/libclass-mop-perl/current/t/073_make_mutable.t
URL: http://svn.debian.org/wsvn/branches/upstream/libclass-mop-perl/current/t/073_make_mutable.t?rev=11605&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/t/073_make_mutable.t (original)
+++ branches/upstream/libclass-mop-perl/current/t/073_make_mutable.t Tue Dec 25 22:13:40 2007
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 104;
+use Test::More tests => 108;
 use Test::Exception;
 
 use Scalar::Util;
@@ -51,11 +51,13 @@
     ok(!$meta->is_mutable,              '... our class is no longer mutable');
     ok($meta->is_immutable,             '... our class is now immutable');
     ok(!$meta->make_immutable,          '... make immutable now returns nothing');
+    ok($meta->get_method_map->{new},    '... inlined constructor created');
 
     lives_ok { $meta->make_mutable; }  '... changed Baz to be mutable';
     ok($meta->is_mutable,               '... our class is mutable');
     ok(!$meta->is_immutable,            '... our class is not immutable');
     ok(!$meta->make_mutable,            '... make mutable now returns nothing');
+    ok(!$meta->get_method_map->{new},   '... inlined constructor removed');
 
     my @new_keys = sort keys %$meta;
     is_deeply(\@orig_keys, \@new_keys, '... no straneous hashkeys');
@@ -88,6 +90,9 @@
     ok( $meta->$_  , "... ${_} works")
       for qw(get_meta_instance       compute_all_applicable_attributes
              class_precedence_list  get_method_map );
+
+    lives_ok {$meta->make_immutable; } '... changed Baz to be immutable again';
+    ok($meta->get_method_map->{new},    '... inlined constructor recreated');
 }
 
 {




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