Re: PerlAddVar: documentation bug (regression?)
Adam Prime schrieb: Michael Ludwig wrote: http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlAddVar_ | my @foos = $r->dir_config('foo'); This is wrong. You have to say: my @foos = $r->dir_config->get('foo'); Committed revision 734312, which updates the two examples on that page that require use of the underlying APR::Table get method. Thank you! (The printed version of the User's Guide also has the mistake, but it is probably generated from the same source documents, so it should be fine.) Michael Ludwig
Re: PerlAddVar: documentation bug (regression?)
Michael Ludwig wrote: Adam Prime schrieb: Michael Ludwig wrote: http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlAddVar_ | my @foos = $r->dir_config('foo'); This is wrong. You have to say: my @foos = $r->dir_config->get('foo'); Committed revision 734312, which updates the two examples on that page that require use of the underlying APR::Table get method. Thank you! (The printed version of the User's Guide also has the mistake, but it is probably generated from the same source documents, so it should be fine.) The PDF's are regenerated once a day. They should update at some point over the next 12 hours I think. Adam
Initializing Sleepycat::DbXml (Berkeley, Oracle) objects in startup.pl
I want to build a mod_perl2 application using Sleepycat::DbXml. This is the Perl bindings to the C++ interface to Berkeley DB and Berkeley DB XML, developed by Sleepycat, now owned by Oracle (keywords: DbEnv, XmlManager, XmlContainer). Has anyone ever used this combination? Note I'm using Apache 2.2 with the worker MPM and a suitably configured Perl (perl -V:useithreads -V:usemultiplicity). I want to open the environment and the XML container (the database) during initialization so this doesn't have to be done anew on each request. However, I don't know how to do this. Currently, I'm trying to set up things in startup.pl (loaded via PerlPostConfigRequire), store the database environment handle in a global package variable, and access that from the PerlContentHandler. (1) Is that okay in principle? (2) As I'm getting unfriendly SEGVs: Has anyone any experience on using mod_perl2 with Sleepycat::Db or Sleepycat::DbXml? If so, I can provide more details on this. Michael Ludwig
Re: Initializing Sleepycat::DbXml (Berkeley, Oracle) objects in startup.pl
On Wed, 14 Jan 2009, Michael Ludwig wrote: > I want to build a mod_perl2 application using > Sleepycat::DbXml. This is > > However, I don't know how to do this. Currently, I'm > trying to set up things in startup.pl (loaded via > PerlPostConfigRequire), store the database environment > handle in a global package variable, and access that from > the PerlContentHandler. This probably won't work since the filehandle cannot be shared among mod_perl children. Your startup.pl script is running before the root apache process forks into the child processes. Scalars, lists and hashes will be cloned, but file handles won't, they have to be opened. Probably what you're thinking of is a PerlChildInitHandler so that each mod_perl child process does your connection for you when the child process first forks. Or, you can use it like this in a handler, essentially the same thing: package YourResponseHandler; use strict; use warnings FATAL => 'all'; use SleepyCat::DbXml qw(simple); # is this the way it works? i trolled for it... # where is the manual page?? ugh my $container = XmlContainer->new('/path/to/whatever.xml'); sub handler { my ($r) = @_; $container->open(Db::DB_CREATE); $container->put... # ... $container->close(); # ?? not sure how it works } But it's not clear how much time you're going to save. I don't know how the thing works. You may or may not be able to call open() from package scope because of locking, are locks on the sleepycat database serial? If so then every mod_perl child process is going to be waiting for the others to complete before they can establish their own locks and there's no way around that. You'll have to balance how many writes you expect to get with how many reads, maybe reading actions do not require locks on the data file. Mark
Re: PerlAddVar: documentation bug (regression?)
Adam Prime wrote: The PDF's are regenerated once a day. They should update at some point over the next 12 hours I think. Adam # every monday rebuild all, including pdf 30 03 * * 1 /home/perlwww/apache.org/modperl-docs/bin/site_build_force_pdf_index # update all (only changes/no pdf) every 6 hours 15 6,12,18 * * * /home/perlwww/apache.org/modperl-docs/bin/site_build_index # update all (only changes and pdfs) once a day 15 0 * * * /home/perlwww/apache.org/modperl-docs/bin/site_build_pdf_index -- 1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70 3F8C 75B8 8FFB DB9B 8C1C Philip M. Gollucci (pgollu...@p6m7g8.com) c: 703.336.9354 Consultant - P6M7G8 Inc.http://p6m7g8.net Senior Sys Admin- RideCharge, Inc. http://ridecharge.com Contractor - PositiveEnergyUSA http://positiveenergyusa.com ASF Member - Apache Software Foundation http://apache.org FreeBSD Committer - FreeBSD Foundation http://freebsd.org Work like you don't need the money, love like you'll never get hurt, and dance like nobody's watching.
Re: Initializing Sleepycat::DbXml (Berkeley, Oracle) objects in startup.pl
This is my first time replying to the list. I've seen advice about not being able to share a filehandle opened in a pre-fork stage before, but have two counter-examples: 1) I opened a log file for write/append in the open-logs stage of a module, and was able to (flock and) write to it in child processes. (It's called the open-logs stage!) 2) My web site ties its read-only DBs at the post-config stage and reads them in the child httpd's. My one RW DB (for guestbook filtering) has an accompanying lockfile that's opened and flocked before the DB is tied, on the fly. I have a vague recollection of reading about the circumstances in which filehandles can be inherited, but can't remember where. Programming Perl? Sorry to make things more complex, but I'll be happy if someone can clarify this. cmac www.animalhead.com On Jan 14, 2009, at 8:18 AM, Mark Hedges wrote: On Wed, 14 Jan 2009, Michael Ludwig wrote: I want to build a mod_perl2 application using Sleepycat::DbXml. This is However, I don't know how to do this. Currently, I'm trying to set up things in startup.pl (loaded via PerlPostConfigRequire), store the database environment handle in a global package variable, and access that from the PerlContentHandler. This probably won't work since the filehandle cannot be shared among mod_perl children. Your startup.pl script is running before the root apache process forks into the child processes. Scalars, lists and hashes will be cloned, but file handles won't, they have to be opened. Probably what you're thinking of is a PerlChildInitHandler so that each mod_perl child process does your connection for you when the child process first forks.
Re: Initializing Sleepycat::DbXml (Berkeley, Oracle) objects in startup.pl
cr...@animalhead.com wrote: I have a vague recollection of reading about the circumstances in which filehandles can be inherited, but can't remember where. I've been bitten by this a few times. Filehandles (and thus sockets) are inherited across forks. If your system isn't very busy you won't notice a problem. But when things heat up you will start to get very strange problems. And I do mean strange. I was doing something with Inline::Java (which communicates over a socket to a JVM) under mod_perl and the communication was getting all garbled. Multiple processes were sending and reading off the socket which confused the other processes since they were all getting partial reads on their data and partial reads from the data for other processes. But the problems only happened during the busiest 2 weeks of the year and were fine the rest of the time. But those weren't very fun weeks :) -- Michael Peters Plus Three, LP
Apache2::Reload - Very fickle, or is it just me?
I'm currently using Apache2::Reload on a development machine, but I can't for the life of me figure out what it's doing and why. I'm coming across weird behavior such as the following just about every 5 minutes: 1. Have a perfectly working page. 2. Change some `print "foo"` to `print "bar"` (completely trivial) 3. Reload the page only to get an error message back (presumably Apache2::Reload reloaded the .pm and the new version has errors). 5. Check the .pm with perl -c, it turns out that my completely trivial change did NOT introduce errors. 6. Scratch head... 7. Reload the page 3 more times, with the same error coming back every time. 8. Reload a 4th time, and this time get a different error. 9. Reload a 5th time, and have it work (for good). I'M SO CONFUSED! :-( -Patrick What exactly does this mean anyway? Aborted why? === Attempt to reload WSS/User.pm aborted === Error during compilation of /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html: Attempt to reload WSS/User.pm aborted. Compilation failed in require at /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html line 14. Stack: [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:811] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:441] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:246] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:211] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:97] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:275] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:353] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:348] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:868] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:822] [(eval 34):8] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] BEGIN failed--compilation aborted at /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html line 14. Stack: [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:811] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:441] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:246] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:211] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:97] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:275] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:353] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:348] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:868] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:822] [(eval 34):8] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] Trace begun at /home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm line 845 HTML::Mason::Interp::_compilation_error('HTML::Mason::Interp=HASH(0x91acc90)', '/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html', 'HTML::Mason::Exception::Compilation=HASH(0x932e308)') called at /home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm line 445 HTML::Mason::Interp::load('HTML::Mason::Interp=HASH(0x91acc90)', '/sign_up.html') called at /home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm line 246 eval {...} at /home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm line 231 HTML::Mason::Request::_initialize('HTML::Mason::Request::ApacheHandler=HASH(0x9330478)') called at /home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm line 211 HTML::Mason::Request::new('HTML::Mason::Request::ApacheHandler', 'error_mode', 'output', '
Re: Apache2::Reload - Very fickle, or is it just me?
I forgot to send the httpd.conf, sorry about that. == LoadModule perl_module modules/mod_perl.so TypesConfig /etc/mime.types ServerName ubuntu Listen 80 User rutski Grouprutski DocumentRoot "/home/rutski/Documents/projects/wss/install/apache/htdocs" PerlSwitches -I/home/rutski/Documents/projects/wss/install/apache/lib PerlModule Apache2::Reload PerlModule CGI SetHandler perl-script PerlInitHandler Apache2::Reload PerlHandler HTML::Mason::ApacheHandler PerlSetVar MasonDataDir "/home/rutski/Documents/projects/wss/install/apache/mason" PerlSetVar MasonCompRoot "/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic" == Patrick Rutkowski wrote: I'm currently using Apache2::Reload on a development machine, but I can't for the life of me figure out what it's doing and why. I'm coming across weird behavior such as the following just about every 5 minutes: 1. Have a perfectly working page. 2. Change some `print "foo"` to `print "bar"` (completely trivial) 3. Reload the page only to get an error message back (presumably Apache2::Reload reloaded the .pm and the new version has errors). 5. Check the .pm with perl -c, it turns out that my completely trivial change did NOT introduce errors. 6. Scratch head... 7. Reload the page 3 more times, with the same error coming back every time. 8. Reload a 4th time, and this time get a different error. 9. Reload a 5th time, and have it work (for good). I'M SO CONFUSED! :-( -Patrick What exactly does this mean anyway? Aborted why? === Attempt to reload WSS/User.pm aborted === Error during compilation of /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html: Attempt to reload WSS/User.pm aborted. Compilation failed in require at /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html line 14. Stack: [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:811] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:441] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:246] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:211] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:97] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:275] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:353] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:348] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:868] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:822] [(eval 34):8] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] BEGIN failed--compilation aborted at /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html line 14. Stack: [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:811] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:441] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:246] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:211] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:97] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:275] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:353] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:348] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:868] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:822] [(eval 34):8] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] Trace begun at /home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm line 845 HTML::Mason::Interp::_compilation_error('HTML::Mason::Interp=HASH(0x91acc90)', '/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html', 'HTML
Re: Apache2::Reload - Very fickle, or is it just me?
My experience troubleshooting this kind of issue has indicated that its likely that the package that was unloaded deleted a value stored in the package space of the module reloaded (probably set at BEGIN block time) that the subsequent require did not restore. When these errors happen the thread may die, which may explain why several reloads don't work - but eventually you've killed each of the threads that were running, and the new ones initialize fresh and normal. David Patrick Rutkowski wrote: I'm currently using Apache2::Reload on a development machine, but I can't for the life of me figure out what it's doing and why. I'm coming across weird behavior such as the following just about every 5 minutes: 1. Have a perfectly working page. 2. Change some `print "foo"` to `print "bar"` (completely trivial) 3. Reload the page only to get an error message back (presumably Apache2::Reload reloaded the .pm and the new version has errors). 5. Check the .pm with perl -c, it turns out that my completely trivial change did NOT introduce errors. 6. Scratch head... 7. Reload the page 3 more times, with the same error coming back every time. 8. Reload a 4th time, and this time get a different error. 9. Reload a 5th time, and have it work (for good). I'M SO CONFUSED! :-( -Patrick What exactly does this mean anyway? Aborted why? === Attempt to reload WSS/User.pm aborted === Error during compilation of /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html: Attempt to reload WSS/User.pm aborted. Compilation failed in require at /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html line 14. Stack: [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:811] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:441] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:246] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:211] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:97] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:275] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:353] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:348] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:868] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:822] [(eval 34):8] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] BEGIN failed--compilation aborted at /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html line 14. Stack: [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:811] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:441] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:246] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:211] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:97] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:275] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:353] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:348] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:868] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:822] [(eval 34):8] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] Trace begun at /home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm line 845 HTML::Mason::Interp::_compilation_error('HTML::Mason::Interp=HASH(0x91acc90)', '/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html', 'HTML::Mason::Exception::Compilation=HASH(0x932e308)') called at /home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm line 445 HTML::Mason::Interp::load('HTML::Mason::Interp=HASH(0x91acc90)', '/sign_up.h
Re: Apache2::Reload - Very fickle, or is it just me?
Hmm, I see. Interesting points, all noted. I also just realized it might have to do with which of the many apache children get which requests and when. I'm hoping that setting MaxRequestsPerChild to something like 1 or 2 (as opposed to the default 1) will help ease the pain. -Patrick P.S. Sorry about that duplication David, I forgot to send to the list. David Ihnen wrote: My experience troubleshooting this kind of issue has indicated that its likely that the package that was unloaded deleted a value stored in the package space of the module reloaded (probably set at BEGIN block time) that the subsequent require did not restore. When these errors happen the thread may die, which may explain why several reloads don't work - but eventually you've killed each of the threads that were running, and the new ones initialize fresh and normal. David Patrick Rutkowski wrote: I'm currently using Apache2::Reload on a development machine, but I can't for the life of me figure out what it's doing and why. I'm coming across weird behavior such as the following just about every 5 minutes: 1. Have a perfectly working page. 2. Change some `print "foo"` to `print "bar"` (completely trivial) 3. Reload the page only to get an error message back (presumably Apache2::Reload reloaded the .pm and the new version has errors). 5. Check the .pm with perl -c, it turns out that my completely trivial change did NOT introduce errors. 6. Scratch head... 7. Reload the page 3 more times, with the same error coming back every time. 8. Reload a 4th time, and this time get a different error. 9. Reload a 5th time, and have it work (for good). I'M SO CONFUSED! :-( -Patrick What exactly does this mean anyway? Aborted why? === Attempt to reload WSS/User.pm aborted === Error during compilation of /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html: Attempt to reload WSS/User.pm aborted. Compilation failed in require at /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html line 14. Stack: [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:811] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:441] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:246] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:211] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:97] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:275] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:353] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:348] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:868] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:822] [(eval 34):8] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] BEGIN failed--compilation aborted at /home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html line 14. Stack: [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:811] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:441] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:246] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Request.pm:211] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:97] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:275] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/Class/Container.pm:353] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm:348] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:868] [/home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/ApacheHandler.pm:822] [(eval 34):8] [/home/rutski/Documents/projects/wss/install/apache/htdocs/dynamic/sign_up.html:14] Trace begun at /home/rutski/Documents/projects/wss/install/local/perl/lib/site_perl/5.10.0/HTML/Mason/Interp.pm line 845 HTML::Mason::Interp::_c
Re: Apache2::Reload - Very fickle, or is it just me?
On Wed, 14 Jan 2009, Patrick Rutkowski wrote: > Hmm, I see. Interesting points, all noted. > > I also just realized it might have to do with which of the many apache > children get which requests and when. > > I'm hoping that setting MaxRequestsPerChild to something like 1 or 2 (as > opposed to the default 1) will help ease the pain. Helps to test this kind of thing (when testing manually) by starting httpd with -X... less confusing. Mark
[mp2] a way to map a uri to a physical path
Hi all, I'm trying to find the class/ method which allows me to get the physical path base on the uri. Something similar to Server.MapPath('/index.htm') in ASP.NET. Any advise is appreciated. Thanks.
Re: [mp2] a way to map a uri to a physical path
Foo JH wrote: > Hi all, > > I'm trying to find the class/ method which allows me to get the physical > path base on the uri. Something similar to Server.MapPath('/index.htm') > in ASP.NET. > > Any advise is appreciated. Thanks. $r->document_root . $r->uri but that won't actually tell you if that file exists, it's just where you'd probably expect that file to reside. Not having any idea how that ASP.NET function works, i don't know if that really answers your question or not. Adam
Setting the CWD
I am writing a CGI::App and I keep having to use full paths to get various places in my application. How can I set the CWD for a certain Location section of my code? Thanks! -- -fREW
Re: [mp2] a way to map a uri to a physical path
Adam Prime wrote: >> I'm trying to find the class/ method which allows me to get the physical >> path base on the uri. Something similar to Server.MapPath('/index.htm') >> in ASP.NET. >> >> Any advise is appreciated. Thanks. > > $r->document_root . $r->uri Thanks for replying. In my case it's a wee bit more complicated (forgot to mention). Thing is, I have alias-ed a path (eg. alias /thisuri c:/wwwroot) in the web server, so $r->uri may not point to the right location. Is there a generic method so that given any uri as a parameter, the library can do the math and return the physical path?
Re: [mp2] a way to map a uri to a physical path
Foo JH wrote: > Adam Prime wrote: >>> I'm trying to find the class/ method which allows me to get the physical >>> path base on the uri. Something similar to Server.MapPath('/index.htm') >>> in ASP.NET. >>> >>> Any advise is appreciated. Thanks. >> $r->document_root . $r->uri > Thanks for replying. In my case it's a wee bit more complicated (forgot > to mention). > > Thing is, I have alias-ed a path (eg. alias /thisuri c:/wwwroot) in the > web server, so $r->uri may not point to the right location. > > Is there a generic method so that given any uri as a parameter, the > library can do the math and return the physical path? > $r->filename by the looks of things. http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_filename_ Adam
Re: Setting the CWD
fREW Schmidt wrote: > I am writing a CGI::App and I keep having to use full paths to get > various places in my application. How can I set the CWD for a certain > Location section of my code? If you're running your CGI::App code through Registry, and using mod_perl 2, and running under the prefork MPM, then you can instead use RegistryPrefork instead of registry, which is exactly the same except it does the chdir you're asking for. HTH, Adam
Re: [mp2] a way to map a uri to a physical path
Adam Prime wrote: > Foo JH wrote: >> Adam Prime wrote: I'm trying to find the class/ method which allows me to get the physical path base on the uri. Something similar to Server.MapPath('/index.htm') in ASP.NET. Any advise is appreciated. Thanks. >>> $r->document_root . $r->uri >> Thanks for replying. In my case it's a wee bit more complicated (forgot >> to mention). >> >> Thing is, I have alias-ed a path (eg. alias /thisuri c:/wwwroot) in the >> web server, so $r->uri may not point to the right location. >> >> Is there a generic method so that given any uri as a parameter, the >> library can do the math and return the physical path? >> > > $r->filename by the looks of things. I'm not sure if that's the one. From the docs (your ref link): filename Get/set the filename on disk corresponding to this response (the result of the URI --> filename translation). Sounds like this method assigns a file to the uri instead.
Re: [mp2] a way to map a uri to a physical path
On Thu 15 Jan 2009, Foo JH wrote: > Is there a generic method so that given any uri as a parameter, the > library can do the math and return the physical path? If you look for the filename for $r->uri, that means the uri of the current request then $r->filename holds that after the map-to-storage phase. If you need a general method to map an arbitrary URI to a filename then it is a subrequest: my $subr=$r->lookup_uri($uri); if( $subr->status == Apache2::Const::OK and -f $subr->filename ) { $filename=$subr->filename; } But keep in mind that it may result in quite unusual filenames if you use the mod_proxy handler for example. Also, the file may not exist. The status 404 is generated only in the response phase. Further, you must perhaps check $subr->path_info for being empty. Torsten -- Need professional mod_perl support? Just hire me: torsten.foert...@gmx.net