"<array variable> is not exported by the <module name>" error message

 Hello there, I am very new to Perl (all my experience comes from last weekend trying to get my head around it) and I am developing a hosting cart.

  I have an array variable @cart and a perl module MyCart.pm. In my MyCart.pm module I explicitly export my @cart variable doing:

MyFile.pm
------------------------------------

package MyFile;

use CGI::Cookie;
use Exporter;
$ISA = qw/Exporter/;
$VERSION = 0.9;
@EXPORT_OK = qw/@cart/;

and in another perl file I am importing it by doing:

MyTestCGIFile.pl
----------------------

use MyCart qw/@cart/;


  but everytime I run it from command prompt (from browser I am getting a 500 Internal Server Error) I am getting the following error:

"@cart is not exported by the MyCart module".

  Any ideas of how I can export/import it and what this error message means is greatly appreciated.

  I am using Perl v5.6.1 under Mandrake Linux 8.1.

  Kind regards
LVL 36
girionisAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ComTechConnect With a Mentor Commented:
Question has been solved and placed into PAQ, and points refunded.

Thank you,
ComTech
CS Admin @ EE
0
 
DVBCommented:
Is @cart defined correctly in the MyCart.pm file?
0
 
girionisAuthor Commented:
 How should it be declared? COuld you provide some sample code?

  Kind regards
0
 
girionisAuthor Commented:
 Problem solved. Instead of use MyCart I did import MyCart qw/@cart/. I seem to obtain the disered result.

  I would like to ask a moderator to refund the points back to me and close the question.

  Kind regards.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.