Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How best to break apart a large perl program

by pvaldes (Chaplain)
on Sep 05, 2013 at 08:41 UTC ( #1052515=note: print w/ replies, xml ) Need Help??


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
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1052515]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-09-18 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (110 votes), past polls