Run-Time Overloading
Since use
statements are executed at
compile time, the only way to change overloading during run time
is:
eval " use overload '+' => \&my_add ";
You can also say:
eval " no overload '+', '--', '<=' ";
although the use of these constructs during run time is questionable.
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.