Public Overload Functions
As of the 5.6 release of Perl, the use
overload
pragma provides the following functions for public
consumption.
overload::StrVal(
OBJ
)
This function returns the string value that
OBJ
would have in absence of stringification overloading ("").overload::Overloaded(
OBJ
)
This function returns a true value if
OBJ
is subject to any operator overloading at all, and false otherwise.overload::Method(
OBJ
,OPERATOR
)
This function returns a reference to whatever code implements the overloading for
OPERATOR
when it operates onOBJ
, orundef
if no such overloading exists.
Get Programming Perl, 3rd Edition 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.