Re: Variable initialization in startup.pl
Perrin Harkins wrote: Andreas Schiffler wrote: Hi, I seem to have an odd problem with variable setup and use. The platform is apache/mod_perl as per LinuxMandrake 7.1. Here is the setup: A) I have a configuration.pm with variable declarations and no "use strict" similar to this: ... @array=() ... %hash=() ... B) Then I have a library of common routines that make use of these variables. These include routines to fill these variables with data. sub fill_array(); sub fill_hash(); C) Now in startup.pl is "use" both packages and call the fill_xyz() routines. D) In the mod_perl scripts (the guts of these scripts is again in a package that gets called by a wrapper .pl script) I "use" both packages and make use of the data with $value=$configuration::array[] and $value=$configuration::hash{} ... just reading their values. The Problem: The array is filled. The hash is empty. Any ideas? Workarounds? Tests? You didn't include enough code here for me to see what you're doing wrong, but your variable assignments look fishy. Here's a sample of how to do it: Well, I did ... you are close though. package SiteConfig; %hash = ( 'name' = 'value', 'name2' = 'value2', ); I use: package SiteConfig; %hash=(); and define a fill_hash() routine in another package: package common; use SiteConfig; sub fill_hash() { %SiteConfig::hash = ('name' = 'value',); # in startup.pl use SiteConfig (); I do a: use SiteConfig(); use common; common-fill_hash(); # in your module my $value2 = $SiteConfig::hash{'name2'}; my $entire_hash = %SiteConfig::hash; my $hash_ref= \%SiteConfig::hash; Same here with: use SiteConfig(); use common; my $value = $SiteConfighash{'name'); Problem: The hash is not defined! (The same for an array works fine.) Ciao Andreas -- | Andreas Schiffler[EMAIL PROTECTED] | | Senior Systems Engineer-Deskplayer Inc., Buffalo | | 4707 Eastwood Cres., Niagara Falls, Ont L2E 1B4, Canada | | +1-905-371-3652 (private) - +1-905-371-8834 (work/fax) |
Variable initialization in startup.pl
Hi, I seem to have an odd problem with variable setup and use. The platform is apache/mod_perl as per LinuxMandrake 7.1. Here is the setup: A) I have a configuration.pm with variable declarations and no "use strict" similar to this: ... @array=() ... %hash=() ... B) Then I have a library of common routines that make use of these variables. These include routines to fill these variables with data. sub fill_array(); sub fill_hash(); C) Now in startup.pl is "use" both packages and call the fill_xyz() routines. D) In the mod_perl scripts (the guts of these scripts is again in a package that gets called by a wrapper .pl script) I "use" both packages and make use of the data with $value=$configuration::array[] and $value=$configuration::hash{} ... just reading their values. The Problem: The array is filled. The hash is empty. Any ideas? Workarounds? Tests? What would be the preferred structure to define static variables that can be used for all modules and pre-initialized by startup.pl. Cheers Andreas -- | Andreas Schiffler[EMAIL PROTECTED] | | Senior Systems Engineer-Deskplayer Inc., Buffalo | | 4707 Eastwood Cres., Niagara Falls, Ont L2E 1B4, Canada | | +1-905-371-3652 (private) - +1-905-371-8834 (work/fax) |
Similar scripts in different directories
Hi there, quick question regarding script concurrency with mod_perl. If Ihave the same script name in different directories, will mod_perl treat them differently and can they be used concurrently? i.e. I have a production version and a development version of help.pm which gets called by help.pl by mod_perl. The code differs and they are in different directories. Can the two instances of help.pl (/production/help.pl and /devel/help.pl) be used at the same time without interfering with each other? Regards Andreas -- | Andreas Schiffler [EMAIL PROTECTED] | | Senior Systems Engineer - Deskplayer Inc., Buffalo | | 4707 Eastwood Cres., Niagara Falls, Ont L2E 1B4, Canada | | +1-905-371-3652 (private) - +1-905-371-8834 (work/fax) |
Re: httpd keeps growing
Andreas Schiffler wrote: I have a problem that I can't explain and don't know exactly how to debug: the httpd process keeps gobbling up memory over time. In reply to my own question, I found the cuplrit after some poking around in frequent restarts of the webserver using: apachectl restart After each code change, the new scripts were copied onto the server and apache restarted. Since we are in active development, this occured several times a day and each time apache was restarted this way, its memory consumption went up. Doing it the "hard" way with the /etc/rc.d/init.d script httpd restart solves the problem. Kindof a weired interaction between mod_perl and apache - can someone elaborate on "is this a bug or is it a feature"? Regards Andreas -- | Andreas Schiffler[EMAIL PROTECTED] | | Senior Systems Engineer-Deskplayer Inc., Buffalo | |
Re: httpd keeps growing
Matt Sergeant wrote: Do you have PerlFreshRestart On ? If so, don't. Install Apache::Reload and try that instead. Yeah, its ON. It seemed like a good thing to do, as per: http://perl.apache.org/guide/config.html#PerlFreshRestart and doesn't cause segfaults as per: http://perl.apache.org/guide/troubleshooting.html#Evil_things_might_happen_when_us I'll turn it OFF, do the "start" and "stop" procedure to reinitialize apache and have a look at Apache::Reload. Thanks for the tip! I still don't understand why a SIGHUP from apachectl would grab so much memory each time for the httpd process. Ideas anyone? Ciao Andreas -- | Andreas Schiffler[EMAIL PROTECTED] | | Senior Systems Engineer-Deskplayer Inc., Buffalo |
httpd keeps growing
Dear mod_perl users, I have a problem that Ican't explain and don't know exactly how to debug:the httpd process keeps gobbling up memory over time. This is what we are running: Server Version: Apache-AdvancedExtranetServer/1.3.12 (NetRevolution/Linux-Mandrake) mod_perl/1.22 mod_ssl/2.6.4 OpenSSL/0.9.5a with DBI/Apache::DBI interfacing a mysql database. The script code in use, is all embedded in several .pm packages with a run() subroutine - one package for each script. They can be called in a dual way: as a standard .cgi call (httpd forked perl process) for development and .pl call (mod_perl) for the production website. They are called in the appropriate way by employing two wrapper scripts (one .cgi and one .pl) that call the run() subroutine. Currently both calling methods are used on the website concurrently. We did this do ease the transition from plain .cgi to a mod_perl environment. Now I suspect this behaviour of the webserver gobbling up memory is due to the current setup, since before this change all was fine. After a httpd clean restart, memory consumption reported by top for httpd is sitting at 15MB ... after a day or two its at 150MB at which point Irestart the webserver. Any ideas where this memory consumption might come from? or how to find the culprit through some mod_perl code? Ciao Andreas -- | Andreas Schiffler [EMAIL PROTECTED] | | Senior Systems Engineer - Deskplayer Inc., Buffalo |
Re: expiring pages with mod_perl
Jamie Krasnoo wrote: Sorry for the newbie question but could anyone tell me how to expire pages so a user can't use the back button to get back to that page? There is a good summary here: http://www.pacificnet.net/~johnr/meta.html Note the failure of IE4 to follow basic Pragma syntax (and their workarounds). In my experience, IE4 and IE5 - under certain circumstances - still seem to cache stuff at will. Regards Andreas -- | Andreas Schiffler [EMAIL PROTECTED] | | Senior Systems Engineer - Deskplayer Inc., Buffalo | | 4707 Eastwood Cres., Niagara Falls, Ont L2E 1B4, Canada | | +1-905-371-3652 (private) - +1-905-371-8834 (work/fax) |