in reply to (crazyinsomniac) Re: Odd constructor in HTML::Template
in thread Odd constructor in HTML::Template

I believe it has something to do with the scope of the variables and the Authors attempt to force the $hash variable to be truly private. There is a great discussion of this in "Object Oriented Perl" by Damian Conway. If you do not have this book it is a must for any OOP Perl programmer and a great introduction to OOP with Perl.
  • Comment on Re: (crazyinsomniac) Re: Odd constructor in HTML::Template

Replies are listed 'Best First'.
•Re: Re: (crazyinsomniac) Re: Odd constructor in HTML::Template
by merlyn (Sage) on Mar 29, 2002 at 14:21 UTC
    Except that it does nothing of the kind. There's no difference to creating a named lexical and letting it fall out of scope versus creating an anonymous value in the first place. So, perhaps this is vestigial code, left over from a larger cut-n-paste, or this is from someone who didn't quite "get it".

    In either case, I'd yellow flag this in a formal code review. Meaning I'd let it stand as workable, but if resources were available, bring it in line with more common idioms.

    -- Randal L. Schwartz, Perl hacker