Skip Menu |

This queue is for tickets about the Aspect CPAN distribution.

Report information
The Basics
Id: 57417
Status: resolved
Priority: 0/
Queue: Aspect

People
Owner: Nobody in particular
Requestors: matthias.helmling [...] gmx.net
Cc:
AdminCc:

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



Subject: Reference lost
Hello Adam, I've attached some simple code which is not working as expected with Aspect. Somehow the around advise "destroys" the reference. The code should be self explaining. I've tested this with Perl 5.8.3 and 5.10.0 running on Linux. Thanks for creating this cool package, Matthias Helmling
Subject: test.pl
#!/usr/bin/perl use Aspect; around { shift->run_original; } call qr/^foo::*/ | call qr/^bar::*/; sub get_foo { return new foo(); } my $bar = new bar(); # this is working my $foo = &get_foo; $bar->foo_hello($foo); # while this isn't $bar->foo_hello(&get_foo); #----------------------------------------------- package foo; sub new { return bless {}, shift; } sub hello { print "Hello World\n"; } #----------------------------------------------- package bar; sub new { return bless {}, shift; } sub foo_hello { my $self = shift; my $foo = shift; $foo->hello; }
This was caused by a bug in the return value handling specifically when an Around advice using ->run_original was called in list context. Fixed in Aspect 0.95. http://svn.ali.as/cpan/releases/Aspect-0.95.tar.gz