problem in including module

S

sks

i have created a module which does not have any class, "meslibhdr.pm".
all it has is has tables and arrays. Then i created a module, "abc.pm",
that use two modules "xyz.pm" and "meslibhdr.pm". whereas xyz.pm to
have used meslibhdr.pm. The problem is that the code that is taking the
refrence of meslibhdr.pm is not executing, that is, no result is
populating.

thanks in advance


sush
 
P

Paul Lalli

sks said:
i have created a module which does not have any class, "meslibhdr.pm".
all it has is has tables and arrays.

What the heck is a table? What does it mean for a module to "have" an
array?
Then i created a module, "abc.pm",
that use two modules "xyz.pm" and "meslibhdr.pm". whereas xyz.pm to
have used meslibhdr.pm. The problem is that the code that is taking the
refrence of meslibhdr.pm is not executing, that is, no result is
populating.

thanks in advance

Thanks in advance for what? You haven't asked anyone to do anything.
You certainly haven't provided any information that would enable anyone
to debug your problem.

Please read the Posting Guidelines for this group. Then follow them.
Post a short but complete program that demonstrates your problem. Then
maybe someone can help you.

Paul Lalli
 
K

Klaus

sks said:
i have created a module which does not have any class, "meslibhdr.pm".
all it has is has tables and arrays. Then i created a module, "abc.pm",
that use two modules "xyz.pm" and "meslibhdr.pm". whereas xyz.pm to
have used meslibhdr.pm. The problem is that the code that is taking the
refrence of meslibhdr.pm is not executing, that is, no result is
populating.

Please post a small but complete example which reproduces the problem:

1. a small but complete "meslibhdr.pm"
2. a small but complete "abc.pm"
3. a small but complete "xyz.pm"
4. a small but complete Perl-program which calls the 3 modules as described
in your original post and which demonstrates the fact that no result is
populated by some appropriate print statements.
 
B

Brian McCauley

sks said:
i have created a module which does not have any class, "meslibhdr.pm".
all it has is has tables and arrays. Then i created a module, "abc.pm",
that use two modules "xyz.pm" and "meslibhdr.pm". whereas xyz.pm to
have used meslibhdr.pm. The problem is that the code that is taking the
refrence of meslibhdr.pm is not executing, that is, no result is
populating.

require (or use) will only load one file once.

If the file that's loaded lacks a "package" declaration then it will get
loaded into whatever namespace was current when the first use/require
was encountered. Give the module its own namespace then export symbols
into the namspaces of the modules that use it.

What you are doing BTW is creating a Perl4-style library and giving it a
..pm suffix. Simply giving a Perl4-style library a .pm suffix does not
make it a well behaved module.

perldoc Exporter
perldoc perlmod
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top