Bloodnok has asked for the wisdom of the Perl Monks concerning the following question:

Given an attempt to use overload... e.g.
use overload <op> => \&pkg::sub;
where <op> is one of either '==' or '@{}' and pkg::sub is an existant fully qualified sub, it seems that, whenever I run the test harness (using Test::More), the following error ensues ...
Operation """": no method found, argument in overloaded package
The only way to avoid it [this error], that I've discovered thus far, is to overload the stringify operator '""' for the package.

Question is, since overload makes no mention of this [feature] that I can discern, has any one else encountered this problem... and if so, how was the problem resolved ??

Update:

As well as actually overloading the stringify operator, changing :

use overload <op> => \&pkg::sub;
to read :
use overload <op> => \&pkg::sub, fallback => 1;
appears to provide a fix of sorts...

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re: overload op requires stringify overload ??
by lostjimmy (Chaplain) on Feb 17, 2009 at 19:18 UTC

    I believe this is the expected behavior. If you are overloading, you have to provide all of the overloads, otherwise Perl will complain. For instance, if you only overload '==' and then try to use the '+' operator, you get the Operation "+": no method found. Using fallbacks, Perl will try to figure out what you want to do for certain overloads, of which stringification is one of them.

    Update: The minimal set of overloaded operations may be helpful.