Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Modules included more than once

by Sifmole (Chaplain)
on Aug 22, 2002 at 11:06 UTC ( #191978=note: print w/ replies, xml ) Need Help??


in reply to Modules included more than once

The "use" command is similar to PHP's "require_once" command, so you may want to look into that. Also have you confirmed that there is only one subroutine with the name XXXX in all the packages you are including? Perhaps you left an old version of the routine laying around...


Comment on Re: Modules included more than once
Re: Re: Modules included more than once
by physgreg (Scribe) on Aug 22, 2002 at 11:19 UTC
    I've done a bit more digging, and it appears that there is a circular include going on:
    package OBJECT_SERVICES; use SUPPORT; use SUPPORT qw( %typeConvert %enumeratedTypes);
    and
    package SUPPORT; use OBJECT_SERVICES;
    I'm not sure how to get round this, as both packages use functions from the other package. I know this looks terrible.
    Would it make sense to make another package containing the functions used by both packages, and use that in both, rather than the way it's done now?
    Thanks,
    Greg.
      the problem is not in circular includes. circular includes are just fine. I suspect the problem is in:
      package OBJECT_SERVICES; use SUPPORT; use SUPPORT qw( %typeConvert %enumeratedTypes);
      why do you use SUPPORT twice? the second use should be enough.

      cheers,
      Aldo

      King of Laziness, Wizard of Impatience, Lord of Hubris

        It's probably cause he's doing stuff he shouldn't be doing.
        perl -Mstrict -w -MCGI -MCGI=*table -e 1 perl -Mstrict -w -MCGI::Carp -MCarp -e 1
        The Carp does it cause has to perform magic. That is why you should use warnings;
        perl -Mstrict -Mwarnings -MCGI::Carp -MCarp -e 1

        ____________________________________________________
        ** The Third rule of perl club is a statement of fact: pod is sexy.

        I suspect that there is something going on with my circular includes, as I do not get the warning if I remove one half of circle. I think the problem is caused by 'use' commands in each module interacting badly with 'use' commands in the super-package that ties everything together. As the modules are never used except through this, I have removed all the redundant calls, and the warnings seem to have disappeared.
        Thanks to everyone for their help!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (12)
As of 2014-09-19 09:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls