When is a program too big for one file?

$

$_

HI, this application im currently developing is already
737 lines long, 501 of which are all callbacks.

It is my understanding that there is a way to split
perl programs accross multiple files, but im not sure at what
point one should think about doing this. Also where would
be a good place to find out about doing this effectively?
 
G

gnari

HI, this application im currently developing is already
737 lines long, 501 of which are all callbacks.

It is my understanding that there is a way to split
perl programs accross multiple files, but im not sure at what
point one should think about doing this.

when it is starting to bother you, the programmer/maintainer.

when you find that some parts oer more or less self-contained
and independent from other parts, and might be reusable in
other projects

when more than one person are working on different
parts of the program

how to do it, depends on how you want to split it
- .pm modules
- require
- do
- cat part1 part2 part2 > prog.pl
- use a Makefile to cat part1 part2 part2 > prog.pl
- probably many other ...

perldoc -f require
perldoc -f do
perldoc perlmod
perldoc perlmodlib


gnari
 
W

Walter Roberson

:HI, this application im currently developing is already
:737 lines long, 501 of which are all callbacks.

:It is my understanding that there is a way to split
:perl programs accross multiple files, but im not sure at what
:point one should think about doing this. Also where would
:be a good place to find out about doing this effectively?

There is a school of thought that programs should be at most one
screen-full. And that school of thought grew up in the days when
screens were often not more than 24 lines long.

The more usual perl way would be to split along functional lines.

By the way, if 501 lines are callbacks, could the program perhaps
be re-written to be table-driven ?
 
$

$_

Just a quick message to say Thank You to: Walter Roberson and gnari
For their responces, much appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top