Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm new to object-oriented programming in Perl; I've used OO modules, of course, but for my own code I've never had to do anything relying on inheritance or anything like that.
I'm about to convert a very large procedural program to Moose, but even here, I'm not doing it so that I can override different methods.
This program has five main tasks in it, each one over 1000 lines long; right now, everything's just one huge file, with comment lines saying "Task #3: archive old files" or whatever to divide it up. For organizational purposes, I'd like to break this up into separate modules, so that my main package would be DoSomething and then I'd have DoSomething::Task1, DoSomething::Task2, etc. The main DoSomething module will have all the core code (setting up logging, reading config, etc.), and then would just call the different tasks as necessary. The end user would just write a small script invoking this, and wouldn't have to know that there are all these different submodules.
Is this the right way to set this up? How would the DoSomething module call routines in the submodules? Is there some other way I should be accomplishing this? Again, I'm not doing this for inheritance or overriding purposes, I'm doing it so that I have five separate thousand-line modules instead of one five-thousand-line mess.
|
---|