=sjs= has asked for the wisdom of the Perl Monks concerning the following question:

I have a main program and several modules. All are using the Exporter and EXPORT_OK. Some of the modules refrence each other (bad practice i know, but it makes sense to encapsulate the data involved.) The program is dying. It says it can't find a subroutine that is exported from one module and imported by another. It dies at startup if I put my call at the beginning of the module -- after the use ... section. Perl says it can't find the subroutine but if I run dumpvar.pl to print the stash for the package involved, I see the lable.

I've been looking at the code for about 8 hours and can't see a problem, and if I use a fully-qualified (packagename::subroutine) syntax, everything is ok.

At this point, it looks like the circular relationship of the modules is the problem, but the lable is in the stash. And this seems like it is something not that unusual but it is the first time I've tried using the exporter this extensively.

Is it a problem with the exporter or should I keep digging into the code.

Thanks
Steve S.

Replies are listed 'Best First'.
Re: problems with Exporter
by dragonchild (Archbishop) on Nov 08, 2001 at 22:09 UTC
    Try adding this function to every module that uses Exporter to aid debugging:
    sub import { print "Inside ", __PACKAGE__, " import() with @_\n"; goto &Exporter::import(@_); }
    That may give you some insight as to what's happening when. Other than that, I don't have an answer offhand.
Re: problems with Exporter
by davorg (Chancellor) on Nov 08, 2001 at 22:32 UTC

    Can you post a cut-down set of files that demonstrates the problem?

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you don't talk about Perl club."