Don't ask to ask, just ask | |
PerlMonks |
Re: Blessing with unknown classnamesby kcott (Archbishop) |
on Apr 01, 2021 at 17:35 UTC ( [id://11130681]=note: print w/replies, xml ) | Need Help?? |
G'day bliako, There is no requirement for $class to be a real class, have length, or even be present. See bless for details. The use of ref in your posted code is not the best choice: the doco explains issues. It would be much better to use the blessed function of the builtin module Scalar::Util. Here's an example of usage. My perle alias captures all sorts of problems.
[Note: Between reading the OP and clicking "Comment on", there appears to have been two updates to the OP. There may be others. I'm replying to the post that ended with "Thanks LanX for looking this up on CB". I don't believe this changes the essence of my reply; just bear in mind what I'm replying to.] — Ken
In Section
Seekers of Perl Wisdom
|
|