While it is true that *real* OO is nice when objects do stuff, OOP in Perl, even if halfway done without doing stuff (it can do stuff, but doesn't have to), is a decent way to implement C structures in a halfway clean sort of way without having to deal with the ugly gorp that is an HoH. That being said, my objects contain HoH's all the time, but I really hate it when outside methods must delve into them each time the hard way, or to iterate through their keys.
I suggest you take the plunge, but retain the knowledge of the old ways. Properly mixed, they are powerful. You never really have to go "pure OO" if you want to, especially not in Perl. Trivial OO (i.e. objects that just work like C glorified structs) is ok for starters until you decide to add more real-OO functionality. Of course, OO isn't really OO until you are using inheritance and other fancy over-hyped concepts :)
Note that over half of the developers that think they are doing "real OO" are just using overglorified structs -- which means (yes), you can do that in C or pretty much in any language. The next step is to mix functional, procedural, and OO styles all in one, which sounds goofy -- but it's kind of cool at the same time. Anyhow, go forth, and take the plunge. The water's fine. (Just beware the alligators -- such as folks who profess fancy "design patterns" and don't have enough common sense to keep things simple when they can be simple).
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.