3 # Test that you can change the invocant.
6 use warnings FATAL => 'all';
11 : (skip_all => "Moose required for testing types")
14 our $skip_no_invocants;
20 use Function::Parameters qw(:strict);
22 sub new { bless {}, __PACKAGE__ }
25 return ref $arg || $arg;
28 method invocant($class:) {
32 method with_arg($class: $arg) {
36 method without_space($class:$arg) {
42 method no_invocant_class_type(Foo::Bar $arg) {
46 method no_invocant_named_param(Foo :$arg) {
51 is $@, '', 'compiles without invocant';
56 sub new { bless {}, __PACKAGE__ }
61 sub new { bless {}, __PACKAGE__ }
65 is( Stuff->invocant, 0 );
66 is( Stuff->with_arg(42), 42 );
67 is( Stuff->without_space(42), 42 );
69 my $stuff = Stuff->new;
70 is( $stuff->no_invocant_class_type(Foo::Bar->new), 'Foo::Bar' );
71 is( $stuff->no_invocant_named_param(arg => Foo->new), 'Foo' );