Re: Parse::RecDescent and Moose
[email protected] (Stevan Little)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
Tod,
Since it seems you fixed problem #2, I will offer a suggestion on
problem #1.
On Mar 27, 2008, at 2:56 PM, Tod Hagan wrote:
> This works, but surely there must be a better way to inspect the
> object
> to determine if it defines the pr() method. If the objects had been
> created by Moose I'd just get the meta object and call
> get_method_list,
> but I'm stuck since they were created by Parse::RecDescent. Thoughts?
Creating a metaclass for a package not defined by Moose is as easy as
this:
my $meta_for_your_package = Class::MOP::Class->initialize
('Your::Package');
It does not actually add the ->meta method for you (it actually
doesn't alter the package at all, you would need to do that on your
own if you wanted too) but it will provide you all the introspection
features you need.
- Stevan