r57108 - in /branches/upstream/libmouse-perl/current: ./ lib/ lib/Mouse/ lib/Mouse/Meta/ lib/Mouse/Meta/Method/ lib/Mouse/Meta/Role/ lib/Mouse/Util/ t/900_bug/ t/900_mouse_bugs/ xs-src/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Thu Apr 29 11:26:09 UTC 2010


Author: ansgar-guest
Date: Thu Apr 29 11:25:50 2010
New Revision: 57108

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

Added:
    branches/upstream/libmouse-perl/current/t/900_mouse_bugs/
    branches/upstream/libmouse-perl/current/t/900_mouse_bugs/001_immutable_types.t
    branches/upstream/libmouse-perl/current/t/900_mouse_bugs/002_does_role_should_search_parent.t
    branches/upstream/libmouse-perl/current/t/900_mouse_bugs/003_RT50421.t
    branches/upstream/libmouse-perl/current/t/900_mouse_bugs/004_RT54203.t   (with props)
    branches/upstream/libmouse-perl/current/t/900_mouse_bugs/005_large_int.t
    branches/upstream/libmouse-perl/current/t/900_mouse_bugs/006_RT69939.t
    branches/upstream/libmouse-perl/current/t/900_mouse_bugs/007_RT56523.t   (with props)
    branches/upstream/libmouse-perl/current/t/900_mouse_bugs/008_RT56837.t
Removed:
    branches/upstream/libmouse-perl/current/t/900_bug/
Modified:
    branches/upstream/libmouse-perl/current/Changes
    branches/upstream/libmouse-perl/current/MANIFEST
    branches/upstream/libmouse-perl/current/META.yml
    branches/upstream/libmouse-perl/current/lib/Mouse.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Exporter.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Attribute.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Class.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Accessor.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Constructor.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Delegation.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Destructor.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Module.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Composite.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Method.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Meta/TypeConstraint.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Object.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/PurePerl.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Role.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Spec.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Tiny.pod
    branches/upstream/libmouse-perl/current/lib/Mouse/Util.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/Util/TypeConstraints.pm
    branches/upstream/libmouse-perl/current/lib/Mouse/XS.pod
    branches/upstream/libmouse-perl/current/xs-src/Mouse.xs

Modified: branches/upstream/libmouse-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/Changes?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/Changes (original)
+++ branches/upstream/libmouse-perl/current/Changes Thu Apr 29 11:25:50 2010
@@ -1,7 +1,12 @@
 Revision history for Mouse
 
+0.56 Thu Apr 29 11:15:45 2010
+    [BUG FIX]
+    * Resolve RT#56837: Role application to instance with init_arg'd
+      attributes caused problems (Sanko Robinson)
+
 0.55 Wed Apr 21 13:27:13 2010
-    [BUF FIX]
+    [BUG FIX]
     * Fix a bug that traits could cause panic/SEGV on threads (gfx)
 
 0.54 Sat Apr 17 17:15:54 2010

Modified: branches/upstream/libmouse-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/MANIFEST?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/MANIFEST (original)
+++ branches/upstream/libmouse-perl/current/MANIFEST Thu Apr 29 11:25:50 2010
@@ -281,13 +281,14 @@
 t/810_with_moose/202-squirrel-role.t
 t/810_with_moose/500_moose_extends_mouse.t
 t/810_with_moose/501_moose_coerce_mouse.t
-t/900_bug/001_immutable_types.t
-t/900_bug/002_does_role_should_search_parent.t
-t/900_bug/003_RT50421.t
-t/900_bug/004_RT54203.t
-t/900_bug/005_large_int.t
-t/900_bug/006_RT69939.t
-t/900_bug/007_RT56523.t
+t/900_mouse_bugs/001_immutable_types.t
+t/900_mouse_bugs/002_does_role_should_search_parent.t
+t/900_mouse_bugs/003_RT50421.t
+t/900_mouse_bugs/004_RT54203.t
+t/900_mouse_bugs/005_large_int.t
+t/900_mouse_bugs/006_RT69939.t
+t/900_mouse_bugs/007_RT56523.t
+t/900_mouse_bugs/008_RT56837.t
 t/990_deprecated/001-export_to_level.t
 t/990_deprecated/044-attribute-metaclass.t
 t/990_deprecated/047-attribute-metaclass-role.t

Modified: branches/upstream/libmouse-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/META.yml?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/META.yml (original)
+++ branches/upstream/libmouse-perl/current/META.yml Thu Apr 29 11:25:50 2010
@@ -32,4 +32,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: git://git.moose.perl.org/Mouse.git
-version: 0.55
+version: 0.56

