Re: global variables

2006-01-11 Thread David Gama Rodrí­guez
David Gama Rodrí­guez wrote: Tom Phoenix wrote: On 1/10/06, David Gama Rodrí­guez <[EMAIL PROTECTED]> wrote: I made a module that loads when Apache starts, in my module I declare a hash as a global in order to be accesed in any place in my module, my $hash; Not to be picky about t

Re: global variables

2006-01-10 Thread Tom Phoenix
On 1/10/06, David Gama Rodrí­guez <[EMAIL PROTECTED]> wrote: > I made a module that loads when Apache starts, in my module I declare a > hash as a global in order to be accesed in any place in my module, > > my $hash; Not to be picky about terminology, but a "my" variable is a lexical variable, n

Re: global variables

2006-01-10 Thread vmalik
I think that a fresh new copy of the module is loaded into memory everytime it is called. That's why your module loses its value. If I want to do something like that, I'd consider storing the value on the hard drive somewhere. Vishal Quoting David Gama Rodrí­guez <[EMAIL PROTECTED]>: > Hello ev

Re: Global variables / special variables / variable identifier with just one character

2004-10-08 Thread Bee
"Adam" <[EMAIL PROTECTED]> 在郵件 news:[EMAIL PROTECTED] 中撰寫... > Expected error message: "Global symbol "$b" requires explicit package name". > However, I get result: "test". > I've checked the special variables and it looks like $b is one of these. > > use warnings; > use strict; > zzz ($b); > prin

Re: Global variables / special variables / variable identifier with just one character

2004-10-08 Thread Steve Bertrand
> Expected error message: "Global symbol "$b" requires explicit package > name". > However, I get result: "test". > I've checked the special variables and it looks like $b is one of > these. > > use warnings; > use strict; > zzz ($b); > print "$b\n"; > sub zzz{ > $_[0] = "test"; > } > > Does it

Re: Global variables and a forked process

2003-08-14 Thread Paul Archer
Yesterday, Wiggins d'Anconia wrote: > Yes and no. There are multiple different implementations of threads all > of which have some good and bad points. You will need to look more into > them depending on your version of Perl and how complex the task is that > you wish to accomplish. (There is also

Re: Global variables and a forked process

2003-08-14 Thread wiggins
On Mon, 11 Aug 2003 08:11:07 -0500 (CDT), Paul Archer <[EMAIL PROTECTED]> wrote: > Yesterday, Wiggins d'Anconia wrote: > > > Yes and no. There are multiple different implementations of threads all > > of which have some good and bad points. You wi

Re: Global variables and a forked process

2003-08-14 Thread Ahmed Moustafa
Steve Grazzini wrote: On Sat, Aug 09, 2003 at 01:04:26PM -0700, Ahmed Moustafa wrote: Does a forked process share the memory locations of the global variables from the parent process? Changes made after the fork() won't be visible in the other process, if that's what you're wondering. Yes, that

Re: Global variables and a forked process

2003-08-11 Thread Steve Grazzini
On Sat, Aug 09, 2003 at 01:04:26PM -0700, Ahmed Moustafa wrote: > Does a forked process share the memory locations of the global > variables from the parent process? Changes made after the fork() won't be visible in the other process, if that's what you're wondering. -- Steve -- To unsubscrib

Re: Global variables and a forked process

2003-08-11 Thread Wiggins d'Anconia
Ahmed Moustafa wrote: Steve Grazzini wrote: On Sat, Aug 09, 2003 at 05:14:34PM -0700, Ahmed Moustafa wrote: Steve Grazzini wrote: Changes made after the fork() won't be visible in the other process, if that's what you're wondering. Yes, that's exactly what I am wondering. So, is there a way to

Re: Global variables and a forked process

2003-08-10 Thread Ahmed Moustafa
Steve Grazzini wrote: On Sat, Aug 09, 2003 at 05:14:34PM -0700, Ahmed Moustafa wrote: Steve Grazzini wrote: Changes made after the fork() won't be visible in the other process, if that's what you're wondering. Yes, that's exactly what I am wondering. So, is there a way to assign values to the glo

Re: Global variables and a forked process

