http://www.perlmonks.org?node_id=1052515


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

My question is this: is there a way of breaking it into smaller chunks for files instead of having everything in one large file? I have done this in other languages and it makes things much more readable.

If what you mean is: "a way of breaking it into smaller chunks for files automatically?", yes, you can split your code using a custom record separator (like "\n\nsub "). See the special variables $/ and $\ in: perldoc perlvar. Using this you can pick up chunks of code containing perl objects and print each different function in your code to a different file (function1, function2... use a counter) to be examinated. You will need a little post-processing for fine-tuning probably

  • 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:58 UTC

    Hi pvaldes,

    My question revolves more around logically breaking it apart as opposed to automatically. Although this looks VERY interesting!

    Thanks for the reply!

    Sincerely,

    Craigbert