SPUG: Scope question

Parr, Ryan Ryan.Parr at wwireless.com
Tue Jun 11 18:39:22 CDT 2002


Peter,

If you fully qualify the var then it is available. But this isn't any
different from my understanding of standard module scope. Be careful when
using global vars from mod_perl though, since the variables will not be
reset when the request is complete. Also, if you modify the values of your
global vars at runtime then all of your httpd children will end up with
different values, which can really bite you. With mod_perl I've found it's
best to just always use 'my'. 

But if you really want to share globals check out
http://theoryx5.uwinnipeg.ca/cgi-bin/guide-filter?page=perl/Using_Global_Var
iables_and_Shari.html;query=global;match=and;where=all;stem=no.

-- Ryan Parr

Common sense is the collection of prejudices acquired by age eighteen.
		-- Albert Einstein


-----Original Message-----
From: Peter Darley [mailto:pdarley at kinesis-cem.com] 
Sent: Tuesday, June 11, 2002 3:00 PM
To: SPUG
Subject: SPUG: Scope question


Friends,
	I have a scope question.  I'm using mod_perl with apache, and it
seems like in my main script (the one that the URL points to) when I do 'use
vars qw($Thing1 %Thing2)' $Thing1 and %Thing2 are not available to functions
in modules called from the main script.  Is this just an illusion and I have
some other problem, or is this the way things work?  If so, is there some
way I can share a variable with modules being used by a script? Thanks,
Peter Darley


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org




More information about the spug-list mailing list