Re: calling a perl file from a perl scriptby jonadab (Parson)
|on Apr 06, 2007 at 20:03 UTC||Need Help??|
I thought it would be good if I have separate file for each part of my code like to get a link list of the categories one code and for getting a link list of the products one and so on
That almost sounds like modules. I think I'd recommend creating your functions to do those things you describe in one or more .pm files ("modules"), placing them in one of the site-perl directories listed in @INC, and then loading them with use from any program that wants to use them.
Modules you're only going to use locally don't have to be held up to the same exacting standards you would do if you were going to publish them to the CPAN for the world to use. A module that's only going to be used by just one app is not really significantly harder to create than any other Perl script. You don't have to mess with package namespaces, for instance, especially for a small application: you can just define your functions in the normal way and let them live in the main namespace. You don't need any more POD for a module of this kind than you would for any other code. I do recommend the use strict pragma, but I'd recommend that even for files you were going to require.
We're working on a six-year set of freely redistributable Vacation Bible School materials.