3 # Test that you can change the invocant.
6 use warnings FATAL => 'all';
8 use Test::More 'no_plan';
10 our $skip_no_invocants;
16 use Function::Parameters qw(:strict);
18 sub new { bless {}, __PACKAGE__ }
21 return ref $arg || $arg;
24 method invocant($class:) {
28 method with_arg($class: $arg) {
32 method without_space($class:$arg) {
38 method no_invocant_class_type($arg) {
42 method no_invocant_named_param(:$arg) {
47 is $@, '', 'compiles without invocant';
52 sub new { bless {}, __PACKAGE__ }
57 sub new { bless {}, __PACKAGE__ }
61 is( Stuff->invocant, 0 );
62 is( Stuff->with_arg(42), 42 );
63 is( Stuff->without_space(42), 42 );
65 my $stuff = Stuff->new;
66 is( $stuff->no_invocant_class_type(Foo::Bar->new), 'Foo::Bar' );
67 is( $stuff->no_invocant_named_param(arg => Foo->new), 'Foo' );