Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hello,

I've been toying around with perl 5.9.4. Just testing out some of the new features. One of those feature I don't understand is UNIVERSAL::DOES(). I've read the perldelta for perl 5.9.4 and the newest edition of The Perl Review which a has an article on perl 5.9.4, but I'm still not getting it. I don't see how it is difference from ISA. Here is some test code I wrote.

#!/opt/bleadperl/bin/bleadperl package Role; package Object; @Object::ISA= ('Role'); sub new { my $class = shift; return bless {}, $class; } package main; my $o = Object->new(); print 'Object DOES Role' if $o->DOES(Role);

I don't see how this is really different than using ->isa(). I understand how roles work in Class::Traits and Moose, but I don't have to use @ISA to setup the relationship. I think i'm missing soming basic or I really don't understand how roles or traits are supposed to work. Can someone point me in the right direction?

Thanks,


In reply to I don't understand UNIVERSAL::DOES() by rlb3

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 13:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found