root/lang/perl/MooseX-Plaggerize/trunk/t/03_run_hook_filter.t @ 31976

Revision 31976, 0.6 kB (checked in by tokuhirom, 4 years ago)

use new_object instead of construct_instance

06:46 @autarch:> tokuhirom_: MX::Plaggerize is using ->construct_instance, you can switch

it to ->new_object and it should just work, but the former will be
deprecated soon

Line 
1use Moose;
2use Test::More tests => 1;
3use MooseX::Plaggerize;
4
5my $context = Moose::Meta::Class->create_anon_class(
6    roles        => ['MooseX::Plaggerize'],
7)->new_object;
8
9my $plugin = Moose::Meta::Class->create_anon_class()->new_object;
10
11{
12    $context->register_hook(
13        'filter' => $plugin,
14        sub {
15            my ($self, $c, $txt) = @_;
16            $txt . '1';
17        }
18    );
19    $context->register_hook(
20        'filter' => $plugin,
21        sub {
22            my ($self, $c, $txt) = @_;
23            $txt . '2';
24        }
25    );
26}
27
28my ($got, ) = $context->run_hook_filter('filter', 'src');
29is $got, 'src12';
30
Note: See TracBrowser for help on using the browser.