I encounter a very strange problem with interactions between main program
and several modules.
If there is no interaction between modules (module1 calling module2 and
module2 calling module1) there is no problem with any sub each module.
But if the mod1 uses 'use mod2' and mod2 uses 'use mod1' then mod2 can't
find any sub of mod1.
There is a by-pass : change 'sub12()' by 'mod1::sub12()' in mod2 but I
can't understand why but in thsi case whe can delete all EXPORT in each
module.
Example of main program and modules :
main program :
#!/usr/bin/perl -w
use mod1 qw(sub11 sub12) ;
use mod2 qw(sub21) ;
sub21() ;
sub11() ;
sub12() ;
mod1:
#!/usr/bin/perl -w
package mod1 ;
require Exporter ;
@ISA =qw(Exporter) ;
@EXPORT_OK =qw(sub11 sub12);
#use mod2 qw(sub21) ;
use strict ;
sub sub11 {
print "mod1::sub11\n" ;
}
sub sub12 {
print "mod1::sub12\n" ;
}
1 ;
mod2:
#!/usr/bin/perl -w
package mod2 ;
require Exporter ;
@ISA =qw(Exporter) ;
@EXPORT_OK =qw(sub21);
use mod1 qw(sub11 sub12);
use strict ;
sub sub21 {
print "mod2::sub21\n" ;
sub12() ;
}
1 ;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>