Modified: branches/upstream/libmouse-perl/current/lib/Mouse.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse.pm Thu Apr 29 11:25:50 2010
@@ -3,7 +3,7 @@
 
 use Mouse::Exporter; # enables strict and warnings
 
-our $VERSION = '0.55';
+our $VERSION = '0.56';
 
 use Carp         qw(confess);
 use Scalar::Util qw(blessed);
@@ -160,7 +160,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Exporter.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Exporter.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Exporter.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Exporter.pm Thu Apr 29 11:25:50 2010
@@ -272,7 +272,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Attribute.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Attribute.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Attribute.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Attribute.pm Thu Apr 29 11:25:50 2010
@@ -401,7 +401,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 METHODS
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Class.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Class.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Class.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Class.pm Thu Apr 29 11:25:50 2010
@@ -486,7 +486,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 METHODS
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method.pm Thu Apr 29 11:25:50 2010
@@ -54,7 +54,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Accessor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Accessor.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Accessor.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Accessor.pm Thu Apr 29 11:25:50 2010
@@ -182,7 +182,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Constructor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Constructor.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Constructor.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Constructor.pm Thu Apr 29 11:25:50 2010
@@ -235,7 +235,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Delegation.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Delegation.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Delegation.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Delegation.pm Thu Apr 29 11:25:50 2010
@@ -61,7 +61,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Destructor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Destructor.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Destructor.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Method/Destructor.pm Thu Apr 29 11:25:50 2010
@@ -55,7 +55,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Module.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Module.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Module.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Module.pm Thu Apr 29 11:25:50 2010
@@ -329,7 +329,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role.pm Thu Apr 29 11:25:50 2010
@@ -238,7 +238,7 @@
     if(defined $instance){ # Application::ToInstance
         # rebless instance
         bless $instance, $consumer->name;
-        $consumer->_initialize_object($instance, $instance);
+        $consumer->_initialize_object($instance, $instance, 1);
     }
 
     return;
@@ -312,7 +312,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Composite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Composite.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Composite.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Composite.pm Thu Apr 29 11:25:50 2010
@@ -125,7 +125,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Method.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Method.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Method.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/Role/Method.pm Thu Apr 29 11:25:50 2010
@@ -23,7 +23,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Meta/TypeConstraint.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Meta/TypeConstraint.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Meta/TypeConstraint.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Meta/TypeConstraint.pm Thu Apr 29 11:25:50 2010
@@ -236,7 +236,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Object.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Object.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Object.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Object.pm Thu Apr 29 11:25:50 2010
@@ -17,7 +17,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 METHODS
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/PurePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/PurePerl.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/PurePerl.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/PurePerl.pm Thu Apr 29 11:25:50 2010
@@ -298,9 +298,9 @@
                 push @triggers_queue, [ $attribute->trigger, $object->{$slot} ];
             }
         }
