"I would much rather do FORTRAN that OOP"

I wouldn't want to do a CGI application in FORTRAN however! I think you are making the OO part out to harder than it is. In perl you can make your objects as complicated or as simple as you're task demands. At the simple level you are just placing your data and it's access methods in a separate Package. You don't have to make the methods private if you don't want to. The Package can be in the same file or a separate one. You don't even have to export your methods (doing so makes them easier to call). You don't have to use inheritance and should you need inheritance you can choose your inheritance method.

If there is a "philosophy" behind perl OO it's "There is more than one way to do it." I can't take credit for that particular insight. I just heard it somewhere, once. ;->

There exists templates for making perl classes. I'm not familiar with them but a search of CPAN and this site should turn up some. My own tendency would be to learn to do it "longhand" first before evaluating packaged solutions. YMMV

  • Step one is to localize your data.
  • Step two is to create access methods (subroutines) for your data.
  • Step three is to move the data and methods into a separate file. Bless the references and call Exporter on your methods. Done!


    s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

    In reply to Re^3: Multiple packages for first time by starbolin
    in thread Multiple packages for first time by Anonymous Monk

    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.