No such thing as a small change | |
PerlMonks |
Re: Can I ask Perl if an object will stringify?by LanX (Saint) |
on Mar 29, 2015 at 22:10 UTC ( [id://1121736]=note: print w/replies, xml ) | Need Help?? |
If I were you I'd reject simple refs and allow all objects without testing. Don't start fiddling with internals. In any case you can only do runtime checks in Perl. So if you get the default stringification from an object (IIRC that's what ref returns) you are free to warn, that something looks strange. Don't try to overengineer your function! Sometimes "it's easier to ask for forgiveness than it is to ask for permission. " (stolen from Python ;)
In Section
Seekers of Perl Wisdom
|
|