in reply to Creating objects within objects being strange...
Consider writing your new functions something like this:
sub new { my $proto=shift; my $class=ref $proto || $proto; my $self={ @_ }; ## ... bless $self,$class; }
Then create your instance like this:
I found that by directly putting the class parameters on the new() line like that makes for cleanliness, and readability. And, it makes for a real quick method of stuffing values into the instance of the object.my $inst=new MyClass( name => 'mr.nick', rank => 'novice', sleep_level => 'not enough' );
mr.nick ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Creating objects within objects being strange...
by demerphq (Chancellor) on Sep 07, 2001 at 18:54 UTC | |
by mr.nick (Chaplain) on Sep 08, 2001 at 23:10 UTC | |
by demerphq (Chancellor) on Sep 09, 2001 at 16:17 UTC | |
by Anonymous Monk on Sep 08, 2001 at 01:34 UTC |