perlunifaq, uniintro: fix for 80 col display
[p5sagit/p5-mst-13.2.git] / cpan / Module-Pluggable / t / 07instantiate.t
CommitLineData
3f7169a2 1#!perl -w
2
3use strict;
4use FindBin;
183ac38d 5use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
3f7169a2 6use Test::More tests => 6;
7
8my $foo;
9ok($foo = MyTest->new());
10
11
12
13my @plugins;
14ok(@plugins = sort $foo->booga(nork => 'fark'));
15is(ref $plugins[0],'MyTest::Extend::Plugin::Bar');
16is($plugins[0]->nork,'fark');
17
18
19@plugins = ();
20eval { @plugins = $foo->wooga( nork => 'fark') };
21is($@, '');
22is(scalar(@plugins),0);
23
24
25package MyTest;
26use File::Spec::Functions qw(catdir);
27use strict;
28use FindBin;
183ac38d 29use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
3f7169a2 30use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"], sub_name => 'booga', instantiate => 'new');
31use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"], sub_name => 'wooga', instantiate => 'nosomuchmethod');
32
33
34sub new {
35 my $class = shift;
36 return bless {}, $class;
37
38}
391;
40