in reply to Re: Anonymous Hash in Constructor
in thread Anonymous Hash in Constructor
I somehow find it instructive to do this…
{ package SomeClass; sub new1 { bless {} } sub new2 { bless \%hash } sub does_it_work { print "Yes, it works\n" } } $obj1 = SomeClass->new1; $obj1->does_it_work; $obj2 = SomeClass->new2; $obj2->does_it_work;
…to your fine example. Removing all pragmas is intentional. This isn't quality code. It's simple code to make the rudiments of something clearer—to me, at least. I learned something by this reduction.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Anonymous Hash in Constructor
by tobyink (Canon) on Oct 19, 2012 at 05:50 UTC | |
by Jim (Curate) on Oct 19, 2012 at 19:20 UTC | |
by tobyink (Canon) on Oct 19, 2012 at 23:09 UTC | |
by Jim (Curate) on Oct 19, 2012 at 23:42 UTC |
In Section
Seekers of Perl Wisdom