From: Goro Fuji Date: Sat, 2 Jan 2010 09:20:46 +0000 (+0900) Subject: Replace CRLF to LF with all the files X-Git-Tag: 0.46~12^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=346a3ab8a10ac61eae8021ccfd068d80ccccd56a;p=gitmo%2FMouse.git Replace CRLF to LF with all the files --- diff --git a/benchmarks/coercion.pl b/benchmarks/coercion.pl index a473303..ce1643d 100755 --- a/benchmarks/coercion.pl +++ b/benchmarks/coercion.pl @@ -7,15 +7,15 @@ use Benchmark qw/cmpthese/; for my $klass (qw/Moose Mouse/) { eval qq{ package ${klass}One; - use $klass; + use $klass; use ${klass}::Util::TypeConstraints; - + subtype 'NaturalNumber', as 'Int', where { \$_ > 0 }; coerce 'NaturalNumber', from 'Str', via { 42 }, - ; - + ; + has n => ( is => 'rw', isa => 'NaturalNumber', diff --git a/benchmarks/subtype.pl b/benchmarks/subtype.pl index 90a0cf3..1539950 100755 --- a/benchmarks/subtype.pl +++ b/benchmarks/subtype.pl @@ -6,11 +6,11 @@ use Benchmark qw/cmpthese/; for my $klass (qw/Moose Mouse/) { eval qq{ package ${klass}One; - use $klass; + use $klass; use ${klass}::Util::TypeConstraints; - - subtype 'NaturalNumber', as 'Int', where { \$_ > 0 }; - + + subtype 'NaturalNumber', as 'Int', where { \$_ > 0 }; + has n => ( is => 'rw', isa => 'NaturalNumber', diff --git a/lib/Mouse/Meta/TypeConstraint.pm b/lib/Mouse/Meta/TypeConstraint.pm index 06d7749..fb7047b 100644 --- a/lib/Mouse/Meta/TypeConstraint.pm +++ b/lib/Mouse/Meta/TypeConstraint.pm @@ -114,15 +114,15 @@ sub _add_type_coercions{ } else{ $self->{_compiled_type_coercion} = sub { - my($thing) = @_; - foreach my $pair (@{$coercions}) { - #my ($constraint, $converter) = @$pair; - if ($pair->[0]->check($thing)) { + my($thing) = @_; + foreach my $pair (@{$coercions}) { + #my ($constraint, $converter) = @$pair; + if ($pair->[0]->check($thing)) { local $_ = $thing; return $pair->[1]->($thing); - } - } - return $thing; + } + } + return $thing; }; } return; diff --git a/lib/Mouse/Spec.pm b/lib/Mouse/Spec.pm index f688eb4..f7a7f44 100644 --- a/lib/Mouse/Spec.pm +++ b/lib/Mouse/Spec.pm @@ -71,7 +71,7 @@ L - The (always classic) B example =item * -L - A simple B example +L - A simple B example =item * @@ -83,31 +83,31 @@ L - Subtypes, and modeling a simple B =item * -L - More subtypes, coercion in a B class +L - More subtypes, coercion in a B class =item * -L - The augment/inner example +L - The augment/inner example =item * -L - Making Moose fast with immutable +L - Making Moose fast with immutable =item * -L - Builder methods and lazy_build +L - Builder methods and lazy_build =item * -L - Operator overloading, subtypes, and coercion +L - Operator overloading, subtypes, and coercion =item * -L - Using BUILDARGS and BUILD to hook into object construction +L - Using BUILDARGS and BUILD to hook into object construction =item * -L - The Moose::Role example +L - The Moose::Role example =item * @@ -115,19 +115,19 @@ L - Advanced Role Composition - method exclusio =item * -L - Applying a role to an object instance +L - Applying a role to an object instance =item * -L - A meta-attribute, attributes with labels +L - A meta-attribute, attributes with labels =item * -L - Labels implemented via attribute traits +L - Labels implemented via attribute traits =item * -L - Providing an alternate base object class +L - Providing an alternate base object class =back diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 17fc188..338f198 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -153,7 +153,7 @@ BEGIN { } return $type eq 'c3' ? [calculateMRO($classname)] - : $_get_linear_isa_dfs->($classname); + : $_get_linear_isa_dfs->($classname); }; } diff --git a/t/001_mouse/044-attribute-metaclass.t b/t/001_mouse/044-attribute-metaclass.t index 4c0c38d..f31e89d 100644 --- a/t/001_mouse/044-attribute-metaclass.t +++ b/t/001_mouse/044-attribute-metaclass.t @@ -203,48 +203,48 @@ do { sub helper_type { 'Num' } - has 'method_constructors' => ( - is => 'ro', - isa => 'HashRef', - lazy => 1, - default => sub { - return +{ - set => sub { - my ( $attr, $reader, $writer ) = @_; - return sub { $writer->( $_[0], $_[1] ) }; + has 'method_constructors' => ( + is => 'ro', + isa => 'HashRef', + lazy => 1, + default => sub { + return +{ + set => sub { + my ( $attr, $reader, $writer ) = @_; + return sub { $writer->( $_[0], $_[1] ) }; + }, + get => sub { + my ( $attr, $reader, $writer ) = @_; + return sub { $reader->( $_[0] ) }; + }, + add => sub { + my ( $attr, $reader, $writer ) = @_; + return sub { $writer->( $_[0], $reader->( $_[0] ) + $_[1] ) }; }, - get => sub { - my ( $attr, $reader, $writer ) = @_; - return sub { $reader->( $_[0] ) }; + sub => sub { + my ( $attr, $reader, $writer ) = @_; + return sub { $writer->( $_[0], $reader->( $_[0] ) - $_[1] ) }; }, - add => sub { - my ( $attr, $reader, $writer ) = @_; - return sub { $writer->( $_[0], $reader->( $_[0] ) + $_[1] ) }; - }, - sub => sub { - my ( $attr, $reader, $writer ) = @_; - return sub { $writer->( $_[0], $reader->( $_[0] ) - $_[1] ) }; - }, - mul => sub { - my ( $attr, $reader, $writer ) = @_; - return sub { $writer->( $_[0], $reader->( $_[0] ) * $_[1] ) }; - }, - div => sub { - my ( $attr, $reader, $writer ) = @_; - return sub { $writer->( $_[0], $reader->( $_[0] ) / $_[1] ) }; - }, - mod => sub { - my ( $attr, $reader, $writer ) = @_; - return sub { $writer->( $_[0], $reader->( $_[0] ) % $_[1] ) }; - }, - abs => sub { - my ( $attr, $reader, $writer ) = @_; - return sub { $writer->( $_[0], abs( $reader->( $_[0] ) ) ) }; - }, - }; - } - ); - + mul => sub { + my ( $attr, $reader, $writer ) = @_; + return sub { $writer->( $_[0], $reader->( $_[0] ) * $_[1] ) }; + }, + div => sub { + my ( $attr, $reader, $writer ) = @_; + return sub { $writer->( $_[0], $reader->( $_[0] ) / $_[1] ) }; + }, + mod => sub { + my ( $attr, $reader, $writer ) = @_; + return sub { $writer->( $_[0], $reader->( $_[0] ) % $_[1] ) }; + }, + abs => sub { + my ( $attr, $reader, $writer ) = @_; + return sub { $writer->( $_[0], abs( $reader->( $_[0] ) ) ) }; + }, + }; + } + ); + package MouseX::AttributeHelpers::Number; use Mouse; diff --git a/t/001_mouse/055-exporter.t b/t/001_mouse/055-exporter.t index 7f945c6..1207c42 100644 --- a/t/001_mouse/055-exporter.t +++ b/t/001_mouse/055-exporter.t @@ -1,81 +1,81 @@ -#!perl -use strict; -use warnings; -use Test::More tests => 14; - -use Mouse (); - -BEGIN{ - package MyMouse; - use Mouse; - Mouse::Exporter->setup_import_methods( - as_is => [qw(foo)], - also => [qw(Mouse)], - ); - - sub foo{ 100 } - - $INC{'MyMouse.pm'}++; - - package MyMouseEx; - use Mouse; - Mouse::Exporter->setup_import_methods( - as_is => [\&bar], - also => [qw(MyMouse)], - -# groups => { -# foobar_only => [qw(foo bar)], -# }, - ); - - sub bar{ 200 } - - $INC{'MyMouseEx.pm'}++; -} - -can_ok 'MyMouse', qw(import unimport); -can_ok 'MyMouseEx', qw(import unimport); - -{ - package MyApp; - use Test::More; - use MyMouse; - - can_ok __PACKAGE__, 'meta'; - ok defined(&foo), 'foo is imported'; - ok defined(&has), 'has is also imported'; - - no MyMouse; - - ok !defined(&foo), 'foo is unimported'; - ok !defined(&has), 'has is also unimported'; -} -{ - package MyAppEx; - use Test::More; - use MyMouseEx; - - can_ok __PACKAGE__, 'meta'; - ok defined(&foo), 'foo is imported'; - ok defined(&bar), 'foo is also imported'; - ok defined(&has), 'has is also imported'; - - no MyMouseEx; - - ok !defined(&foo), 'foo is unimported'; - ok !defined(&bar), 'foo is also unimported'; - ok !defined(&has), 'has is also unimported'; -} - -# exporting groups are not implemented in Moose::Exporter -#{ -# package MyAppExTags; -# use Test::More; -# use MyMouseEx qw(:foobar_only); -# -# can_ok __PACKAGE__, 'meta'; -# ok defined(&foo); -# ok defined(&bar); -# ok!defined(&has), "export tags"; -#} - +#!perl +use strict; +use warnings; +use Test::More tests => 14; + +use Mouse (); + +BEGIN{ + package MyMouse; + use Mouse; + Mouse::Exporter->setup_import_methods( + as_is => [qw(foo)], + also => [qw(Mouse)], + ); + + sub foo{ 100 } + + $INC{'MyMouse.pm'}++; + + package MyMouseEx; + use Mouse; + Mouse::Exporter->setup_import_methods( + as_is => [\&bar], + also => [qw(MyMouse)], + +# groups => { +# foobar_only => [qw(foo bar)], +# }, + ); + + sub bar{ 200 } + + $INC{'MyMouseEx.pm'}++; +} + +can_ok 'MyMouse', qw(import unimport); +can_ok 'MyMouseEx', qw(import unimport); + +{ + package MyApp; + use Test::More; + use MyMouse; + + can_ok __PACKAGE__, 'meta'; + ok defined(&foo), 'foo is imported'; + ok defined(&has), 'has is also imported'; + + no MyMouse; + + ok !defined(&foo), 'foo is unimported'; + ok !defined(&has), 'has is also unimported'; +} +{ + package MyAppEx; + use Test::More; + use MyMouseEx; + + can_ok __PACKAGE__, 'meta'; + ok defined(&foo), 'foo is imported'; + ok defined(&bar), 'foo is also imported'; + ok defined(&has), 'has is also imported'; + + no MyMouseEx; + + ok !defined(&foo), 'foo is unimported'; + ok !defined(&bar), 'foo is also unimported'; + ok !defined(&has), 'has is also unimported'; +} + +# exporting groups are not implemented in Moose::Exporter +#{ +# package MyAppExTags; +# use Test::More; +# use MyMouseEx qw(:foobar_only); +# +# can_ok __PACKAGE__, 'meta'; +# ok defined(&foo); +# ok defined(&bar); +# ok!defined(&has), "export tags"; +#} + diff --git a/t/001_mouse/056-role-combine.t b/t/001_mouse/056-role-combine.t index 6ebe4e3..c195d59 100644 --- a/t/001_mouse/056-role-combine.t +++ b/t/001_mouse/056-role-combine.t @@ -1,35 +1,35 @@ -#!perl -use strict; -use warnings; -use Test::More tests => 2; -use Test::Exception; -{ - package RoleA; - use Mouse::Role; - - sub foo { } - sub bar { } -} -{ - package RoleB; - use Mouse::Role; - - sub foo { } - sub bar { } -} -{ - package Class; - use Mouse; - use Test::More; - use Test::Exception; - - throws_ok { - with qw(RoleA RoleB); - } qr/Due to method name conflicts in roles 'RoleA' and 'RoleB', the methods 'bar' and 'foo' must be/; - - lives_ok { - with RoleA => { -excludes => ['foo'] }, - RoleB => { -excludes => ['bar'] }, - ; - }; -} +#!perl +use strict; +use warnings; +use Test::More tests => 2; +use Test::Exception; +{ + package RoleA; + use Mouse::Role; + + sub foo { } + sub bar { } +} +{ + package RoleB; + use Mouse::Role; + + sub foo { } + sub bar { } +} +{ + package Class; + use Mouse; + use Test::More; + use Test::Exception; + + throws_ok { + with qw(RoleA RoleB); + } qr/Due to method name conflicts in roles 'RoleA' and 'RoleB', the methods 'bar' and 'foo' must be/; + + lives_ok { + with RoleA => { -excludes => ['foo'] }, + RoleB => { -excludes => ['bar'] }, + ; + }; +} diff --git a/t/010_basics/failing/020-global-destruction-helper.pl b/t/010_basics/failing/020-global-destruction-helper.pl index a0defbe..7c30edd 100755 --- a/t/010_basics/failing/020-global-destruction-helper.pl +++ b/t/010_basics/failing/020-global-destruction-helper.pl @@ -1,34 +1,34 @@ -#!/usr/bin/perl - -use strict; -use warnings; - - -{ - package Foo; - use Mouse; - - sub DEMOLISH { - my $self = shift; - my ($igd) = @_; - - print $igd; - } -} - -{ - package Bar; - use Mouse; - - sub DEMOLISH { - my $self = shift; - my ($igd) = @_; - - print $igd; - } - - __PACKAGE__->meta->make_immutable; -} - -our $foo = Foo->new; -our $bar = Bar->new; +#!/usr/bin/perl + +use strict; +use warnings; + + +{ + package Foo; + use Mouse; + + sub DEMOLISH { + my $self = shift; + my ($igd) = @_; + + print $igd; + } +} + +{ + package Bar; + use Mouse; + + sub DEMOLISH { + my $self = shift; + my ($igd) = @_; + + print $igd; + } + + __PACKAGE__->meta->make_immutable; +} + +our $foo = Foo->new; +our $bar = Bar->new; diff --git a/t/040_type_constraints/017_subtyping_union_types.t b/t/040_type_constraints/017_subtyping_union_types.t index 505e92c..830f1e8 100755 --- a/t/040_type_constraints/017_subtyping_union_types.t +++ b/t/040_type_constraints/017_subtyping_union_types.t @@ -1,69 +1,69 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More tests => 19; -use Test::Exception; - -BEGIN { - use_ok("Mouse::Util::TypeConstraints"); -} - -lives_ok { - subtype 'MyCollections' => as 'ArrayRef | HashRef'; -} '... created the subtype special okay'; - -{ - my $t = find_type_constraint('MyCollections'); - isa_ok($t, 'Mouse::Meta::TypeConstraint'); - - is($t->name, 'MyCollections', '... name is correct'); - - my $p = $t->parent; -# isa_ok($p, 'Mouse::Meta::TypeConstraint::Union'); - isa_ok($p, 'Mouse::Meta::TypeConstraint'); - - is($p->name, 'ArrayRef|HashRef', '... parent name is correct'); - - ok($t->check([]), '... validated it correctly'); - ok($t->check({}), '... validated it correctly'); - ok(!$t->check(1), '... validated it correctly'); -} - -lives_ok { - subtype 'MyCollectionsExtended' - => as 'ArrayRef|HashRef' - => where { - if (ref($_) eq 'ARRAY') { - return if scalar(@$_) < 2; - } - elsif (ref($_) eq 'HASH') { - return if scalar(keys(%$_)) < 2; - } - 1; - }; -} '... created the subtype special okay'; - -{ - my $t = find_type_constraint('MyCollectionsExtended'); - isa_ok($t, 'Mouse::Meta::TypeConstraint'); - - is($t->name, 'MyCollectionsExtended', '... name is correct'); - - my $p = $t->parent; -# isa_ok($p, 'Mouse::Meta::TypeConstraint::Union'); - isa_ok($p, 'Mouse::Meta::TypeConstraint'); - - is($p->name, 'ArrayRef|HashRef', '... parent name is correct'); - - ok(!$t->check([]), '... validated it correctly'); - ok($t->check([1, 2]), '... validated it correctly'); - - ok(!$t->check({}), '... validated it correctly'); - ok($t->check({ one => 1, two => 2 }), '... validated it correctly'); - - ok(!$t->check(1), '... validated it correctly'); -} - - +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 19; +use Test::Exception; + +BEGIN { + use_ok("Mouse::Util::TypeConstraints"); +} + +lives_ok { + subtype 'MyCollections' => as 'ArrayRef | HashRef'; +} '... created the subtype special okay'; + +{ + my $t = find_type_constraint('MyCollections'); + isa_ok($t, 'Mouse::Meta::TypeConstraint'); + + is($t->name, 'MyCollections', '... name is correct'); + + my $p = $t->parent; +# isa_ok($p, 'Mouse::Meta::TypeConstraint::Union'); + isa_ok($p, 'Mouse::Meta::TypeConstraint'); + + is($p->name, 'ArrayRef|HashRef', '... parent name is correct'); + + ok($t->check([]), '... validated it correctly'); + ok($t->check({}), '... validated it correctly'); + ok(!$t->check(1), '... validated it correctly'); +} + +lives_ok { + subtype 'MyCollectionsExtended' + => as 'ArrayRef|HashRef' + => where { + if (ref($_) eq 'ARRAY') { + return if scalar(@$_) < 2; + } + elsif (ref($_) eq 'HASH') { + return if scalar(keys(%$_)) < 2; + } + 1; + }; +} '... created the subtype special okay'; + +{ + my $t = find_type_constraint('MyCollectionsExtended'); + isa_ok($t, 'Mouse::Meta::TypeConstraint'); + + is($t->name, 'MyCollectionsExtended', '... name is correct'); + + my $p = $t->parent; +# isa_ok($p, 'Mouse::Meta::TypeConstraint::Union'); + isa_ok($p, 'Mouse::Meta::TypeConstraint'); + + is($p->name, 'ArrayRef|HashRef', '... parent name is correct'); + + ok(!$t->check([]), '... validated it correctly'); + ok($t->check([1, 2]), '... validated it correctly'); + + ok(!$t->check({}), '... validated it correctly'); + ok($t->check({ one => 1, two => 2 }), '... validated it correctly'); + + ok(!$t->check(1), '... validated it correctly'); +} + + diff --git a/t/990_deprecated/044-attribute-metaclass.t b/t/990_deprecated/044-attribute-metaclass.t index 01786eb..8a3eb9f 100644 --- a/t/990_deprecated/044-attribute-metaclass.t +++ b/t/990_deprecated/044-attribute-metaclass.t @@ -31,14 +31,14 @@ do { return $attr; }; - around 'canonicalize_args' => sub { - my ($next, $self, $name, %args) = @_; - - %args = $next->($self, $name, %args); - $args{is} = 'rw' unless exists $args{is}; - - return %args; - }; + around 'canonicalize_args' => sub { + my ($next, $self, $name, %args) = @_; + + %args = $next->($self, $name, %args); + $args{is} = 'rw' unless exists $args{is}; + + return %args; + }; package # hide me from search.cpan.org Mouse::Meta::Attribute::Custom::Number; diff --git a/xs-src/MouseAccessor.xs b/xs-src/MouseAccessor.xs index b9aad70..2d26088 100644 --- a/xs-src/MouseAccessor.xs +++ b/xs-src/MouseAccessor.xs @@ -388,7 +388,7 @@ mouse_instance_weaken_slot(pTHX_ SV* const instance, SV* const slot) { sv_rvweaken(HeVAL(he)); } } - + MODULE = Mouse::Meta::Method::Accessor::XS PACKAGE = Mouse::Meta::Method::Accessor::XS PROTOTYPES: DISABLE