"Perl's syntax is a lot more difficult,
and not as powerful..."
I agree with the first statement, although understand that
it gets easier with time and experience. The second
statement is just plain wrong, however. The reason Perl's
syntax is more difficult is because Perl IS powerful. I
didn't 'get' Perl until about 2-3 years of using it.
Remember, tye said that inheritence should mostly be
considered as a last resort, and he is dead on the money.
The buzz term is "favor aggregation over inheritence".
Inheritance is not the best answer, as you see when you
realize that a mistake was made in the parent class.
My opinions on pre-declared variables: a maintenance
nightmare. However, i do like thing such as:
sub new {
my $class = shift;
my $self = {
day => '',
some_list => [],
some_hash => {},
};
return bless $self, $class;
}
If your variables are named appropriately, you shouldn't
have to add comments to explain what they are. Comments
should be reserved to ideas that can't be immediately
gleaned from the code, code such as this:
# grab the pk if found, remove it and store for later use
# and remove it's column from the table
if (exists $self->{'pk'}) {
$self->{'pk_index'} = delete $self->{'fields_hash'}->{$self->{'pk'}
+};
splice(@{$self->{'fields_arry'}},$self->{'pk_index'},1)
if defined $self->{'pk_index'};
}
And yes, that one-liner constructer is bad form. If you
thought that was bad, then how about this:
sub get_attrib { shift->{shift} }
;)
jeffa
Austin Powers / 0 |