Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > problem in including module

Reply
Thread Tools

problem in including module

 
 
sks
Guest
Posts: n/a
 
      08-08-2005
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

 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      08-08-2005
sks wrote:
> 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

 
Reply With Quote
 
 
 
 
Klaus
Guest
Posts: n/a
 
      08-08-2005
"sks" <> wrote in message
news: oups.com...
> 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.

--
Klaus


 
Reply With Quote
 
Brian McCauley
Guest
Posts: n/a
 
      08-08-2005


sks wrote:
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Including a module in an included module. Prince Nez Ruby 3 08-18-2009 11:46 AM
Information about including module? bukzor Python 1 01-03-2008 02:20 AM
Re: module docstring, documentation,anything? please note is the module type/object NOT some module Maric Michaud Python 0 06-24-2006 12:42 PM
Question about the behavior of reopening a module and including another module. Zev Blut Ruby 3 11-24-2004 12:27 PM
including singleton methods with a module? Ferenc Engard Ruby 2 12-31-2003 01:54 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57