Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Class / package weak association

by dd-b (Monk)
on Jun 10, 2021 at 21:32 UTC ( [id://11133747] : note . print w/replies, xml ) Need Help??


in reply to Re: Class / package weak association
in thread Class / package weak association

Yeah, I already saw issues with attempting to really package the class as part of the stringification (all sorts of issues, many already mentioned here, both in general and in my particular use); I was just a little surprised not to be warned that I'd neglected to use the package.

I was thinking about adding a new function call to do eval-with-bless-checking, hadn't realized I could actually overload bless to verify the package. I don't do any blessing without packages that I remember in this code, so that might be a clean way to fix that.

At least I've learned something new (didn't realize I could override bless!). I shouldn't be surprised, at this point there's not all that much I can't override in Perl.

Replies are listed 'Best First'.
Re^3: Class / package weak association
by LanX (Saint) on Jun 11, 2021 at 11:07 UTC
    > At least I've learned something new (didn't realize I could override bless!). I shouldn't be surprised, at this point there's not all that much I can't override in Perl.

    Please note that it's not global but "only" on package basis, which is a good thing. Better don't try this in main.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery