dirtdart has asked for the wisdom of the Perl Monks concerning the following question:
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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Errenous behavior from Exporter
by Fletch (Bishop) on Nov 06, 2007 at 14:28 UTC | |
by dirtdart (Beadle) on Nov 06, 2007 at 15:25 UTC | |
|
Re: Errenous behavior from Exporter
by Anonymous Monk on Nov 06, 2007 at 15:23 UTC |