I would like to use these constants in the rest of my programs like so:#!/usr/bin/perl -w package SFConfig::Globals; use strict; use Exporter; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw(TEMPLATE_DIRECTORY); sub TEMPLATE_DIRECTORY () {"/srv/www/vhosts/spamfilter.o +nlineky.net/Templates"} 1;
Whenever I run the script above on my Suse Linux 10.2 box with Perl 5.8.8 installed, I get the message "Bareword "SFConfig::Globals::TEMPLATE_PATH" not allowed while "strict subs" in use". When I run the exact same code with the exact same module on my Windows XP box with ActivePerl, it works just exactly as I would expect, printing the contents of TEMPLATE_PATH. On both machines, I saved the module in the site_perl directory. What else could I be doing wrong?#!/usr/bin/perl -w use strict; use SFConfig::Globals; print "Content-type: text/html\n\n"; my $test = SFConfig::Globals::TEMPLATE_PATH; print "$test\n";
In reply to Errenous behavior from Exporter by dirtdart
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |