Commit | Line | Data |
595edbcf |
1 | #!perl |
2 | use strict; |
3 | use warnings FATAL => 'all'; |
4 | |
5 | use Test::More tests => 3; # last test to print |
6 | use Function::Parameters qw(:strict); |
7 | |
8 | |
9 | my $evalcode = do { |
10 | local $/ = undef; |
11 | <DATA>; |
12 | }; |
13 | |
14 | ok( |
15 | do { |
16 | my $r = eval $evalcode; |
17 | die $@ if not $r; |
18 | 1; |
19 | }, |
20 | 'Basic Eval Moose' |
21 | ); |
22 | |
23 | my $foo = foo->new({}); |
24 | is ($foo->example (), 1, 'First method declared'); |
25 | is ($foo->example2(), 2, 'Second method declared (after injected semicolon)'); |
26 | |
27 | __DATA__ |
28 | { |
29 | package foo; |
30 | |
31 | use Function::Parameters qw(:strict); |
32 | method new($class: $init) { bless $init, $class } |
33 | method example { 1 } # look Ma, no semicolon! |
34 | method example2 { 2 } |
35 | } |
36 | 1; |