Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the methods of a class or object #170

Closed
schwern opened this issue Jan 12, 2011 · 2 comments
Closed

Get the methods of a class or object #170

schwern opened this issue Jan 12, 2011 · 2 comments

Comments

@schwern
Copy link
Contributor

schwern commented Jan 12, 2011

Write a method to return the methods available to a class or object.

my @methods = $class->mc->methods;
my @methods = $obj->mo->methods;

By default it returns all the methods available to the object, including inherited ones. Flags include:

UNIVERSAL      whether to include methods inherited from UNIVERSAL
                          default false
inherited            whether to included inherited methods
                          default true

This is implemented by walking linear_isa and looking in the symbol table of each for typeglobs which contain CODE.

Side technologies will probably include:

getting the symbol table for a class
asking if a typeglob contains a reference of type X
@schwern
Copy link
Contributor Author

schwern commented Jan 12, 2011

Created a branch, mo_methods, for this. It contains a proof of concept Mif, Jacinta and I knocked out at Melbourne Perl Mongers.
https://github.com/schwern/perl5i/commits/mo_methods

@schwern
Copy link
Contributor Author

schwern commented Jan 24, 2011

Done. I went with with_UNIVERSAL and just_mine as the options.

dap pushed a commit to dap/perl5i that referenced this issue Sep 6, 2011
dap pushed a commit to dap/perl5i that referenced this issue Sep 6, 2011
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant