Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: calling a perl file from a perl script

by jonadab (Parson)
on Apr 06, 2007 at 20:03 UTC ( #608741=note: print w/replies, xml ) Need Help??

in reply to Re^2: calling a perl file from a perl script
in thread calling a perl file from a perl script

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.

Replies are listed 'Best First'.
Re^2: calling a perl file from a perl script
by hodashirzad (Novice) on Apr 06, 2007 at 20:08 UTC
    Thanks a lot for your help I will look into creating modules and start from there.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://608741]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2017-12-14 21:09 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (410 votes). Check out past polls.