Re: $r and Registry(NG)* scripts

2001-03-14 Thread Daniel



Stas Bekman wrote:

 On Tue, 13 Mar 2001, Daniel wrote:
 
 
 
 
 All scripts on
 site start with:
 
 use vars qw(%input $r);
 $r = Apache-request;
 
 This has worked fine...no complaints in log files...until I switched the
 handler from Registry to RegistryNG;
 
 Now I see occasional:
 Variable "$r" will not stay shared at /home/httpd/perl/daily-news.pl
 line 9 (#1)
 in log files.
 
 
 http://perl.apache.org/guide/troubleshooting.html#Value_of_x_will_not_stay_shared
 
 Thanks for the reply and the guide (of which I'm pretty familiar) Stas.
 See comments above and below. $r is global in my scripts.
 Unless I'm misunderstanding something, the warning shouldn't be
 occurring. Wasn't under Registry. Also these warnings do not appear on
 every page request, so I'm wondering if it has something to do with the
 compile stage of perlrun and/or something that happens during a new
 apache process creation.
 
 
 Sorry, I've jumped too fast with a conclusion at seeing the standard
 "...will not stay shared".

lol...np...you're doing a great job for mod_perl helping newcomers.


 But in order to debug the problem, I have to be
 able to reproduce it. Are you saying that the script below, as it is,
 has this problem? But it's not the whole script, I understand. Can you
 write a small reproducing test?

I tried last nite to put something together to trigger the error 
everytime. All I came up with was reducing maxrequestsperchild to 10
and some scary lwp selfdownloading, $self-lookup($self_uri)-run code.
The code did not produce the exact error but managed to produce:


Can't locate object method "log_error" via package "Apache::RegistryNG" 
at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/PerlRun.pm line 53.
 
Apache::PerlRun::can_compile('Apache::RegistryNG=HASH(0x876a8dc)') 
called at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/RegistryNG.pm 
line 33
 Apache::RegistryNG::handler('Apache=SCALAR(0x876af3c)') called 
at /dev/null line 0
 eval {...} called at /dev/null line 0

I can't post the full site code either.

Best I can do is expand the description and other oddities I've noticed 
here on site.

There's about six heavily used RegistryNG scripts onsite.

Each calls a php header via $subr-run which does a virtual() to include 
a RegistryNG banner ad.

Each calls a php footer via $subr-run which does a virtual() to include
about five other RegistryNG banners ads and a virtual() for a RegistryNG 
list of the day's stories.

Oddity: after any $subr-run calls, the next print() may or may not 
work. I have to print "!--anything--"; to use print() reliably after a 
$subr-run call.

Oddity: I use $ENV{SCRIPT_NAME} for scripts that call themselves. Once a 
$subr-run has occurred  $ENV{SCRIPT_NAME} $ENV{SCRIPT_FILENAME} are 
changed in the caller to the values of the $subr %ENV (does it not try 
to restore?).

Lemme know if any of this sounds familiar.




 
Error occurs at first $r assignment:

 
 first nine from daily-news.pl:
 #!/usr/bin/perl -w
 use strict;
 use DBI;
 use date_site;
 my $dateformat = date_site::dateformat;
 use Apache::Request;
 
 use vars qw($dbh %input %output %filebase $r %sites); #vars used on $r
 $r = Apache-request; #--error first happens here
 
 


-- 
Daniel Bohling
NewsFactor Network




Re: $r and Registry(NG)* scripts

2001-03-13 Thread Daniel




 All scripts on
 site start with:
 
 use vars qw(%input $r);
 $r = Apache-request;
 
 This has worked fine...no complaints in log files...until I switched the
 handler from Registry to RegistryNG;
 
 Now I see occasional:
 Variable "$r" will not stay shared at /home/httpd/perl/daily-news.pl
 line 9 (#1)
 in log files.
 
 
 http://perl.apache.org/guide/troubleshooting.html#Value_of_x_will_not_stay_shared

Thanks for the reply and the guide (of which I'm pretty familiar) Stas.
See comments above and below. $r is global in my scripts.
Unless I'm misunderstanding something, the warning shouldn't be 
occurring. Wasn't under Registry. Also these warnings do not appear on 
every page request, so I'm wondering if it has something to do with the 
compile stage of perlrun and/or something that happens during a new 
apache process creation.

 
 
 first nine from daily-news.pl:
 #!/usr/bin/perl -w
 use strict;
 use DBI;
 use date_site;
 my $dateformat = date_site::dateformat;
 use Apache::Request;
 
 use vars qw($dbh %input %output %filebase $r %sites); #vars used on $r
 $r = Apache-request; #--here
 

Thanks,

-- 
Daniel Bohling
NewsFactor Network




Re: $r and Registry(NG)* scripts

2001-03-13 Thread Stas Bekman

On Tue, 13 Mar 2001, Daniel wrote:




  All scripts on
  site start with:
 
  use vars qw(%input $r);
  $r = Apache-request;
 
  This has worked fine...no complaints in log files...until I switched the
  handler from Registry to RegistryNG;
 
  Now I see occasional:
  Variable "$r" will not stay shared at /home/httpd/perl/daily-news.pl
  line 9 (#1)
  in log files.
 
 
  http://perl.apache.org/guide/troubleshooting.html#Value_of_x_will_not_stay_shared

 Thanks for the reply and the guide (of which I'm pretty familiar) Stas.
 See comments above and below. $r is global in my scripts.
 Unless I'm misunderstanding something, the warning shouldn't be
 occurring. Wasn't under Registry. Also these warnings do not appear on
 every page request, so I'm wondering if it has something to do with the
 compile stage of perlrun and/or something that happens during a new
 apache process creation.

Sorry, I've jumped too fast with a conclusion at seeing the standard
"...will not stay shared". But in order to debug the problem, I have to be
able to reproduce it. Are you saying that the script below, as it is,
has this problem? But it's not the whole script, I understand. Can you
write a small reproducing test?

  first nine from daily-news.pl:
  #!/usr/bin/perl -w
  use strict;
  use DBI;
  use date_site;
  my $dateformat = date_site::dateformat;
  use Apache::Request;
 
  use vars qw($dbh %input %output %filebase $r %sites); #vars used on $r
  $r = Apache-request; #--here
 

 Thanks,

 --
 Daniel Bohling
 NewsFactor Network




_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Re: $r and Registry(NG)* scripts

2001-03-12 Thread Stas Bekman

On Mon, 12 Mar 2001, Daniel wrote:

 Just trying to get a consensus on people's usage of the apache request
 object in Registry(NG)* scripts.

 I usually make the $r available as a global variable so I can use in
 various subroutines without passing it around constantly. All scripts on
 site start with:

 use vars qw(%input $r);
 $r = Apache-request;

 This has worked fine...no complaints in log files...until I switched the
 handler from Registry to RegistryNG;

 Now I see occasional:
 Variable "$r" will not stay shared at /home/httpd/perl/daily-news.pl
 line 9 (#1)
 in log files.

http://perl.apache.org/guide/troubleshooting.html#Value_of_x_will_not_stay_shared

 first nine from daily-news.pl:
 #!/usr/bin/perl -w
 use strict;
 use DBI;
 use date_site;
 my $dateformat = date_site::dateformat;
 use Apache::Request;

 use vars qw($dbh %input %output %filebase $r %sites); #vars used on $r
 $r = Apache-request; #--here


 Any ideas on why this would happen?

 Thanks in advance,

 --
 Daniel Bohling
 NewsFactor Network




_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/