Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mouse CPAN distribution.

Report information
The Basics
Id: 76880
Status: resolved
Priority: 0/
Queue: Mouse

People
Owner: Nobody in particular
Requestors: DDUMONT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.97
Fixed in: (no value)



Subject: trigger function are not called with the 3rd parameter (the old value)
Hello trigger should call trigger function with 3 parameters (unless the attribute was never set). With Mouse, the 3rd parameters (the old value) is never passed to the trigger function: $ ANY_MOOSE=Mouse perl -Ilib t/slider.t 1..3 _new_image got SDLx::SlideShow::RollOver=HASH(0x1821ce8) SDLx::App=SCALAR(0x1821310) ok 1 - slider created with current image _new_image got SDLx::SlideShow::RollOver=HASH(0x1821ce8) SDLx::Surface=SCALAR(0x182f280) _new_image got SDLx::SlideShow::RollOver=HASH(0x1821ce8) SDLx::Surface=SCALAR(0x182f1d8) _new_image got SDLx::SlideShow::RollOver=HASH(0x1821ce8) SDLx::Surface=SCALAR(0x182f2e0) _new_image got SDLx::SlideShow::RollOver=HASH(0x1821ce8) SDLx::Surface=SCALAR(0x182f358) _new_image got SDLx::SlideShow::RollOver=HASH(0x1821ce8) SDLx::Surface=SCALAR(0x182f2f8) ok 2 - transition done # Looks like you planned 3 tests but ran 2. With Moose, the trigger is called as expected: $ ANY_MOOSE=Moose perl -Ilib t/slider.t 1..3 _new_image got SDLx::SlideShow::RollOver=HASH(0x1c7c400) SDLx::App=SCALAR(0x1c6e310) ok 1 - slider created with current image _new_image got SDLx::SlideShow::RollOver=HASH(0x1c7c400) SDLx::Surface=SCALAR(0x1c7c280) SDLx::App=SCALAR(0x1c6e310) _new_image got SDLx::SlideShow::RollOver=HASH(0x1c7c400) SDLx::Surface=SCALAR(0x1c7c1d8) SDLx::Surface=SCALAR(0x1c7c280) _new_image got SDLx::SlideShow::RollOver=HASH(0x1c7c400) SDLx::Surface=SCALAR(0x1c7c2e0) SDLx::Surface=SCALAR(0x1c7c1d8) _new_image got SDLx::SlideShow::RollOver=HASH(0x1c7c400) SDLx::Surface=SCALAR(0x1c7c358) SDLx::Surface=SCALAR(0x1c7c2e0) _new_image got SDLx::SlideShow::RollOver=HASH(0x1c7c400) SDLx::Surface=SCALAR(0x1c7c2f8) SDLx::Surface=SCALAR(0x1c7c358) ok 2 - transition done # Looks like you planned 3 tests but ran 2. For the record, here's the attribute and the trigger function: has image => ( is => 'rw', isa => 'SDLx::Surface', handles => { qw/width w height h/ } , required => 1, trigger => \&_new_image , ); sub _new_image { my ($self,$image,$old) = @_; say "_new_image got @_" ; # return unless @_ > 2 ; if (defined $old) { croak "new image does not match old image size" unless $old->w eq $old->width and $old->h eq $old->height ; } $self->reset_step; } All the best
Thanks for reporting it. Added in 1.07 by schwern. -- Goro Fuji (gfx) GFUJI at CPAN.org