in reply to Automatic vivification of an object

I suggesting reviewing this thread too: Object method prototypes?. Moo/Moose/Mouse all let you defer every aspect of attribute instantiation already and Mouse (and maybe Moo) is likely going to be faster than anything using $AUTOLOAD.

  • Comment on Re: Automatic vivification of an object

Replies are listed 'Best First'.
Re^2: Automatic vivification of an object
by bounsy (Acolyte) on Jan 14, 2015 at 04:06 UTC

    I would love to be able to use Moose or something like it, but that's not available to me at my current workplace and is unlikely to be in use any time soon.

    The use of AUTLOAD in this case should involve minimal impact since it only ever calls it once (at most). From then on, it is an object of the correct type.

Re^2: Automatic vivification of an object
by bounsy (Acolyte) on Jan 14, 2015 at 04:25 UTC

    I'm going to have to take a closer look at Moo. It looks like I might be able to use that in the future, since it appears to be pure Perl. (The XS code is what makes Moose unusable currently due to environmental issues that include too many versions of Perl across multiple operating systems.) Unfortunately, Moo's not going to be able to help my current project.