Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 19081 invoked from network); 28 Jun 2005 07:19:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Jun 2005 07:19:56 -0000 Received: (qmail 26640 invoked by uid 500); 28 Jun 2005 07:19:46 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 26622 invoked by uid 500); 28 Jun 2005 07:19:45 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 26609 invoked by uid 99); 28 Jun 2005 07:19:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jun 2005 00:19:45 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of tomAtLinux@gmx.at designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 28 Jun 2005 00:19:44 -0700 Received: (qmail invoked by alias); 28 Jun 2005 07:19:41 -0000 Received: from mail.bestsolution.at (EHLO [192.168.100.12]) [83.64.113.2] by mail.gmx.net (mp003) with SMTP; 28 Jun 2005 09:19:41 +0200 X-Authenticated: #6137719 Message-ID: <42C0FA0C.7070306@gmx.at> Date: Tue, 28 Jun 2005 09:19:40 +0200 From: Tom Schindl User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050322) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: x x , mod_perl Subject: Re: Declaring variables in a required script References: In-Reply-To: X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 You should learn how perl works. I suppose you are running the script as an Apache::Reqistry but you miss the version. You problem is that if en.pl is loaded using require in a process is will not be reloaded once more hence you lines of code won't be run. If you really want to run the "required" code everytime you are loading it you have to use "do" see perlfunc for more information. Still I'd consider using "do" a bad program design. Tom x x schrieb: | I'm sorry if this question has already been answered, but I couldn't | find the answer. | | Here is my problem. I have a script that looks like this: | #!/usr/local/bin/perl -Tw | | use strict; | use CGI; | | my $q = new CGI; | | my $var = $q->param("var"); | $var =~ m/(.*)/; #just to don't get any tainted errors, don't use in | public. | $var = $1;#just to don't get any tainted errors, don't use in public. | | require "/Library/WebServer/mod_perl/$var.pl"; | | print "Content-Type: text/plain\n\n"; | | print "1\n" if $lang::varl eq $var; | print "$var\n"; | print "$lang::varl\n"; | | | | And I have the script nl.pl: | #!/usr/bin/perl -wT | | use strict; | | $lang::varl = "nl"; | | | | And the last one, en.pl: | #!/usr/bin/perl -wT | | use strict; | | $lang::varl = "en"; | | | So if I make a request a few times with &var=en and then switch to | &var=nl It sometimes happens that I get: | nl | en | | So I don't get the 1 ($lang::varl and $var don't eq) and indeed the two | lines don't match ("en\nnl" or also sometimes "nl\nen") $var always has | the right value, the problem is that $lang::varl doesn't always have the | right value. | | I am using Apache 1.3.33, mod_perl 1.29 and Mac OS X 10.4.1. | | I hope someone could help me. Thank you very much! | | Bram. | | _________________________________________________________________ | Direct antwoord op je vragen: gebruik MSN Messenger | http://messenger.msn.nl/ | | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCwPoLkVPeOFLgZFIRAuKDAKCFGY5qJZmdK7onl+AaD9icsPYH8gCgsTjw fmldKQYXB1yBvh6s/7INRjw= =Y1qX -----END PGP SIGNATURE-----