Hi ribasushi,
Thanks for the suggestion! I tried it out, and the module returns a bit more
information than overload::Method(), but unless I missed something it unfortunately
doesn't seem to directly answer the question whether an object will stringify via
magic autogeneration or not, but I could probably figure it out based on all the
information it returns. Here's an example of what the overload_info() function
returns for two of my test classes from the original post:
# this class stringifies even though "" is not directly overloaded
{
"0+" => {
class => "ICanStringify",
code => sub { ... },
code_name => "ICanStringify::__ANON__",
},
"fallback" => { class => "ICanStringify", value => undef },
}
# this class does not stringify
{
"0+" => {
class => "OnlyANumber",
code => sub { ... },
code_name => "OnlyANumber::__ANON__",
},
"fallback" => { class => "OnlyANumber", value => 0 },
}
Right now my current solution (posted below) of "just try it out" seems to work,
so I'm a bit hesitant to change it except in a way that would simplify it.
I'll look into it a bit more whether I can do so with the above info.
Thanks and Regards,
-- Hauke D
|