Hi LadyAleena,
three things that caught my attention:
Then you can call methods on that object an reuse the data you passed in on new(), and e.g. cache more data in your instance data as you read them (in case you're likely to need them again later):sub new { my ($class, $datafile, $accounts) = @_; return bless { file => $datafile, accounts => $accounts, }, $class; }
sub acct_data { my ($self, $type) = @_; die "Invalid type, $type does not exist." unless defined $headings +{$type}; return $self->{data}{$type} if defined $self->{data}; return $self->{data}{$type} = { get_hash( file => data_file($self->{file}, "$type.txt"), headings => $headings{$type}, ) } }
In reply to Re: RFC on how I'm doing when it comes to writing objects?
by mbethke
in thread RFC on how I'm doing when it comes to writing objects?
by Lady_Aleena
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |