Subject: | References are not passed for the building call |
Consider the following MWE:
Cat.pm:
--------------8<--------------
package Cat;
use strict;
use warnings;
sub new { return bless {}, $_[0] }
sub store { $_[1] = 'mouse' }
1;
--------------8<--------------
hunt.pl:
--------------8<--------------
#!/usr/bin/perl
use strict;
use warnings;
use Cat;
use Object::Lazy;
my $eager_cat = Cat->new;
my $lazy_cat = Object::Lazy->new( sub { return Cat->new } );
$eager_cat->store( my $eager_out );
$lazy_cat->store( my $lazy_out );
print "Eager: $eager_out\n";
print "Lazy: $lazy_out\n";
--------------8<--------------
One would expect both the $eager_out and $lazy_out contain a string with 'mouse', however, the following output is printed:
--------------8<--------------
Eager: mouse
Use of uninitialized value $lazy_out in concatenation (.) or string at hunt.pl line 15.
Lazy:
--------------8<--------------
To me it seems that the AUTOLOAD of Object::Lazy fails to pass its parameters unmodified to the called subroutine.