Name
can
Synopsis
$sub
= $obj
->can(
method
)
Description
Checks if object $obj has a method method. If so,
returns a reference to the subroutine, otherwise returns undef
.
Can be called as either a static or object method call, or
as a subroutine:
$ref = UNIVERSAL::can(val, method)
Returns a reference to the subroutine if val
is a blessed reference
with a method method
, and undef
if
val
is not blessed or does not have method
.
Get Perl in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.