2003-08-10 Thread Steve Grazzini
On Sat, Aug 09, 2003 at 05:14:34PM -0700, Ahmed Moustafa wrote: > Steve Grazzini wrote: >> Changes made after the fork() won't be visible in the other >> process, if that's what you're wondering. > > Yes, that's exactly what I am wondering. So, is there a way to > assign values to the global varia

Re: Global variables

2002-08-21 Thread Connie Chan
I learnt something about this for days only, so don't know if there are bugs here : # Create a package glob_vars.pm # package glob_vars; require Exporter; our @ISA = qw (Exporter); our @EXPORT = qw (%VARS) our %VARS = (); $VARS{sth_a} = 'sth_a'; $VARS{sth_b} = 'sth_b'; 1; # End of package # #

Re: Global variables

2002-08-20 Thread david
use package. example: name the following DBString.pm: #!/usr/bin/perl; package DBString; @EXPORT = qw($db $user $psw); $db = 'db'; $user = 'user'; $psw = 'psw'; 1; then in another test script: #!/usr/bin/perl use DBString; print $DBString::db,"\n"; #-- prints db print $DBString::user,"\n"; #--

Re: Global variables in forked processes

2002-05-10 Thread drieux
On Friday, May 10, 2002, at 09:20 , Chas Owens wrote: [..] > In many operating systems fork is implemented using copy-on-write. This > means that when you fork both processes refer to the same memory > locations until one of them tries to change the bytes stored there. At > that time the change

Re: Global variables in forked processes

2002-05-10 Thread Chas Owens
On Fri, 2002-05-10 at 00:12, Ahmed Moustafa wrote: > Thanks a lot. I understand that. > > I was thinking that variable 'x' of a forked process 'p2' would point at > the same memory location of variable 'x' of a parent process 'p1'. That > can't be true. If that was true, 'p1' and 'p2' would be

Re: Global variables in forked processes

2002-05-09 Thread Ahmed Moustafa
Thanks a lot. I understand that. I was thinking that variable 'x' of a forked process 'p2' would point at the same memory location of variable 'x' of a parent process 'p1'. That can't be true. If that was true, 'p1' and 'p2' would be identitcal (no need to fork!). -- Ahmed Moustafa http://po

Re: Global Variables: 'my' vs 'use vars'

2002-03-28 Thread Chas Owens
On Thu, 2002-03-28 at 14:55, [EMAIL PROTECTED] wrote: > Hello, All: > > I've never been very good at scoping so it it's no surprise that this > confuses me: > > When declaring variables at the beginning of a script, what is the > difference between 'my' and 'use vars'? > > -- > Eric P. >

Re: global variables

2001-09-24 Thread _brian_d_foy
In article <001201c144fb$4a1ba3d0$ec00a8c0@boxx>, [EMAIL PROTECTED] (Sascha Kersken) wrote: > Perl 5.6 provides the 'our' statement as opposite to 'my': it makes a > variable global to a file in which it's used. it declares a package variable, actually. if you aren't in its package, then you h

Re: global variables

2001-09-24 Thread _brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Ruth Albocher) wrote: > I would like to use a global variable in my perl application, but since > everything in perl is in a package, it will always belong to some > package. what can I do? stay away from global variables. :) what are you tryi

Re: global variables

2001-09-24 Thread Sascha Kersken
Hi! Perl 5.6 provides the 'our' statement as opposite to 'my': it makes a variable global to a file in which it's used. HTH Sascha - Original Message - From: "Ruth Albocher" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 24, 2001 1:01 PM Subject: global variables

Re: global variables in subroutines..?

2001-07-18 Thread Brett W. McCoy
On Wed, 18 Jul 2001, Stephanie Stiavetti wrote: > I'm writing a script to check for validity of form elements. here's what I > have so far: > > my ($job) = $cgi->param("job"); > > bla bla bla more script bla bla bla > > > sub fixFailed > { my (@failedFields); > my ($validForm)="1"; > >

Re: Global Variables Question

2001-04-25 Thread Paul
--- "Warren D. Johnson" <[EMAIL PROTECTED]> wrote: > > Test.pl uses variables (via use vars) from config.pl. These > variables are defined and given values in config.pl. AFter the first > usage of test.pl, the variables we are pulling in from config.pl no > longer have values. So it's som