Gossamer Forum
Home : General : Perl Programming :

Require not working?

Quote Reply
Require not working?
Hi I'm using the following code;

Code:
eval {
require $CFG->{admin_root_path} . "/defs/backup_settings_database.txt";
};
if ($@) {
print $IN->header();
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
}

...and defs/backup_settings_database.txt contains;

Code:

my $url = "";
my $user = "";
my $pass = "";
my $remote_ftp = "0";
my $cwd_to = "";
my $dateorname = "date";

1;

I get this error when running the script though;

Quote:
[Wed Sep 3 16:17:22 2003] ace_backup.cgi: Global symbol "$dateorname" requires explicit package name at ace_backup.cgi line 184.
[Wed Sep 3 16:17:22 2003] ace_backup.cgi: Global symbol "$FTPBackup" requires explicit package name at ace_backup.cgi line 200.
[Wed Sep 3 16:17:22 2003] ace_backup.cgi: Global symbol "$url" requires explicit package name at ace_backup.cgi line 202.
[Wed Sep 3 16:17:22 2003] ace_backup.cgi: Global symbol "$user" requires explicit package name at ace_backup.cgi line 203.
[Wed Sep 3 16:17:22 2003] ace_backup.cgi: Global symbol "$pass" requires explicit package name at ace_backup.cgi line 203.
[Wed Sep 3 16:17:22 2003] ace_backup.cgi: Global symbol "$cwd_to" requires explicit package name at ace_backup.cgi line 204.
[Wed Sep 3 16:17:22 2003] ace_backup.cgi: Global symbol "$ByDateOrName" requires explicit package name at ace_backup.cgi line 207.
[Wed Sep 3 16:17:22 2003] ace_backup.cgi: Execution of ace_backup.cgi aborted due to compilation errors.

Any ideas why? The eva{} isn't showing any errors, but the variables just don't seem to be importing Frown

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Require not working? In reply to
Figured it out. I needed to use 'our' (I'm assuming this is something to do with the way strict work?)

Code:
our ($url,$user,$pass,$remote_ftp,$cwd_to,$dateorname);

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates