If you're expecting to be able to pass parameters to the new method (like you do here), you would want to take the parameters that are passed to new and use them as the values for your internal hash:
sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = {FILENAME => undef, NAME => undef, VAL => undef, ATYPE => undef, VOL => undef, MASS => undef, DESC => undef, RACE => undef, stats_change => [], @_}; # <-- Note this line here. # It takes the values passed to new and will override the "defaults" s +et above. bless($self); return $self; }
Update: It looks like that is what you're trying to do. The reason only stats_change is "working" is because that's the only one you're explicitly setting. Your original new code does not automagically set the other values for you.</code>
perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^+*`^ ve^#$&V"+@( NO CARRIER'
In reply to Re: OO package problems...
by Chmrr
in thread OO package problems...
by Ahbeyra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |