"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


In reply to (jeffa) 3Re: OO 2 death? by jeffa
in thread OO 2 death? by Cestus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.