Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hi whittick,

I think the responses you've got so far are very good, I just wanted to throw out a few more thoughts on the matter.

As for books, there's also Modern Perl. Once you've gotten through some of the Learning/Intermediate/Mastering Perl series, of course the Camel is great. A somewhat advanced book, but great if you want to "broaden your horizons" in regards to what's possible with Perl, is Higher-Order Perl.

As others have said, I don't think OO is a requirement for "real" programs. There is a huge gray area between what might be understood as a "script" and a "real program" and that definition will differ from person to person. In addition to what was already mentioned by others, like testing and VCS, here are a few things that I think would move a script towards a program: try to avoid global variables, reduce repetition and refactor code into subroutines (that are hopefully re-usable; which can then be moved into your own modules and/or turned into OO methods), and use modules appropriate to the task instead of re-inventing the wheel.

If you do want to go to OO, then probably the first thing I'd recommend is leaning how to do it in core Perl (e.g. perlootut and perlobj; Update: or Modern Perl's section Blessed References); I remember finding it quite eye-opening as to how in Perl, relatively little is needed to go from a simple hash reference to an object. If you want to code entirely in OO, then it's probably best to go to a framework like Moo or Moose.

Hope this helps,
-- Hauke D

In reply to Re: Moving from scripting to programming by haukex
in thread Moving from scripting to programming by whittick

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (7)
    As of 2020-04-04 23:32 GMT
    Find Nodes?
      Voting Booth?
      The most amusing oxymoron is:

      Results (33 votes). Check out past polls.