Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re (tilly) 2: Reblessing (was: OO Perl: calling a constructor within a class)

by tilly (Archbishop)
on Sep 27, 2001 at 21:05 UTC ( #115162=note: print w/ replies, xml ) Need Help??


in reply to Re: Reblessing (was: OO Perl: calling a constructor within a class)
in thread OO Perl: calling a constructor within a class

Were you thinking something like this?

Objects can always can, but a special can can can the usual can. But to see it's a special can you can:
$check_that_can_with = UNIVERSAL::can($obj,'can') ne \&UNIVERSAL::can;
But you can't catch the man who replaced the default can:
my $can = \&UNIVERSAL::can; local $^W = 0; *UNIVERSAL::can = sub { $_[1] eq 'can' ? \&UNIVERSAL::can : &$can; };
So can that man before he cans your can!
(Sorry)


Comment on Re (tilly) 2: Reblessing (was: OO Perl: calling a constructor within a class)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (18)
As of 2015-07-31 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (280 votes), past polls