Skip Menu |

This queue is for tickets about the POE-Component-DirWatch-Object CPAN distribution.

Report information
The Basics
Id: 22759
Status: resolved
Priority: 0/
Queue: POE-Component-DirWatch-Object

People
Owner: groditi [...] gmail.com
Requestors: melo [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.04
Fixed in: (no value)



Subject: bug in sub _callback
Hi, According to the docs, the callback function is called with two parameters, the filename and the path of the file. In reality, you are calling my callback with all the normal POE parameters for a state handler. The correct sub _callback should be something like this: sub _callback{ my ($self, $filename, $path) = @_[OBJECT, ARG0, ARG1]; return $self->callback->($filename, $path); } This works as per docs. Best regards,
From: groditi [...] gmail.com
You are correct. At this point I think I am going to change the documentation to match the behavior rather than the other way around because I indeed intended for the callback to have a access to the POE variables. If you have any other suggestions I'll be listening. On Thu Nov 02 11:03:19 2006, MELO wrote: Show quoted text
> Hi, > > According to the docs, the callback function is called with two > parameters, the filename and > the path of the file. > > In reality, you are calling my callback with all the normal POE > parameters for a state handler. > > The correct sub _callback should be something like this: > > sub _callback{ > my ($self, $filename, $path) = @_[OBJECT, ARG0, ARG1]; > return $self->callback->($filename, $path); > } > > This works as per docs. > > Best regards,
Subject: Re: [rt.cpan.org #22759] bug in sub _callback
Date: Thu, 2 Nov 2006 22:25:51 +0000
To: bug-POE-Component-DirWatch-Object [...] rt.cpan.org
From: Pedro Melo <MELO [...] cpan.org>
Hi, On Nov 2, 2006, at 4:26 PM, Guillermo Roditi via RT wrote: Show quoted text
> You are correct. At this point I think I am going to change the > documentation to match the behavior rather than the other way around > because I indeed intended for the callback to have a access to the POE > variables. If you have any other suggestions I'll be listening.
hmms... They maybe you could use a postback? Postbacks are great because they allow me to pass some arguments and then complement those with your own arguments. Best regards, -- Pedro Melo JID: xmpp:melo@simplicidade.org
On Thu Nov 02 17:26:27 2006, MELO wrote: Show quoted text
> Hi, > > On Nov 2, 2006, at 4:26 PM, Guillermo Roditi via RT wrote: >
> > You are correct. At this point I think I am going to change the > > documentation to match the behavior rather than the other way around > > because I indeed intended for the callback to have a access to the POE > > variables. If you have any other suggestions I'll be listening.
> > hmms... They maybe you could use a postback? > > Postbacks are great because they allow me to pass some arguments and > then complement those with your own arguments.
After sleeping on it, I'm more confident on my recommendation: accept a normal coderef as the callback paremeter: 1. it's consistent with the docs; 2. it allows people who don't need the POE parameters to use a quick inline sub; 3. if you do need POE parameters, you can pass a postback and they will work to. So that would be my recomendation. In fact, the code I sent you does all three points: if you pass a postback, it will also work. Do you want me to send you a proper diff with docs? Thanks,
From: groditi [...] gmail.com
Hey I just got back from vacation. I will update tomorrow and release. Thanks for the report. On Fri Nov 03 12:32:23 2006, MELO wrote: Show quoted text
> On Thu Nov 02 17:26:27 2006, MELO wrote:
> > Hi, > > > > On Nov 2, 2006, at 4:26 PM, Guillermo Roditi via RT wrote: > >
> > > You are correct. At this point I think I am going to change the > > > documentation to match the behavior rather than the other way
> around
> > > because I indeed intended for the callback to have a access to the
> POE
> > > variables. If you have any other suggestions I'll be listening.
> > > > hmms... They maybe you could use a postback? > > > > Postbacks are great because they allow me to pass some arguments and > > then complement those with your own arguments.
> > After sleeping on it, I'm more confident on my recommendation: accept > a normal coderef as > the callback paremeter: > > 1. it's consistent with the docs; > 2. it allows people who don't need the POE parameters to use a quick > inline sub; > 3. if you do need POE parameters, you can pass a postback and they > will work to. > > So that would be my recomendation. > > In fact, the code I sent you does all three points: if you pass a > postback, it will also work. > > Do you want me to send you a proper diff with docs? > > Thanks,
Fixed. Behavior and documentation now match. Callbacks should not have received all @_; oops.