in reply to Re: Re: Exporting scalars from a module
in thread Exporting scalars from a module

How can I enable use strict and not use my to declare the variables? (The version of perl we use does not support the our keyword):

package ExitCode; my @varsToExport = qw(%exitCodes $EXIT_SUCCESS $EXIT_GENERAL_FAILURE $ +EXIT_CHANGELIST_CONSUMED $EXIT_FUTURE_CHANGELIST); require Exporter; use vars (qw(@ISA @EXPORT), @varsToExport); @ISA = qw(Exporter); @EXPORT = qw(@varsToExport); %exitCodes; # Define exit codes $EXIT_SUCCESS = 0;

Replies are listed 'Best First'.
Re^4: Exporting scalars from a module
by Tanktalus (Canon) on Mar 19, 2005 at 02:55 UTC
    You need to put your @varsToExport in a BEGIN block.
    my @varsToExport; BEGIN { @varsToExport = qw(...); } use vars @varsToExport; @EXPORT = qw(@varsToExport);
    Or you can upgrade your perl. :-)