Otherwise, it all looks fine. You've got a lot of the idioms I would use in an OO situation.
A few ideas to bring (and boggle) you further:
That is much easier to maintain when you start hitting 20 or 30 attributes in your objects.sub new { # Stuff up here foreach my $attrib (keys %$self) { my $conv_attrib = $attrib; $conv_attrib =~ s/^_(\w+)$/lc $1/e; no strict 'refs'; *{__PACKAGE__ . "::$conv_attrib"} = gen_closure($attrib); } return $self; } sub gen_closure { my $attrib = shift; return sub { my $self = shift; if (@_) { $self->{$attrib} = shift; } return $self->{$attrib}; } }
Good luck!
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
In reply to Re: My first stab at OO perl...
by dragonchild
in thread My first stab at OO perl...
by Theseus
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |