problem in including module

Discussion in 'Perl Misc' started by sks, Aug 8, 2005.

  1. sks

    sks Guest

    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
    sks, Aug 8, 2005
    #1
    1. Advertising

  2. sks

    Paul Lalli Guest

    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
    Paul Lalli, Aug 8, 2005
    #2
    1. Advertising

  3. sks

    Klaus Guest

    "sks" <> wrote in message
    news:...
    > 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
    Klaus, Aug 8, 2005
    #3
  4. 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
    Brian McCauley, Aug 8, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bukzor
    Replies:
    1
    Views:
    211
    bukzor
    Jan 3, 2008
  2. Ferenc Engard
    Replies:
    2
    Views:
    104
    Ferenc Engard
    Dec 31, 2003
  3. Zev Blut
    Replies:
    3
    Views:
    158
    trans. (T. Onoma)
    Nov 24, 2004
  4. Phil Darnowsky
    Replies:
    1
    Views:
    85
  5. Prince Nez
    Replies:
    3
    Views:
    240
    Robert Klemme
    Aug 18, 2009
Loading...

Share This Page