Re: Callback methods in a Moose object

[email protected] (Jesse Luehrs)
Newsgroups perl.moose
Message-ID <[email protected]>
On Mon, Jan 09, 2012 at 05:42:39PM -0800, Toby Betts wrote:
> The issue seems to be that the arguments to be given to the callback are
> missing. Based on the XML::Twig docs, handlers are passed a self-referencing
> object called a twig and the element to handle, like so:

Yes, this is the issue. If you're wrapping a method call in a coderef
like that, you need to pass through the arguments yourself - the form
"sub { $self->method }" is only correct when the callback doesn't take
arguments. What you really want is "sub { $self->method(@_) }".

-doy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.