Commit | Line | Data |
---|---|---|
3f7169a2 RGS |
1 | #!perl -w |
2 | ||
3 | use strict; | |
4 | use FindBin; | |
5 | use lib "$FindBin::Bin/lib"; | |
6 | use Test::More tests => 10; | |
7 | ||
8 | { | |
9 | my $foo; | |
10 | ok($foo = MyTest->new()); | |
11 | ||
12 | my @plugins; | |
13 | my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo); | |
14 | ok(@plugins = sort $foo->plugins); | |
15 | ||
16 | is_deeply(\@plugins, \@expected); | |
17 | ||
18 | @plugins = (); | |
19 | ||
20 | ok(@plugins = sort MyTest->plugins); | |
21 | is_deeply(\@plugins, \@expected); | |
22 | } | |
23 | ||
24 | { | |
25 | my $foo; | |
26 | ok($foo = MyTestSub->new()); | |
27 | ||
28 | my @plugins; | |
29 | my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo); | |
30 | ok(@plugins = sort $foo->plugins); | |
31 | ||
32 | is_deeply(\@plugins, \@expected); | |
33 | ||
34 | @plugins = (); | |
35 | ||
36 | ok(@plugins = sort MyTestSub->plugins); | |
37 | is_deeply(\@plugins, \@expected); | |
38 | } | |
39 | ||
40 | package MyTest; | |
41 | ||
42 | use strict; | |
43 | use Module::Pluggable except => qr/MyTest::Plugin::Foo/; | |
44 | ||
45 | ||
46 | ||
47 | sub new { | |
48 | my $class = shift; | |
49 | return bless {}, $class; | |
50 | ||
51 | } | |
52 | ||
53 | package MyTestSub; | |
54 | ||
55 | use strict; | |
56 | use Module::Pluggable search_path => "MyTest::Plugin"; | |
57 | ||
58 | ||
59 | sub new { | |
60 | my $class = shift; | |
61 | my $self = bless {}, $class; | |
62 | ||
63 | $self->except(qr/MyTest::Plugin::Foo/); | |
64 | ||
65 | return $self; | |
66 | } | |
67 | 1; | |
68 |