Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

"<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
0
girionis
Asked:
girionis
  • 2
1 Solution
 
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
 
ComTechCommented:
Question has been solved and placed into PAQ, and points refunded.

Thank you,
ComTech
CS Admin @ EE
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now