It's not an EMbperl question, but...
 
When you use p2 it's gets compiled and the Perl compiler tries to resolve the names to the subrountines you import from p1. If the use is before the BEGIN, these symbols aren't exported at this point, so the compiling of p2 will fail.
 
Gerald
 
-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
 
Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------
----- Original Message -----
From: Maurício Amorim
To: embperl
Sent: Monday, February 10, 2003 2:39 AM
Subject: Question about Exported symbols

Hi list,

 

I have two modules with cross dependency.

Some of type:

 

package p1;

BEGIN {

        use Exporter ();

 

        our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);

 

        # set the version for version checking

        $VERSION     = 1.00;

 

        @ISA         = qw(Exporter);

        @EXPORT      = qw(f1 f2);

        %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],

 

        # your exported package globals go here,

        # as well as any optionally exported functions

        @EXPORT_OK   = qw();

};

use p2;

.

.

1;

------------

 

package p2;

BEGIN {

.

.

.

};

use p1;

.

.

1;

 

I am having some problems about undefined subroutine when the use is before the BEGIN clause.

Any body know because it occurr ?

I can always export symbols before use modules, same when the export is inside of BEGIN clause ?

 

When the use is how showed above,  the error not occurr.

I am exporting many symbols with @EXPORT.

Any body suggest an better use of this situation ?

 

 

Thank you. Mauricio