in reply to Exporter usage?

Because you are declaring $z as a file-scoped lexical using my. It has to be a package-global to be exported. You also need to use Foo qw($z); - note the sigil.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: Exporter usage?
by Anonymous Monk on Sep 02, 2002 at 03:56 UTC
    Hmm. Can I not declare $CGI = new CGI;@EXPORT_OK=qw($CGI);1;etc. and import the CGI ref in my other file?

      You can, but only if $CGI is not declared using my. This means either a use vars '$CGI'; or our $CGI (or don't declare it at all and don't use strict, but you should use strict).


      Confession: It does an Immortal Body good.

        Still doesn't work:
        package Foo; use strict; require Exporter; use vars qw(@ISA @EXPORT @EXPORT_OK); @ISA = qw(Exporter); @EXPORT_OK = qw($CGI); @EXPORT = qw($CGI); use CGI; our $CGI = new CGI; die $CGI; # I tried the export stuff down here, too 1; ----- use Foo qw($CGI);
        returns
        "$CGI" is not exported by the Foo module at..