Codebase list libmoose-perl / 3fde0b6
[svn-upgrade] Integrating new upstream version, libmoose-perl (1.02) Jonathan Yu 14 years ago
88 changed file(s) with 669 addition(s) and 382 deletion(s). Raw diff Collapse all Expand all
00 Also see Moose::Manual::Delta for more details of, and workarounds
11 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)
223
324 1.01 Fri, Mar 26, 2010
425
44 inc/Module/Install/AuthorRequires.pm
55 inc/Module/Install/Base.pm
66 inc/Module/Install/Can.pm
7 inc/Module/Install/ExtraTests.pm
87 inc/Module/Install/Fetch.pm
98 inc/Module/Install/Makefile.pm
109 inc/Module/Install/Metadata.pm
341340 t/100_bugs/026_create_anon_recursion.t
342341 t/100_bugs/027_constructor_object_overload.t
343342 t/100_bugs/028_apply_role_to_one_instance_only.t
343 t/100_bugs/029_instance_application_role_args.t
344344 t/200_examples/001_example.t
345345 t/200_examples/002_example_Moose_POOP.t
346346 t/200_examples/003_example.t
383383 t/600_todo_tests/005_moose_and_threads.t
384384 t/600_todo_tests/006_required_role_accessors.t
385385 t/600_todo_tests/007_metaclass_compat.t
386 t/600_todo_tests/008_replacing_super_methods.t
386387 t/lib/Bar.pm
387388 t/lib/Foo.pm
388389 t/lib/Moose/Meta/Attribute/Custom/Bar.pm
88 configure_requires:
99 ExtUtils::MakeMaker: 6.42
1010 distribution_type: module
11 generated_by: 'Module::Install version 0.92'
11 generated_by: 'Module::Install version 0.95'
1212 license: perl
1313 meta-spec:
1414 url: http://module-build.sourceforge.net/META-spec-v1.4.html
3232 perl: 5.8.1
3333 resources:
3434 license: http://dev.perl.org/licenses/
35 version: 1.01
35 version: 1.02
00 use strict;
11 use warnings;
2 use inc::Module::Install 0.91;
3 use Module::Install::ExtraTests;
2 use inc::Module::Install 0.95;
43 use Module::Install::AuthorRequires;
54 use 5.008001;
65
6 check_broken_extratests();
77 check_conflicts();
88
99 name 'Moose';
3131 author_requires 'Test::Pod::Coverage';
3232 author_requires 'Test::NoTabs';
3333
34 if ( $Module::Install::AUTHOR || $ENV{IS_MAINTAINER} ) {
34 if ( is_maintainer() ) {
3535 system( $^X, 'author/extract-inline-tests' );
3636 }
3737
38 extra_tests();
3938 tests_recursive();
4039
4140 WriteAll();
6160 'MooseX::StrictConstructor' => '0.07',
6261 'MooseX::Types' => '0.19',
6362 'namespace::autoclean' => '0.08',
63 'KiokuDB' => '0.41',
6464 );
6565
6666 my $found = 0;
9595
9696 sleep 4;
9797 }
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
11 ===========================
22
33 See the individual module documentation for more information
33 use strict 'vars';
44 use vars qw{$VERSION};
55 BEGIN {
6 $VERSION = '0.92';
6 $VERSION = '0.95';
77 }
88
99 # Suspend handler for "redefined" warnings
88
99 use vars qw{$VERSION @ISA $ISCORE};
1010 BEGIN {
11 $VERSION = '0.92';
11 $VERSION = '0.95';
1212 @ISA = 'Module::Install::Base';
1313 $ISCORE = 1;
1414 }
+0
-100
inc/Module/Install/ExtraTests.pm less more
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__
55
66 use vars qw{$VERSION @ISA $ISCORE};
77 BEGIN {
8 $VERSION = '0.92';
8 $VERSION = '0.95';
99 @ISA = 'Module::Install::Base';
1010 $ISCORE = 1;
1111 }
66
77 use vars qw{$VERSION @ISA $ISCORE};
88 BEGIN {
9 $VERSION = '0.92';
9 $VERSION = '0.95';
1010 @ISA = 'Module::Install::Base';
1111 $ISCORE = 1;
1212 }
2424 die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
2525 }
2626
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} ) {
2929 local $ENV{PERL_MM_USE_DEFAULT} = 1;
3030 goto &ExtUtils::MakeMaker::prompt;
3131 } else {
4444 ( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0
4545 }
4646
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
4799 sub makemaker_args {
48 my $self = shift;
100 my ($self, %new_args) = @_;
49101 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 }
51129 return $args;
52130 }
53131
57135 my $self = shift;
58136 my $name = shift;
59137 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}, @_ )
62140 : join( ' ', @_ );
63141 }
64142
117195 %test_dir = ();
118196 require File::Find;
119197 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 }
120201 $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir );
121202 }
122203
154235 my $args = $self->makemaker_args;
155236 $args->{DISTNAME} = $self->name;
156237 $args->{NAME} = $self->module_name || $self->name;
157 $args->{VERSION} = $self->version;
158238 $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;
159247 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 };
161257 }
162258 if ( $] >= 5.005 ) {
163259 $args->{ABSTRACT} = $self->abstract;
164 $args->{AUTHOR} = $self->author;
260 $args->{AUTHOR} = join ', ', @{$self->author || []};
165261 }
166262 if ( $self->makemaker(6.10) ) {
167 $args->{NO_META} = 1;
263 $args->{NO_META} = 1;
264 #$args->{NO_MYMETA} = 1;
168265 }
169266 if ( $self->makemaker(6.17) and $self->sign ) {
170267 $args->{SIGN} = 1;
171268 }
172269 unless ( $self->is_admin ) {
173270 delete $args->{SIGN};
271 }
272 if ( $self->makemaker(6.31) and $self->license ) {
273 $args->{LICENSE} = $self->license;
174274 }
175275
176276 my $prereq = ($args->{PREREQ_PM} ||= {});
221321 }
222322 }
223323
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;
227332
228333 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) ) {
230335 foreach my $key ( keys %$preop ) {
231336 $args{dist}->{$key} = $preop->{$key};
232337 }
296401
297402 __END__
298403
299 #line 426
404 #line 531
55
66 use vars qw{$VERSION @ISA $ISCORE};
77 BEGIN {
8 $VERSION = '0.92';
8 $VERSION = '0.95';
99 @ISA = 'Module::Install::Base';
1010 $ISCORE = 1;
1111 }
1818 name
1919 module_name
2020 abstract
21 author
2221 version
2322 distribution_type
2423 tests
4241
4342 my @array_keys = qw{
4443 keywords
44 author
4545 };
46
47 *authors = \&author;
4648
4749 sub Meta { shift }
4850 sub Meta_BooleanKeys { @boolean_keys }
229231 die("The path '$file' does not exist, or is not a file");
230232 }
231233
232 $self->{values}{all_from} = $file;
234 $self->{values}{all_from} = $file;
233235
234236 # Some methods pull from POD instead of code.
235237 # If there is a matching .pod, use that instead
241243 $self->name_from($file) unless $self->name;
242244 $self->version_from($file) unless $self->version;
243245 $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 || []};
245247 $self->license_from($pod) unless $self->license;
246248 $self->abstract_from($pod) unless $self->abstract;
247249
427429 ([^\n]*)
428430 /ixms) {
429431 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 }
432475 $self->author($author);
433476 } else {
434477 warn "Cannot determine author info from $_[0]\n";
436479 }
437480
438481 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 }
476523 }
477524 }
478525
55
66 use vars qw{$VERSION @ISA $ISCORE};
77 BEGIN {
8 $VERSION = '0.92';
8 $VERSION = '0.95';
99 @ISA = 'Module::Install::Base';
1010 $ISCORE = 1;
1111 }
55
66 use vars qw{$VERSION @ISA $ISCORE};
77 BEGIN {
8 $VERSION = '0.92';;
8 $VERSION = '0.95';;
99 @ISA = qw{Module::Install::Base};
1010 $ISCORE = 1;
1111 }
2525
2626 $self->check_nmake if $args{check_nmake};
2727 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 }
2932 }
3033
3134 # Until ExtUtils::MakeMaker support MYMETA.yml, make sure
1818
1919 use 5.005;
2020 use strict 'vars';
21 use Cwd ();
22 use File::Find ();
23 use File::Path ();
24 use FindBin;
2125
2226 use vars qw{$VERSION $MAIN};
2327 BEGIN {
2731 # This is not enforced yet, but will be some time in the next few
2832 # releases once we can make sure it won't clash with custom
2933 # Module::Install extensions.
30 $VERSION = '0.92';
34 $VERSION = '0.95';
3135
3236 # Storage for the pseudo-singleton
3337 $MAIN = undef;
3741
3842 }
3943
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" }
5263
5364 Please invoke ${\__PACKAGE__} with:
5465
6071
6172 END_DIE
6273
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" }
8396
8497 Your installer $0 has a modification time in the future ($s > $t).
8598
88101 Please correct this, then run $0 again.
89102
90103 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" }
100110
101111 Module::Install no longer supports Build.PL.
102112
106116
107117 END_DIE
108118
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 }
126149
127150 sub autoload {
128151 my $self = shift;
151174 };
152175 }
153176
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
181177 sub preload {
182178 my $self = shift;
183179 unless ( $self->{extensions} ) {
3232
3333 =head2 Examples
3434
35 Let's say that you want to additional properties to
35 Let's say that you want to add additional properties to
3636 attributes. Specifically, we want to add a "label" property to each
3737 attribute, so we can write C<<
3838 My::Class->meta()->get_attribute('size')->label() >>. The first two
9696 The C<get_attribute_list> method returns a list of attribute names. You can
9797 then use C<get_attribute> to get the L<Moose::Meta::Attribute> object itself.
9898
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:
100100
101101 print $point->meta->get_attribute('x')->type_constraint;
102102 => Int
108108
109109 =head1 RECIPE REVIEW
110110
111 We start by creating a new attribute metaclass.
111 We start by creating a new attribute metaclass.
112112
113113 package MyApp::Meta::Attribute::Labeled;
114114 use Moose;
125125
126126 A custom method metaclass lets us add both behavior and
127127 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
129129 API we have for adding these methods is not very pretty.
130130
131131 That can be improved with custom Moose-like sugar, or even by using a
22 use strict;
33 use warnings;
44
5 our $VERSION = '1.01';
5 our $VERSION = '1.02';
66 $VERSION = eval $VERSION;
77 our $AUTHORITY = 'cpan:STEVAN';
88
22 use strict;
33 use warnings;
44
5 our $VERSION = '1.01';
5 our $VERSION = '1.02';
66 $VERSION = eval $VERSION;
77 our $AUTHORITY = 'cpan:STEVAN';
88
22 use strict;
33 use warnings;
44
5 our $VERSION = '1.01';
5 our $VERSION = '1.02';
66 $VERSION = eval $VERSION;
77 our $AUTHORITY = 'cpan:STEVAN';
88
22 use strict;
33 use warnings;
44
5 our $VERSION = '1.01';
5 our $VERSION = '1.02';
66 our $XS_VERSION = $VERSION;
77 $VERSION = eval $VERSION;
88 our $AUTHORITY = 'cpan:STEVAN';
9393 }
9494
9595
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.
10299
103100 sub BUILD {
104101 my $self = shift;
105 my $params_hashref = shift;
102 my $args = shift;
106103
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 );
109109 }
110
111
112110
113111 =head3 BUILD and parent classes
114112
1414 feature. If you encounter a problem and have a solution but don't see
1515 it documented here, or think we missed an important feature, please
1616 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
1731
1832 =head1 1.00
1933
33 use List::Util;
44 use List::MoreUtils;
55
6 our $VERSION = '1.01';
6 our $VERSION = '1.02';
77 $VERSION = eval $VERSION;
88 our $AUTHORITY = 'cpan:STEVAN';
99
345345 return sub {
346346 my ( $instance, $n, $f ) = @_;
347347 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);
352352 }
353 $it;
353
354 return;
354355 };
355356 }
356357
11 package Moose::Meta::Attribute::Native::MethodProvider::Bool;
22 use Moose::Role;
33
4 our $VERSION = '1.01';
4 our $VERSION = '1.02';
55 $VERSION = eval $VERSION;
66 our $AUTHORITY = 'cpan:STEVAN';
77
00 package Moose::Meta::Attribute::Native::MethodProvider::Code;
11 use Moose::Role;
22
3 our $VERSION = '1.01';
3 our $VERSION = '1.02';
44 $VERSION = eval $VERSION;
55 our $AUTHORITY = 'cpan:STEVAN';
66
11 package Moose::Meta::Attribute::Native::MethodProvider::Counter;
22 use Moose::Role;
33
4 our $VERSION = '1.01';
4 our $VERSION = '1.02';
55 $VERSION = eval $VERSION;
66 our $AUTHORITY = 'cpan:STEVAN';
77
00 package Moose::Meta::Attribute::Native::MethodProvider::Hash;
11 use Moose::Role;
22
3 our $VERSION = '1.01';
3 our $VERSION = '1.02';
44 $VERSION = eval $VERSION;
55 our $AUTHORITY = 'cpan:STEVAN';
66
00 package Moose::Meta::Attribute::Native::MethodProvider::String;
11 use Moose::Role;
22
3 our $VERSION = '1.01';
3 our $VERSION = '1.02';
44 $VERSION = eval $VERSION;
55 our $AUTHORITY = 'cpan:STEVAN';
66
11 package Moose::Meta::Attribute::Native::Trait::Array;
22 use Moose::Role;
33
4 our $VERSION = '1.01';
4 our $VERSION = '1.02';
55 $VERSION = eval $VERSION;
66 our $AUTHORITY = 'cpan:STEVAN';
77
11 use Moose::Role;
22 use Moose::Meta::Attribute::Native::MethodProvider::Bool;
33
4 our $VERSION = '1.01';
4 our $VERSION = '1.02';
55 $VERSION = eval $VERSION;
66 our $AUTHORITY = 'cpan:STEVAN';
77
11 use Moose::Role;
22 use Moose::Meta::Attribute::Native::MethodProvider::Code;
33
4 our $VERSION = '1.01';
4 our $VERSION = '1.02';
55 $VERSION = eval $VERSION;
66 our $AUTHORITY = 'cpan:STEVAN';
77
11 package Moose::Meta::Attribute::Native::Trait::Counter;
22 use Moose::Role;
33
4 our $VERSION = '1.01';
4 our $VERSION = '1.02';
55 $VERSION = eval $VERSION;
66 our $AUTHORITY = 'cpan:STEVAN';
77
11 package Moose::Meta::Attribute::Native::Trait::Hash;
22 use Moose::Role;
33
4 our $VERSION = '1.01';
4 our $VERSION = '1.02';
55 $VERSION = eval $VERSION;
66 our $AUTHORITY = 'cpan:STEVAN';
77
00 package Moose::Meta::Attribute::Native::Trait::Number;
11 use Moose::Role;
22
3 our $VERSION = '1.01';
3 our $VERSION = '1.02';
44 $VERSION = eval $VERSION;
55 our $AUTHORITY = 'cpan:STEVAN';
66
00 package Moose::Meta::Attribute::Native::Trait::String;
11 use Moose::Role;
22
3 our $VERSION = '1.01';
3 our $VERSION = '1.02';
44 $VERSION = eval $VERSION;
55 our $AUTHORITY = 'cpan:STEVAN';
66
22 use Moose::Role;
33 use Moose::Util::TypeConstraints;
44
5 our $VERSION = '1.01';
5 our $VERSION = '1.02';
66 $VERSION = eval $VERSION;
77 our $AUTHORITY = 'cpan:STEVAN';
88
00 package Moose::Meta::Attribute::Native;
11
2 our $VERSION = '1.01';
2 our $VERSION = '1.02';
33 $VERSION = eval $VERSION;
44 our $AUTHORITY = 'cpan:STEVAN';
55
88 use Try::Tiny;
99 use overload ();
1010
11 our $VERSION = '1.01';
11 our $VERSION = '1.02';
1212 our $AUTHORITY = 'cpan:STEVAN';
1313
1414 use Moose::Meta::Method::Accessor;
44
55 use Class::MOP;
66
7 our $VERSION = '1.01';
7 our $VERSION = '1.02';
88 $VERSION = eval $VERSION;
99 our $AUTHORITY = 'cpan:STEVAN';
1010
1010 use List::MoreUtils qw( any all uniq first_index );
1111 use Scalar::Util 'weaken', 'blessed';
1212
13 our $VERSION = '1.01';
13 our $VERSION = '1.02';
1414 $VERSION = eval $VERSION;
1515 our $AUTHORITY = 'cpan:STEVAN';
1616
33 use strict;
44 use warnings;
55
6 our $VERSION = '1.01';
6 our $VERSION = '1.02';
77 $VERSION = eval $VERSION;
88 our $AUTHORITY = 'cpan:STEVAN';
99
33 use strict;
44 use warnings;
55
6 our $VERSION = '1.01';
6 our $VERSION = '1.02';
77 $VERSION = eval $VERSION;
88 our $AUTHORITY = 'cpan:STEVAN';
99
22 use strict;
33 use warnings;
44
5 our $VERSION = '1.01';
5 our $VERSION = '1.02';
66 $VERSION = eval $VERSION;
77 our $AUTHORITY = 'cpan:STEVAN';
88
55
66 use Scalar::Util 'blessed', 'weaken', 'looks_like_number', 'refaddr';
77
8 our $VERSION = '1.01';
8 our $VERSION = '1.02';
99 our $AUTHORITY = 'cpan:STEVAN';
1010
1111 use base 'Moose::Meta::Method',
66 use Carp 'confess';
77 use Scalar::Util 'blessed', 'weaken';
88
9 our $VERSION = '1.01';
9 our $VERSION = '1.02';
1010 $VERSION = eval $VERSION;
1111 our $AUTHORITY = 'cpan:STEVAN';
1212
77 use Scalar::Util 'blessed', 'weaken';
88 use Try::Tiny ();
99
10 our $VERSION = '1.01';
10 our $VERSION = '1.02';
1111 $VERSION = eval $VERSION;
1212 our $AUTHORITY = 'cpan:STEVAN';
1313
22 use strict;
33 use warnings;
44
5 our $VERSION = '1.01';
5 our $VERSION = '1.02';
66 $VERSION = eval $VERSION;
77 our $AUTHORITY = 'cpan:STEVAN';
88
22 use strict;
33 use warnings;
44
5 our $VERSION = '1.01';
5 our $VERSION = '1.02';
66 $VERSION = eval $VERSION;
77 our $AUTHORITY = 'cpan:STEVAN';
88
22 use strict;
33 use warnings;
44
5 our $VERSION = '1.01';
5 our $VERSION = '1.02';
66 our $AUTHORITY = 'cpan:STEVAN';
77
88 use base 'Class::MOP::Mixin::AttributeCore';
77
88 use Moose::Meta::Role::Composite;
99
10 our $VERSION = '1.01';
10 our $VERSION = '1.02';
1111 $VERSION = eval $VERSION;
1212 our $AUTHORITY = 'cpan:STEVAN';
1313
66 use Moose::Util 'english_list';
77 use Scalar::Util 'weaken', 'blessed';
88
9 our $VERSION = '1.01';
9 our $VERSION = '1.02';
1010 $VERSION = eval $VERSION;
1111 our $AUTHORITY = 'cpan:STEVAN';
1212
55
66 use Scalar::Util 'blessed';
77
8 our $VERSION = '1.01';
8 our $VERSION = '1.02';
99 $VERSION = eval $VERSION;
1010 our $AUTHORITY = 'cpan:STEVAN';
1111
1717 ));
1818
1919 sub apply {
20 my ( $self, $role, $object ) = @_;
20 my ( $self, $role, $object, $args ) = @_;
2121
2222 my $obj_meta = Class::MOP::class_of($object) || 'Moose::Meta::Class';
2323
2929
3030 my $class = $obj_meta->create_anon_class(
3131 superclasses => [ blessed($object) ],
32 roles => [ $role ],
32 roles => [ $role, keys(%$args) ? ($args) : () ],
3333 cache => 1,
3434 );
3535
55
66 use Scalar::Util 'blessed';
77
8 our $VERSION = '1.01';
8 our $VERSION = '1.02';
99 $VERSION = eval $VERSION;
1010 our $AUTHORITY = 'cpan:STEVAN';
1111
33 use warnings;
44 use metaclass;
55
6 our $VERSION = '1.01';
6 our $VERSION = '1.02';
77 $VERSION = eval $VERSION;
88 our $AUTHORITY = 'cpan:STEVAN';
99
66 use List::MoreUtils 'all';
77 use Scalar::Util 'blessed', 'weaken';
88
9 our $VERSION = '1.01';
9 our $VERSION = '1.02';
1010 our $AUTHORITY = 'cpan:STEVAN';
1111
1212 use base 'Moose::Meta::Mixin::AttributeCore';
55
66 use Scalar::Util 'blessed';
77
8 our $VERSION = '1.01';
8 our $VERSION = '1.02';
99 $VERSION = eval $VERSION;
1010 our $AUTHORITY = 'cpan:STEVAN';
1111
77
88 use base qw(Moose::Meta::Role::Method::Required);
99
10 our $VERSION = '1.01';
10 our $VERSION = '1.02';
1111 $VERSION = eval $VERSION;
1212 our $AUTHORITY = 'cpan:STEVAN';
1313
99
1010 use base qw(Class::MOP::Object);
1111
12 our $VERSION = '1.01';
12 our $VERSION = '1.02';
1313 $VERSION = eval $VERSION;
1414 our $AUTHORITY = 'cpan:STEVAN';
1515
33 use strict;
44 use warnings;
55
6 our $VERSION = '1.01';
6 our $VERSION = '1.02';
77 $VERSION = eval $VERSION;
88 our $AUTHORITY = 'cpan:STEVAN';
99
88 use Carp 'confess';
99 use Devel::GlobalDestruction 'in_global_destruction';
1010
11 our $VERSION = '1.01';
11 our $VERSION = '1.02';
1212 $VERSION = eval $VERSION;
1313 our $AUTHORITY = 'cpan:STEVAN';
1414
398398 ## ------------------------------------------------------------------
399399
400400 sub apply {
401 my ($self, $other, @args) = @_;
401 my ($self, $other, %args) = @_;
402402
403403 (blessed($other))
404404 || Moose->throw_error("You must pass in an blessed instance");
415415 }
416416
417417 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);
419419 }
420420
421421 sub composition_class_roles { }
66
77 use Scalar::Util 'blessed';
88
9 our $VERSION = '1.01';
9 our $VERSION = '1.02';
1010 $VERSION = eval $VERSION;
1111 our $AUTHORITY = 'cpan:STEVAN';
1212
77 use Moose::Meta::Attribute;
88 use Moose::Util::TypeConstraints ();
99
10 our $VERSION = '1.01';
10 our $VERSION = '1.02';
1111 $VERSION = eval $VERSION;
1212 our $AUTHORITY = 'cpan:STEVAN';
1313
66 use Scalar::Util 'blessed';
77 use Moose::Util::TypeConstraints ();
88
9 our $VERSION = '1.01';
9 our $VERSION = '1.02';
1010 $VERSION = eval $VERSION;
1111 our $AUTHORITY = 'cpan:STEVAN';
1212
3333 my $class = $self->class;
3434 $self->hand_optimized_type_constraint(
3535 sub {
36 blessed( $_[0] ) && $_[0]->isa($class)
36 blessed( $_[0] ) && blessed( $_[0] ) ne 'Regexp' && $_[0]->isa($class)
3737 }
3838 );
3939 }
7777 sub is_subtype_of {
7878 my ($self, $type_or_name_or_class ) = @_;
7979
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;
8388 }
8489
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) {
9091 # if $type_or_name_or_class isn't a class, it might be the TC name of another ::Class type
9192 # or it could also just be a type object in this branch
9293 return $self->class->isa( $type->class );
99
1010 use Moose::Util::TypeConstraints ();
1111
12 our $VERSION = '1.01';
12 our $VERSION = '1.02';
1313 $VERSION = eval $VERSION;
1414 our $AUTHORITY = 'cpan:STEVAN';
1515
55
66 use Moose::Util::TypeConstraints ();
77
8 our $VERSION = '1.01';
8 our $VERSION = '1.02';
99 $VERSION = eval $VERSION;
1010 our $AUTHORITY = 'cpan:STEVAN';
1111
33 use warnings;
44 use metaclass;
55
6 our $VERSION = '1.01';
6 our $VERSION = '1.02';
77 $VERSION = eval $VERSION;
88 our $AUTHORITY = 'cpan:STEVAN';
99
77 use Moose::Util::TypeConstraints;
88 use Moose::Meta::TypeConstraint::Parameterizable;
99
10 our $VERSION = '1.01';
10 our $VERSION = '1.02';
1111 $VERSION = eval $VERSION;
1212 our $AUTHORITY = 'cpan:STEVAN';
1313
66
77 use Scalar::Util 'blessed';
88
9 our $VERSION = '1.01';
9 our $VERSION = '1.02';
1010 $VERSION = eval $VERSION;
1111 our $AUTHORITY = 'cpan:STEVAN';
1212
66 use Scalar::Util 'blessed';
77 use Moose::Util::TypeConstraints ();
88
9 our $VERSION = '1.01';
9 our $VERSION = '1.02';
1010 $VERSION = eval $VERSION;
1111 our $AUTHORITY = 'cpan:STEVAN';
1212
88
99 use List::Util qw(first);
1010
11 our $VERSION = '1.01';
11 our $VERSION = '1.02';
1212 $VERSION = eval $VERSION;
1313 our $AUTHORITY = 'cpan:STEVAN';
1414
1212
1313 use base qw(Class::MOP::Object);
1414
15 our $VERSION = '1.01';
15 our $VERSION = '1.02';
1616 $VERSION = eval $VERSION;
1717 our $AUTHORITY = 'cpan:STEVAN';
1818
1111 use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class';
1212 use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class';
1313
14 our $VERSION = '1.01';
14 our $VERSION = '1.02';
1515 $VERSION = eval $VERSION;
1616 our $AUTHORITY = 'cpan:STEVAN';
1717
66
77 use Sub::Exporter;
88
9 our $VERSION = '1.01';
9 our $VERSION = '1.02';
1010 $VERSION = eval $VERSION;
1111 our $AUTHORITY = 'cpan:STEVAN';
1212
33 use warnings;
44 use Scalar::Util 'blessed';
55
6 our $VERSION = '1.01';
6 our $VERSION = '1.02';
77 $VERSION = eval $VERSION;
88 our $AUTHORITY = 'cpan:STEVAN';
99
55 use Class::MOP;
66 use Scalar::Util 'blessed', 'looks_like_number';
77
8 our $VERSION = '1.01';
8 our $VERSION = '1.02';
99 $VERSION = eval $VERSION;
1010 our $AUTHORITY = 'cpan:STEVAN';
1111
55 use Scalar::Util qw( blessed reftype );
66 use Moose::Exporter;
77
8 our $VERSION = '1.01';
8 our $VERSION = '1.02';
99 $VERSION = eval $VERSION;
1010 our $AUTHORITY = 'cpan:STEVAN';
1111
77 use Scalar::Util 'blessed';
88 use Class::MOP 0.60;
99
10 our $VERSION = '1.01';
10 our $VERSION = '1.02';
1111 $VERSION = eval $VERSION;
1212 our $AUTHORITY = 'cpan:STEVAN';
1313
372372 The name resolution mechanism is covered in
373373 L<Moose/Metaclass and Trait Name Resolution>.
374374
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
375383 =item B<english_list(@items)>
376384
377385 Given a list of scalars, turns them into a proper list in English
378386 ("one and two", "one, two, three, and four"). This is used to help us
379387 make nicer error messages.
380388
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
389389 =back
390390
391391 =head1 TODO
33
44 use 5.008;
55
6 our $VERSION = '1.01';
6 our $VERSION = '1.02';
77 $VERSION = eval $VERSION;
88 our $AUTHORITY = 'cpan:STEVAN';
99
88 use List::MoreUtils 'all';
99 use Moose::Util 'does_role', 'find_meta';
1010
11 our $VERSION = '1.01';
11 our $VERSION = '1.02';
1212 $VERSION = eval $VERSION;
1313 our $AUTHORITY = 'cpan:STEVAN';
1414
44
55 use Class::MOP;
66
7 our $VERSION = '1.01';
7 our $VERSION = '1.02';
88 $VERSION = eval $VERSION;
99 our $AUTHORITY = 'cpan:STEVAN';
1010
3131
3232 is( $type->class, "Foo", "class attribute" );
3333
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
3437 ok( $type->is_subtype_of("Gorch"), "subtype of gorch" );
3538
3639 ok( $type->is_subtype_of("Bar"), "subtype of bar" );
5760 ok( !$type->equals(Moose::Meta::TypeConstraint::Class->new( name => "__ANON__", class => "Bar" )), "doesn't equal other anon constraint" );
5861 ok( $type->is_subtype_of(Moose::Meta::TypeConstraint::Class->new( name => "__ANON__", class => "Bar" )), "subtype of other anon constraint" );
5962
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
6068 done_testing;
2222 }
2323
2424 my $Int = find_type_constraint('Int');
25 ok $Int, 'Got a good type contstraint';
25 ok $Int, 'Got a good type constraint';
2626
2727 my $parent = Test::Moose::Meta::TypeConstraint::AnySubType->new({
2828 name => "Test::Moose::Meta::TypeConstraint::AnySubType" ,
66
77 use Test::More;
88 use Test::Exception;
9
10 use File::Spec;
11 use File::Temp 'tempdir';
912
1013 BEGIN {
1114 eval "use Module::Refresh;";
3740
3841 =cut
3942
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');
4147
4248 my $test_module_source_1 = q|
4349 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;
182182 refactored
183183 refactoring
184184 rethrows
185 ROLETYPE
185186 runtime
186187 serializer
187188 stacktrace
1616
1717 if ( $ENV{MOOSE_TEST_MD_ALL} ) {
1818 test_all_dependents( 'Moose', { exclude => $exclude } );
19 done_testing;
1920 }
2021 else {
2122 my @modules = map { chomp; $_ } <DATA>;
23 plan tests => scalar @modules;
2224 test_module($_) for @modules;
23 done_testing;
2425 }
2526
2627 __DATA__
2728 Moose::Autobox
2829 MooseX::ABC
30 MooseX::AbstractFactory
2931 MooseX::Accessors::ReadWritePrivate
3032 MooseX::Aliases
33 MooseX::AlwaysCoerce
3134 MooseX::App::Cmd
35 MooseX::App::Cmd::Command::BashComplete
3236 MooseX::Async
3337 MooseX::Attribute::ENV
38 MooseX::AttributeCloner
39 MooseX::AttributeDefaults
3440 MooseX::AttributeHelpers
41 MooseX::AttributeIndexes
3542 MooseX::AttributeInflate
36 MooseX::Attribute::Prototype
3743 MooseX::Attributes::Curried
3844 MooseX::Blessed::Reconstruct
45 MooseX::CascadeClearing
3946 MooseX::ClassAttribute
4047 MooseX::Clone
4148 MooseX::ConfigFromFile
4653 MooseX::Daemonize
4754 MooseX::Declare
4855 MooseX::DeepAccessors
56 MooseX::Dumper
4957 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
5063 MooseX::FollowPBP
5164 MooseX::Getopt
65 MooseX::Getopt::Defanged
5266 MooseX::GlobRef
53 MooseX::GlobRef::Object
5467 MooseX::HasDefaults
5568 MooseX::Has::Sugar
5669 MooseX::InsideOut
5871 MooseX::Iterator
5972 MooseX::KeyedMutex
6073 MooseX::LazyLogDispatch
74 MooseX::LazyRequire
75 MooseX::Lexical::Types
76 MooseX::LexicalRoleApplication
77 MooseX::Lists
6178 MooseX::LogDispatch
6279 MooseX::Log::Log4perl
6380 MooseX::MakeImmutable
6481 MooseX::Mangle
82 MooseX::MarkAsMethods
83 MooseX::Meta::Attribute::Index
84 MooseX::Meta::Attribute::Lvalue
6585 MooseX::Meta::TypeConstraint::ForceCoercion
86 MooseX::Meta::TypeConstraint::Intersection
87 MooseX::MetaDescription
88 MooseX::Method
6689 MooseX::MethodAttributes
6790 MooseX::Method::Signatures
6891 MooseX::MultiInitArg
6992 MooseX::MultiMethods
7093 MooseX::MutatorAttributes
94 MooseX::Net::API
7195 MooseX::NonMoose
7296 MooseX::Object::Pluggable
7397 MooseX::Param
7599 MooseX::Plaggerize
76100 MooseX::POE
77101 MooseX::Policy::SemiAffordanceAccessor
78 MooseX::Q4MLog
102 MooseX::RelatedClassRoles
103 MooseX::Role::BuildInstanceOf
79104 MooseX::Role::Cmd
105 MooseX::Role::DBIx::Connector
80106 MooseX::Role::Matcher
81107 MooseX::Role::Parameterized
108 MooseX::Role::Restricted
109 MooseX::Role::Strict
110 MooseX::Role::WithOverloading
82111 MooseX::Role::XMLRPC::Client
112 MooseX::Runnable
113 MooseX::Scaffold
83114 MooseX::SemiAffordanceAccessor
115 MooseX::SetOnce
84116 MooseX::SimpleConfig
85117 MooseX::Singleton
86118 MooseX::SingletonMethod
119 MooseX::SlurpyConstructor
87120 MooseX::Storage
88121 MooseX::Storage::Format::XML::Simple
89122 MooseX::StrictConstructor
90123 MooseX::Struct
91124 MooseX::Templated
92125 MooseX::Timestamp
126 MooseX::TrackDirty::Attributes
93127 MooseX::Traits
128 MooseX::Traits::Attribute::CascadeClear
129 MooseX::Traits::Attribute::MergeHashRef
130 MooseX::Traits::Pluggable
131 MooseX::TypeMap
94132 MooseX::Types
95133 MooseX::Types::Authen::Passphrase
134 MooseX::Types::Buf
96135 MooseX::Types::Common
97136 MooseX::Types::Data::GUID
98137 MooseX::Types::DateTime
138 MooseX::Types::DateTime::ButMaintained
139 MooseX::Types::Digest
140 MooseX::Types::Email
99141 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
100148 MooseX::Types::Path::Class
101149 MooseX::Types::Set::Object
102150 MooseX::Types::Structured
103151 MooseX::Types::URI
104152 MooseX::Types::UUID
153 MooseX::Types::UniStr
154 MooseX::Types::Varchar
105155 MooseX::Types::VariantTable
156 MooseX::UndefTolerant
106157 MooseX::WithCache
107158 MooseX::Workers
108159 MooseX::YAML
109 Fey::ORM
110 KiokuDB
160 App::Nopaste
161 App::Termcast
162 Bread::Board
163 Cantella::Worker
164 Carp::REPL
111165 Catalyst
112166 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
113198 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