in reply to My first stab at OO perl...
Get rid of that 'ref (proto)' malarky and note that $id will already be undef if it is not specified. Other than that, everything seems OK - i do have a list of minor nitpicks though:sub new { my $class = shift; my $id = shift; my $self = { _ID => $id, _FINALIZED => 0, _EXPENSES => [], _TOTAL => undef, _COUNT => undef, }; return bless $self, $class; }
seems more intuitive as$newexp->{_ID} = $#expenses + 1;
$newexp->{_ID} = scalar @expenses;
You are doing that in ExpenseReport::finalize, so i suspect this code was overlooked.local $Data::Dumper::Indent = 3;
# open file my $file = do {local $/; <REPORT>};
$self->{$hiddenkey} = shift if @_;
Over all, very good work. And good luck with the next step. :)
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (jeffa) Re: My first stab at OO perl...
by Theseus (Pilgrim) on Jul 16, 2002 at 17:09 UTC | |
by jeffa (Bishop) on Jul 16, 2002 at 17:26 UTC | |
by Theseus (Pilgrim) on Jul 16, 2002 at 17:54 UTC | |
by dragonchild (Archbishop) on Jul 16, 2002 at 19:42 UTC | |
by Theseus (Pilgrim) on Jul 16, 2002 at 19:52 UTC | |
| |
by jeffa (Bishop) on Jul 16, 2002 at 19:27 UTC | |
by Theseus (Pilgrim) on Jul 16, 2002 at 19:46 UTC | |
| |
by frag (Hermit) on Jul 17, 2002 at 03:49 UTC | |
by jeffa (Bishop) on Jul 17, 2002 at 06:10 UTC | |
by frag (Hermit) on Jul 17, 2002 at 11:30 UTC | |
| |
by v_thunder (Scribe) on Jul 17, 2002 at 03:57 UTC | |
by v_thunder (Scribe) on Jul 17, 2002 at 04:18 UTC | |
by Theseus (Pilgrim) on Jul 17, 2002 at 20:26 UTC | |
by LanceDeeply (Chaplain) on Jul 16, 2002 at 21:32 UTC | |
by Anonymous Monk on Jul 17, 2002 at 00:02 UTC |