4 if ($^O eq 'VMS' || $^O eq 'VOS') {
5 print "1..0 # Skip: can't handle misspelled plugin names\n";
13 use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
14 use File::Spec::Functions qw(catfile);
17 my ($dodgy_file) = (catfile($FindBin::Bin, "lib", "OddTest", "Plugin", "-Dodgy.pm")=~/^(.*)$/);
18 unless (-f $dodgy_file) {
19 plan skip_all => "Can't handle misspelled plugin names\n";
26 ok($foo = OddTest->new());
29 my @expected = ('OddTest::Plugin::-Dodgy', 'OddTest::Plugin::Foo');
30 ok(@plugins = sort $foo->plugins);
31 is_deeply(\@plugins, \@expected, "is deeply");
34 my @odd_expected = qw(OddTest::Plugin::Foo);
35 ok(@odd_plugins = sort $foo->odd_plugins);
36 is_deeply(\@odd_plugins, \@odd_expected, "is deeply");
39 package OddTest::Pluggable;
42 use base qw(Module::Pluggable::Object);
47 my @files = $self->SUPER::find_files(@_);
48 return grep { !/(^|\/)-/ } $self->SUPER::find_files(@_) ;
54 use Module::Pluggable;
59 return bless {}, $class;
66 my ($pkg, $file) = caller;
67 # the default name for the method is 'plugins'
68 my $sub = $opts{'sub_name'} || 'plugins';
70 my ($package) = $opts{'package'} || "OddTest";
71 $opts{filename} = $file;
72 $opts{package} = $package;
76 my $op = OddTest::Pluggable->new( package => ref($self) );
77 return $op->plugins(@_);