r33071 - in /trunk/libmouse-perl: ./ debian/ lib/ lib/Mouse/ lib/Mouse/Meta/ lib/Mouse/Meta/Method/ lib/Mouse/Util/ t/ t/000-recipes/ t/030_roles/
ryan52-guest at users.alioth.debian.org
ryan52-guest at users.alioth.debian.org
Sun Apr 12 03:35:27 UTC 2009
Author: ryan52-guest
Date: Sun Apr 12 03:35:21 2009
New Revision: 33071
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=33071
Log:
New upstream release
Modified:
trunk/libmouse-perl/.gitignore
trunk/libmouse-perl/Changes
trunk/libmouse-perl/META.yml
trunk/libmouse-perl/debian/changelog
trunk/libmouse-perl/lib/Mouse.pm
trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm
trunk/libmouse-perl/lib/Mouse/Meta/Class.pm
trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm
trunk/libmouse-perl/lib/Mouse/Meta/Role.pm
trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm
trunk/libmouse-perl/lib/Mouse/Object.pm
trunk/libmouse-perl/lib/Mouse/Role.pm
trunk/libmouse-perl/lib/Mouse/Tiny.pm
trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm
trunk/libmouse-perl/t/000-recipes/002_schwartz_tutorial.t
trunk/libmouse-perl/t/028-subclass-attr.t
trunk/libmouse-perl/t/030_roles/003_apply_role.t
trunk/libmouse-perl/t/030_roles/019_build.t
trunk/libmouse-perl/t/031-clone.t
trunk/libmouse-perl/t/039-subtype.t
trunk/libmouse-perl/t/500_moose_extends_mouse.t
Modified: trunk/libmouse-perl/.gitignore
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/.gitignore?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/.gitignore (original)
+++ trunk/libmouse-perl/.gitignore Sun Apr 12 03:35:21 2009
@@ -10,3 +10,4 @@
lib/Mouse/Tiny.pm
*~
*.old
+xt/compatibility/
Modified: trunk/libmouse-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/Changes?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/Changes (original)
+++ trunk/libmouse-perl/Changes Sun Apr 12 03:35:21 2009
@@ -1,6 +1,25 @@
Revision history for Mouse
-0.20
+0.21 Sat Apr 11 13:52:11 2009
+ * clone_instance has been made private, like in Moose (tokuhirom)
+
+ * Fix method modifiers applying to the wrong class (gfuji)
+ reported by Heikki Lehvaslaiho in [rt.cpan.org #42992]
+
+ * Fix test failures when user does not have C::Method::Modifiers(::Fast)
+ installed (Joel Bernstein)
+
+ * use get_all_attributes instead of
+ compute_all_applicable_attributes (tokuhirom)
+
+ * fixed pod bug (tokuhirom)
+ reported by Ryan52 in [rt.cpan.org #44928]
+
+ * Parameterized type constraints can now have messages (tokuhirom)
+
+ * Added documentation about type constraints (Mark Stosberg)
+
+0.20 Thu Apr 9 20:22:33 2009
* Squirrel is now deprecated. Use Any::Moose instead (Sartak)
* To improve Moose compat, the third argument to trigger
Modified: trunk/libmouse-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/META.yml?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/META.yml (original)
+++ trunk/libmouse-perl/META.yml Sun Apr 12 03:35:21 2009
@@ -23,4 +23,4 @@
perl: 5.6.0
resources:
license: http://dev.perl.org/licenses/
-version: 0.20
+version: 0.21
Modified: trunk/libmouse-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/debian/changelog?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/debian/changelog (original)
+++ trunk/libmouse-perl/debian/changelog Sun Apr 12 03:35:21 2009
@@ -1,8 +1,9 @@
-libmouse-perl (0.20-2) UNRELEASED; urgency=low
+libmouse-perl (0.21-1) UNRELEASED; urgency=low
* remove patch, it's applied upstream
+ * New upstream release
- -- Ryan Niebur <ryanryan52 at gmail.com> Sat, 11 Apr 2009 09:37:32 -0700
+ -- Ryan Niebur <ryanryan52 at gmail.com> Sat, 11 Apr 2009 20:35:11 -0700
libmouse-perl (0.20-1) unstable; urgency=low
Modified: trunk/libmouse-perl/lib/Mouse.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse.pm (original)
+++ trunk/libmouse-perl/lib/Mouse.pm Sun Apr 12 03:35:21 2009
@@ -4,7 +4,7 @@
use 5.006;
use base 'Exporter';
-our $VERSION = '0.20';
+our $VERSION = '0.21';
use Carp 'confess';
use Scalar::Util 'blessed';
@@ -305,10 +305,16 @@
=item isa => TypeConstraint
-Provides basic type checking in the constructor and accessor. Basic types such
-as C<Int>, C<ArrayRef>, C<Defined> are supported. Any unknown type is taken to
-be a class check (e.g. isa => 'DateTime' would accept only L<DateTime>
-objects).
+Provides type checking in the constructor and accessor. The following types are
+supported. Any unknown type is taken to be a class check (e.g. isa =>
+'DateTime' would accept only L<DateTime> objects).
+
+ Any Item Bool Undef Defined Value Num Int Str ClassName
+ Ref ScalarRef ArrayRef HashRef CodeRef RegexpRef GlobRef
+ FileHandle Object
+
+For more documentation on type constraints, see L<Mouse::Util::TypeConstraints>.
+
=item required => 0|1
@@ -418,6 +424,12 @@
involves checking for the existence of C<$VERSION>, C<@ISA>, and any
locally-defined method.
+=head1 SOURCE CODE ACCESS
+
+We have a public git repo:
+
+ git clone git://jules.scsys.co.uk/gitmo/Mouse.git
+
=head1 AUTHORS
Shawn M Moore, C<< <sartak at gmail.com> >>
Modified: trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Attribute.pm Sun Apr 12 03:35:21 2009
@@ -236,9 +236,7 @@
sub verify_type_constraint_error {
my($self, $name, $value, $type) = @_;
- $type = ref($type) eq 'ARRAY' ? join '|', map { $_->name } @{ $type } : $type->name;
- my $display = defined($value) ? overload::StrVal($value) : 'undef';
- Carp::confess("Attribute ($name) does not pass the type constraint because: Validation failed for \'$type\' failed with value $display");
+ Carp::confess("Attribute ($name) does not pass the type constraint because: " . $type->get_message($value));
}
sub coerce_constraint { ## my($self, $value) = @_;
Modified: trunk/libmouse-perl/lib/Mouse/Meta/Class.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Class.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Class.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Class.pm Sun Apr 12 03:35:21 2009
@@ -459,7 +459,8 @@
=head2 clone_instance Instance, Parameters -> Instance
-Clones the given C<Instance> and sets any additional parameters.
+The clone_instance method has been made private.
+The public version is deprecated.
=cut
Modified: trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Method/Constructor.pm Sun Apr 12 03:35:21 2009
@@ -6,7 +6,7 @@
my ($class, $meta) = @_;
my $associated_metaclass_name = $meta->name;
- my @attrs = $meta->compute_all_applicable_attributes;
+ my @attrs = $meta->get_all_attributes;
my $buildall = $class->_generate_BUILDALL($meta);
my $buildargs = $class->_generate_BUILDARGS($meta);
my $processattrs = $class->_generate_processattrs($meta, \@attrs);
Modified: trunk/libmouse-perl/lib/Mouse/Meta/Role.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/Role.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/Role.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/Role.pm Sun Apr 12 03:35:21 2009
@@ -101,7 +101,7 @@
# XXX what's Moose's behavior?
#next;
} else {
- *$class_function = *$role_function;
+ *{$class_function} = \&{$role_function};
}
if ($args{alias} && $args{alias}->{$name}) {
my $dstname = $args{alias}->{$name};
Modified: trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Meta/TypeConstraint.pm Sun Apr 12 03:35:21 2009
@@ -14,7 +14,11 @@
$check = $check->{_compiled_type_constraint};
}
- bless +{ name => $name, _compiled_type_constraint => $check }, $class;
+ bless +{
+ name => $name,
+ _compiled_type_constraint => $check,
+ message => $args{message}
+ }, $class;
}
sub name { shift->{name} }
@@ -22,6 +26,25 @@
sub check {
my $self = shift;
$self->{_compiled_type_constraint}->(@_);
+}
+
+sub message {
+ return $_[0]->{message};
+}
+
+sub get_message {
+ my ($self, $value) = @_;
+ if ( my $msg = $self->message ) {
+ local $_ = $value;
+ return $msg->($value);
+ }
+ else {
+ $value = ( defined $value ? overload::StrVal($value) : 'undef' );
+ return
+ "Validation failed for '"
+ . $self->name
+ . "' failed with value $value";
+ }
}
1;
Modified: trunk/libmouse-perl/lib/Mouse/Object.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Object.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Object.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Object.pm Sun Apr 12 03:35:21 2009
@@ -12,7 +12,7 @@
my $instance = bless {}, $class;
- for my $attribute ($class->meta->compute_all_applicable_attributes) {
+ for my $attribute ($class->meta->get_all_attributes) {
my $from = $attribute->init_arg;
my $key = $attribute->name;
Modified: trunk/libmouse-perl/lib/Mouse/Role.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Role.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Role.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Role.pm Sun Apr 12 03:35:21 2009
@@ -163,6 +163,8 @@
Sets up an "around" method modifier. See L<Moose/around> or
L<Class::Method::Modifiers/around>.
+=over 4
+
=item B<super>
Sets up the "super" keyword. See L<Moose/super>.
@@ -178,6 +180,8 @@
=item B<augment ($name, &sub)>
This is not supported and emits an error. See L<Moose/Role>.
+
+=back
=head2 has (name|names) => parameters
Modified: trunk/libmouse-perl/lib/Mouse/Tiny.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Tiny.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Tiny.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Tiny.pm Sun Apr 12 03:35:21 2009
@@ -227,7 +227,7 @@
use 5.006;
use base 'Exporter';
-our $VERSION = '0.20';
+our $VERSION = '0.21';
use Carp 'confess';
use Scalar::Util 'blessed';
@@ -642,9 +642,7 @@
sub verify_type_constraint_error {
my($self, $name, $value, $type) = @_;
- $type = ref($type) eq 'ARRAY' ? join '|', map { $_->name } @{ $type } : $type->name;
- my $display = defined($value) ? overload::StrVal($value) : 'undef';
- Carp::confess("Attribute ($name) does not pass the type constraint because: Validation failed for \'$type\' failed with value $display");
+ Carp::confess("Attribute ($name) does not pass the type constraint because: " . $type->get_message($value));
}
sub coerce_constraint { ## my($self, $value) = @_;
@@ -1201,7 +1199,7 @@
my ($class, $meta) = @_;
my $associated_metaclass_name = $meta->name;
- my @attrs = $meta->compute_all_applicable_attributes;
+ my @attrs = $meta->get_all_attributes;
my $buildall = $class->_generate_BUILDALL($meta);
my $buildargs = $class->_generate_BUILDARGS($meta);
my $processattrs = $class->_generate_processattrs($meta, \@attrs);
@@ -1512,7 +1510,7 @@
# XXX what's Moose's behavior?
#next;
} else {
- *$class_function = *$role_function;
+ *{$class_function} = \&{$role_function};
}
if ($args{alias} && $args{alias}->{$name}) {
my $dstname = $args{alias}->{$name};
@@ -1729,7 +1727,11 @@
$check = $check->{_compiled_type_constraint};
}
- bless +{ name => $name, _compiled_type_constraint => $check }, $class;
+ bless +{
+ name => $name,
+ _compiled_type_constraint => $check,
+ message => $args{message}
+ }, $class;
}
sub name { shift->{name} }
@@ -1739,6 +1741,25 @@
$self->{_compiled_type_constraint}->(@_);
}
+sub message {
+ return $_[0]->{message};
+}
+
+sub get_message {
+ my ($self, $value) = @_;
+ if ( my $msg = $self->message ) {
+ local $_ = $value;
+ return $msg->($value);
+ }
+ else {
+ $value = ( defined $value ? overload::StrVal($value) : 'undef' );
+ return
+ "Validation failed for '"
+ . $self->name
+ . "' failed with value $value";
+ }
+}
+
package Mouse::Object;
use strict;
use warnings;
@@ -1753,7 +1774,7 @@
my $instance = bless {}, $class;
- for my $attribute ($class->meta->compute_all_applicable_attributes) {
+ for my $attribute ($class->meta->get_all_attributes) {
my $from = $attribute->init_arg;
my $key = $attribute->name;
@@ -2131,8 +2152,8 @@
if ($TYPE{$name} && $TYPE_SOURCE{$name} ne $pkg) {
Carp::croak "The type constraint '$name' has already been created in $TYPE_SOURCE{$name} and cannot be created again in $pkg";
};
- my $constraint = $conf{where};
- my $as_constraint = find_or_create_isa_type_constraint($conf{as} || 'Any');
+ my $constraint = delete $conf{where};
+ my $as_constraint = find_or_create_isa_type_constraint(delete $conf{as} || 'Any');
$TYPE_SOURCE{$name} = $pkg;
$TYPE{$name} = Mouse::Meta::TypeConstraint->new(
@@ -2148,6 +2169,7 @@
$as_constraint->check($_[0]);
}
),
+ %conf
);
return $name;
@@ -2360,7 +2382,7 @@
}; #eval
} #unless
-} # XXX: 2009-04-09 Sartak: no idea why I had to add this brace. Compile errors without it!
+} # XXX added manually
package Mouse::Tiny;
use base 'Mouse';
Modified: trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm (original)
+++ trunk/libmouse-perl/lib/Mouse/Util/TypeConstraints.pm Sun Apr 12 03:35:21 2009
@@ -109,8 +109,8 @@
if ($TYPE{$name} && $TYPE_SOURCE{$name} ne $pkg) {
Carp::croak "The type constraint '$name' has already been created in $TYPE_SOURCE{$name} and cannot be created again in $pkg";
};
- my $constraint = $conf{where};
- my $as_constraint = find_or_create_isa_type_constraint($conf{as} || 'Any');
+ my $constraint = delete $conf{where};
+ my $as_constraint = find_or_create_isa_type_constraint(delete $conf{as} || 'Any');
$TYPE_SOURCE{$name} = $pkg;
$TYPE{$name} = Mouse::Meta::TypeConstraint->new(
@@ -126,6 +126,7 @@
$as_constraint->check($_[0]);
}
),
+ %conf
);
return $name;
@@ -342,7 +343,165 @@
=head1 NAME
-Mouse::Util::TypeConstraints - simple type constraints
+Mouse::Util::TypeConstraints - Type constraint system for Mouse
+
+=head2 SYNOPSIS
+
+ use Mouse::Util::TypeConstraints;
+
+ subtype 'Natural'
+ => as 'Int'
+ => where { $_ > 0 };
+
+ subtype 'NaturalLessThanTen'
+ => as 'Natural'
+ => where { $_ < 10 }
+ => message { "This number ($_) is not less than ten!" };
+
+ coerce 'Num'
+ => from 'Str'
+ => via { 0+$_ };
+
+ enum 'RGBColors' => qw(red green blue);
+
+ no Mouse::Util::TypeConstraints;
+
+=head1 DESCRIPTION
+
+This module provides Mouse with the ability to create custom type
+constraints to be used in attribute definition.
+
+=head2 Important Caveat
+
+This is B<NOT> a type system for Perl 5. These are type constraints,
+and they are not used by Mouse unless you tell it to. No type
+inference is performed, expressions are not typed, etc. etc. etc.
+
+A type constraint is at heart a small "check if a value is valid"
+function. A constraint can be associated with an attribute. This
+simplifies parameter validation, and makes your code clearer to read,
+because you can refer to constraints by name.
+
+=head2 Slightly Less Important Caveat
+
+It is B<always> a good idea to quote your type names.
+
+This prevents Perl from trying to execute the call as an indirect
+object call. This can be an issue when you have a subtype with the
+same name as a valid class.
+
+For instance:
+
+ subtype DateTime => as Object => where { $_->isa('DateTime') };
+
+will I<just work>, while this:
+
+ use DateTime;
+ subtype DateTime => as Object => where { $_->isa('DateTime') };
+
+will fail silently and cause many headaches. The simple way to solve
+this, as well as future proof your subtypes from classes which have
+yet to have been created, is to quote the type name:
+
+ use DateTime;
+ subtype 'DateTime' => as 'Object' => where { $_->isa('DateTime') };
+
+=head2 Default Type Constraints
+
+This module also provides a simple hierarchy for Perl 5 types, here is
+that hierarchy represented visually.
+
+ Any
+ Item
+ Bool
+ Maybe[`a]
+ Undef
+ Defined
+ Value
+ Num
+ Int
+ Str
+ ClassName
+ RoleName
+ Ref
+ ScalarRef
+ ArrayRef[`a]
+ HashRef[`a]
+ CodeRef
+ RegexpRef
+ GlobRef
+ FileHandle
+ Object
+ Role
+
+B<NOTE:> Any type followed by a type parameter C<[`a]> can be
+parameterized, this means you can say:
+
+ ArrayRef[Int] # an array of integers
+ HashRef[CodeRef] # a hash of str to CODE ref mappings
+ Maybe[Str] # value may be a string, may be undefined
+
+If Mouse finds a name in brackets that it does not recognize as an
+existing type, it assumes that this is a class name, for example
+C<ArrayRef[DateTime]>.
+
+B<NOTE:> Unless you parameterize a type, then it is invalid to include
+the square brackets. I.e. C<ArrayRef[]> will be treated as a new type
+name, I<not> as a parameterization of C<ArrayRef>.
+
+B<NOTE:> The C<Undef> type constraint for the most part works
+correctly now, but edge cases may still exist, please use it
+sparingly.
+
+B<NOTE:> The C<ClassName> type constraint does a complex package
+existence check. This means that your class B<must> be loaded for this
+type constraint to pass.
+
+B<NOTE:> The C<RoleName> constraint checks a string is a I<package
+name> which is a role, like C<'MyApp::Role::Comparable'>. The C<Role>
+constraint checks that an I<object does> the named role.
+
+=head2 Type Constraint Naming
+
+Type name declared via this module can only contain alphanumeric
+characters, colons (:), and periods (.).
+
+Since the types created by this module are global, it is suggested
+that you namespace your types just as you would namespace your
+modules. So instead of creating a I<Color> type for your
+B<My::Graphics> module, you would call the type
+I<My::Graphics::Types::Color> instead.
+
+=head2 Use with Other Constraint Modules
+
+This module can play nicely with other constraint modules with some
+slight tweaking. The C<where> clause in types is expected to be a
+C<CODE> reference which checks it's first argument and returns a
+boolean. Since most constraint modules work in a similar way, it
+should be simple to adapt them to work with Mouse.
+
+For instance, this is how you could use it with
+L<Declare::Constraints::Simple> to declare a completely new type.
+
+ type 'HashOfArrayOfObjects',
+ {
+ where => IsHashRef(
+ -keys => HasLength,
+ -values => IsArrayRef(IsObject)
+ )
+ };
+
+Here is an example of using L<Test::Deep> and it's non-test
+related C<eq_deeply> function.
+
+ type 'ArrayOfHashOfBarsAndRandomNumbers'
+ => where {
+ eq_deeply($_,
+ array_each(subhashof({
+ bar => isa('Bar'),
+ random_number => ignore()
+ })))
+ };
=head1 METHODS
@@ -366,6 +525,10 @@
=back
+=head1 THANKS
+
+Much of this documentation was taken from L<Moose::Util::TypeConstraints>
+
=cut
Modified: trunk/libmouse-perl/t/000-recipes/002_schwartz_tutorial.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/t/000-recipes/002_schwartz_tutorial.t?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/t/000-recipes/002_schwartz_tutorial.t (original)
+++ trunk/libmouse-perl/t/000-recipes/002_schwartz_tutorial.t Sun Apr 12 03:35:21 2009
@@ -10,6 +10,17 @@
use strict;
use warnings;
+use Test::More;
+
+BEGIN {
+ plan skip_all =>
+ "This test requires Class::Method::Modifiers or Class::Method::Modifiers::Fast"
+ unless eval {
+ require Class::Method::Modifiers::Fast;
+ } or eval {
+ require Class::Method::Modifiers;
+ };
+}
# functions to capture the output of the tutorial
our $DUMMY_STDOUT = "";
@@ -105,7 +116,7 @@
######################################################################
# Now the tests
package main;
-use Test::More tests => 5;
+plan tests => 5;
#use Horse;
my $talking = Horse->new(name => 'Mr. Ed');
@@ -114,7 +125,6 @@
$talking->color("grey"); # sets the color
$talking->speak; # says "Mr. Ed goes neigh"
-TODO: { local $TODO = "this currently fails because of a bug in Class::Method::Modifiers (see RT #42992)";
is stdout, <<EXPECTED;
Mr. Ed goes neigh
EXPECTED
@@ -126,7 +136,6 @@
is stdout, <<EXPECTED;
Baab goes baaaah
EXPECTED
- }
#use MouseA
my $mickey = MouseA->new(name => 'Mickey');
Modified: trunk/libmouse-perl/t/028-subclass-attr.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/t/028-subclass-attr.t?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/t/028-subclass-attr.t (original)
+++ trunk/libmouse-perl/t/028-subclass-attr.t Sun Apr 12 03:35:21 2009
@@ -26,10 +26,10 @@
ok($obj->child, "local attribute set in constructor");
ok($obj->class, "inherited attribute set in constructor");
-is_deeply([Child->meta->compute_all_applicable_attributes], [
+is_deeply([Child->meta->get_all_attributes], [
Child->meta->get_attribute('child'),
Class->meta->get_attribute('class'),
-], "correct compute_all_applicable_attributes");
+], "correct get_all_attributes");
do {
package Foo;
@@ -61,11 +61,11 @@
is(Bar->meta->get_attribute('attr')->default, undef);
is(Bar->meta->get_attribute('attr')->_is_metadata, 'rw');
-is_deeply([Foo->meta->compute_all_applicable_attributes], [
+is_deeply([Foo->meta->get_all_attributes], [
Foo->meta->get_attribute('attr'),
-], "correct compute_all_applicable_attributes");
+], "correct get_all_attributes");
-is_deeply([Bar->meta->compute_all_applicable_attributes], [
+is_deeply([Bar->meta->get_all_attributes], [
Bar->meta->get_attribute('attr'),
-], "correct compute_all_applicable_attributes");
+], "correct get_all_attributes");
Modified: trunk/libmouse-perl/t/030_roles/003_apply_role.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/t/030_roles/003_apply_role.t?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/t/030_roles/003_apply_role.t (original)
+++ trunk/libmouse-perl/t/030_roles/003_apply_role.t Sun Apr 12 03:35:21 2009
@@ -2,8 +2,18 @@
use strict;
use warnings;
-
-use Test::More tests => 86;
+use Test::More;
+BEGIN {
+ plan skip_all =>
+ "This test requires Class::Method::Modifiers or Class::Method::Modifiers::Fast"
+ unless eval {
+ require Class::Method::Modifiers::Fast;
+ } or eval {
+ require Class::Method::Modifiers;
+ };
+}
+
+plan tests => 86;
use Test::Exception;
{
Modified: trunk/libmouse-perl/t/030_roles/019_build.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/t/030_roles/019_build.t?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/t/030_roles/019_build.t (original)
+++ trunk/libmouse-perl/t/030_roles/019_build.t Sun Apr 12 03:35:21 2009
@@ -1,7 +1,19 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More;
+BEGIN {
+ plan skip_all =>
+ "This test requires Class::Method::Modifiers or Class::Method::Modifiers::Fast"
+ unless eval {
+ require Class::Method::Modifiers::Fast;
+ } or eval {
+ require Class::Method::Modifiers;
+ };
+}
+
+plan tests => 6;
+
# this test script ensures that my idiom of:
# role: sub BUILD, after BUILD
Modified: trunk/libmouse-perl/t/031-clone.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/t/031-clone.t?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/t/031-clone.t (original)
+++ trunk/libmouse-perl/t/031-clone.t Sun Apr 12 03:35:21 2009
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 10;
+use Test::More tests => 9;
use Test::Exception;
do {
@@ -57,7 +57,4 @@
Foo->meta->clone_object(Foo->meta)
} qr/You must pass an instance of the metaclass \(Foo\), not \(Mo.se::Meta::Class=HASH\(\w+\)\)/;
-throws_ok {
- Foo->meta->clone_instance("constant")
-} qr/You can only clone instances, \(constant\) is not a blessed instance/;
Modified: trunk/libmouse-perl/t/039-subtype.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/t/039-subtype.t?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/t/039-subtype.t (original)
+++ trunk/libmouse-perl/t/039-subtype.t Sun Apr 12 03:35:21 2009
@@ -22,8 +22,5 @@
ok(My::Class->new(name => 'foo'));
-TODO: {
- local $TODO = "message is not used";
- throws_ok { My::Class->new(name => '') } qr/^Attribute \(name\) does not pass the type constraint because: The string is empty!/;
-};
+throws_ok { My::Class->new(name => '') } qr/^Attribute \(name\) does not pass the type constraint because: The string is empty!/;
Modified: trunk/libmouse-perl/t/500_moose_extends_mouse.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmouse-perl/t/500_moose_extends_mouse.t?rev=33071&op=diff
==============================================================================
--- trunk/libmouse-perl/t/500_moose_extends_mouse.t (original)
+++ trunk/libmouse-perl/t/500_moose_extends_mouse.t Sun Apr 12 03:35:21 2009
@@ -84,7 +84,7 @@
is_deeply(
- [ sort map { $_->name } Bar->meta->compute_all_applicable_attributes ],
+ [ sort map { $_->name } Bar->meta->get_all_attributes ],
[ sort qw(foo bar) ],
"attributes",
);
More information about the Pkg-perl-cvs-commits
mailing list