I buy that.
But it's not a far stretch to use very very light-weight classes and use a simple hash for the properties until you need something more. This is an entire class in a small steal-entries-from-http://buzz.bazooka.se/-and-fake-email-posts-to-our-internal-bullshit-list-at-work program I wrote for the fun of it after a coffe break discussion:
package Buzz::Post::Comment;
use HTML::Entities;
sub new { my $pkg = shift;
bless(my $self = { @_ }, $pkg);
$self->{text} =~ s{<br />}{\n}gs;
$self->{text} = decode_entities($self->{text});
return($self);
}
It's not really a serious class in that you can't see what properties there are, there is no documentation, no visible interface to new() etc.
But the benefits I get are:
- No hassle, it's almost like just using a hash
- OO thinking, which is the way I work
- A good name. That's always worth a lot
- Somewhere to put my methods instead of in the pile of subs
Basically it's the same laid-back scripting attitude, but with a touch of structure.
/J
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.