-        elsif(!$is_cloning) { # no init arg, noop while cloning
+        else { # no init arg
             if ($attribute->has_default || $attribute->has_builder) {
-                if (!$attribute->is_lazy) {
+                if (!$attribute->is_lazy && !exists $object->{$slot}) {
                     my $default = $attribute->default;
                     my $builder = $attribute->builder;
                     my $value =   $builder                ? $object->$builder()
@@ -313,7 +313,7 @@
                         if ref($object->{$slot}) && $attribute->is_weak_ref;
                 }
             }
-            elsif($attribute->is_required) {
+            elsif(!$is_cloning && $attribute->is_required) {
                 $self->throw_error("Attribute (".$attribute->name.") is required");
             }
         }
@@ -720,7 +720,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SEE ALSO
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Role.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Role.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Role.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Role.pm Thu Apr 29 11:25:50 2010
@@ -1,7 +1,7 @@
 package Mouse::Role;
 use Mouse::Exporter; # enables strict and warnings
 
-our $VERSION = '0.55';
+our $VERSION = '0.56';
 
 use Carp         qw(confess);
 use Scalar::Util qw(blessed);
@@ -145,7 +145,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Spec.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Spec.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Spec.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Spec.pm Thu Apr 29 11:25:50 2010
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.55';
+our $VERSION = '0.56';
 
 our $MouseVersion = $VERSION;
 our $MooseVersion = '0.93';
@@ -19,7 +19,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Tiny.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Tiny.pod?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Tiny.pod (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Tiny.pod Thu Apr 29 11:25:50 2010
@@ -5,7 +5,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Util.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Util.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Util.pm Thu Apr 29 11:25:50 2010
@@ -52,7 +52,7 @@
     # Because Mouse::Util is loaded first in all the Mouse sub-modules,
     # XS loader is placed here, not in Mouse.pm.
 
-    our $VERSION = '0.55';
+    our $VERSION = '0.56';
 
     my $xs = !(exists $INC{'Mouse/PurePerl.pm'} || $ENV{MOUSE_PUREPERL});
 
@@ -365,7 +365,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 IMPLEMENTATIONS FOR
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/Util/TypeConstraints.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/Util/TypeConstraints.pm?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/Util/TypeConstraints.pm (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/Util/TypeConstraints.pm Thu Apr 29 11:25:50 2010
@@ -406,7 +406,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head2 SYNOPSIS
 

Modified: branches/upstream/libmouse-perl/current/lib/Mouse/XS.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/lib/Mouse/XS.pod?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/lib/Mouse/XS.pod (original)
+++ branches/upstream/libmouse-perl/current/lib/Mouse/XS.pod Thu Apr 29 11:25:50 2010
@@ -5,7 +5,7 @@
 
 =head1 VERSION
 
-This document describes Mouse version 0.55
+This document describes Mouse version 0.56
 
 =head1 DESCRIPTION
 

Added: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/001_immutable_types.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/t/900_mouse_bugs/001_immutable_types.t?rev=57108&op=file
==============================================================================
--- branches/upstream/libmouse-perl/current/t/900_mouse_bugs/001_immutable_types.t (added)
+++ branches/upstream/libmouse-perl/current/t/900_mouse_bugs/001_immutable_types.t Thu Apr 29 11:25:50 2010
@@ -1,0 +1,67 @@
+use strict;
+use warnings;
+use Test::More tests => 4;
+use Mouse::Util::TypeConstraints;
+
+subtype 'Foo', as 'Object', where { $_->isa('A') };
+
+{
+    package A;
+    use Mouse;
+    has data => ( is => 'rw', isa => 'Str' );
+}
+
+{
+    package C;
+    use Mouse;
+    has a => ( is => 'rw', isa => 'Foo', coerce => 1 );
+}
+
+isa_ok(C->new(a => A->new()), 'C');
+C->meta->make_immutable;
+isa_ok(C->new(a => A->new()), 'C');
+
+
+
+# The BUILD invocation order used to get reversed after
+# making a class immutable.  This checks it is correct.
+{
+    package D;
+    use Mouse;
+
+    # we'll keep
+    has order => 
+        (is => 'ro', 
+         default => sub {[]});
+
+    sub BUILD { push @{shift->order}, 'D' }
+
+    package E;
+    use Mouse;
+    extends 'D';
+
+    sub BUILD { push @{shift->order}, 'E' }
+
+    package F;
+    use Mouse;
+    extends 'E';
+
+    sub BUILD { push @{shift->order}, 'F' }
+
+
+}
+
+my $obj = F->new;
+
+print join(", ", @{$obj->order}),"\n";
+is_deeply $obj->order, [qw(D E F)], "mutable BUILD invocation order correct";
+
+# now make the classes immutable
+$_->meta->make_immutable for qw(D E F);
+
+my $obj2 = F->new;
+
+print join(", ", @{$obj2->order}),"\n";
+is_deeply $obj2->order, [qw(D E F)], "immutable BUILD invocation order still correct";
+
+

Added: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/002_does_role_should_search_parent.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/t/900_mouse_bugs/002_does_role_should_search_parent.t?rev=57108&op=file
==============================================================================
--- branches/upstream/libmouse-perl/current/t/900_mouse_bugs/002_does_role_should_search_parent.t (added)
+++ branches/upstream/libmouse-perl/current/t/900_mouse_bugs/002_does_role_should_search_parent.t Thu Apr 29 11:25:50 2010
@@ -1,0 +1,26 @@
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+# Klass->does_role should check the parent classes.
+
+{
+    package R1;
+    use Mouse::Role;
+}
+
+{
+    package C1;
+    use Mouse;
+    with 'R1';
+}
+
+{
+    package C2;
+    use Mouse;
+    extends 'C1';
+}
+
+ok(C1->meta->does_role('R1'));
+ok(C2->meta->does_role('R1'));
+

Added: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/003_RT50421.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/t/900_mouse_bugs/003_RT50421.t?rev=57108&op=file
==============================================================================
--- branches/upstream/libmouse-perl/current/t/900_mouse_bugs/003_RT50421.t (added)
+++ branches/upstream/libmouse-perl/current/t/900_mouse_bugs/003_RT50421.t Thu Apr 29 11:25:50 2010
@@ -1,0 +1,42 @@
+#!/usr/bin/perl -w
+use Test;
+
+plan tests => 3;
+
+{
+    package Class;
+    sub new {}
+}
+
+{
+    package MouseClass;
+    use Mouse;
+}
+
+
+{
+    package Foo;
+
+    use Mouse;
+
+    has unknown => (
+        is  => 'rw',
+        isa => 'HashRef[Unknown]'
+    );
+
+    has class   => (
+        is      => 'rw',
+        isa     => 'HashRef[Class]',
+    );
+
+    has mouse   => (
+        is      => 'rw',
+        isa     => 'HashRef[MouseClass]',
+    );
+}
+
+
+my $obj = Foo->new;
+ok eval { $obj->unknown({}); };
+ok eval { $obj->class({}); };
+ok eval { $obj->mouse({}); };

Added: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/004_RT54203.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/t/900_mouse_bugs/004_RT54203.t?rev=57108&op=file
==============================================================================
--- branches/upstream/libmouse-perl/current/t/900_mouse_bugs/004_RT54203.t (added)
+++ branches/upstream/libmouse-perl/current/t/900_mouse_bugs/004_RT54203.t Thu Apr 29 11:25:50 2010
@@ -1,0 +1,33 @@
+#!/usr/bin/env perl
+# originally mouse_bad.pl, reported by chocolateboy (RT #54203)
+
+use constant HAS_PATH_CLASS => eval{ require Path::Class };
+use Test::More HAS_PATH_CLASS ? (tests => 4) : (skip_all => 'Testing with Path::Class');
+
+package MyClass;
+
+use Mouse;
+use Path::Class qw(file);
+
+has path => (
+    is  => 'rw',
+    isa => 'Str',
+);
+
+sub BUILD {
+    my $self = shift;
+    my $path1 = file($0)->stringify;
+    ::ok(defined $path1, 'file($0)->stringify');
+
+    $self->path(file($0)->stringify);
+    my $path2 = $self->path();
+    ::ok(defined $path2, '$self->path(file($0)->stringify)');
+
+    my $path3 = $self->path(file($0)->stringify);
+    ::ok(defined $path3, 'my $path3 = $self->path(file($0)->stringify)');
+}
+
+package main;
+
+my $object = MyClass->new();
+ok defined($object->path);

Propchange: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/004_RT54203.t
------------------------------------------------------------------------------
    svn:executable = *

Added: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/005_large_int.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/t/900_mouse_bugs/005_large_int.t?rev=57108&op=file
==============================================================================
--- branches/upstream/libmouse-perl/current/t/900_mouse_bugs/005_large_int.t (added)
+++ branches/upstream/libmouse-perl/current/t/900_mouse_bugs/005_large_int.t Thu Apr 29 11:25:50 2010
@@ -1,0 +1,37 @@
+# See also http://rt.cpan.org/Public/Bug/Display.html?id=55048
+package MyInteger;
+use Mouse;
+
+has a_int => (
+    is => 'rw',
+    isa => 'Int',
+);
+
+has a_num => (
+    is => 'rw',
+    isa => 'Num',
+);
+
+package main;
+use Test::More tests => 24;
+
+foreach my $i(2**32, 2**40, 2**46) {
+    for my $sig(1, -1) {
+        my $value = $i * $sig;
+
+        my $int = MyInteger->new( a_int => $value )->a_int;
+        cmp_ok($int, '==', $value, "Mouse groked the Int $i");
+
+
+        my $num = MyInteger->new( a_num => $value )->a_num;
+        cmp_ok($num, '==', $value, "Mouse groked the Num $i");
+
+        $value += 0.5;
+
+        eval { MyInteger->new( a_int => $value ) };
+        like $@, qr/does not pass the type constraint/, "Mouse does not regard $value as Int";
+        eval { MyInteger->new( a_num => $value ) };
+        is $@, '', "Mouse regards $value as Num";
+    }
+}
+

Added: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/006_RT69939.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/t/900_mouse_bugs/006_RT69939.t?rev=57108&op=file
==============================================================================
--- branches/upstream/libmouse-perl/current/t/900_mouse_bugs/006_RT69939.t (added)
+++ branches/upstream/libmouse-perl/current/t/900_mouse_bugs/006_RT69939.t Thu Apr 29 11:25:50 2010
@@ -1,0 +1,38 @@
+#!perl -w
+
+package Foo;
+use Mouse;
+
+has bar => (
+    is => 'rw',
+
+    trigger => sub {
+        eval 'BEGIN{ die }';
+    },
+    default => sub {
+        eval 'BEGIN{ die }';
+        return 42;
+    },
+);
+
+sub BUILDARGS {
+    eval 'BEGIN{ die }';
+    return {};
+}
+
+sub BUILD {
+    eval 'BEGIN{ die }';
+}
+
+package main;
+
+use Test::More tests => 3;
+
+$@ = '(ERRSV)';
+
+my $foo = Foo->new;
+isa_ok $foo, 'Foo';
+is $foo->bar, 42;
+$foo->bar(100);
+is $foo->bar, 100;
+note("\$@=$@");

Added: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/007_RT56523.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/t/900_mouse_bugs/007_RT56523.t?rev=57108&op=file
==============================================================================
--- branches/upstream/libmouse-perl/current/t/900_mouse_bugs/007_RT56523.t (added)
+++ branches/upstream/libmouse-perl/current/t/900_mouse_bugs/007_RT56523.t Thu Apr 29 11:25:50 2010
@@ -1,0 +1,37 @@
+#!/usr/bin/perl
+use strict;
+use Test::More;
+#warn $Mouse::VERSION;
+{
+    package Foo;
+
+    use Mouse;
+
+    has thing => (
+        reader        => 'thing',
+        writer        => 'set_thing',
+        builder       => '_build_thing',
+        lazy          => 1,
+    );
+
+    sub _build_thing {
+        42;
+    }
+}
+
+# Get them set
+{
+    my $obj = Foo->new;
+    is $obj->thing, 42;
+    $obj->set_thing( 23 );
+    is $obj->thing, 23;
+}
+
+# Set then get
+{
+    my $obj = Foo->new;
+    $obj->set_thing(23);
+    is $obj->thing, 23;
+}
+
+done_testing();

Propchange: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/007_RT56523.t
------------------------------------------------------------------------------
    svn:executable = *

Added: branches/upstream/libmouse-perl/current/t/900_mouse_bugs/008_RT56837.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/t/900_mouse_bugs/008_RT56837.t?rev=57108&op=file
==============================================================================
--- branches/upstream/libmouse-perl/current/t/900_mouse_bugs/008_RT56837.t (added)
+++ branches/upstream/libmouse-perl/current/t/900_mouse_bugs/008_RT56837.t Thu Apr 29 11:25:50 2010
@@ -1,0 +1,28 @@
+#!perl
+# This test is contributed by Sanko Robinson.
+# https://rt.cpan.org/Public/Bug/Display.html?id=56837
+# "Role application to instance with init_arg'd attributes"
+use strict;
+use Test::More tests => 2;
+
+{
+    package Admin;
+    use Mouse::Role;
+    sub shutdown {1}
+}
+{
+    package User;
+    use Mouse;
+    has 'name' =>
+        (isa => 'Str', is => 'ro', init_arg => 'Name', required => 1);
+}
+
+package main;
+my $tim = User->new(Name => 'Tim');
+
+Admin->meta->apply($tim);
+
+ok($tim->can('shutdown'),
+    'The role was successfully composed at the object level');
+is($tim->name, 'Tim',
+    '... attribute with init_arg was re-initialized correctly');

Modified: branches/upstream/libmouse-perl/current/xs-src/Mouse.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmouse-perl/current/xs-src/Mouse.xs?rev=57108&op=diff
==============================================================================
--- branches/upstream/libmouse-perl/current/xs-src/Mouse.xs (original)
+++ branches/upstream/libmouse-perl/current/xs-src/Mouse.xs Thu Apr 29 11:25:50 2010
@@ -338,13 +338,15 @@
             }
             used++;
         }
-        else if(!is_cloning){ /* no init arg, noop while cloning */
+        else { /* no init arg */
             if(flags & (MOUSEf_ATTR_HAS_DEFAULT | MOUSEf_ATTR_HAS_BUILDER)){
-                if(!(flags & MOUSEf_ATTR_IS_LAZY)){
+                /* skip if the object has the slot (it occurs on cloning/reblessing) */
+                if(!(flags & MOUSEf_ATTR_IS_LAZY) && !has_slot(object, slot)){
                     mouse_xa_set_default(aTHX_ xa, object);
                 }
             }
-            else if(flags & MOUSEf_ATTR_IS_REQUIRED) {
+            /* don't check while cloning (or reblesseing) */
+            else if(!is_cloning && flags & MOUSEf_ATTR_IS_REQUIRED) {
                 mouse_throw_error(attr, NULL, "Attribute (%"SVf") is required", slot);
             }
         }




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