Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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.


Comment on Re: calling a perl file from a perl script
Select or Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2014-10-31 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (215 votes), past polls