[svn-upgrade] Integrating new upstream version, libmoose-perl (1.02)
Jonathan Yu
14 years ago
0 | 0 | Also see Moose::Manual::Delta for more details of, and workarounds |
1 | 1 | for, noteworthy changes. |
2 | ||
3 | 1.02 Sat, May 01, 2010 | |
4 | ||
5 | [BUG FIXES] | |
6 | ||
7 | * Stop the natatime method provided by the native Array trait from returning | |
8 | an exhausted iterator when being called with a callback. (Florian Ragwitz) | |
9 | ||
10 | * Make Moose::Meta::TypeConstraint::Class correctly reject RegexpRefs. | |
11 | (Florian Ragwitz) | |
12 | ||
13 | * Calling is_subtype_of on a Moose::Meta::TypeConstraint::Class with itself or | |
14 | the class the TC represents as an argument incorrectly returned true. This | |
15 | behavior is correct for is_type_of, not is_subtype_of. (Guillermo Roditi) | |
16 | ||
17 | * Use File::Temp for temp files created during tests. Previously, files were | |
18 | written to the t/ dir, which could cause problems of the user running the | |
19 | tests did not have write access to that directory.. (Chris Weyl, Ævar | |
20 | Arnfjörð Bjarmason) | |
21 | ||
22 | * Pass role arguments along when applying roles to instances. (doy, lsm) | |
2 | 23 | |
3 | 24 | 1.01 Fri, Mar 26, 2010 |
4 | 25 |
4 | 4 | inc/Module/Install/AuthorRequires.pm |
5 | 5 | inc/Module/Install/Base.pm |
6 | 6 | inc/Module/Install/Can.pm |
7 | inc/Module/Install/ExtraTests.pm | |
8 | 7 | inc/Module/Install/Fetch.pm |
9 | 8 | inc/Module/Install/Makefile.pm |
10 | 9 | inc/Module/Install/Metadata.pm |
341 | 340 | t/100_bugs/026_create_anon_recursion.t |
342 | 341 | t/100_bugs/027_constructor_object_overload.t |
343 | 342 | t/100_bugs/028_apply_role_to_one_instance_only.t |
343 | t/100_bugs/029_instance_application_role_args.t | |
344 | 344 | t/200_examples/001_example.t |
345 | 345 | t/200_examples/002_example_Moose_POOP.t |
346 | 346 | t/200_examples/003_example.t |
383 | 383 | t/600_todo_tests/005_moose_and_threads.t |
384 | 384 | t/600_todo_tests/006_required_role_accessors.t |
385 | 385 | t/600_todo_tests/007_metaclass_compat.t |
386 | t/600_todo_tests/008_replacing_super_methods.t | |
386 | 387 | t/lib/Bar.pm |
387 | 388 | t/lib/Foo.pm |
388 | 389 | t/lib/Moose/Meta/Attribute/Custom/Bar.pm |
8 | 8 | configure_requires: |
9 | 9 | ExtUtils::MakeMaker: 6.42 |
10 | 10 | distribution_type: module |
11 | generated_by: 'Module::Install version 0.92' | |
11 | generated_by: 'Module::Install version 0.95' | |
12 | 12 | license: perl |
13 | 13 | meta-spec: |
14 | 14 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
32 | 32 | perl: 5.8.1 |
33 | 33 | resources: |
34 | 34 | license: http://dev.perl.org/licenses/ |
35 | version: 1.01 | |
35 | version: 1.02 |
0 | 0 | use strict; |
1 | 1 | use warnings; |
2 | use inc::Module::Install 0.91; | |
3 | use Module::Install::ExtraTests; | |
2 | use inc::Module::Install 0.95; | |
4 | 3 | use Module::Install::AuthorRequires; |
5 | 4 | use 5.008001; |
6 | 5 | |
6 | check_broken_extratests(); | |
7 | 7 | check_conflicts(); |
8 | 8 | |
9 | 9 | name 'Moose'; |
31 | 31 | author_requires 'Test::Pod::Coverage'; |
32 | 32 | author_requires 'Test::NoTabs'; |
33 | 33 | |
34 | if ( $Module::Install::AUTHOR || $ENV{IS_MAINTAINER} ) { | |
34 | if ( is_maintainer() ) { | |
35 | 35 | system( $^X, 'author/extract-inline-tests' ); |
36 | 36 | } |
37 | 37 | |
38 | extra_tests(); | |
39 | 38 | tests_recursive(); |
40 | 39 | |
41 | 40 | WriteAll(); |
61 | 60 | 'MooseX::StrictConstructor' => '0.07', |
62 | 61 | 'MooseX::Types' => '0.19', |
63 | 62 | 'namespace::autoclean' => '0.08', |
63 | 'KiokuDB' => '0.41', | |
64 | 64 | ); |
65 | 65 | |
66 | 66 | my $found = 0; |
95 | 95 | |
96 | 96 | sleep 4; |
97 | 97 | } |
98 | ||
99 | sub is_maintainer { | |
100 | return $Module::Install::AUTHOR || $ENV{IS_MAINTAINER}; | |
101 | } | |
102 | ||
103 | sub check_broken_extratests { | |
104 | return unless is_maintainer(); | |
105 | ||
106 | if ( exists $Module::Install::ExtraTests::{VERSION} && Module::Install::ExtraTests->VERSION < 0.007 ) { | |
107 | print STDERR <<'EOR'; | |
108 | You have a broken version of Module::Install::ExtraTests installed. | |
109 | Please upgrade to version 0.007 or newer and re-run Makefile.PL | |
110 | EOR | |
111 | exit 0; | |
112 | } | |
113 | } |
0 | Moose version 1.01 | |
0 | Moose version 1.02 | |
1 | 1 | =========================== |
2 | 2 | |
3 | 3 | See the individual module documentation for more information |
3 | 3 | use strict 'vars'; |
4 | 4 | use vars qw{$VERSION}; |
5 | 5 | BEGIN { |
6 | $VERSION = '0.92'; | |
6 | $VERSION = '0.95'; | |
7 | 7 | } |
8 | 8 | |
9 | 9 | # Suspend handler for "redefined" warnings |
8 | 8 | |
9 | 9 | use vars qw{$VERSION @ISA $ISCORE}; |
10 | 10 | BEGIN { |
11 | $VERSION = '0.92'; | |
11 | $VERSION = '0.95'; | |
12 | 12 | @ISA = 'Module::Install::Base'; |
13 | 13 | $ISCORE = 1; |
14 | 14 | } |
0 | #line 1 | |
1 | use strict; | |
2 | use warnings; | |
3 | use 5.006; | |
4 | package Module::Install::ExtraTests; | |
5 | use Module::Install::Base; | |
6 | ||
7 | BEGIN { | |
8 | our $VERSION = '0.006'; | |
9 | our $ISCORE = 1; | |
10 | our @ISA = qw{Module::Install::Base}; | |
11 | } | |
12 | ||
13 | sub extra_tests { | |
14 | my ($self) = @_; | |
15 | ||
16 | return unless -d 'xt'; | |
17 | return unless my @content = grep { $_ =~ /^[.]/ } <xt/*>; | |
18 | ||
19 | die "unknown files found in ./xt" if grep { -f } @content; | |
20 | ||
21 | my %known = map {; $_ => 1 } qw(author smoke release); | |
22 | my @unknown = grep { not $known{$_} } @content; | |
23 | die "unknown directories found in ./xt: @unknown" if @unknown; | |
24 | ||
25 | { | |
26 | no warnings qw(closure once); | |
27 | package # The newline tells PAUSE, "DO NOT INDEXING!" | |
28 | MY; | |
29 | sub test_via_harness { | |
30 | my ($self, $perl, $tests) = @_; | |
31 | my $a_str = -d 'xt/author' ? 'xt/author' : ''; | |
32 | my $r_str = -d 'xt/release' ? 'xt/release' : ''; | |
33 | my $s_str = -d 'xt/smoke' ? 'xt/smoke' : ''; | |
34 | my $is_author = $Module::Install::AUTHOR ? 1 : 0; | |
35 | ||
36 | return qq{\t$perl "-Iinc" "-MModule::Install::ExtraTests" } | |
37 | . qq{"-e" "Module::Install::ExtraTests::__harness('Test::Harness', $is_author, '$a_str', '$r_str', '$s_str', \$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests\n}; | |
38 | } | |
39 | ||
40 | sub dist_test { | |
41 | my ($self, @args) = @_; | |
42 | my $text = $self->SUPER::dist_test(@args); | |
43 | my @lines = split /\n/, $text; | |
44 | $_ =~ s/ (\S*MAKE\S* test )/ RELEASE_TESTING=1 $1 / for grep { m/ test / } @lines; | |
45 | return join "\n", @lines; | |
46 | } | |
47 | ||
48 | } | |
49 | } | |
50 | ||
51 | sub __harness { | |
52 | my $harness_class = shift; | |
53 | my $is_author = shift; | |
54 | my $author_tests = shift; | |
55 | my $release_tests = shift; | |
56 | my $smoke_tests = shift; | |
57 | ||
58 | eval "require $harness_class; 1" or die; | |
59 | require File::Spec; | |
60 | ||
61 | my $verbose = shift; | |
62 | eval "\$$harness_class\::verbose = $verbose; 1" or die; | |
63 | ||
64 | # Because Windows doesn't do this for us and listing all the *.t files | |
65 | # out on the command line can blow over its exec limit. | |
66 | require ExtUtils::Command; | |
67 | push @ARGV, __PACKAGE__->_deep_t($author_tests) | |
68 | if $author_tests and (exists $ENV{AUTHOR_TESTING} ? $ENV{AUTHOR_TESTING} : $is_author); | |
69 | ||
70 | push @ARGV, __PACKAGE__->_deep_t($release_tests) | |
71 | if $release_tests and $ENV{RELEASE_TESTING}; | |
72 | ||
73 | push @ARGV, __PACKAGE__->_deep_t($smoke_tests) | |
74 | if $smoke_tests and $ENV{AUTOMATED_TESTING}; | |
75 | ||
76 | my @argv = ExtUtils::Command::expand_wildcards(@ARGV); | |
77 | ||
78 | local @INC = @INC; | |
79 | unshift @INC, map { File::Spec->rel2abs($_) } @_; | |
80 | $harness_class->can('runtests')->(sort { lc $a cmp lc $b } @argv); | |
81 | } | |
82 | ||
83 | sub _wanted { | |
84 | my $href = shift; | |
85 | no warnings 'once'; | |
86 | sub { /\.t$/ and -f $_ and $href->{$File::Find::dir} = 1 } | |
87 | } | |
88 | ||
89 | sub _deep_t { | |
90 | my ($self, $dir) = @_; | |
91 | require File::Find; | |
92 | ||
93 | my %test_dir; | |
94 | File::Find::find(_wanted(\%test_dir), $dir); | |
95 | return map { "$_/*.t" } sort keys %test_dir; | |
96 | } | |
97 | ||
98 | 1; | |
99 | __END__ |
5 | 5 | |
6 | 6 | use vars qw{$VERSION @ISA $ISCORE}; |
7 | 7 | BEGIN { |
8 | $VERSION = '0.92'; | |
8 | $VERSION = '0.95'; | |
9 | 9 | @ISA = 'Module::Install::Base'; |
10 | 10 | $ISCORE = 1; |
11 | 11 | } |
6 | 6 | |
7 | 7 | use vars qw{$VERSION @ISA $ISCORE}; |
8 | 8 | BEGIN { |
9 | $VERSION = '0.92'; | |
9 | $VERSION = '0.95'; | |
10 | 10 | @ISA = 'Module::Install::Base'; |
11 | 11 | $ISCORE = 1; |
12 | 12 | } |
24 | 24 | die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])"; |
25 | 25 | } |
26 | 26 | |
27 | # In automated testing, always use defaults | |
28 | if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) { | |
27 | # In automated testing or non-interactive session, always use defaults | |
28 | if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) { | |
29 | 29 | local $ENV{PERL_MM_USE_DEFAULT} = 1; |
30 | 30 | goto &ExtUtils::MakeMaker::prompt; |
31 | 31 | } else { |
44 | 44 | ( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0 |
45 | 45 | } |
46 | 46 | |
47 | # Ripped from ExtUtils::MakeMaker 6.56, and slightly modified | |
48 | # as we only need to know here whether the attribute is an array | |
49 | # or a hash or something else (which may or may not be appendable). | |
50 | my %makemaker_argtype = ( | |
51 | C => 'ARRAY', | |
52 | CONFIG => 'ARRAY', | |
53 | # CONFIGURE => 'CODE', # ignore | |
54 | DIR => 'ARRAY', | |
55 | DL_FUNCS => 'HASH', | |
56 | DL_VARS => 'ARRAY', | |
57 | EXCLUDE_EXT => 'ARRAY', | |
58 | EXE_FILES => 'ARRAY', | |
59 | FUNCLIST => 'ARRAY', | |
60 | H => 'ARRAY', | |
61 | IMPORTS => 'HASH', | |
62 | INCLUDE_EXT => 'ARRAY', | |
63 | LIBS => 'ARRAY', # ignore '' | |
64 | MAN1PODS => 'HASH', | |
65 | MAN3PODS => 'HASH', | |
66 | META_ADD => 'HASH', | |
67 | META_MERGE => 'HASH', | |
68 | PL_FILES => 'HASH', | |
69 | PM => 'HASH', | |
70 | PMLIBDIRS => 'ARRAY', | |
71 | PMLIBPARENTDIRS => 'ARRAY', | |
72 | PREREQ_PM => 'HASH', | |
73 | CONFIGURE_REQUIRES => 'HASH', | |
74 | SKIP => 'ARRAY', | |
75 | TYPEMAPS => 'ARRAY', | |
76 | XS => 'HASH', | |
77 | # VERSION => ['version',''], # ignore | |
78 | # _KEEP_AFTER_FLUSH => '', | |
79 | ||
80 | clean => 'HASH', | |
81 | depend => 'HASH', | |
82 | dist => 'HASH', | |
83 | dynamic_lib=> 'HASH', | |
84 | linkext => 'HASH', | |
85 | macro => 'HASH', | |
86 | postamble => 'HASH', | |
87 | realclean => 'HASH', | |
88 | test => 'HASH', | |
89 | tool_autosplit => 'HASH', | |
90 | ||
91 | # special cases where you can use makemaker_append | |
92 | CCFLAGS => 'APPENDABLE', | |
93 | DEFINE => 'APPENDABLE', | |
94 | INC => 'APPENDABLE', | |
95 | LDDLFLAGS => 'APPENDABLE', | |
96 | LDFROM => 'APPENDABLE', | |
97 | ); | |
98 | ||
47 | 99 | sub makemaker_args { |
48 | my $self = shift; | |
100 | my ($self, %new_args) = @_; | |
49 | 101 | my $args = ( $self->{makemaker_args} ||= {} ); |
50 | %$args = ( %$args, @_ ); | |
102 | foreach my $key (keys %new_args) { | |
103 | if ($makemaker_argtype{$key} eq 'ARRAY') { | |
104 | $args->{$key} = [] unless defined $args->{$key}; | |
105 | unless (ref $args->{$key} eq 'ARRAY') { | |
106 | $args->{$key} = [$args->{$key}] | |
107 | } | |
108 | push @{$args->{$key}}, | |
109 | ref $new_args{$key} eq 'ARRAY' | |
110 | ? @{$new_args{$key}} | |
111 | : $new_args{$key}; | |
112 | } | |
113 | elsif ($makemaker_argtype{$key} eq 'HASH') { | |
114 | $args->{$key} = {} unless defined $args->{$key}; | |
115 | foreach my $skey (keys %{ $new_args{$key} }) { | |
116 | $args->{$key}{$skey} = $new_args{$key}{$skey}; | |
117 | } | |
118 | } | |
119 | elsif ($makemaker_argtype{$key} eq 'APPENDABLE') { | |
120 | $self->makemaker_append($key => $new_args{$key}); | |
121 | } | |
122 | else { | |
123 | if (defined $args->{$key}) { | |
124 | warn qq{MakeMaker attribute "$key" is overriden; use "makemaker_append" to append values\n}; | |
125 | } | |
126 | $args->{$key} = $new_args{$key}; | |
127 | } | |
128 | } | |
51 | 129 | return $args; |
52 | 130 | } |
53 | 131 | |
57 | 135 | my $self = shift; |
58 | 136 | my $name = shift; |
59 | 137 | my $args = $self->makemaker_args; |
60 | $args->{name} = defined $args->{$name} | |
61 | ? join( ' ', $args->{name}, @_ ) | |
138 | $args->{$name} = defined $args->{$name} | |
139 | ? join( ' ', $args->{$name}, @_ ) | |
62 | 140 | : join( ' ', @_ ); |
63 | 141 | } |
64 | 142 | |
117 | 195 | %test_dir = (); |
118 | 196 | require File::Find; |
119 | 197 | File::Find::find( \&_wanted_t, $dir ); |
198 | if ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) { | |
199 | File::Find::find( \&_wanted_t, 'xt' ); | |
200 | } | |
120 | 201 | $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); |
121 | 202 | } |
122 | 203 | |
154 | 235 | my $args = $self->makemaker_args; |
155 | 236 | $args->{DISTNAME} = $self->name; |
156 | 237 | $args->{NAME} = $self->module_name || $self->name; |
157 | $args->{VERSION} = $self->version; | |
158 | 238 | $args->{NAME} =~ s/-/::/g; |
239 | $args->{VERSION} = $self->version or die <<'EOT'; | |
240 | ERROR: Can't determine distribution version. Please specify it | |
241 | explicitly via 'version' in Makefile.PL, or set a valid $VERSION | |
242 | in a module, and provide its file path via 'version_from' (or | |
243 | 'all_from' if you prefer) in Makefile.PL. | |
244 | EOT | |
245 | ||
246 | $DB::single = 1; | |
159 | 247 | if ( $self->tests ) { |
160 | $args->{test} = { TESTS => $self->tests }; | |
248 | my @tests = split ' ', $self->tests; | |
249 | my %seen; | |
250 | $args->{test} = { | |
251 | TESTS => (join ' ', grep {!$seen{$_}++} @tests), | |
252 | }; | |
253 | } elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) { | |
254 | $args->{test} = { | |
255 | TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ), | |
256 | }; | |
161 | 257 | } |
162 | 258 | if ( $] >= 5.005 ) { |
163 | 259 | $args->{ABSTRACT} = $self->abstract; |
164 | $args->{AUTHOR} = $self->author; | |
260 | $args->{AUTHOR} = join ', ', @{$self->author || []}; | |
165 | 261 | } |
166 | 262 | if ( $self->makemaker(6.10) ) { |
167 | $args->{NO_META} = 1; | |
263 | $args->{NO_META} = 1; | |
264 | #$args->{NO_MYMETA} = 1; | |
168 | 265 | } |
169 | 266 | if ( $self->makemaker(6.17) and $self->sign ) { |
170 | 267 | $args->{SIGN} = 1; |
171 | 268 | } |
172 | 269 | unless ( $self->is_admin ) { |
173 | 270 | delete $args->{SIGN}; |
271 | } | |
272 | if ( $self->makemaker(6.31) and $self->license ) { | |
273 | $args->{LICENSE} = $self->license; | |
174 | 274 | } |
175 | 275 | |
176 | 276 | my $prereq = ($args->{PREREQ_PM} ||= {}); |
221 | 321 | } |
222 | 322 | } |
223 | 323 | |
224 | $args->{INSTALLDIRS} = $self->installdirs; | |
225 | ||
226 | my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args; | |
324 | if ($self->installdirs) { | |
325 | warn qq{old INSTALLDIRS (probably set by makemaker_args) is overriden by installdirs\n} if $args->{INSTALLDIRS}; | |
326 | $args->{INSTALLDIRS} = $self->installdirs; | |
327 | } | |
328 | ||
329 | my %args = map { | |
330 | ( $_ => $args->{$_} ) } grep {defined($args->{$_} ) | |
331 | } keys %$args; | |
227 | 332 | |
228 | 333 | my $user_preop = delete $args{dist}->{PREOP}; |
229 | if (my $preop = $self->admin->preop($user_preop)) { | |
334 | if ( my $preop = $self->admin->preop($user_preop) ) { | |
230 | 335 | foreach my $key ( keys %$preop ) { |
231 | 336 | $args{dist}->{$key} = $preop->{$key}; |
232 | 337 | } |
296 | 401 | |
297 | 402 | __END__ |
298 | 403 | |
299 | #line 426 | |
404 | #line 531 |
5 | 5 | |
6 | 6 | use vars qw{$VERSION @ISA $ISCORE}; |
7 | 7 | BEGIN { |
8 | $VERSION = '0.92'; | |
8 | $VERSION = '0.95'; | |
9 | 9 | @ISA = 'Module::Install::Base'; |
10 | 10 | $ISCORE = 1; |
11 | 11 | } |
18 | 18 | name |
19 | 19 | module_name |
20 | 20 | abstract |
21 | author | |
22 | 21 | version |
23 | 22 | distribution_type |
24 | 23 | tests |
42 | 41 | |
43 | 42 | my @array_keys = qw{ |
44 | 43 | keywords |
44 | author | |
45 | 45 | }; |
46 | ||
47 | *authors = \&author; | |
46 | 48 | |
47 | 49 | sub Meta { shift } |
48 | 50 | sub Meta_BooleanKeys { @boolean_keys } |
229 | 231 | die("The path '$file' does not exist, or is not a file"); |
230 | 232 | } |
231 | 233 | |
232 | $self->{values}{all_from} = $file; | |
234 | $self->{values}{all_from} = $file; | |
233 | 235 | |
234 | 236 | # Some methods pull from POD instead of code. |
235 | 237 | # If there is a matching .pod, use that instead |
241 | 243 | $self->name_from($file) unless $self->name; |
242 | 244 | $self->version_from($file) unless $self->version; |
243 | 245 | $self->perl_version_from($file) unless $self->perl_version; |
244 | $self->author_from($pod) unless $self->author; | |
246 | $self->author_from($pod) unless @{$self->author || []}; | |
245 | 247 | $self->license_from($pod) unless $self->license; |
246 | 248 | $self->abstract_from($pod) unless $self->abstract; |
247 | 249 | |
427 | 429 | ([^\n]*) |
428 | 430 | /ixms) { |
429 | 431 | my $author = $1 || $2; |
430 | $author =~ s{E<lt>}{<}g; | |
431 | $author =~ s{E<gt>}{>}g; | |
432 | ||
433 | # XXX: ugly but should work anyway... | |
434 | if (eval "require Pod::Escapes; 1") { | |
435 | # Pod::Escapes has a mapping table. | |
436 | # It's in core of perl >= 5.9.3, and should be installed | |
437 | # as one of the Pod::Simple's prereqs, which is a prereq | |
438 | # of Pod::Text 3.x (see also below). | |
439 | $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } | |
440 | { | |
441 | defined $2 | |
442 | ? chr($2) | |
443 | : defined $Pod::Escapes::Name2character_number{$1} | |
444 | ? chr($Pod::Escapes::Name2character_number{$1}) | |
445 | : do { | |
446 | warn "Unknown escape: E<$1>"; | |
447 | "E<$1>"; | |
448 | }; | |
449 | }gex; | |
450 | } | |
451 | elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) { | |
452 | # Pod::Text < 3.0 has yet another mapping table, | |
453 | # though the table name of 2.x and 1.x are different. | |
454 | # (1.x is in core of Perl < 5.6, 2.x is in core of | |
455 | # Perl < 5.9.3) | |
456 | my $mapping = ($Pod::Text::VERSION < 2) | |
457 | ? \%Pod::Text::HTML_Escapes | |
458 | : \%Pod::Text::ESCAPES; | |
459 | $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } | |
460 | { | |
461 | defined $2 | |
462 | ? chr($2) | |
463 | : defined $mapping->{$1} | |
464 | ? $mapping->{$1} | |
465 | : do { | |
466 | warn "Unknown escape: E<$1>"; | |
467 | "E<$1>"; | |
468 | }; | |
469 | }gex; | |
470 | } | |
471 | else { | |
472 | $author =~ s{E<lt>}{<}g; | |
473 | $author =~ s{E<gt>}{>}g; | |
474 | } | |
432 | 475 | $self->author($author); |
433 | 476 | } else { |
434 | 477 | warn "Cannot determine author info from $_[0]\n"; |
436 | 479 | } |
437 | 480 | |
438 | 481 | sub _extract_license { |
439 | if ( | |
440 | $_[0] =~ m/ | |
441 | ( | |
442 | =head \d \s+ | |
443 | (?:licen[cs]e|licensing|copyrights?|legal)\b | |
444 | .*? | |
445 | ) | |
446 | (=head\\d.*|=cut.*|) | |
447 | \z | |
448 | /ixms ) { | |
449 | my $license_text = $1; | |
450 | my @phrases = ( | |
451 | 'under the same (?:terms|license) as (?:perl|the perl programming language)' => 'perl', 1, | |
452 | 'under the terms of (?:perl|the perl programming language) itself' => 'perl', 1, | |
453 | 'GNU general public license' => 'gpl', 1, | |
454 | 'GNU public license' => 'gpl', 1, | |
455 | 'GNU lesser general public license' => 'lgpl', 1, | |
456 | 'GNU lesser public license' => 'lgpl', 1, | |
457 | 'GNU library general public license' => 'lgpl', 1, | |
458 | 'GNU library public license' => 'lgpl', 1, | |
459 | 'BSD license' => 'bsd', 1, | |
460 | 'Artistic license' => 'artistic', 1, | |
461 | 'GPL' => 'gpl', 1, | |
462 | 'LGPL' => 'lgpl', 1, | |
463 | 'BSD' => 'bsd', 1, | |
464 | 'Artistic' => 'artistic', 1, | |
465 | 'MIT' => 'mit', 1, | |
466 | 'proprietary' => 'proprietary', 0, | |
467 | ); | |
468 | while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { | |
469 | $pattern =~ s#\s+#\\s+#gs; | |
470 | if ( $license_text =~ /\b$pattern\b/i ) { | |
471 | return $license; | |
472 | } | |
473 | } | |
474 | } else { | |
475 | return; | |
482 | my $pod = shift; | |
483 | my $matched; | |
484 | return __extract_license( | |
485 | ($matched) = $pod =~ m/ | |
486 | (=head \d \s+ (?:licen[cs]e|licensing)\b.*?) | |
487 | (=head \d.*|=cut.*|)\z | |
488 | /ixms | |
489 | ) || __extract_license( | |
490 | ($matched) = $pod =~ m/ | |
491 | (=head \d \s+ (?:copyrights?|legal)\b.*?) | |
492 | (=head \d.*|=cut.*|)\z | |
493 | /ixms | |
494 | ); | |
495 | } | |
496 | ||
497 | sub __extract_license { | |
498 | my $license_text = shift or return; | |
499 | my @phrases = ( | |
500 | 'under the same (?:terms|license) as (?:perl|the perl programming language)' => 'perl', 1, | |
501 | 'under the terms of (?:perl|the perl programming language) itself' => 'perl', 1, | |
502 | 'Artistic and GPL' => 'perl', 1, | |
503 | 'GNU general public license' => 'gpl', 1, | |
504 | 'GNU public license' => 'gpl', 1, | |
505 | 'GNU lesser general public license' => 'lgpl', 1, | |
506 | 'GNU lesser public license' => 'lgpl', 1, | |
507 | 'GNU library general public license' => 'lgpl', 1, | |
508 | 'GNU library public license' => 'lgpl', 1, | |
509 | 'BSD license' => 'bsd', 1, | |
510 | 'Artistic license' => 'artistic', 1, | |
511 | 'GPL' => 'gpl', 1, | |
512 | 'LGPL' => 'lgpl', 1, | |
513 | 'BSD' => 'bsd', 1, | |
514 | 'Artistic' => 'artistic', 1, | |
515 | 'MIT' => 'mit', 1, | |
516 | 'proprietary' => 'proprietary', 0, | |
517 | ); | |
518 | while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { | |
519 | $pattern =~ s#\s+#\\s+#gs; | |
520 | if ( $license_text =~ /\b$pattern\b/i ) { | |
521 | return $license; | |
522 | } | |
476 | 523 | } |
477 | 524 | } |
478 | 525 |
5 | 5 | |
6 | 6 | use vars qw{$VERSION @ISA $ISCORE}; |
7 | 7 | BEGIN { |
8 | $VERSION = '0.92'; | |
8 | $VERSION = '0.95'; | |
9 | 9 | @ISA = 'Module::Install::Base'; |
10 | 10 | $ISCORE = 1; |
11 | 11 | } |
5 | 5 | |
6 | 6 | use vars qw{$VERSION @ISA $ISCORE}; |
7 | 7 | BEGIN { |
8 | $VERSION = '0.92';; | |
8 | $VERSION = '0.95';; | |
9 | 9 | @ISA = qw{Module::Install::Base}; |
10 | 10 | $ISCORE = 1; |
11 | 11 | } |
25 | 25 | |
26 | 26 | $self->check_nmake if $args{check_nmake}; |
27 | 27 | unless ( $self->makemaker_args->{PL_FILES} ) { |
28 | $self->makemaker_args( PL_FILES => {} ); | |
28 | # XXX: This still may be a bit over-defensive... | |
29 | unless ($self->makemaker(6.25)) { | |
30 | $self->makemaker_args( PL_FILES => {} ) if -f 'Build.PL'; | |
31 | } | |
29 | 32 | } |
30 | 33 | |
31 | 34 | # Until ExtUtils::MakeMaker support MYMETA.yml, make sure |
18 | 18 | |
19 | 19 | use 5.005; |
20 | 20 | use strict 'vars'; |
21 | use Cwd (); | |
22 | use File::Find (); | |
23 | use File::Path (); | |
24 | use FindBin; | |
21 | 25 | |
22 | 26 | use vars qw{$VERSION $MAIN}; |
23 | 27 | BEGIN { |
27 | 31 | # This is not enforced yet, but will be some time in the next few |
28 | 32 | # releases once we can make sure it won't clash with custom |
29 | 33 | # Module::Install extensions. |
30 | $VERSION = '0.92'; | |
34 | $VERSION = '0.95'; | |
31 | 35 | |
32 | 36 | # Storage for the pseudo-singleton |
33 | 37 | $MAIN = undef; |
37 | 41 | |
38 | 42 | } |
39 | 43 | |
40 | ||
41 | ||
42 | ||
43 | ||
44 | # Whether or not inc::Module::Install is actually loaded, the | |
45 | # $INC{inc/Module/Install.pm} is what will still get set as long as | |
46 | # the caller loaded module this in the documented manner. | |
47 | # If not set, the caller may NOT have loaded the bundled version, and thus | |
48 | # they may not have a MI version that works with the Makefile.PL. This would | |
49 | # result in false errors or unexpected behaviour. And we don't want that. | |
50 | my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; | |
51 | unless ( $INC{$file} ) { die <<"END_DIE" } | |
44 | sub import { | |
45 | my $class = shift; | |
46 | my $self = $class->new(@_); | |
47 | my $who = $self->_caller; | |
48 | ||
49 | #------------------------------------------------------------- | |
50 | # all of the following checks should be included in import(), | |
51 | # to allow "eval 'require Module::Install; 1' to test | |
52 | # installation of Module::Install. (RT #51267) | |
53 | #------------------------------------------------------------- | |
54 | ||
55 | # Whether or not inc::Module::Install is actually loaded, the | |
56 | # $INC{inc/Module/Install.pm} is what will still get set as long as | |
57 | # the caller loaded module this in the documented manner. | |
58 | # If not set, the caller may NOT have loaded the bundled version, and thus | |
59 | # they may not have a MI version that works with the Makefile.PL. This would | |
60 | # result in false errors or unexpected behaviour. And we don't want that. | |
61 | my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; | |
62 | unless ( $INC{$file} ) { die <<"END_DIE" } | |
52 | 63 | |
53 | 64 | Please invoke ${\__PACKAGE__} with: |
54 | 65 | |
60 | 71 | |
61 | 72 | END_DIE |
62 | 73 | |
63 | ||
64 | ||
65 | ||
66 | ||
67 | # If the script that is loading Module::Install is from the future, | |
68 | # then make will detect this and cause it to re-run over and over | |
69 | # again. This is bad. Rather than taking action to touch it (which | |
70 | # is unreliable on some platforms and requires write permissions) | |
71 | # for now we should catch this and refuse to run. | |
72 | if ( -f $0 ) { | |
73 | my $s = (stat($0))[9]; | |
74 | ||
75 | # If the modification time is only slightly in the future, | |
76 | # sleep briefly to remove the problem. | |
77 | my $a = $s - time; | |
78 | if ( $a > 0 and $a < 5 ) { sleep 5 } | |
79 | ||
80 | # Too far in the future, throw an error. | |
81 | my $t = time; | |
82 | if ( $s > $t ) { die <<"END_DIE" } | |
74 | # This reportedly fixes a rare Win32 UTC file time issue, but | |
75 | # as this is a non-cross-platform XS module not in the core, | |
76 | # we shouldn't really depend on it. See RT #24194 for detail. | |
77 | # (Also, this module only supports Perl 5.6 and above). | |
78 | eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006; | |
79 | ||
80 | # If the script that is loading Module::Install is from the future, | |
81 | # then make will detect this and cause it to re-run over and over | |
82 | # again. This is bad. Rather than taking action to touch it (which | |
83 | # is unreliable on some platforms and requires write permissions) | |
84 | # for now we should catch this and refuse to run. | |
85 | if ( -f $0 ) { | |
86 | my $s = (stat($0))[9]; | |
87 | ||
88 | # If the modification time is only slightly in the future, | |
89 | # sleep briefly to remove the problem. | |
90 | my $a = $s - time; | |
91 | if ( $a > 0 and $a < 5 ) { sleep 5 } | |
92 | ||
93 | # Too far in the future, throw an error. | |
94 | my $t = time; | |
95 | if ( $s > $t ) { die <<"END_DIE" } | |
83 | 96 | |
84 | 97 | Your installer $0 has a modification time in the future ($s > $t). |
85 | 98 | |
88 | 101 | Please correct this, then run $0 again. |
89 | 102 | |
90 | 103 | END_DIE |
91 | } | |
92 | ||
93 | ||
94 | ||
95 | ||
96 | ||
97 | # Build.PL was formerly supported, but no longer is due to excessive | |
98 | # difficulty in implementing every single feature twice. | |
99 | if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } | |
104 | } | |
105 | ||
106 | ||
107 | # Build.PL was formerly supported, but no longer is due to excessive | |
108 | # difficulty in implementing every single feature twice. | |
109 | if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } | |
100 | 110 | |
101 | 111 | Module::Install no longer supports Build.PL. |
102 | 112 | |
106 | 116 | |
107 | 117 | END_DIE |
108 | 118 | |
109 | ||
110 | ||
111 | ||
112 | ||
113 | # To save some more typing in Module::Install installers, every... | |
114 | # use inc::Module::Install | |
115 | # ...also acts as an implicit use strict. | |
116 | $^H |= strict::bits(qw(refs subs vars)); | |
117 | ||
118 | ||
119 | ||
120 | ||
121 | ||
122 | use Cwd (); | |
123 | use File::Find (); | |
124 | use File::Path (); | |
125 | use FindBin; | |
119 | #------------------------------------------------------------- | |
120 | ||
121 | # To save some more typing in Module::Install installers, every... | |
122 | # use inc::Module::Install | |
123 | # ...also acts as an implicit use strict. | |
124 | $^H |= strict::bits(qw(refs subs vars)); | |
125 | ||
126 | #------------------------------------------------------------- | |
127 | ||
128 | unless ( -f $self->{file} ) { | |
129 | require "$self->{path}/$self->{dispatch}.pm"; | |
130 | File::Path::mkpath("$self->{prefix}/$self->{author}"); | |
131 | $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); | |
132 | $self->{admin}->init; | |
133 | @_ = ($class, _self => $self); | |
134 | goto &{"$self->{name}::import"}; | |
135 | } | |
136 | ||
137 | *{"${who}::AUTOLOAD"} = $self->autoload; | |
138 | $self->preload; | |
139 | ||
140 | # Unregister loader and worker packages so subdirs can use them again | |
141 | delete $INC{"$self->{file}"}; | |
142 | delete $INC{"$self->{path}.pm"}; | |
143 | ||
144 | # Save to the singleton | |
145 | $MAIN = $self; | |
146 | ||
147 | return 1; | |
148 | } | |
126 | 149 | |
127 | 150 | sub autoload { |
128 | 151 | my $self = shift; |
151 | 174 | }; |
152 | 175 | } |
153 | 176 | |
154 | sub import { | |
155 | my $class = shift; | |
156 | my $self = $class->new(@_); | |
157 | my $who = $self->_caller; | |
158 | ||
159 | unless ( -f $self->{file} ) { | |
160 | require "$self->{path}/$self->{dispatch}.pm"; | |
161 | File::Path::mkpath("$self->{prefix}/$self->{author}"); | |
162 | $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); | |
163 | $self->{admin}->init; | |
164 | @_ = ($class, _self => $self); | |
165 | goto &{"$self->{name}::import"}; | |
166 | } | |
167 | ||
168 | *{"${who}::AUTOLOAD"} = $self->autoload; | |
169 | $self->preload; | |
170 | ||
171 | # Unregister loader and worker packages so subdirs can use them again | |
172 | delete $INC{"$self->{file}"}; | |
173 | delete $INC{"$self->{path}.pm"}; | |
174 | ||
175 | # Save to the singleton | |
176 | $MAIN = $self; | |
177 | ||
178 | return 1; | |
179 | } | |
180 | ||
181 | 177 | sub preload { |
182 | 178 | my $self = shift; |
183 | 179 | unless ( $self->{extensions} ) { |
32 | 32 | |
33 | 33 | =head2 Examples |
34 | 34 | |
35 | Let's say that you want to additional properties to | |
35 | Let's say that you want to add additional properties to | |
36 | 36 | attributes. Specifically, we want to add a "label" property to each |
37 | 37 | attribute, so we can write C<< |
38 | 38 | My::Class->meta()->get_attribute('size')->label() >>. The first two |
96 | 96 | The C<get_attribute_list> method returns a list of attribute names. You can |
97 | 97 | then use C<get_attribute> to get the L<Moose::Meta::Attribute> object itself. |
98 | 98 | |
99 | Once you this meta-attribute object, you can call methods on it like this: | |
99 | Once you have this meta-attribute object, you can call methods on it like this: | |
100 | 100 | |
101 | 101 | print $point->meta->get_attribute('x')->type_constraint; |
102 | 102 | => Int |
108 | 108 | |
109 | 109 | =head1 RECIPE REVIEW |
110 | 110 | |
111 | We start by creating a new attribute metaclass. | |
111 | We start by creating a new attribute metaclass. | |
112 | 112 | |
113 | 113 | package MyApp::Meta::Attribute::Labeled; |
114 | 114 | use Moose; |
125 | 125 | |
126 | 126 | A custom method metaclass lets us add both behavior and |
127 | 127 | meta-information to methods. Unfortunately, because the Perl |
128 | interpreter does not private easy hooks into method declaration, the | |
128 | interpreter does not provide easy hooks into method declaration, the | |
129 | 129 | API we have for adding these methods is not very pretty. |
130 | 130 | |
131 | 131 | That can be improved with custom Moose-like sugar, or even by using a |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.01'; | |
5 | our $VERSION = '1.02'; | |
6 | 6 | $VERSION = eval $VERSION; |
7 | 7 | our $AUTHORITY = 'cpan:STEVAN'; |
8 | 8 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.01'; | |
5 | our $VERSION = '1.02'; | |
6 | 6 | $VERSION = eval $VERSION; |
7 | 7 | our $AUTHORITY = 'cpan:STEVAN'; |
8 | 8 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.01'; | |
5 | our $VERSION = '1.02'; | |
6 | 6 | $VERSION = eval $VERSION; |
7 | 7 | our $AUTHORITY = 'cpan:STEVAN'; |
8 | 8 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.01'; | |
5 | our $VERSION = '1.02'; | |
6 | 6 | our $XS_VERSION = $VERSION; |
7 | 7 | $VERSION = eval $VERSION; |
8 | 8 | our $AUTHORITY = 'cpan:STEVAN'; |
93 | 93 | } |
94 | 94 | |
95 | 95 | |
96 | As C<BUILD> is called with the original hashref passed to new (or the | |
97 | results of your C<BUILDARGS>, if you have overridden the default | |
98 | C<BUILDARGS>.) it can also use be used to create a custom constructor | |
99 | using parameters that weren't consumed by attributes. This can be | |
100 | useful if you need to venture beyond what the default initialization | |
101 | behavior and coercions can accomplish. | |
96 | The C<BUILD> method is called with the hash reference of the parameters passed | |
97 | to the constructor (after munging by C<BUILDARGS>). This gives you a chance to | |
98 | do something with parameters that do not represent object attributes. | |
102 | 99 | |
103 | 100 | sub BUILD { |
104 | 101 | my $self = shift; |
105 | my $params_hashref = shift; | |
102 | my $args = shift; | |
106 | 103 | |
107 | $self->addFriend( My::User->new($params_hashref->{friendId}, | |
108 | $params_hashref->{activationCode}) ); | |
104 | $self->add_friend( | |
105 | My::User->new( | |
106 | user_id => $args->{user_id}, | |
107 | ) | |
108 | ); | |
109 | 109 | } |
110 | ||
111 | ||
112 | 110 | |
113 | 111 | =head3 BUILD and parent classes |
114 | 112 |
14 | 14 | feature. If you encounter a problem and have a solution but don't see |
15 | 15 | it documented here, or think we missed an important feature, please |
16 | 16 | send us a patch. |
17 | ||
18 | =head1 1.02 | |
19 | ||
20 | =over 4 | |
21 | ||
22 | =item Moose::Meta::TypeConstraint::Class is_subtype_of behavior | |
23 | ||
24 | Earlier versions of L<is_subtype_of|Moose::Meta::TypeConstraint::Class/is_subtype_of> | |
25 | would incorrectly return true when called with itself, its own TC name or | |
26 | its class name as an argument. (i.e. $foo_tc->is_subtype_of('Foo') == 1) This | |
27 | behavior was a caused by C<isa> being checked before the class name. The old | |
28 | behavior can be accessed with L<is_type_of|Moose::Meta::TypeConstraint::Class/is_type_of> | |
29 | ||
30 | =back | |
17 | 31 | |
18 | 32 | =head1 1.00 |
19 | 33 |
3 | 3 | use List::Util; |
4 | 4 | use List::MoreUtils; |
5 | 5 | |
6 | our $VERSION = '1.01'; | |
6 | our $VERSION = '1.02'; | |
7 | 7 | $VERSION = eval $VERSION; |
8 | 8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | 9 | |
345 | 345 | return sub { |
346 | 346 | my ( $instance, $n, $f ) = @_; |
347 | 347 | my $it = List::MoreUtils::natatime($n, @{ $reader->($instance) }); |
348 | if ($f) { | |
349 | while (my @vals = $it->()) { | |
350 | $f->(@vals); | |
351 | } | |
348 | return $it unless $f; | |
349 | ||
350 | while (my @vals = $it->()) { | |
351 | $f->(@vals); | |
352 | 352 | } |
353 | $it; | |
353 | ||
354 | return; | |
354 | 355 | }; |
355 | 356 | } |
356 | 357 |
1 | 1 | package Moose::Meta::Attribute::Native::MethodProvider::Bool; |
2 | 2 | use Moose::Role; |
3 | 3 | |
4 | our $VERSION = '1.01'; | |
4 | our $VERSION = '1.02'; | |
5 | 5 | $VERSION = eval $VERSION; |
6 | 6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | 7 |
0 | 0 | package Moose::Meta::Attribute::Native::MethodProvider::Code; |
1 | 1 | use Moose::Role; |
2 | 2 | |
3 | our $VERSION = '1.01'; | |
3 | our $VERSION = '1.02'; | |
4 | 4 | $VERSION = eval $VERSION; |
5 | 5 | our $AUTHORITY = 'cpan:STEVAN'; |
6 | 6 |
1 | 1 | package Moose::Meta::Attribute::Native::MethodProvider::Counter; |
2 | 2 | use Moose::Role; |
3 | 3 | |
4 | our $VERSION = '1.01'; | |
4 | our $VERSION = '1.02'; | |
5 | 5 | $VERSION = eval $VERSION; |
6 | 6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | 7 |
0 | 0 | package Moose::Meta::Attribute::Native::MethodProvider::Hash; |
1 | 1 | use Moose::Role; |
2 | 2 | |
3 | our $VERSION = '1.01'; | |
3 | our $VERSION = '1.02'; | |
4 | 4 | $VERSION = eval $VERSION; |
5 | 5 | our $AUTHORITY = 'cpan:STEVAN'; |
6 | 6 |
0 | 0 | package Moose::Meta::Attribute::Native::MethodProvider::String; |
1 | 1 | use Moose::Role; |
2 | 2 | |
3 | our $VERSION = '1.01'; | |
3 | our $VERSION = '1.02'; | |
4 | 4 | $VERSION = eval $VERSION; |
5 | 5 | our $AUTHORITY = 'cpan:STEVAN'; |
6 | 6 |
1 | 1 | package Moose::Meta::Attribute::Native::Trait::Array; |
2 | 2 | use Moose::Role; |
3 | 3 | |
4 | our $VERSION = '1.01'; | |
4 | our $VERSION = '1.02'; | |
5 | 5 | $VERSION = eval $VERSION; |
6 | 6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | 7 |
1 | 1 | use Moose::Role; |
2 | 2 | use Moose::Meta::Attribute::Native::MethodProvider::Bool; |
3 | 3 | |
4 | our $VERSION = '1.01'; | |
4 | our $VERSION = '1.02'; | |
5 | 5 | $VERSION = eval $VERSION; |
6 | 6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | 7 |
1 | 1 | use Moose::Role; |
2 | 2 | use Moose::Meta::Attribute::Native::MethodProvider::Code; |
3 | 3 | |
4 | our $VERSION = '1.01'; | |
4 | our $VERSION = '1.02'; | |
5 | 5 | $VERSION = eval $VERSION; |
6 | 6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | 7 |
1 | 1 | package Moose::Meta::Attribute::Native::Trait::Counter; |
2 | 2 | use Moose::Role; |
3 | 3 | |
4 | our $VERSION = '1.01'; | |
4 | our $VERSION = '1.02'; | |
5 | 5 | $VERSION = eval $VERSION; |
6 | 6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | 7 |
1 | 1 | package Moose::Meta::Attribute::Native::Trait::Hash; |
2 | 2 | use Moose::Role; |
3 | 3 | |
4 | our $VERSION = '1.01'; | |
4 | our $VERSION = '1.02'; | |
5 | 5 | $VERSION = eval $VERSION; |
6 | 6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | 7 |
0 | 0 | package Moose::Meta::Attribute::Native::Trait::Number; |
1 | 1 | use Moose::Role; |
2 | 2 | |
3 | our $VERSION = '1.01'; | |
3 | our $VERSION = '1.02'; | |
4 | 4 | $VERSION = eval $VERSION; |
5 | 5 | our $AUTHORITY = 'cpan:STEVAN'; |
6 | 6 |
0 | 0 | package Moose::Meta::Attribute::Native::Trait::String; |
1 | 1 | use Moose::Role; |
2 | 2 | |
3 | our $VERSION = '1.01'; | |
3 | our $VERSION = '1.02'; | |
4 | 4 | $VERSION = eval $VERSION; |
5 | 5 | our $AUTHORITY = 'cpan:STEVAN'; |
6 | 6 |
2 | 2 | use Moose::Role; |
3 | 3 | use Moose::Util::TypeConstraints; |
4 | 4 | |
5 | our $VERSION = '1.01'; | |
5 | our $VERSION = '1.02'; | |
6 | 6 | $VERSION = eval $VERSION; |
7 | 7 | our $AUTHORITY = 'cpan:STEVAN'; |
8 | 8 |
0 | 0 | package Moose::Meta::Attribute::Native; |
1 | 1 | |
2 | our $VERSION = '1.01'; | |
2 | our $VERSION = '1.02'; | |
3 | 3 | $VERSION = eval $VERSION; |
4 | 4 | our $AUTHORITY = 'cpan:STEVAN'; |
5 | 5 |
8 | 8 | use Try::Tiny; |
9 | 9 | use overload (); |
10 | 10 | |
11 | our $VERSION = '1.01'; | |
11 | our $VERSION = '1.02'; | |
12 | 12 | our $AUTHORITY = 'cpan:STEVAN'; |
13 | 13 | |
14 | 14 | use Moose::Meta::Method::Accessor; |
4 | 4 | |
5 | 5 | use Class::MOP; |
6 | 6 | |
7 | our $VERSION = '1.01'; | |
7 | our $VERSION = '1.02'; | |
8 | 8 | $VERSION = eval $VERSION; |
9 | 9 | our $AUTHORITY = 'cpan:STEVAN'; |
10 | 10 |
10 | 10 | use List::MoreUtils qw( any all uniq first_index ); |
11 | 11 | use Scalar::Util 'weaken', 'blessed'; |
12 | 12 | |
13 | our $VERSION = '1.01'; | |
13 | our $VERSION = '1.02'; | |
14 | 14 | $VERSION = eval $VERSION; |
15 | 15 | our $AUTHORITY = 'cpan:STEVAN'; |
16 | 16 |
3 | 3 | use strict; |
4 | 4 | use warnings; |
5 | 5 | |
6 | our $VERSION = '1.01'; | |
6 | our $VERSION = '1.02'; | |
7 | 7 | $VERSION = eval $VERSION; |
8 | 8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | 9 |
3 | 3 | use strict; |
4 | 4 | use warnings; |
5 | 5 | |
6 | our $VERSION = '1.01'; | |
6 | our $VERSION = '1.02'; | |
7 | 7 | $VERSION = eval $VERSION; |
8 | 8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | 9 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.01'; | |
5 | our $VERSION = '1.02'; | |
6 | 6 | $VERSION = eval $VERSION; |
7 | 7 | our $AUTHORITY = 'cpan:STEVAN'; |
8 | 8 |
5 | 5 | |
6 | 6 | use Scalar::Util 'blessed', 'weaken', 'looks_like_number', 'refaddr'; |
7 | 7 | |
8 | our $VERSION = '1.01'; | |
8 | our $VERSION = '1.02'; | |
9 | 9 | our $AUTHORITY = 'cpan:STEVAN'; |
10 | 10 | |
11 | 11 | use base 'Moose::Meta::Method', |
6 | 6 | use Carp 'confess'; |
7 | 7 | use Scalar::Util 'blessed', 'weaken'; |
8 | 8 | |
9 | our $VERSION = '1.01'; | |
9 | our $VERSION = '1.02'; | |
10 | 10 | $VERSION = eval $VERSION; |
11 | 11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | 12 |
7 | 7 | use Scalar::Util 'blessed', 'weaken'; |
8 | 8 | use Try::Tiny (); |
9 | 9 | |
10 | our $VERSION = '1.01'; | |
10 | our $VERSION = '1.02'; | |
11 | 11 | $VERSION = eval $VERSION; |
12 | 12 | our $AUTHORITY = 'cpan:STEVAN'; |
13 | 13 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.01'; | |
5 | our $VERSION = '1.02'; | |
6 | 6 | $VERSION = eval $VERSION; |
7 | 7 | our $AUTHORITY = 'cpan:STEVAN'; |
8 | 8 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.01'; | |
5 | our $VERSION = '1.02'; | |
6 | 6 | $VERSION = eval $VERSION; |
7 | 7 | our $AUTHORITY = 'cpan:STEVAN'; |
8 | 8 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.01'; | |
5 | our $VERSION = '1.02'; | |
6 | 6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | 7 | |
8 | 8 | use base 'Class::MOP::Mixin::AttributeCore'; |
7 | 7 | |
8 | 8 | use Moose::Meta::Role::Composite; |
9 | 9 | |
10 | our $VERSION = '1.01'; | |
10 | our $VERSION = '1.02'; | |
11 | 11 | $VERSION = eval $VERSION; |
12 | 12 | our $AUTHORITY = 'cpan:STEVAN'; |
13 | 13 |
6 | 6 | use Moose::Util 'english_list'; |
7 | 7 | use Scalar::Util 'weaken', 'blessed'; |
8 | 8 | |
9 | our $VERSION = '1.01'; | |
9 | our $VERSION = '1.02'; | |
10 | 10 | $VERSION = eval $VERSION; |
11 | 11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | 12 |
5 | 5 | |
6 | 6 | use Scalar::Util 'blessed'; |
7 | 7 | |
8 | our $VERSION = '1.01'; | |
8 | our $VERSION = '1.02'; | |
9 | 9 | $VERSION = eval $VERSION; |
10 | 10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | 11 | |
17 | 17 | )); |
18 | 18 | |
19 | 19 | sub apply { |
20 | my ( $self, $role, $object ) = @_; | |
20 | my ( $self, $role, $object, $args ) = @_; | |
21 | 21 | |
22 | 22 | my $obj_meta = Class::MOP::class_of($object) || 'Moose::Meta::Class'; |
23 | 23 | |
29 | 29 | |
30 | 30 | my $class = $obj_meta->create_anon_class( |
31 | 31 | superclasses => [ blessed($object) ], |
32 | roles => [ $role ], | |
32 | roles => [ $role, keys(%$args) ? ($args) : () ], | |
33 | 33 | cache => 1, |
34 | 34 | ); |
35 | 35 |
5 | 5 | |
6 | 6 | use Scalar::Util 'blessed'; |
7 | 7 | |
8 | our $VERSION = '1.01'; | |
8 | our $VERSION = '1.02'; | |
9 | 9 | $VERSION = eval $VERSION; |
10 | 10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | 11 |
3 | 3 | use warnings; |
4 | 4 | use metaclass; |
5 | 5 | |
6 | our $VERSION = '1.01'; | |
6 | our $VERSION = '1.02'; | |
7 | 7 | $VERSION = eval $VERSION; |
8 | 8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | 9 |
6 | 6 | use List::MoreUtils 'all'; |
7 | 7 | use Scalar::Util 'blessed', 'weaken'; |
8 | 8 | |
9 | our $VERSION = '1.01'; | |
9 | our $VERSION = '1.02'; | |
10 | 10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | 11 | |
12 | 12 | use base 'Moose::Meta::Mixin::AttributeCore'; |
5 | 5 | |
6 | 6 | use Scalar::Util 'blessed'; |
7 | 7 | |
8 | our $VERSION = '1.01'; | |
8 | our $VERSION = '1.02'; | |
9 | 9 | $VERSION = eval $VERSION; |
10 | 10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | 11 |
7 | 7 | |
8 | 8 | use base qw(Moose::Meta::Role::Method::Required); |
9 | 9 | |
10 | our $VERSION = '1.01'; | |
10 | our $VERSION = '1.02'; | |
11 | 11 | $VERSION = eval $VERSION; |
12 | 12 | our $AUTHORITY = 'cpan:STEVAN'; |
13 | 13 |
9 | 9 | |
10 | 10 | use base qw(Class::MOP::Object); |
11 | 11 | |
12 | our $VERSION = '1.01'; | |
12 | our $VERSION = '1.02'; | |
13 | 13 | $VERSION = eval $VERSION; |
14 | 14 | our $AUTHORITY = 'cpan:STEVAN'; |
15 | 15 |
3 | 3 | use strict; |
4 | 4 | use warnings; |
5 | 5 | |
6 | our $VERSION = '1.01'; | |
6 | our $VERSION = '1.02'; | |
7 | 7 | $VERSION = eval $VERSION; |
8 | 8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | 9 |
8 | 8 | use Carp 'confess'; |
9 | 9 | use Devel::GlobalDestruction 'in_global_destruction'; |
10 | 10 | |
11 | our $VERSION = '1.01'; | |
11 | our $VERSION = '1.02'; | |
12 | 12 | $VERSION = eval $VERSION; |
13 | 13 | our $AUTHORITY = 'cpan:STEVAN'; |
14 | 14 | |
398 | 398 | ## ------------------------------------------------------------------ |
399 | 399 | |
400 | 400 | sub apply { |
401 | my ($self, $other, @args) = @_; | |
401 | my ($self, $other, %args) = @_; | |
402 | 402 | |
403 | 403 | (blessed($other)) |
404 | 404 | || Moose->throw_error("You must pass in an blessed instance"); |
415 | 415 | } |
416 | 416 | |
417 | 417 | Class::MOP::load_class($application_class); |
418 | return $application_class->new(@args)->apply($self, $other); | |
418 | return $application_class->new(%args)->apply($self, $other, \%args); | |
419 | 419 | } |
420 | 420 | |
421 | 421 | sub composition_class_roles { } |
6 | 6 | |
7 | 7 | use Scalar::Util 'blessed'; |
8 | 8 | |
9 | our $VERSION = '1.01'; | |
9 | our $VERSION = '1.02'; | |
10 | 10 | $VERSION = eval $VERSION; |
11 | 11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | 12 |
7 | 7 | use Moose::Meta::Attribute; |
8 | 8 | use Moose::Util::TypeConstraints (); |
9 | 9 | |
10 | our $VERSION = '1.01'; | |
10 | our $VERSION = '1.02'; | |
11 | 11 | $VERSION = eval $VERSION; |
12 | 12 | our $AUTHORITY = 'cpan:STEVAN'; |
13 | 13 |
6 | 6 | use Scalar::Util 'blessed'; |
7 | 7 | use Moose::Util::TypeConstraints (); |
8 | 8 | |
9 | our $VERSION = '1.01'; | |
9 | our $VERSION = '1.02'; | |
10 | 10 | $VERSION = eval $VERSION; |
11 | 11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | 12 | |
33 | 33 | my $class = $self->class; |
34 | 34 | $self->hand_optimized_type_constraint( |
35 | 35 | sub { |
36 | blessed( $_[0] ) && $_[0]->isa($class) | |
36 | blessed( $_[0] ) && blessed( $_[0] ) ne 'Regexp' && $_[0]->isa($class) | |
37 | 37 | } |
38 | 38 | ); |
39 | 39 | } |
77 | 77 | sub is_subtype_of { |
78 | 78 | my ($self, $type_or_name_or_class ) = @_; |
79 | 79 | |
80 | if ( not ref $type_or_name_or_class ) { | |
81 | # it might be a class | |
82 | return 1 if $self->class->isa( $type_or_name_or_class ); | |
80 | my $type = Moose::Util::TypeConstraints::find_type_constraint($type_or_name_or_class); | |
81 | ||
82 | if ( not defined $type ) { | |
83 | if ( not ref $type_or_name_or_class ) { | |
84 | # it might be a class | |
85 | return 1 if $self->class->isa( $type_or_name_or_class ); | |
86 | } | |
87 | return; | |
83 | 88 | } |
84 | 89 | |
85 | my $type = Moose::Util::TypeConstraints::find_type_constraint($type_or_name_or_class); | |
86 | ||
87 | return unless defined $type; | |
88 | ||
89 | if ( $type->isa(__PACKAGE__) ) { | |
90 | if ( $type->isa(__PACKAGE__) && $type->class ne $self->class) { | |
90 | 91 | # if $type_or_name_or_class isn't a class, it might be the TC name of another ::Class type |
91 | 92 | # or it could also just be a type object in this branch |
92 | 93 | return $self->class->isa( $type->class ); |
9 | 9 | |
10 | 10 | use Moose::Util::TypeConstraints (); |
11 | 11 | |
12 | our $VERSION = '1.01'; | |
12 | our $VERSION = '1.02'; | |
13 | 13 | $VERSION = eval $VERSION; |
14 | 14 | our $AUTHORITY = 'cpan:STEVAN'; |
15 | 15 |
5 | 5 | |
6 | 6 | use Moose::Util::TypeConstraints (); |
7 | 7 | |
8 | our $VERSION = '1.01'; | |
8 | our $VERSION = '1.02'; | |
9 | 9 | $VERSION = eval $VERSION; |
10 | 10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | 11 |
3 | 3 | use warnings; |
4 | 4 | use metaclass; |
5 | 5 | |
6 | our $VERSION = '1.01'; | |
6 | our $VERSION = '1.02'; | |
7 | 7 | $VERSION = eval $VERSION; |
8 | 8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | 9 |
7 | 7 | use Moose::Util::TypeConstraints; |
8 | 8 | use Moose::Meta::TypeConstraint::Parameterizable; |
9 | 9 | |
10 | our $VERSION = '1.01'; | |
10 | our $VERSION = '1.02'; | |
11 | 11 | $VERSION = eval $VERSION; |
12 | 12 | our $AUTHORITY = 'cpan:STEVAN'; |
13 | 13 |
6 | 6 | |
7 | 7 | use Scalar::Util 'blessed'; |
8 | 8 | |
9 | our $VERSION = '1.01'; | |
9 | our $VERSION = '1.02'; | |
10 | 10 | $VERSION = eval $VERSION; |
11 | 11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | 12 |
6 | 6 | use Scalar::Util 'blessed'; |
7 | 7 | use Moose::Util::TypeConstraints (); |
8 | 8 | |
9 | our $VERSION = '1.01'; | |
9 | our $VERSION = '1.02'; | |
10 | 10 | $VERSION = eval $VERSION; |
11 | 11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | 12 |
8 | 8 | |
9 | 9 | use List::Util qw(first); |
10 | 10 | |
11 | our $VERSION = '1.01'; | |
11 | our $VERSION = '1.02'; | |
12 | 12 | $VERSION = eval $VERSION; |
13 | 13 | our $AUTHORITY = 'cpan:STEVAN'; |
14 | 14 |
12 | 12 | |
13 | 13 | use base qw(Class::MOP::Object); |
14 | 14 | |
15 | our $VERSION = '1.01'; | |
15 | our $VERSION = '1.02'; | |
16 | 16 | $VERSION = eval $VERSION; |
17 | 17 | our $AUTHORITY = 'cpan:STEVAN'; |
18 | 18 |
11 | 11 | use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class'; |
12 | 12 | use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class'; |
13 | 13 | |
14 | our $VERSION = '1.01'; | |
14 | our $VERSION = '1.02'; | |
15 | 15 | $VERSION = eval $VERSION; |
16 | 16 | our $AUTHORITY = 'cpan:STEVAN'; |
17 | 17 |
6 | 6 | |
7 | 7 | use Sub::Exporter; |
8 | 8 | |
9 | our $VERSION = '1.01'; | |
9 | our $VERSION = '1.02'; | |
10 | 10 | $VERSION = eval $VERSION; |
11 | 11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | 12 |
3 | 3 | use warnings; |
4 | 4 | use Scalar::Util 'blessed'; |
5 | 5 | |
6 | our $VERSION = '1.01'; | |
6 | our $VERSION = '1.02'; | |
7 | 7 | $VERSION = eval $VERSION; |
8 | 8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | 9 |
5 | 5 | use Class::MOP; |
6 | 6 | use Scalar::Util 'blessed', 'looks_like_number'; |
7 | 7 | |
8 | our $VERSION = '1.01'; | |
8 | our $VERSION = '1.02'; | |
9 | 9 | $VERSION = eval $VERSION; |
10 | 10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | 11 |
5 | 5 | use Scalar::Util qw( blessed reftype ); |
6 | 6 | use Moose::Exporter; |
7 | 7 | |
8 | our $VERSION = '1.01'; | |
8 | our $VERSION = '1.02'; | |
9 | 9 | $VERSION = eval $VERSION; |
10 | 10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | 11 |
7 | 7 | use Scalar::Util 'blessed'; |
8 | 8 | use Class::MOP 0.60; |
9 | 9 | |
10 | our $VERSION = '1.01'; | |
10 | our $VERSION = '1.02'; | |
11 | 11 | $VERSION = eval $VERSION; |
12 | 12 | our $AUTHORITY = 'cpan:STEVAN'; |
13 | 13 | |
372 | 372 | The name resolution mechanism is covered in |
373 | 373 | L<Moose/Metaclass and Trait Name Resolution>. |
374 | 374 | |
375 | =item B<meta_class_alias($to[, $from])> | |
376 | ||
377 | =item B<meta_attribute_alias($to[, $from])> | |
378 | ||
379 | Create an alias from the class C<$from> (or the current package, if | |
380 | C<$from> is unspecified), so that | |
381 | L<Moose/Metaclass and Trait Name Resolution> works properly. | |
382 | ||
375 | 383 | =item B<english_list(@items)> |
376 | 384 | |
377 | 385 | Given a list of scalars, turns them into a proper list in English |
378 | 386 | ("one and two", "one, two, three, and four"). This is used to help us |
379 | 387 | make nicer error messages. |
380 | 388 | |
381 | =item B<meta_class_alias($to[, $from])> | |
382 | ||
383 | =item B<meta_attribute_alias($to[, $from])> | |
384 | ||
385 | Create an alias from the class C<$from> (or the current package, if | |
386 | C<$from> is unspecified), so that | |
387 | L<Moose/Metaclass and Trait Name Resolution> works properly. | |
388 | ||
389 | 389 | =back |
390 | 390 | |
391 | 391 | =head1 TODO |
3 | 3 | |
4 | 4 | use 5.008; |
5 | 5 | |
6 | our $VERSION = '1.01'; | |
6 | our $VERSION = '1.02'; | |
7 | 7 | $VERSION = eval $VERSION; |
8 | 8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | 9 |
8 | 8 | use List::MoreUtils 'all'; |
9 | 9 | use Moose::Util 'does_role', 'find_meta'; |
10 | 10 | |
11 | our $VERSION = '1.01'; | |
11 | our $VERSION = '1.02'; | |
12 | 12 | $VERSION = eval $VERSION; |
13 | 13 | our $AUTHORITY = 'cpan:STEVAN'; |
14 | 14 |
4 | 4 | |
5 | 5 | use Class::MOP; |
6 | 6 | |
7 | our $VERSION = '1.01'; | |
7 | our $VERSION = '1.02'; | |
8 | 8 | $VERSION = eval $VERSION; |
9 | 9 | our $AUTHORITY = 'cpan:STEVAN'; |
10 | 10 |
31 | 31 | |
32 | 32 | is( $type->class, "Foo", "class attribute" ); |
33 | 33 | |
34 | ok( !$type->is_subtype_of('Foo'), "Foo is not subtype of Foo" ); | |
35 | ok( !$type->is_subtype_of($type), '$foo_type is not subtype of $foo_type' ); | |
36 | ||
34 | 37 | ok( $type->is_subtype_of("Gorch"), "subtype of gorch" ); |
35 | 38 | |
36 | 39 | ok( $type->is_subtype_of("Bar"), "subtype of bar" ); |
57 | 60 | ok( !$type->equals(Moose::Meta::TypeConstraint::Class->new( name => "__ANON__", class => "Bar" )), "doesn't equal other anon constraint" ); |
58 | 61 | ok( $type->is_subtype_of(Moose::Meta::TypeConstraint::Class->new( name => "__ANON__", class => "Bar" )), "subtype of other anon constraint" ); |
59 | 62 | |
63 | { | |
64 | my $regexp_type = Moose::Meta::TypeConstraint::Class->new(name => 'Regexp', class => 'Regexp'); | |
65 | ok(!$regexp_type->check(qr//), 'a Regexp is not an instance of a class, even tho perl pretends it is'); | |
66 | } | |
67 | ||
60 | 68 | done_testing; |
22 | 22 | } |
23 | 23 | |
24 | 24 | my $Int = find_type_constraint('Int'); |
25 | ok $Int, 'Got a good type contstraint'; | |
25 | ok $Int, 'Got a good type constraint'; | |
26 | 26 | |
27 | 27 | my $parent = Test::Moose::Meta::TypeConstraint::AnySubType->new({ |
28 | 28 | name => "Test::Moose::Meta::TypeConstraint::AnySubType" , |
6 | 6 | |
7 | 7 | use Test::More; |
8 | 8 | use Test::Exception; |
9 | ||
10 | use File::Spec; | |
11 | use File::Temp 'tempdir'; | |
9 | 12 | |
10 | 13 | BEGIN { |
11 | 14 | eval "use Module::Refresh;"; |
37 | 40 | |
38 | 41 | =cut |
39 | 42 | |
40 | my $test_module_file = 'TestBaz.pm'; | |
43 | my $dir = tempdir( "MooseTest-XXXXX", CLEANUP => 1, TMPDIR => 1 ); | |
44 | push @INC, $dir; | |
45 | ||
46 | my $test_module_file = File::Spec->catdir($dir, 'TestBaz.pm'); | |
41 | 47 | |
42 | 48 | my $test_module_source_1 = q| |
43 | 49 | package TestBaz; |
0 | #!/usr/bin/perl | |
1 | use strict; | |
2 | use warnings; | |
3 | use Test::More; | |
4 | use Test::Exception; | |
5 | ||
6 | { | |
7 | package Point; | |
8 | use Moose; | |
9 | ||
10 | with qw/DoesNegated DoesTranspose/; | |
11 | ||
12 | has x => ( isa => 'Int', is => 'rw' ); | |
13 | has y => ( isa => 'Int', is => 'rw' ); | |
14 | ||
15 | sub inspect { [$_[0]->x, $_[0]->y] } | |
16 | ||
17 | no Moose; | |
18 | } | |
19 | ||
20 | { | |
21 | package DoesNegated; | |
22 | use Moose::Role; | |
23 | ||
24 | sub negated { | |
25 | my $self = shift; | |
26 | $self->new( x => -$self->x, y => -$self->y ); | |
27 | } | |
28 | ||
29 | no Moose::Role; | |
30 | } | |
31 | ||
32 | { | |
33 | package DoesTranspose; | |
34 | use Moose::Role; | |
35 | ||
36 | sub transpose { | |
37 | my $self = shift; | |
38 | $self->new( x => $self->y, y => $self->x ); | |
39 | } | |
40 | ||
41 | no Moose::Role; | |
42 | } | |
43 | ||
44 | my $p = Point->new( x => 4, y => 3 ); | |
45 | ||
46 | DoesTranspose->meta->apply( $p, alias => { transpose => 'negated' } ); | |
47 | ||
48 | is_deeply($p->negated->inspect, [3, 4]); | |
49 | is_deeply($p->transpose->inspect, [3, 4]); | |
50 | ||
51 | done_testing; |
0 | #!/usr/bin/env perl | |
1 | use strict; | |
2 | use warnings; | |
3 | use Test::More; | |
4 | ||
5 | my ($super_called, $sub_called, $new_super_called) = (0, 0, 0); | |
6 | { | |
7 | package Foo; | |
8 | use Moose; | |
9 | ||
10 | sub foo { $super_called++ } | |
11 | } | |
12 | ||
13 | { | |
14 | package Foo::Sub; | |
15 | use Moose; | |
16 | extends 'Foo'; | |
17 | ||
18 | override foo => sub { | |
19 | $sub_called++; | |
20 | super(); | |
21 | }; | |
22 | } | |
23 | ||
24 | Foo::Sub->new->foo; | |
25 | is($super_called, 1, "super called"); | |
26 | is($new_super_called, 0, "new super not called"); | |
27 | is($sub_called, 1, "sub called"); | |
28 | ||
29 | ($super_called, $sub_called, $new_super_called) = (0, 0, 0); | |
30 | ||
31 | Foo->meta->add_method(foo => sub { | |
32 | $new_super_called++; | |
33 | }); | |
34 | ||
35 | Foo::Sub->new->foo; | |
36 | { local $TODO = "super doesn't get replaced"; | |
37 | is($super_called, 0, "super not called"); | |
38 | is($new_super_called, 1, "new super called"); | |
39 | } | |
40 | is($sub_called, 1, "sub called"); | |
41 | ||
42 | done_testing; |
182 | 182 | refactored |
183 | 183 | refactoring |
184 | 184 | rethrows |
185 | ROLETYPE | |
185 | 186 | runtime |
186 | 187 | serializer |
187 | 188 | stacktrace |
16 | 16 | |
17 | 17 | if ( $ENV{MOOSE_TEST_MD_ALL} ) { |
18 | 18 | test_all_dependents( 'Moose', { exclude => $exclude } ); |
19 | done_testing; | |
19 | 20 | } |
20 | 21 | else { |
21 | 22 | my @modules = map { chomp; $_ } <DATA>; |
23 | plan tests => scalar @modules; | |
22 | 24 | test_module($_) for @modules; |
23 | done_testing; | |
24 | 25 | } |
25 | 26 | |
26 | 27 | __DATA__ |
27 | 28 | Moose::Autobox |
28 | 29 | MooseX::ABC |
30 | MooseX::AbstractFactory | |
29 | 31 | MooseX::Accessors::ReadWritePrivate |
30 | 32 | MooseX::Aliases |
33 | MooseX::AlwaysCoerce | |
31 | 34 | MooseX::App::Cmd |
35 | MooseX::App::Cmd::Command::BashComplete | |
32 | 36 | MooseX::Async |
33 | 37 | MooseX::Attribute::ENV |
38 | MooseX::AttributeCloner | |
39 | MooseX::AttributeDefaults | |
34 | 40 | MooseX::AttributeHelpers |
41 | MooseX::AttributeIndexes | |
35 | 42 | MooseX::AttributeInflate |
36 | MooseX::Attribute::Prototype | |
37 | 43 | MooseX::Attributes::Curried |
38 | 44 | MooseX::Blessed::Reconstruct |
45 | MooseX::CascadeClearing | |
39 | 46 | MooseX::ClassAttribute |
40 | 47 | MooseX::Clone |
41 | 48 | MooseX::ConfigFromFile |
46 | 53 | MooseX::Daemonize |
47 | 54 | MooseX::Declare |
48 | 55 | MooseX::DeepAccessors |
56 | MooseX::Dumper | |
49 | 57 | MooseX::Emulate::Class::Accessor::Fast |
58 | MooseX::Error::Exception::Class | |
59 | MooseX::Error::Trap | |
60 | MooseX::FSM | |
61 | MooseX::FileAttribute | |
62 | MooseX::File_or_DB::Storage | |
50 | 63 | MooseX::FollowPBP |
51 | 64 | MooseX::Getopt |
65 | MooseX::Getopt::Defanged | |
52 | 66 | MooseX::GlobRef |
53 | MooseX::GlobRef::Object | |
54 | 67 | MooseX::HasDefaults |
55 | 68 | MooseX::Has::Sugar |
56 | 69 | MooseX::InsideOut |
58 | 71 | MooseX::Iterator |
59 | 72 | MooseX::KeyedMutex |
60 | 73 | MooseX::LazyLogDispatch |
74 | MooseX::LazyRequire | |
75 | MooseX::Lexical::Types | |
76 | MooseX::LexicalRoleApplication | |
77 | MooseX::Lists | |
61 | 78 | MooseX::LogDispatch |
62 | 79 | MooseX::Log::Log4perl |
63 | 80 | MooseX::MakeImmutable |
64 | 81 | MooseX::Mangle |
82 | MooseX::MarkAsMethods | |
83 | MooseX::Meta::Attribute::Index | |
84 | MooseX::Meta::Attribute::Lvalue | |
65 | 85 | MooseX::Meta::TypeConstraint::ForceCoercion |
86 | MooseX::Meta::TypeConstraint::Intersection | |
87 | MooseX::MetaDescription | |
88 | MooseX::Method | |
66 | 89 | MooseX::MethodAttributes |
67 | 90 | MooseX::Method::Signatures |
68 | 91 | MooseX::MultiInitArg |
69 | 92 | MooseX::MultiMethods |
70 | 93 | MooseX::MutatorAttributes |
94 | MooseX::Net::API | |
71 | 95 | MooseX::NonMoose |
72 | 96 | MooseX::Object::Pluggable |
73 | 97 | MooseX::Param |
75 | 99 | MooseX::Plaggerize |
76 | 100 | MooseX::POE |
77 | 101 | MooseX::Policy::SemiAffordanceAccessor |
78 | MooseX::Q4MLog | |
102 | MooseX::RelatedClassRoles | |
103 | MooseX::Role::BuildInstanceOf | |
79 | 104 | MooseX::Role::Cmd |
105 | MooseX::Role::DBIx::Connector | |
80 | 106 | MooseX::Role::Matcher |
81 | 107 | MooseX::Role::Parameterized |
108 | MooseX::Role::Restricted | |
109 | MooseX::Role::Strict | |
110 | MooseX::Role::WithOverloading | |
82 | 111 | MooseX::Role::XMLRPC::Client |
112 | MooseX::Runnable | |
113 | MooseX::Scaffold | |
83 | 114 | MooseX::SemiAffordanceAccessor |
115 | MooseX::SetOnce | |
84 | 116 | MooseX::SimpleConfig |
85 | 117 | MooseX::Singleton |
86 | 118 | MooseX::SingletonMethod |
119 | MooseX::SlurpyConstructor | |
87 | 120 | MooseX::Storage |
88 | 121 | MooseX::Storage::Format::XML::Simple |
89 | 122 | MooseX::StrictConstructor |
90 | 123 | MooseX::Struct |
91 | 124 | MooseX::Templated |
92 | 125 | MooseX::Timestamp |
126 | MooseX::TrackDirty::Attributes | |
93 | 127 | MooseX::Traits |
128 | MooseX::Traits::Attribute::CascadeClear | |
129 | MooseX::Traits::Attribute::MergeHashRef | |
130 | MooseX::Traits::Pluggable | |
131 | MooseX::TypeMap | |
94 | 132 | MooseX::Types |
95 | 133 | MooseX::Types::Authen::Passphrase |
134 | MooseX::Types::Buf | |
96 | 135 | MooseX::Types::Common |
97 | 136 | MooseX::Types::Data::GUID |
98 | 137 | MooseX::Types::DateTime |
138 | MooseX::Types::DateTime::ButMaintained | |
139 | MooseX::Types::Digest | |
140 | MooseX::Types::Email | |
99 | 141 | MooseX::Types::IO |
142 | MooseX::Types::ISO8601 | |
143 | MooseX::Types::JSON | |
144 | MooseX::Types::LoadableClass | |
145 | MooseX::Types::Locale::Country | |
146 | MooseX::Types::Locale::Language | |
147 | MooseX::Types::Log::Dispatch | |
100 | 148 | MooseX::Types::Path::Class |
101 | 149 | MooseX::Types::Set::Object |
102 | 150 | MooseX::Types::Structured |
103 | 151 | MooseX::Types::URI |
104 | 152 | MooseX::Types::UUID |
153 | MooseX::Types::UniStr | |
154 | MooseX::Types::Varchar | |
105 | 155 | MooseX::Types::VariantTable |
156 | MooseX::UndefTolerant | |
106 | 157 | MooseX::WithCache |
107 | 158 | MooseX::Workers |
108 | 159 | MooseX::YAML |
109 | Fey::ORM | |
110 | KiokuDB | |
160 | App::Nopaste | |
161 | App::Termcast | |
162 | Bread::Board | |
163 | Cantella::Worker | |
164 | Carp::REPL | |
111 | 165 | Catalyst |
112 | 166 | Chart::Clicker |
167 | CHI | |
168 | Config::MVP | |
169 | Data::Stream::Bulk | |
170 | Data::Visitor | |
171 | DBIx::Class | |
172 | Devel::REPL | |
173 | Dist::Zilla | |
174 | Email::Sender | |
175 | FCGI::Engine | |
176 | Fey | |
177 | Fey::ORM | |
178 | File::ChangeNotify | |
179 | Forest | |
180 | Git::PurePerl | |
181 | Hailo | |
182 | IM::Engine | |
183 | JSORB | |
184 | KiokuDB | |
185 | KiokuDB::Backend::DBI | |
186 | KiokuX::User | |
187 | Lighttpd::Control | |
188 | Locale::POFileManager | |
189 | Markdent | |
190 | namespace::autoclean | |
191 | NetHack::Item | |
192 | Net::Twitter | |
193 | Path::Router | |
194 | Pod::Elemental | |
195 | Pod::Weaver | |
196 | Reflex | |
197 | Throwable | |
113 | 198 | TryCatch |
114 | Bread::Board | |
115 | Devel::REPL | |
116 | Carp::REPL | |
117 | IM::Engine | |
118 | NetHack::Item | |
119 | Forest | |
120 | App::Nopaste | |
121 | CHI | |
122 | Data::Visitor | |
123 | namespace::autoclean | |
124 | DBIx::Class | |
125 | Hailo | |
199 | XML::Toolkit |