diff options
author | Toby Inkster <mail@tobyinkster.co.uk> | 2022-09-22 10:04:00 +0100 |
---|---|---|
committer | Toby Inkster <mail@tobyinkster.co.uk> | 2022-09-22 10:04:00 +0100 |
commit | 6a854c17bd8f6e8eefd9cf4ede8ad134cba0f425 (patch) | |
tree | 6646fbd014d317501fac5290aab7da8bd29805bd /lib/Type/Params.pm | |
parent | 4482eabe55a0ffc7565c06b38cfa9c002a51b946 (diff) |
signature_for should use inheritance to find methods being wrapped
Diffstat (limited to 'lib/Type/Params.pm')
-rw-r--r-- | lib/Type/Params.pm | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Type/Params.pm b/lib/Type/Params.pm index d5fefe83..21554e02 100644 --- a/lib/Type/Params.pm +++ b/lib/Type/Params.pm @@ -136,6 +136,9 @@ sub signature_for { $opts{package} ||= $package; $opts{subname} ||= ( $function =~ /::(\w+)$/ ) ? $1 : $function; $opts{goto_next} ||= do { no strict 'refs'; exists(&$fullname) ? \&$fullname : undef; }; + if ( $opts{method} ) { + $opts{goto_next} ||= eval { $package->can( $opts{subname} ) }; + } if ( $opts{fallback} and not $opts{goto_next} ) { $opts{goto_next} = ref( $opts{fallback} ) ? $opts{fallback} : sub {}; } |