Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: Thoughts on new 'class' OO in upcoming perl

by tobyink (Canon)
on Mar 06, 2023 at 15:11 UTC ( [id://11150791]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Thoughts on new 'class' OO in upcoming perl
in thread Thoughts on new 'class' OO in upcoming perl

The same way you prevent people calling bless( \%params, $your_class ) directly. You don't/can't.

Replies are listed 'Best First'.
Re^5: Thoughts on new 'class' OO in upcoming perl
by dsheroh (Monsignor) on Mar 07, 2023 at 08:38 UTC
    Technically correct, but it ignores one little detail: Calling ->new is the normal, default way to create an object. Calling bless directly is not.

    There's quite a difference between expecting people to not instantiate an object in a way which 99% of classes consider to be an unsupported backdoor "here be dragons" approach (bless) and expecting them to not instantiate it in a way which 99% of classes consider to be the standard way to do it (calling the ->new method).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11150791]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2025-06-22 05:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.