in reply to How best to break apart a large perl program

G'day Craigbert,

Welcome to the monastery.

The short answer is yes: you can break up your code into modules, gathering related functionality into separate modules and putting each module into its own file.

The longer answer is going to depend on what code you're actually dealing with: beyond knowing it's large, "does a LOT of stuff" and "jumps around a bit", we don't have a lot to go on.

As a start, given you're "VERY new to Perl", I'd suggest you bookmark the Online Perldoc (perl page): possibly read perlintro in the Overview section; look at what's available in the Tutorials section (maybe skimming some of the FAQs); and just make a mental note of the contents of the Reference Manual. Basically, there's far too much to read: get a feel for where things are documented so you can look them up quickly as you need to.

For creating the modules, take a look at perlmodlib - Modules: Creation, Use, and Abuse, perlmodstyle and perlmod.

-- Ken

  • Comment on Re: How best to break apart a large perl program

Replies are listed 'Best First'.
Re^2: How best to break apart a large perl program
by Craigbert (Initiate) on Sep 07, 2013 at 15:55 UTC

    Hi Ken,

    Thanks for the reply! I was a little vague for two reasons:

    1. I am kind of new to my current job and I am not sure what my current employer would be OK w/my posting and not posting. So as I work through it I may post small chunks for help.

    2. Because I am new I figured (right or wrong) I need to do a massive amount of reading and learning so that I know better what I am doing and can ask better questions here.

    Thanks for the links I will dutifully go through those this weekend. Also, I have purchased used copies of "Learning Perl" (4th ed.) and "Mastering Perl" and I am slowly working my way through those.

    Thanks again for your help...I am sure there will be more questions to come! :)

    Sincerely,

    Craigbert

      When I wrote "we don't have a lot to go on", that wasn't intended as a criticism but rather a reason why I was unable to provide a more detailed answer.

      The code you're working with is more than likely the intellectual property of your employer. There's a good chance that, when you started your job, you entered into some form of legally binding contract in which you agreed not to share that code with third-parties. I'd recommend that you simply do not post that code: I don't know your situation but it's possible that just asking for permission may be viewed negatively.

      A better approach would be to put together minimal, generalised code that's sufficient to explain whatever questions you have and post that. This would be appropriate for module design questions as well as asking for specific "how do I do ...?" help.

      We're more than happy to help, especially when you demonstrate that you've made some effort yourself. Have a look at the guidelines in "How do I post a question effectively?". You'll also find useful information in the "Posting on PerlMonks" FAQ and the "How (Not) To Ask A Question" tutorial.

      -- Ken