[svn-upgrade] Integrating new upstream version, libany-moose-perl (0.12)
Jonathan Yu
14 years ago
0 | 0.12 Fri 02 Apr 2010 | |
1 | * t/000-version.t for better diagnostics (tokuhirom) | |
2 | * Slight performance improvements for is_class_loaded, | |
3 | lazily loading Carp, etc (Sartak) | |
4 | * Start some real documentation (Sartak) | |
5 | * Document $ENV{ANY_MOOSE} (Sartak) | |
6 | - fixes [rt.cpan.org #52339] | |
7 | * Test that Moose is loaded, not CMOP (Sartak) | |
8 | - fixes [rt.cpan.org #56093] | |
9 | * Alias class_of and more functions (Sartak) | |
10 | - requested by [rt.cpan.org #52275] | |
11 | ||
0 | 12 | 0.11 Sun 19 Dec 2009 |
1 | 13 | * Support "use Any::Moose '::Util::TypeConstraints'" (gfx) |
2 | 14 | * Support "no Any::Moose '::Util::TypeConstraints'" (gfx) |
0 | This software is copyright (c) 2009 by Best Practical Solutions. | |
0 | This software is copyright (c) 2010 by Best Practical Solutions. | |
1 | 1 | |
2 | 2 | This is free software; you can redistribute it and/or modify it under |
3 | the same terms as perl itself. | |
4 | ||
5 | Terms of Perl itself | |
3 | the same terms as the Perl 5 programming language system itself. | |
4 | ||
5 | Terms of the Perl programming language system itself | |
6 | 6 | |
7 | 7 | a) the GNU General Public License as published by the Free |
8 | 8 | Software Foundation; either version 1, or (at your option) any |
11 | 11 | |
12 | 12 | --- The GNU General Public License, Version 1, February 1989 --- |
13 | 13 | |
14 | This software is Copyright (c) 2009 by Best Practical Solutions. | |
14 | This software is Copyright (c) 2010 by Best Practical Solutions. | |
15 | 15 | |
16 | 16 | This is free software, licensed under: |
17 | 17 | |
269 | 269 | |
270 | 270 | --- The Artistic License 1.0 --- |
271 | 271 | |
272 | This software is Copyright (c) 2009 by Best Practical Solutions. | |
272 | This software is Copyright (c) 2010 by Best Practical Solutions. | |
273 | 273 | |
274 | 274 | This is free software, licensed under: |
275 | 275 |
5 | 5 | README |
6 | 6 | dist.ini |
7 | 7 | lib/Any/Moose.pm |
8 | t/000-version.t | |
8 | 9 | t/001-basic-moose.t |
9 | 10 | t/001-basic-mouse.t |
10 | 11 | t/002-other-modules-moose.t |
12 | 13 | t/003-is_moose_loaded.t |
13 | 14 | t/004-x-modules-moose.t |
14 | 15 | t/004-x-modules-mouse.t |
15 | t/005-is_class_loaded-moose.t | |
16 | t/005-is_class_loaded-mouse.t | |
16 | t/005-aliases-moose.t | |
17 | t/005-aliases-mouse.t | |
17 | 18 | t/010-use_mouse_roles.t |
18 | 19 | t/011-use_moose_roles.t |
19 | 20 | t/012-use_moose_util.t |
21 | 22 | t/020-strict.t |
22 | 23 | t/100-canonicalize-fragments.t |
23 | 24 | t/101-localize-errvar.t |
25 | t/lib/AnyMooseTest.pm | |
24 | 26 | t/release-pod-coverage.t |
25 | 27 | t/release-pod-syntax.t⏎ |
5 | 5 | - 'Stevan Little <stevan@iinteractive.com>' |
6 | 6 | - 'Tokuhiro Matsuno <tokuhirom@gmail.com>' |
7 | 7 | - 'Goro Fuji <gfuji@cpan.org>' |
8 | generated_by: 'Dist::Zilla version 1.093400' | |
8 | build_requires: {} | |
9 | configure_requires: | |
10 | ExtUtils::MakeMaker: 6.31 | |
11 | generated_by: 'Dist::Zilla version 2.100921' | |
9 | 12 | license: perl |
10 | 13 | meta-spec: |
11 | 14 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
12 | 15 | version: 1.4 |
13 | 16 | name: Any-Moose |
17 | recommends: {} | |
14 | 18 | requires: |
15 | 19 | Mouse: 0.40 |
16 | 20 | perl: 5.006_002 |
17 | version: 0.11 | |
21 | version: 0.12 |
3 | 3 | |
4 | 4 | BEGIN { require 5.006_002; } |
5 | 5 | |
6 | use ExtUtils::MakeMaker; | |
6 | use ExtUtils::MakeMaker 6.31; | |
7 | 7 | |
8 | WriteMakefile( | |
9 | DISTNAME => 'Any-Moose', | |
10 | NAME => 'Any::Moose', | |
11 | AUTHOR => "Shawn\ M\ Moore\ \<sartak\@bestpractical\.com\>\,\ Florian\ Ragwitz\ \<rafl\@debian\.org\>\,\ Stevan\ Little\ \<stevan\@iinteractive\.com\>\,\ Tokuhiro\ Matsuno\ \<tokuhirom\@gmail\.com\>\,\ Goro\ Fuji\ \<gfuji\@cpan\.org\>", | |
12 | ABSTRACT => "use\ Moose\ or\ Mouse\ modules", | |
13 | VERSION => '0.11', | |
14 | EXE_FILES => [ qw() ], | |
15 | (eval { ExtUtils::MakeMaker->VERSION(6.31) } ? (LICENSE => 'perl') : ()), | |
16 | PREREQ_PM => { | |
17 | "Mouse" => '0.40', | |
18 | }, | |
19 | test => {TESTS => 't/*.t'} | |
20 | ); | |
21 | 8 | |
9 | ||
10 | my %WriteMakefileArgs = ( | |
11 | 'test' => { | |
12 | 'TESTS' => 't/*.t' | |
13 | }, | |
14 | 'NAME' => 'Any::Moose', | |
15 | 'DISTNAME' => 'Any-Moose', | |
16 | 'CONFIGURE_REQUIRES' => { | |
17 | 'ExtUtils::MakeMaker' => '6.31' | |
18 | }, | |
19 | 'AUTHOR' => 'Shawn M Moore <sartak@bestpractical.com>, Florian Ragwitz <rafl@debian.org>, Stevan Little <stevan@iinteractive.com>, Tokuhiro Matsuno <tokuhirom@gmail.com>, Goro Fuji <gfuji@cpan.org>', | |
20 | 'BUILD_REQUIRES' => {}, | |
21 | 'ABSTRACT' => 'use Moose or Mouse modules', | |
22 | 'EXE_FILES' => [], | |
23 | 'VERSION' => '0.12', | |
24 | 'PREREQ_PM' => { | |
25 | 'Mouse' => '0.40' | |
26 | }, | |
27 | 'LICENSE' => 'perl' | |
28 | ); | |
29 | ||
30 | ||
31 | delete $WriteMakefileArgs{BUILD_REQUIRES} | |
32 | unless eval { ExtUtils::MakeMaker->VERSION(6.56) }; | |
33 | ||
34 | delete $WriteMakefileArgs{CONFIGURE_REQUIRES} | |
35 | unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; | |
36 | ||
37 | WriteMakefile(%WriteMakefileArgs); | |
38 | ||
39 | ||
40 |
0 | 0 | |
1 | 1 | |
2 | This archive contains the distribution Any-Moose, version | |
3 | 0.11: | |
2 | This archive contains the distribution Any-Moose, | |
3 | version 0.12: | |
4 | 4 | |
5 | 5 | use Moose or Mouse modules |
6 | 6 | |
7 | This software is copyright (c) 2009 by Best Practical Solutions. | |
7 | This software is copyright (c) 2010 by Best Practical Solutions. | |
8 | 8 | |
9 | 9 | This is free software; you can redistribute it and/or modify it under |
10 | the same terms as perl itself. | |
10 | the same terms as the Perl 5 programming language system itself. | |
11 | 11 | |
12 |
0 | 0 | name = Any-Moose |
1 | version = 0.11 | |
1 | version = 0.12 | |
2 | 2 | author = Shawn M Moore <sartak@bestpractical.com> |
3 | 3 | author = Florian Ragwitz <rafl@debian.org> |
4 | 4 | author = Stevan Little <stevan@iinteractive.com> |
0 | 0 | package Any::Moose; |
1 | our $VERSION = '0.11'; | |
1 | BEGIN { | |
2 | $Any::Moose::VERSION = '0.12'; | |
3 | } | |
2 | 4 | # ABSTRACT: use Moose or Mouse modules |
3 | 5 | |
4 | 6 | use 5.006_002; |
5 | 7 | use strict; |
6 | 8 | use warnings; |
7 | 9 | |
8 | use Carp (); | |
9 | ||
10 | our $PREFERRED = $ENV{'ANY_MOOSE'}; | |
10 | # decide which backend to use | |
11 | our $PREFERRED; | |
12 | do { | |
13 | local $@; | |
14 | if ($ENV{ANY_MOOSE}) { | |
15 | $PREFERRED = $ENV{'ANY_MOOSE'}; | |
16 | warn "ANY_MOOSE is not set to Moose or Mouse" | |
17 | unless $PREFERRED eq 'Moose' | |
18 | || $PREFERRED eq 'Mouse'; | |
19 | ||
20 | # if we die here, then perl gives "unknown error" which doesn't tell | |
21 | # you what the problem is at all. argh. | |
22 | if ($PREFERRED eq 'Moose' && !eval { require Moose }) { | |
23 | warn "\$ANY_MOOSE is set to Moose but we cannot load it"; | |
24 | } | |
25 | elsif ($PREFERRED eq 'Mouse' && !eval { require Mouse }) { | |
26 | warn "\$ANY_MOOSE is set to Mouse but we cannot load it"; | |
27 | } | |
28 | } | |
29 | elsif (_is_moose_loaded()) { | |
30 | $PREFERRED = 'Moose'; | |
31 | } | |
32 | elsif (eval { require Mouse }) { | |
33 | $PREFERRED = 'Mouse'; | |
34 | } | |
35 | elsif (eval { require Moose }) { | |
36 | $PREFERRED = 'Moose'; | |
37 | } | |
38 | else { | |
39 | require Carp; | |
40 | warn "Unable to locate Mouse or Moose in INC"; | |
41 | } | |
42 | }; | |
11 | 43 | |
12 | 44 | sub import { |
13 | 45 | my $self = shift; |
54 | 86 | . '$module->unimport();'; |
55 | 87 | $@; |
56 | 88 | }; |
57 | Carp::croak("Cannot unimport Any::Moose: $e") if $e; | |
89 | ||
90 | if ($e) { | |
91 | require Carp; | |
92 | Carp::croak("Cannot unimport Any::Moose: $e"); | |
93 | } | |
94 | ||
58 | 95 | return; |
59 | 96 | } |
60 | 97 | |
115 | 152 | . '$module->import(@{ $options->{imports} });'; |
116 | 153 | $@; |
117 | 154 | }; |
118 | Carp::croak("Cannot import Any::Moose: $e") if $e; | |
155 | if ($e) { | |
156 | require Carp; | |
157 | Carp::croak("Cannot import Any::Moose: $e"); | |
158 | } | |
119 | 159 | return; |
120 | 160 | } |
121 | 161 | |
134 | 174 | |
135 | 175 | return $fragment if $backer =~ /^Moose/; |
136 | 176 | |
137 | if (!$PREFERRED) { | |
138 | local $@; | |
139 | if (_is_moose_loaded()) { | |
140 | $PREFERRED = 'Moose'; | |
141 | } | |
142 | elsif (eval { require Mouse }) { | |
143 | $PREFERRED = 'Mouse'; | |
144 | } | |
145 | elsif (eval { require Moose }) { | |
146 | $PREFERRED = 'Moose'; | |
147 | } | |
148 | else { | |
149 | require Carp; | |
150 | Carp::confess("Unable to locate Mouse or Moose in INC"); | |
151 | } | |
152 | } | |
153 | ||
154 | 177 | $fragment =~ s/^Moose/Mouse/ if mouse_is_preferred(); |
155 | 178 | return $fragment; |
156 | 179 | } |
157 | 180 | |
158 | sub load_class { | |
159 | my ($class_name) = @_; | |
160 | return Class::MOP::load_class($class_name) if moose_is_preferred(); | |
161 | return Mouse::load_class($class_name); | |
162 | } | |
163 | ||
164 | sub is_class_loaded { | |
165 | my ($class_name) = @_; | |
166 | return Class::MOP::is_class_loaded($class_name) if moose_is_preferred(); | |
167 | return Mouse::is_class_loaded($class_name); | |
181 | for my $name (qw/load_class is_class_loaded class_of get_metaclass_by_name get_all_metaclass_instances get_all_metaclass_names/) { | |
182 | no strict 'refs'; | |
183 | *{__PACKAGE__."::$name"} = moose_is_preferred() | |
184 | ? *{"Class::MOP::$name"} | |
185 | : *{"Mouse::Util::$name"}; | |
168 | 186 | } |
169 | 187 | |
170 | 188 | sub moose_is_preferred { $PREFERRED eq 'Moose' } |
171 | 189 | sub mouse_is_preferred { $PREFERRED eq 'Mouse' } |
172 | 190 | |
173 | sub _is_moose_loaded { exists $INC{'Class/MOP.pm'} } | |
191 | sub _is_moose_loaded { exists $INC{'Moose.pm'} } | |
174 | 192 | |
175 | 193 | sub is_moose_loaded { |
194 | require Carp; | |
176 | 195 | Carp::carp("Any::Moose::is_moose_loaded is deprecated. Please use Any::Moose::moose_is_preferred instead"); |
177 | 196 | goto \&_is_moose_loaded; |
178 | 197 | } |
208 | 227 | |
209 | 228 | =head1 VERSION |
210 | 229 | |
211 | version 0.11 | |
230 | version 0.12 | |
212 | 231 | |
213 | 232 | =head1 SYNOPSIS |
214 | 233 | |
234 | ||
215 | 235 | =head2 BASIC |
216 | 236 | |
237 | ||
217 | 238 | package Class; |
218 | 239 | |
219 | # uses Moose if it's loaded, Mouse otherwise | |
240 | # uses Moose if it's loaded or demanded, Mouse otherwise | |
220 | 241 | use Any::Moose; |
221 | 242 | |
222 | 243 | # cleans the namespace up |
223 | 244 | no Any::Moose; |
224 | 245 | |
225 | 246 | =head2 OTHER MODULES |
247 | ||
226 | 248 | |
227 | 249 | package Other::Class; |
228 | 250 | use Any::Moose; |
231 | 253 | # Mouse::Util::TypeConstraints otherwise. |
232 | 254 | use Any::Moose '::Util::TypeConstraints'; |
233 | 255 | |
256 | =head2 ROLES | |
257 | ||
258 | ||
259 | package My::Sorter; | |
260 | use Any::Moose 'Role'; | |
261 | ||
262 | requires 'cmp'; | |
263 | ||
234 | 264 | =head2 COMPLEX USAGE |
265 | ||
235 | 266 | |
236 | 267 | package My::Meta::Class; |
237 | 268 | use Any::Moose; |
244 | 275 | '::Util' => ['does_role'], |
245 | 276 | ); |
246 | 277 | |
247 | # uses MouseX::Types | |
278 | # uses MouseX::Types or MooseX::Types | |
248 | 279 | use Any::Moose 'X::Types'; |
249 | 280 | |
250 | 281 | # gives you the right class name depending on which Mo*se was loaded |
252 | 283 | |
253 | 284 | =head1 DESCRIPTION |
254 | 285 | |
255 | Actual documentation is forthcoming, once we solidify all the bits of the API. | |
256 | The examples above are very likely to continue working. | |
286 | ||
287 | Though we recommend that people generally use L<Moose>, we accept that Moose | |
288 | cannot yet be used for everything everywhere. People generally like the Moose | |
289 | sugar, so many people use L<Mouse>, a lightweight replacement for parts of | |
290 | Moose. | |
291 | ||
292 | ||
293 | Because Mouse strives for compatibility with Moose, it's easy to substitute one | |
294 | for the other. This module facilitates that substitution. By default, Mouse | |
295 | will be provided to libraries, unless Moose is already loaded -or- | |
296 | explicitly requested by the end-user. The end-user can force the decision | |
297 | of which backend to use by setting the environment variable C<ANY_MOOSE> to | |
298 | be C<Moose> or C<Mouse>. | |
299 | ||
300 | ||
301 | Note that the decision of which backend to use is made only once, so that if | |
302 | Any-Moose picks Mouse, then a third-party library loads Moose, anything else | |
303 | that uses Any-Moose will continue to pick Mouse. | |
304 | ||
305 | ||
306 | So, if you have to use L<Mouse>, please be considerate to the Moose fanboys | |
307 | (like myself!) and use L<Any-Moose> instead. C<:)> | |
257 | 308 | |
258 | 309 | =head1 SEE ALSO |
259 | 310 | |
311 | ||
260 | 312 | L<Moose> |
261 | 313 | |
314 | ||
262 | 315 | L<Mouse> |
316 | ||
317 | ||
318 | L<Squirrel> - a deprecated first-stab at Any-Moose-like logic. Its biggest | |
319 | fault was in making the decision of which backend to use every time it was | |
320 | used, rather than just once. | |
263 | 321 | |
264 | 322 | =head1 AUTHORS |
265 | 323 | |
271 | 329 | |
272 | 330 | =head1 COPYRIGHT AND LICENSE |
273 | 331 | |
274 | This software is copyright (c) 2009 by Best Practical Solutions. | |
332 | This software is copyright (c) 2010 by Best Practical Solutions. | |
275 | 333 | |
276 | 334 | This is free software; you can redistribute it and/or modify it under |
277 | the same terms as perl itself. | |
335 | the same terms as the Perl 5 programming language system itself. | |
278 | 336 | |
279 | 337 | =cut |
280 | 338 |
0 | use strict; | |
1 | use Test::More tests => 1; | |
2 | use_ok 'Any::Moose'; | |
3 | ||
4 | show_version($_) for qw/ | |
5 | Mouse | |
6 | MouseX::Types | |
7 | Moose | |
8 | Class::MOP | |
9 | MooseX::Types | |
10 | /; | |
11 | ||
12 | sub show_version { | |
13 | my $klass = shift; | |
14 | if (eval "require $klass; 1;") { | |
15 | no strict 'refs'; | |
16 | diag "$klass: " . ${"${klass}::VERSION"}; | |
17 | } else { | |
18 | diag "$klass not found"; | |
19 | } | |
20 | } |
0 | #!/usr/bin/env perl | |
1 | use strict; | |
2 | use warnings; | |
3 | use Test::More; | |
4 | ||
5 | BEGIN { delete $ENV{ANY_MOOSE} } | |
6 | ||
7 | BEGIN { | |
8 | eval 'require Moose;'; | |
9 | plan skip_all => 'Moose not available' if $@; | |
10 | plan tests => 20; | |
11 | } | |
12 | ||
13 | package MyClass; | |
14 | use Any::Moose; | |
15 | ||
16 | package main; | |
17 | ||
18 | ok(Any::Moose::is_class_loaded('Moose'), 'Moose is loaded'); | |
19 | ok(Any::Moose::is_class_loaded('MyClass'), 'MyClass is loaded'); | |
20 | ok(!Any::Moose::is_class_loaded('NonexistentPackage'), 'NonexistentPackage is not loaded'); | |
21 | ||
22 | push @INC, 't/lib'; | |
23 | ||
24 | ok(!Any::Moose::is_class_loaded('AnyMooseTest'), 'AnyMooseTest not yet loaded'); | |
25 | ok(Any::Moose::load_class('AnyMooseTest'), 'Loading AnyMooseTest'); | |
26 | ok(Any::Moose::is_class_loaded('AnyMooseTest'), 'AnyMooseTest now loaded'); | |
27 | ||
28 | is(eval { Any::Moose::load_class('NonexistentTest'); 1 }, undef, 'load_class on nonexistent module fails'); | |
29 | ok(!Any::Moose::is_class_loaded('NonexistentTest'), 'and it is still not loaded'); | |
30 | ||
31 | like(Any::Moose::class_of('MyClass'), qr/Moose::Meta::Class=HASH/, 'metaclass check'); | |
32 | is(Any::Moose::class_of('NonexistentTest'), undef, 'class_of nonexistent class is undef'); | |
33 | like(Any::Moose::class_of(MyClass->new), qr/Moose::Meta::Class=HASH/, 'metaclass check via object'); | |
34 | ||
35 | like(Any::Moose::get_metaclass_by_name('MyClass'), qr/Moose::Meta::Class=HASH/, 'metaclass check'); | |
36 | is(Any::Moose::get_metaclass_by_name('NonexistentTest'), undef, 'class_of nonexistent class is undef'); | |
37 | is(Any::Moose::get_metaclass_by_name(MyClass->new), undef, 'get_metaclass_by_name via object returns undef'); | |
38 | ||
39 | my %metaclasses = map { $_->name => $_ } Any::Moose::get_all_metaclass_instances(); | |
40 | is($metaclasses{MyClass}, MyClass->meta); | |
41 | is($metaclasses{AnyMooseTest}, AnyMooseTest->meta); | |
42 | is($metaclasses{NonexistentTest}, undef); | |
43 | ||
44 | is((grep { $_ eq 'MyClass' } Any::Moose::get_all_metaclass_names()), 1); | |
45 | is((grep { $_ eq 'AnyMooseTest' } Any::Moose::get_all_metaclass_names()), 1); | |
46 | is((grep { $_ eq 'NonexistentTest' } Any::Moose::get_all_metaclass_names()), 0); | |
47 |
0 | #!/usr/bin/env perl | |
1 | use strict; | |
2 | use warnings; | |
3 | use Test::More; | |
4 | ||
5 | BEGIN { delete $ENV{ANY_MOOSE} } | |
6 | ||
7 | BEGIN { | |
8 | eval 'require Mouse;'; | |
9 | plan skip_all => 'Mouse not available' if $@; | |
10 | plan tests => 20; | |
11 | } | |
12 | ||
13 | package MyClass; | |
14 | use Any::Moose; | |
15 | ||
16 | package main; | |
17 | ||
18 | ok(Any::Moose::is_class_loaded('Mouse'), 'Mouse is loaded'); | |
19 | ok(Any::Moose::is_class_loaded('MyClass'), 'MyClass is loaded'); | |
20 | ok(!Any::Moose::is_class_loaded('NonexistentPackage'), 'NonexistentPackage is not loaded'); | |
21 | ||
22 | push @INC, 't/lib'; | |
23 | ||
24 | ok(!Any::Moose::is_class_loaded('AnyMooseTest'), 'AnyMooseTest not yet loaded'); | |
25 | ok(Any::Moose::load_class('AnyMooseTest'), 'Loading AnyMooseTest'); | |
26 | ok(Any::Moose::is_class_loaded('AnyMooseTest'), 'AnyMooseTest now loaded'); | |
27 | ||
28 | is(eval { Any::Moose::load_class('NonexistentTest'); 1 }, undef, 'load_class on nonexistent module fails'); | |
29 | ok(!Any::Moose::is_class_loaded('NonexistentTest'), 'and it is still not loaded'); | |
30 | ||
31 | like(Any::Moose::class_of('MyClass'), qr/Mouse::Meta::Class=HASH/, 'metaclass check'); | |
32 | is(Any::Moose::class_of('NonexistentTest'), undef, 'class_of nonexistent class is undef'); | |
33 | like(Any::Moose::class_of(MyClass->new), qr/Mouse::Meta::Class=HASH/, 'metaclass check via object'); | |
34 | ||
35 | like(Any::Moose::get_metaclass_by_name('MyClass'), qr/Mouse::Meta::Class=HASH/, 'metaclass check'); | |
36 | is(Any::Moose::get_metaclass_by_name('NonexistentTest'), undef, 'class_of nonexistent class is undef'); | |
37 | is(Any::Moose::get_metaclass_by_name(MyClass->new), undef, 'get_metaclass_by_name via object returns undef'); | |
38 | ||
39 | my %metaclasses = map { $_->name => $_ } Any::Moose::get_all_metaclass_instances(); | |
40 | is($metaclasses{MyClass}, MyClass->meta); | |
41 | is($metaclasses{AnyMooseTest}, AnyMooseTest->meta); | |
42 | is($metaclasses{NonexistentTest}, undef); | |
43 | ||
44 | is((grep { $_ eq 'MyClass' } Any::Moose::get_all_metaclass_names()), 1); | |
45 | is((grep { $_ eq 'AnyMooseTest' } Any::Moose::get_all_metaclass_names()), 1); | |
46 | is((grep { $_ eq 'NonexistentTest' } Any::Moose::get_all_metaclass_names()), 0); | |
47 |
0 | #!/usr/bin/env perl | |
1 | use strict; | |
2 | use warnings; | |
3 | use Test::More; | |
4 | ||
5 | BEGIN { delete $ENV{ANY_MOOSE} } | |
6 | ||
7 | BEGIN { | |
8 | eval 'require Moose;'; | |
9 | plan skip_all => 'Moose not available' if $@; | |
10 | plan tests => 2; | |
11 | } | |
12 | ||
13 | package MyFoo; | |
14 | use Any::Moose; | |
15 | ::ok Any::Moose::is_class_loaded('Moose'); | |
16 | ::ok !Any::Moose::is_class_loaded('Meese'); | |
17 |
0 | #!/usr/bin/env perl | |
1 | use strict; | |
2 | use warnings; | |
3 | use Test::More; | |
4 | ||
5 | BEGIN { delete $ENV{ANY_MOOSE} } | |
6 | ||
7 | BEGIN { | |
8 | eval 'require Mouse'; | |
9 | plan skip_all => 'Mouse not available' if $@; | |
10 | plan tests => 2; | |
11 | } | |
12 | ||
13 | { | |
14 | package MyFoo; | |
15 | use Any::Moose; | |
16 | } | |
17 | ||
18 | package main; | |
19 | ok(Any::Moose::is_class_loaded('Mouse')); | |
20 | ok(!Any::Moose::is_class_loaded('Meese')); | |
21 |