This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
patch@32274 t/op/taint.t not cleaning up properly on VMS.
[perl5.git] / t / Module_Pluggable / 13exceptregex.t
CommitLineData
3f7169a2
RGS
1#!perl -w
2
3use strict;
4use FindBin;
5use lib "$FindBin::Bin/lib";
6use 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
40package MyTest;
41
42use strict;
43use Module::Pluggable except => qr/MyTest::Plugin::Foo/;
44
45
46
47sub new {
48 my $class = shift;
49 return bless {}, $class;
50
51}
52
53package MyTestSub;
54
55use strict;
56use Module::Pluggable search_path => "MyTest::Plugin";
57
58
59sub new {
60 my $class = shift;
61 my $self = bless {}, $class;
62
63 $self->except(qr/MyTest::Plugin::Foo/);
64
65 return $self;
66}
671;
68