Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with use

Status
Not open for further replies.

frasernm

Programmer
Aug 7, 2001
25
GB
Hi,

I have a number of .pm files (all contained in ./lib) - this was one file, but I split it up as the number of subroutines was getting unmanagable. Each file contains methods that are used by subroutines in the other .pm files.

Do I have to to put use a; use b; use c; etc... in all of my files, or is it possible to do this in just one file, as long as all of the file use this same file.

Or is there another better way to do this.

TIA,

Fraser
 
Hi Fraser,

You have to use each file in your script I'm afraid. Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
You could just have one .pm file that includes all the other PM files. You could then just use that file. IE:

###### allfiles.pm ######
use a;
use b;
use c;
use SuperduperSubs;
use me;

then, in each program,
use allfiles;

I think that might work.
 
Krel,

That is a valid thing to do - but I don't think you'll be able to say something like:

$val = a::a_function();

in your main script unless you 'use' a.pm in the main script itself. Mike
______________________________________________________________________
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Oh yeah - good thinking, Mike. I never thought of that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top