Hi,
Methinks you are trying to break the language itself: perl stringifies everything on demand (in string context). The "stringification" operator purpose is to provide something meaningful, and not to be some marker "it stringifies to to something meaningful".
I think you can use something like UNIVERSAL::can to check pretense of method like "to_my_string". If the passed object don't have that method, that means that something is wrong, and die could be better then warn.
In reply to Re: Can I ask Perl if an object will stringify?
by basiliscos
in thread Can I ask Perl if an object will stringify?
by haukex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |