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

comment on

( [id://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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-03-28 14:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found