Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

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

This will work with any Plain Old Perl Package, no Moose-ness required.

my @methods = Class::MOP::Class->initialize('Class::Name')->compute_al +l_applicable_methods;
Each element of @methods will be a HASH ref containing
  • method name
  • the name of the class in which the method lives
  • a Class::MOP::Method instance that contains the CODE ref for the actual method
As with your version (and pretty much any introspection out there) it will not handle AUTOLOAD (IMO - AUTOLOAD is evil anyway, it shouldn't be used and any modules that use it should be treated with suspicion). It will also properly ignore imported functions as well, like if you were to import Scalar::Util::blessed into your package, Class::MOP::Class would properly ignore it since it is not a method.

-stvn

In reply to Re: Listing the functions of a package / methods of an object by stvn
in thread Listing the functions of a package / methods of an object by amir_e_a

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 avoiding work at the Monastery: (5)
As of 2024-04-19 03:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found