in reply to Is there an advantage to storing references to objects in an attribute instead of the object itself?

So I did something different. Instead of storing the large object in an attribute, I stored a reference to a reader method I created in the large object:

use Moose; my $little_obj = Class->new( { get_big_obj_data => sub{ $big_object->g +et_data(@_) } } ); # retrieve data like this: my $data = $little_obj->get_big_obj_data->(@args);

Seems like this is a much smarter thing to do because it provides encapsulation.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

  • Comment on Re: Is there an advantage to storing references to objects in an attribute instead of the object itself?
  • Download Code