Well, this simple example isn't really the heart of OOP. (Rather than get off on a rant, just search this site and others, as there is a wealth of OO info.) If all you want is a way to get the contents of a file in an array, and open it in one line, just make a function. It seems that what you want to do is make a module to group a lot of miscellaneous things together to make it easier. . . and this would be a good course to go, but I think it would be easier if you just made it a module, rather than an object-oriented approach. i.e., an OOP places the importance on data (and its abstraction), however, you seem to just want a quick way to do various, unrelated(and unrelated data, as a result) tasks. . . My advice, stick it in a module, but steer clear of OOP.
Book reccommendation: for a good OO book, check out Data Abstraction with C++ (not exact title). It was required in my C/C++ class, and it was pretty good--it showed examples with C++, but the principles can be applied around the board. Though, if you are interested in OOP w/ perl, checkout the objperl manpage and look for literature/links directly related to perl.
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.