Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^6: I don't understand UNIVERSAL::DOES() (import)

by tye (Sage)
on Mar 09, 2007 at 21:27 UTC ( [id://604058]=note: print w/replies, xml ) Need Help??


in reply to Re^5: I don't understand UNIVERSAL::DOES()
in thread I don't understand UNIVERSAL::DOES()

*isa= \&UNIVERSAL::isa;

works great for me. I don't even have to "use UNIVERSAL" for this. There being no UNIVERSAL->import() makes some sense to me, but, as noted in Universally unimportant and overused, UNIVERSAL->import() appears to exist (and causes problems).

Defining a special UNIVERSAL::isa() that can detect when it has been misused would be an acceptable compromise to me.

- tye        

Replies are listed 'Best First'.
Re^7: I don't understand UNIVERSAL::DOES() (import)
by ikegami (Patriarch) on Mar 12, 2007 at 08:24 UTC

    The last paragraph was the most important, and it wasn't addressed. My fault, I didn't explain myself. Consider

    { package Foo; sub DOES { my ($self, $role) = @_; return 1 if ...; return $self->SUPER::DOES($role); } } Foo->DOES(...); # Line "A" UNIVERSAL::DOES('Foo', ...); # Line "B"

    Unless DOES does something non-intuitive, line "A" results in an infinite loop.
    Unless DOES does something non-intuitive, line "B" doesn't call the overridden DOES.

    Do we really want DOES to be that special? Having a function does (which calls DOES when appropriate) would avoid all this complexity.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2026-02-15 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.