in reply to Re: Exporter usage?
in thread Exporter usage?

Hmm. Can I not declare $CGI = new CGI;@EXPORT_OK=qw($CGI);1;etc. and import the CGI ref in my other file?

Replies are listed 'Best First'.
Re: Re: Re: Exporter usage?
by theorbtwo (Prior) on Sep 02, 2002 at 04:03 UTC

    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..

        Hm. I was prepared to appolgize for posting without testing, and being wrong thereby... but all I can say is that it works fine for me... so long as I put the first and second parts of this in different files. Otherwise, I get an error because there is no Foo.pm -- are you sure you're picking up the right file?


        Confession: It does an Immortal Body good.