register_cleanup on mod_perl 2.0
Hi! I've a script that looks like this: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } Under mod_perl 1.0 works fine with Apache::Registry. Can someone give me an Example how to make a register_cleanup with mod_perl 2? Thanks a lot Denis
Re: register_cleanup on mod_perl 2.0
Denis Banovic wrote: Hi! I've a script that looks like this: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } Under mod_perl 1.0 works fine with Apache::Registry. Can someone give me an Example how to make a register_cleanup with mod_perl 2? A copy-n-paste from Apache/compat.pm: sub register_cleanup { shift-pool-cleanup_register(@_); } if you use Apache::compat, your mp1 code will work under mp2 unmodified. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: register_cleanup on mod_perl 2.0
Stas Bekman wrote: Denis Banovic wrote: Hi! I've a script that looks like this: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } Under mod_perl 1.0 works fine with Apache::Registry. Can someone give me an Example how to make a register_cleanup with mod_perl 2? A copy-n-paste from Apache/compat.pm: sub register_cleanup { shift-pool-cleanup_register(@_); } if you use Apache::compat, your mp1 code will work under mp2 unmodified. And it is documented here: http://perl.apache.org/docs/2.0/user/compat/compat.html#C__r_E_gt_register_cleanup_ http://perl.apache.org/docs/2.0/user/compat/compat.html#C__s_E_gt_register_cleanup_ In the future please refer to the docs first, before asking on the list. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
register_cleanup
Hi! I'm trying to migrate some stuff from mod_perl 1. I've read the tutorial on perl.apache.org but it didn't help. I've a perl script that looks like this: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } Under mod_perl 1.0 works fine with Apache::Registry. But I can't find out how to port this to mod_perl 2. I've tried to use Apache::compat(); but then I got another error from an Module we are using to cache the script's output: ModPerl::Registry: anonymous handlers not (yet) supported at... The code looks like this: ... $self-{r} = Apache-request; $self-{r}-push_handlers(PerlHandler = sub {$self-DESTROY}); ... 1) How to do a register_cleanup with mod_perl 2.0 ? 2) How to fix the second error? googling didn't help. Can someone please help me with it? Thanks a lot Denis Banovic
Re: register_cleanup
Denis Banovic wrote: Hi! I'm trying to migrate some stuff from mod_perl 1. I've read the tutorial on perl.apache.org but it didn't help. I've a perl script that looks like this: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } Under mod_perl 1.0 works fine with Apache::Registry. But I can't find out how to port this to mod_perl 2. I've tried to use Apache::compat(); but then I got another error from an Module we are using to cache the script's output: ModPerl::Registry: anonymous handlers not (yet) supported at... It's not an error in your code, anon callbacks aren't implemented yet. $self-{r}-push_handlers(PerlHandler = sub {$self-DESTROY}); that should be PerlCleanupHandler, btw. even though it doesn't work yet. 1) How to do a register_cleanup with mod_perl 2.0 ? If you are asking about requests cleanup it's one of these: sub my_cleanup {...} $r-pool-cleanup_register(\my_cleanup); $r-pool-cleanup_register('my_cleanup'); $r-pool-cleanup_register(sub {...}); # anon subs do work here! $r-push_handlers(PerlCleanupHandler = \my_cleanup); $r-push_handlers(PerlCleanupHandler = 'my_cleanup'); Also, your original 1.x code: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } should work unmodified, under Apache::compat. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: mp2/httpd2 perlio test fail register_cleanup CGI.pm error
t/TEST -v apr/perlio and also send the errors from t/logs/error_log. I have resolved this myself. It appears the perlio test failed because of some trivial permission problems in the t/perlio directory. Various files didn't exist or were unwritable by the test script so I touched and chmodded them appropriately. Also in the future please use t/REPORT script to report problems, as explained here: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems Sorry, I'll do this from now on. ModPerl::Registry: Can't locate object method register_cleanup via package Apache::RequestRec at /usr/local/lib/perl5/5.8.0/CGI.pm line 270. this method is defined in Apache::compat. What happens if you add PerlModule Apache::compat It works when I use this. Thanks for your reply, Phil.
Re: mp2/httpd2 perlio test fail register_cleanup CGI.pm error
Philip Burrow wrote: Hi all. Read some nice things about mod_perl so I thought I'd try it. I tried mp1 with the latest 1.x of Apache but Apache just seg faulted if I tried to run it. So, I went on to httpd 2.x. Couple of problems though. Firstly, it fails 11/11 of the apr/perlio.t tests during make test. All other tests are fine. Can you please run: t/TEST -v apr/perlio and also send the errors from t/logs/error_log. without a detailed report we cannot know what the problem is. Also in the future please use t/REPORT script to report problems, as explained here: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems Secondly, I get this error in the log when I try to run a CGI that uses CGI.pm: ModPerl::Registry: Can't locate object method register_cleanup via package Apache::RequestRec at /usr/local/lib/perl5/5.8.0/CGI.pm line 270. this method is defined in Apache::compat. What happens if you add PerlModule Apache::compat in httpd.conf. The latest CGI.pm (2.89?) loads this module automatically: if ($mod_perl::VERSION = 1.99) { require Apache::compat; } else { require Apache; } The CGI in question works fine without mod_perl. I'm using the startup script specified on http://perl.apache.org/docs/2.0/user/config/config.html and have configured Apache as per that page. I have installed perl 5.8.0 from source as per your documentation on the site. All related modules are latest versions from CPAN. Versions of software: RedHat 7.2, httpd 2.0.42, mod_perl 1.99_07, CGI.pm 2.89, kernel 2.4.19. If this still doesn't help, can you please post a *short* CGI script that reproduces the problem? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:stas;stason.org http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
mp2/httpd2 perlio test fail register_cleanup CGI.pm error
Hi all. Read some nice things about mod_perl so I thought I'd try it. I tried mp1 with the latest 1.x of Apache but Apache just seg faulted if I tried to run it. So, I went on to httpd 2.x. Couple of problems though. Firstly, it fails 11/11 of the apr/perlio.t tests during make test. All other tests are fine. Secondly, I get this error in the log when I try to run a CGI that uses CGI.pm: ModPerl::Registry: Can't locate object method register_cleanup via package Apache::RequestRec at /usr/local/lib/perl5/5.8.0/CGI.pm line 270. The CGI in question works fine without mod_perl. I'm using the startup script specified on http://perl.apache.org/docs/2.0/user/config/config.html and have configured Apache as per that page. I have installed perl 5.8.0 from source as per your documentation on the site. All related modules are latest versions from CPAN. Versions of software: RedHat 7.2, httpd 2.0.42, mod_perl 1.99_07, CGI.pm 2.89, kernel 2.4.19. Cheers, Phil.
Re: [BUG?] PerlSetVar in .htaccess segfaults w/ register_cleanup()
D.Kreft wrote: ... I am greeted with Netcape's Document contains no data error dialog box, and a segfault notice in the error log: [Thu May 9 09:19:52 2002] [notice] child pid 25420 exit \ signal Segmentation fault (11) ... Does anyone have any ideas about what's going wrong here? Any help would be greatly appreciated! Probably not, without a back trace (from the Segfault) unless someone has had a similar problem and solved it before. See http://perl.apache.org/preview/modperl-docs/dst_html/docs/1.0/guide/help.html#How_to_Report_Problems on how to retrieve the backtrace. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Can't solve the CGI/pm Can't call register_cleanup problem
Fran See below. Cheers Ron Savage [EMAIL PROTECTED] http://savage.net.au/index.html use CGI qw(-compile :all); There's a typo in the book. Chop '-compile'.
Can't solve the CGI/pm Can't call register_cleanup problem
Hello, I've just installed a mod_perl enabled Apache and I am trying to configure it. I ran into the can't call register_cleanup on an undefined value while I was trying out the sample startup.pl file in the Writing Apache Modules in Perl and C book. I did see the note about this in the troubleshooting, but the fix didn't solve my problem. Here's my httpd.conf: ... Alias /perl/ /usr/local/apachemp/cgi-bin/ PerlPostReadRequestHandler 'sub { Apache-request(shift) }' PerlModule Apache::Registry PerlFreshRestart On PerlRequire conf/startup.pl Location /perl SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI allow from all PerlSendHeader on /Location Location /hello/world SetHandler perl-script PerlHandler Apache::Hello /Location And here is conf/startup.pl... #!/usr/local/bin/perl BEGIN { use Apache (); use lib Apache-server_root_relative('lib/perl'); } use Apache::Registry(); use Apache::Constants(); use CGI::Carp (); use CGI qw(-compile :all); 1; It dies on the use CGI qw(-compile :all); line, with the message: [root@dungeon apachemp]# ./bin/apachectl configtest [Tue Jul 31 00:54:54 2001] [error] [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] CGI.pm: Can't call method register_cleanup on an undefined value at /usr/lib/perl5/5.6.0/CGI/Object.pm line 225. [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] startup.pl: BEGIN failed--compilation aborted at conf/startup.pl line 14. [Tue Jul 31 00:54:54 2001] startup.pl: Compilation failed in require. Syntax error on line 995 of /usr/local/apache/conf/httpd.conf: [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] CGI.pm: Can't call method register_cleanup on an undefined value at /usr/lib/perl5/5.6.0/CGI/Object.pm line 225. [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] startup.pl: BEGIN failed--compilation aborted at conf/startup.pl line 14. [Tue Jul 31 00:54:54 2001] startup.pl: Compilation failed in require. [root@dungeon apachemp]# I'm running the following versions of the software: Apache 1.3.20 mod_perl 1.26 CGI.pm 3.02 I saw the note about it in the faq/troubleshooting section of the docs on perl.apache.org, but as you can see I made the suggested change (the PerlPostReadRequestHandler line in httpd) and I still get the error. Any ideas? I'm not doing anything fancy, these are all default installs of everything, just following the docs for installation and the book for the startup.pl. The server starts and runs fine if I remove the use CGI qw(-compile :all); line. Thanks, Fran
Re: Can't solve the CGI/pm Can't call register_cleanup problem
On Tue, 31 Jul 2001, Fran Fabrizio wrote: Hello, I've just installed a mod_perl enabled Apache and I am trying to configure it. I ran into the can't call register_cleanup on an undefined value while I was trying out the sample startup.pl file in the Writing Apache Modules in Perl and C book. I did see the note about this in the troubleshooting, but the fix didn't solve my problem. CGI.pm 3.02 is an alpha version. I'm not sure about its interoperability with mod_perl. Get the 2.x version to solve the problem asap. Here's my httpd.conf: ... Alias /perl/ /usr/local/apachemp/cgi-bin/ PerlPostReadRequestHandler 'sub { Apache-request(shift) }' PerlModule Apache::Registry PerlFreshRestart On PerlRequire conf/startup.pl Location /perl SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI allow from all PerlSendHeader on /Location Location /hello/world SetHandler perl-script PerlHandler Apache::Hello /Location And here is conf/startup.pl... #!/usr/local/bin/perl BEGIN { use Apache (); use lib Apache-server_root_relative('lib/perl'); } use Apache::Registry(); use Apache::Constants(); use CGI::Carp (); use CGI qw(-compile :all); 1; It dies on the use CGI qw(-compile :all); line, with the message: [root@dungeon apachemp]# ./bin/apachectl configtest [Tue Jul 31 00:54:54 2001] [error] [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] CGI.pm: Can't call method register_cleanup on an undefined value at /usr/lib/perl5/5.6.0/CGI/Object.pm line 225. [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] startup.pl: BEGIN failed--compilation aborted at conf/startup.pl line 14. [Tue Jul 31 00:54:54 2001] startup.pl: Compilation failed in require. Syntax error on line 995 of /usr/local/apache/conf/httpd.conf: [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] CGI.pm: Can't call method register_cleanup on an undefined value at /usr/lib/perl5/5.6.0/CGI/Object.pm line 225. [Tue Jul 31 00:54:54 2001] startup.pl: [Tue Jul 31 00:54:54 2001] startup.pl: BEGIN failed--compilation aborted at conf/startup.pl line 14. [Tue Jul 31 00:54:54 2001] startup.pl: Compilation failed in require. [root@dungeon apachemp]# I'm running the following versions of the software: Apache 1.3.20 mod_perl 1.26 CGI.pm 3.02 I saw the note about it in the faq/troubleshooting section of the docs on perl.apache.org, but as you can see I made the suggested change (the PerlPostReadRequestHandler line in httpd) and I still get the error. Any ideas? I'm not doing anything fancy, these are all default installs of everything, just following the docs for installation and the book for the startup.pl. The server starts and runs fine if I remove the use CGI qw(-compile :all); line. Thanks, Fran _ 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://eXtropia.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Problem with $r-register_cleanup()
On Wed, 7 Feb 2001 [EMAIL PROTECTED] wrote: Hi, I just ran into a problem with $r-register_cleanup() only sometime beeing called. This is mod_perl 1.24_01, perl 5.6.0, apache 1.3.14 compiled with gcc 5.6.0 on AIX 4.3.3. Here's a sample code (snippet): sub handler { # PerlTransHandler my $r = shift; $r-register_cleanup(\clean1); $r-push_handlers(PerlCleanupHandler = \clean2); $r-pnotes('cleanup', bless {} ); print STDERR 'in ; ^ ^ could this have something todo with it? after fixing that, i tried your transhandler and get the expected results in the error_log: in register_cleanup register_cleanup push_handlers push_handlers DESTROY if you still see this behavior with 1.25, i'd need more info of how to reproduce the problem, such as what requests you're making that produce unexpected results.
Antwort: Re: Problem with $r-register_cleanup()
There are no other handlers besides my own (content and auth) and the core apache... Also, I'd think that every reload of a page (that get's served by the same Apache child) should execute the same code and handlers with the same result---but here's the register_cleanup sometimes gets called and sometimes not. I press Reload, Reload, Reload... and get the result as below... Michael Datum: 07.02.2001 23:37 An:Michael Jacob/EXT/GAD@GAD Kopie: [EMAIL PROTECTED] Betreff: Re: Problem with $r-register_cleanup() Nachrichtentext: Is it possible that another handler (such as CGI, or parsed-html) is taking over before yours and exiting or returning OK. Rob Hi, I just ran into a problem with $r-register_cleanup() only sometime beeing called. This is mod_perl 1.24_01, perl 5.6.0, apache 1.3.14 compiled with gcc 5.6.0 on AIX 4.3.3. Here's a sample code (snippet): sub handler { # PerlTransHandler my $r = shift; $r-register_cleanup(\clean1); $r-push_handlers(PerlCleanupHandler = \clean2); $r-pnotes('cleanup', bless {} ); print STDERR 'in "; return DECLINE; } sub clean1 { print STDERR "register_cleanup "; } sub clean2 { print STDERR "push_handlers "; } sub DESTROY { print STDERR "DESTROY\n"; } And that's the error_log: in register_cleanup push_handlers DESTROY in register_cleanup push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in register_cleanup push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in register_cleanup push_handlers DESTROY in push_handlers DESTROY The pushed handler only get's called about a third or less of the time. :-( Any idea, bug? Michael Jacob PS: Yes I did some tests with -x... Robert L. Landrum Senior Programmer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "It's working correctly. It's simply working in contrast to what you have perceived to be correct."
Problem with $r-register_cleanup()
Hi, I just ran into a problem with $r-register_cleanup() only sometime beeing called. This is mod_perl 1.24_01, perl 5.6.0, apache 1.3.14 compiled with gcc 5.6.0 on AIX 4.3.3. Here's a sample code (snippet): sub handler { # PerlTransHandler my $r = shift; $r-register_cleanup(\clean1); $r-push_handlers(PerlCleanupHandler = \clean2); $r-pnotes('cleanup', bless {} ); print STDERR 'in "; return DECLINE; } sub clean1 { print STDERR "register_cleanup "; } sub clean2 { print STDERR "push_handlers "; } sub DESTROY { print STDERR "DESTROY\n"; } And that's the error_log: in register_cleanup push_handlers DESTROY in register_cleanup push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in register_cleanup push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in register_cleanup push_handlers DESTROY in push_handlers DESTROY The pushed handler only get's called about a third or less of the time. :-( Any idea, bug? Michael Jacob PS: Yes I did some tests with -x...
Re: Problem with $r-register_cleanup()
Is it possible that another handler (such as CGI, or parsed-html) is taking over before yours and exiting or returning OK. Rob Hi, I just ran into a problem with $r-register_cleanup() only sometime beeing called. This is mod_perl 1.24_01, perl 5.6.0, apache 1.3.14 compiled with gcc 5.6.0 on AIX 4.3.3. Here's a sample code (snippet): sub handler { # PerlTransHandler my $r = shift; $r-register_cleanup(\clean1); $r-push_handlers(PerlCleanupHandler = \clean2); $r-pnotes('cleanup', bless {} ); print STDERR 'in "; return DECLINE; } sub clean1 { print STDERR "register_cleanup "; } sub clean2 { print STDERR "push_handlers "; } sub DESTROY { print STDERR "DESTROY\n"; } And that's the error_log: in register_cleanup push_handlers DESTROY in register_cleanup push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in register_cleanup push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in push_handlers DESTROY in register_cleanup push_handlers DESTROY in push_handlers DESTROY The pushed handler only get's called about a third or less of the time. :-( Any idea, bug? Michael Jacob PS: Yes I did some tests with -x... Robert L. Landrum Senior Programmer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "It's working correctly. It's simply working in contrast to what you have perceived to be correct."
RE: push_handlers (was: PerlCleanupHandler vs register_cleanup)
a quick test showed the handlers to be FIFO, so I would expect you to get moda modb modc d e HTH --Geoff -Original Message- From: Paul G. Weiss [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 24, 2000 2:38 PM To: 'Stas Bekman' Cc: modperl Subject: push_handlers (was: PerlCleanupHandler vs register_cleanup) While we're on the subject of handlers, if I have PerlLogHandlers moda modb modc in my conf file and I do $r-push_handlers('PerlLogHandler', \d); $r-push_handlers('PerlLogHandler', \e); during the content phase what is the order that the stacked log handlers run? -P -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 24, 2000 12:47 PM To: Paul G. Weiss Cc: modperl Subject: Re: PerlCleanupHandler vs register_cleanup On Thu, 24 Aug 2000, Paul G. Weiss wrote: What is the difference between doing $r-push_handlers('PerlCleanupHandler', \function); and $r-register_cleanup(\function); The same: http://www.modperl.com/book/chapters/ch9.html#Server_Core_Functions The register_cleanup() method registers a subroutine that will be called after the logging stage of a request. This is much the same as installing a cleanup handler with the PerlCleanupHandler directive. See Chapter 7 for some practical examples of using register_cleanup(). _ 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://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
Re: PerlCleanupHandler vs register_cleanup
On Thu, 24 Aug 2000, Paul G. Weiss wrote: What is the difference between doing $r-push_handlers('PerlCleanupHandler', \function); and $r-register_cleanup(\function); The same: http://www.modperl.com/book/chapters/ch9.html#Server_Core_Functions The register_cleanup() method registers a subroutine that will be called after the logging stage of a request. This is much the same as installing a cleanup handler with the PerlCleanupHandler directive. See Chapter 7 for some practical examples of using register_cleanup(). _ 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://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
push_handlers (was: PerlCleanupHandler vs register_cleanup)
While we're on the subject of handlers, if I have PerlLogHandlers moda modb modc in my conf file and I do $r-push_handlers('PerlLogHandler', \d); $r-push_handlers('PerlLogHandler', \e); during the content phase what is the order that the stacked log handlers run? -P -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 24, 2000 12:47 PM To: Paul G. Weiss Cc: modperl Subject: Re: PerlCleanupHandler vs register_cleanup On Thu, 24 Aug 2000, Paul G. Weiss wrote: What is the difference between doing $r-push_handlers('PerlCleanupHandler', \function); and $r-register_cleanup(\function); The same: http://www.modperl.com/book/chapters/ch9.html#Server_Core_Functions The register_cleanup() method registers a subroutine that will be called after the logging stage of a request. This is much the same as installing a cleanup handler with the PerlCleanupHandler directive. See Chapter 7 for some practical examples of using register_cleanup(). _ 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://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
Re: $r-register_cleanup limits (Problem Solved)
Doug MacEachern writes: there's no limit the number of cleanups you can register, but i would still push the sub {}'s into an array and register a single cleanup to iterate over them. you're right that wasn't the problem, I was passing the same Image::Magick reference to each subroutine, and as it read in pictures it kept using more and more memory until it ran out of and killed the process. I did as you suggested though and now there's only one cleanup, thanks! -- [EMAIL PROTECTED]
Re: $r-register_cleanup limits?
On Tue, 6 Jun 2000, Jim Woodgate wrote: In a module I'm using register_cleanup so the client doesn't need to wait for me to do a bunch of work. It basically does this: foreach (@images) { unless (-f $thumb{$_}) { create_thumb($_); $r-register_cleanup(sub {create_more_sizes($_, ...)}); } } there's no limit the number of cleanups you can register, but i would still push the sub {}'s into an array and register a single cleanup to iterate over them. create_more_sizes will create various additional sizes to scale down a large picture. This seems to work really well unless there is a large set of images, then the cleanup handler doesn't get all the way through. I don't see any warnings/errors. (And unfortunately since the thumbnail is created the next time someone visits create_more_sizes won't get called unless I do explicit checks, which would cause me to actually read the images and I was hoping to avoid that) Anyway I'm not sure if I'm hitting a limit on the amount of time it is taking or if I'm just registering too many cleanups. I was thinking of $r-reset_timeout() as the first line of create_more_size(), but thought I would check with the list first as I don't fully understand the ramifications. i don't think $r-*_timeout will work properly in a cleanup, but alarm + eval {} should be fine. if you want to see where it's stuck, try this: % gdb httpd pid of spinning process (gdb) where (gdb) source mod_perl-x.xx/.gdbinit (gdb) curinfo
$r-register_cleanup limits?
In a module I'm using register_cleanup so the client doesn't need to wait for me to do a bunch of work. It basically does this: foreach (@images) { unless (-f $thumb{$_}) { create_thumb($_); $r-register_cleanup(sub {create_more_sizes($_, ...)}); } } create_more_sizes will create various additional sizes to scale down a large picture. This seems to work really well unless there is a large set of images, then the cleanup handler doesn't get all the way through. I don't see any warnings/errors. (And unfortunately since the thumbnail is created the next time someone visits create_more_sizes won't get called unless I do explicit checks, which would cause me to actually read the images and I was hoping to avoid that) Anyway I'm not sure if I'm hitting a limit on the amount of time it is taking or if I'm just registering too many cleanups. I was thinking of $r-reset_timeout() as the first line of create_more_size(), but thought I would check with the list first as I don't fully understand the ramifications. -- [EMAIL PROTECTED]
RE: $r-register_cleanup limits?
-Original Message- From: Jim Woodgate [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 06, 2000 9:48 AM To: [EMAIL PROTECTED] Subject: $r-register_cleanup limits? In a module I'm using register_cleanup so the client doesn't need to wait for me to do a bunch of work. It basically does this: foreach (@images) { unless (-f $thumb{$_}) { create_thumb($_); $r-register_cleanup(sub {create_more_sizes($_, ...)}); } } create_more_sizes will create various additional sizes to scale down a large picture. This seems to work really well unless there is a large set of images, then the cleanup handler doesn't get all the way through. I don't see any warnings/errors. (And unfortunately since the thumbnail is created the next time someone visits create_more_sizes won't get called unless I do explicit checks, which would cause me to actually read the images and I was hoping to avoid that) Anyway I'm not sure if I'm hitting a limit on the amount of time it is taking or if I'm just registering too many cleanups. I was thinking of $r-reset_timeout() as the first line of create_more_size(), but thought I would check with the list first as I don't fully understand the ramifications. I'm afraid I don't know the answer, but I would be interested in knowing whether any of the *_timeout functions apply to the cleanup phase - the Timeout directive docs and the eagle book seem to imply that these are methods aimed at closing the data connection, and I thought the connection was over by the time cleanup is called... just more questions - sorry I can't be of help, though... --Geoff -- [EMAIL PROTECTED]
cant find register_cleanup
I'm trying to install mod_auth_mysql 2.20. But when I start apache (httpd) i get the error: Cannot load /etc/httpd/modules/mod_auth_mysql.so into server: /etc/httpd/modules/mod_auth_mysql.so: undefined symbol: register_cleanup Setup is: mod_perl 1.24. Built with EVERYTHING=1, apxs method for loading Apache is 1.3.12 from RedHat RPM with CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" added O/S Redhat 6.2, Perl 5.6.0 I installed auth_mysql using the method from the mini HOWTO Apache-mods-3 cd to the source directory cp config.h auth_mysql_config.h /usr/sbin/apxs -i -a -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient -c mod_auth_mysql.c Hope someone can help .. -pete