The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

#!perl
use strict;
use warnings FATAL => 'all';
{
package Foo;
use Function::Parameters qw(:strict);
method new($class:) { bless {}, $class }
method bar(@) { 42 }
}
my $foo = Foo->new;
is(exception {
$foo->bar
}, undef, 'method without signature succeeds when called without args');
is(exception {
$foo->bar(42)
}, undef, 'method without signature succeeds when called with args');
done_testing;