Greetings monks,
I'm looking to create an object oriented solution to a particular problem, and I've never played with OOP before. After reading the intro to objects and classes in
Advanced Perl Programming, the general message I got about designing classes is that they should be built around the data, to encapsulate it and mediate access to it. I'm on board with that, but is it not recommended think of it in terms of pulling various supporting data together for a specific function (in this case, method) for ease of use?
What I've got is a variable name, a range of values I want it to take on, and other various and dynamic statements I want to eval within that loop before calling a coderef. My thoughts were to create a class that hold the data as object data and which has a method to do the loop and coderef call. Then I could make a chain of these objects each calling the looping methods of the next in line, until a final "innermost" subroutine is called. It's sort of a highly configurable nested loop deal with designated things happening at specific levels.
Should I bother with using objects for this, or am I making my life too complicated?
Thanks for your consideration,
~MB
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.