Hello list,

I use() a module and explicitly put some of its functions into the main
namespace so that I can use them without giving the full package name.
However, when the same module is used by another module, then if I
use() the modules in some order, it works, if I use() them in another,
it fails as if perl couldn't see the function.

I guess I'm doing something wrong, but what?

In case the above isn't clear, here is some code that exhibits the
problem:

>>>> essai.pl <<<<                                                        
#!/usr/bin/perl
-w use
strict; use
warnings;                                                             

# This works
# use FRED1 qw/ fred1a /;
# use FRED2;             

# This fails with:
# Bareword "fred2a" not allowed while "strict subs" in use at FRED1.pm
line 14. use FRED2;
use FRED1 qw/ fred1a /;

fred1a;
>>>> FRED1.pm <<<<
use strict;
use warnings;

package FRED1;

require Exporter;
our @ISA = qw/ Exporter /;
our @EXPORT_OK = qw/ fred1a /;

use FRED2 qw/ fred2a /;

sub fred1a {
     print "This is fred1a, I call fred2a\n";
     fred2a;
}
1;
>>>> FRED2.pm <<<<
use strict;
use warnings;

require Exporter;
our @ISA = qw/ Exporter /;
our @EXPORT_OK = qw/ fred2a fred2b /;

sub fred2a {
     print "This is fred2a\n";
}

sub fred2b {
     print "This is fred2b\n";
}
1;


-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to