Re: Errors in the wrong place and wrong format
On 21/11/14 04:19, Perrin Harkins wrote: > I think that only redirects errors logged with Apche2::Log, not all of > STDERR. There might be a workaround for capturing STDERR. I'd try searching > the mailing list archives. > > - Perrin I get "die" erors in one log file (the one specified for my virtual host) and warn errors in /var/log/apache2/error.log What on Earth could be the reason for that? Worik > > On Mon, Nov 17, 2014 at 6:28 PM, worik wrote: > >> > My virtual host has errors redirected to: >> > >> > Worik.errors.log >> > >> > (ErrorLog ${APACHE_LOG_DIR}/Worik.error.log) >> > >> > It is in this virtueal host that I have set-up mod-perl. Why then are >> > errors sent to error.log? >> > >> > And why do errors emanating from mod_perl not have time stamps? >> > >> > -- Why is the legal status of chardonnay different to that of cannabis? worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) I voted for love signature.asc Description: OpenPGP digital signature
Prototype mismatch
I get the following messages in my apache2/error.log when I restart. Why is that? What steps should I take to diagnose the problem? The line in the script where this ocures says: use FileHandle; cheers Worik Prototype mismatch: sub Apache::AdMachine::Track::LOCK_UN: none vs () Prototype mismatch: sub Apache::AdMachine::Track::LOCK_NB: none vs () Prototype mismatch: sub Apache::AdMachine::Track::SEEK_END: none vs () Prototype mismatch: sub Apache::AdMachine::Track::LOCK_EX: none vs () Prototype mismatch: sub Apache::AdMachine::Track::LOCK_SH: none vs () Prototype mismatch: sub Apache::AdMachine::Track::_IOFBF: none vs () Prototype mismatch: sub Apache::AdMachine::Track::_IOLBF: none vs () Prototype mismatch: sub Apache::AdMachine::Track::_IONBF: none vs () Prototype mismatch: sub Apache::AdMachine::Track::FD_CLOEXEC: none vs () Prototype mismatch: sub Apache::AdMachine::Track::F_DUPFD: none vs () Prototype mismatch: sub Apache::AdMachine::Track::F_EXLCK: none vs () Prototype mismatch: sub Apache::AdMachine::Track::F_GETFD: none vs () Prototype mismatch: sub Apache::AdMachine::Track::F_GETFL: none vs () Prototype mismatch: sub Apache::AdMachine::Track::F_GETLK: none vs () Prototype mismatch: sub Apache::AdMachine::Track::F_GETLK64: none vs () Prototype mismatch: sub Apache::AdMachine::Track::F_GETOWN: none vs () -- Why is the legal status of chardonnay different to that of cannabis? worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) I voted for love signature.asc Description: OpenPGP digital signature
Re: $r->path_info unreliable?
On 19/06/14 14:11, Jie Gao wrote: > * Worik Stanton wrote: > >> Date: Thu, 19 Jun 2014 12:13:10 +1200 >> From: Worik Stanton >> To: mod_perl list >> Subject: $r->path_info unreliable? >> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 >> Thunderbird/24.5.0 >> >> In my handler I call $r->path_info to determine the path used to call my >> script. > > It looks to me, on the face of it, that you should use "$r->uri" instead. Ah yes. That is true. Thank you for that. W -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: $r->path_info unreliable?
On 19/06/14 13:12, Jie Gao wrote: > Could it be that after the URI --> filename translation, there is > indeed nothing left there? > > A resource referred to by the "Location" directive does not > necessarily correspond to a local file. I am not sure. I do not do any translation deliberately. SetHandler perl-script PerlResponseHandler Apache::MyPackage::DataHash In this case it works. Has the URI --> file name translation done some thing different than for... SetHandler perl-script PerlResponseHandler Apache::MyPackage::FrontEnd2 Where it does work? I do not think I understand URI --> file name translation. Worik PS I am sorry I sent this message twice. It seemed to bounce from the list at my end, and I admit I got a bit confused and thought I had used an incorrect address. I emailed the list owner thinking I had failed, twice, to get through. -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
$r->path_info unreliable?
In my handler I call $r->path_info to determine the path used to call my script. I am trying to have a test version of my code using the same module but which reads different data based on the path. So I have: SetHandler perl-script PerlResponseHandler Apache::MyPackage::FrontEnd2 SetHandler perl-script PerlResponseHandler Apache::MyPackage::FrontEnd2 In FrontEnd2 sub handler { my $r =3D shift; warn $r->path_info; if($r->path_info =3D~ /test/i){ ## Load test data }else{ ## Load real data } This works for another package I have exactly like this, but in this case $r->path_info is empty. I am stumped. Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Why is RecuestRec::path_info sometimes empty?
In my handler I call $r->path_info to determine the path used to call my script. I am trying to have a test version of my code using the same module but which reads different data based on the path. So I have: SetHandler perl-script PerlResponseHandler Apache::MyPackage::FrontEnd2 SetHandler perl-script PerlResponseHandler Apache::MyPackage::FrontEnd2 In FrontEnd2 sub handler { my $r = shift; warn $r->path_info; if($r->path_info =~ /test/i){ ## Load test data }else{ ## Load real data } This works for another package I have exactly like this, but in this case $r->path_info is empty. I am stumped. Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: Trouble with script execution
On 19/05/14 12:13, Brad Van Sickle wrote: > Yep you need to restart to see your changes. I am sure I read somewhere that mod_perl monitors scripts and reloads them if the modification date changes. But oh well. It definitely notices sometimes. cheers Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: What about debugging?
On 19/05/14 12:03, Worik Stanton wrote: > Is there a way to get useful debugging info? > > I am getting messages like: > > "failed to resolve handler `Apache::AdMachine::MyHandler;' > Excuse my sillieness. `Apache::AdMachine::MyHandler;' had a ';' on the end. The error message was very sensible, and I was unobservant, Sorry to waste your time. Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: Trouble with script execution
On 19/05/14 11:34, John Dunlap wrote: > No, you have to restart the server for code changes to be noticed. Does that mean I have to restart my server for every change to a script? Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
What about debugging?
Is there a way to get useful debugging info? I am getting messages like: "failed to resolve handler `Apache::AdMachine::MyHandler;' Which says something is wrong, but offers no clue. If I have a bug like: my $z = ; # Clearly wrong I get a useful error message. So when I see: "failed to resolve handler `Apache::AdMachine::MyHandler;' I am a bit lost Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Trouble with script execution
I am having a nproblem executing my handler. The short of it is it is when I make a change to the script I have to restart the server to get it noticed, and it does not always call the same code. The lng of it: I have a package with a 'handler' function. It starts... package Apache::Script; use strict; use Apache2::Const qw(:common); use Apache2::Connection; [snip] sub handler { warn "Apache::Script::handler $$ '".join(", ", @_)."'"; my $r = shift; [snip] Many more lines like... warn "Apache::Script::handler"; And in the config file: SetHandler perl-script PerlResponseHandler Apache::Script Repeatedly loading the URL I get different results almost every time. With the first 'warn' statement producing oyutput almst every iteration and occasionally the later warn statements not being executed, and often with no output. Making changes t the script (adding debugging 'warn' statements) are only reliably (ish) noticed if I restart the server. There is some unreliability in my code (bugs) I am trying to track down but it is confounded by the fact I am not sure what mod_perl is doing. There seems to be a time element. After restarting the server everything goes well for a while (minutes) but soon behaviour changes and I am back to only some of the code executing (with no oither changes but the passing of time). I thought mod_perl would reload code that changed. Is this wrong? Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: API Docs
On 16/05/14 21:09, André Warnier wrote: > Maybe you should start here : > https://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_ > Thank you. That is very useful Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: Testing mod_perl
On 16/05/14 08:24, John Dunlap wrote: > If I may ask a potentially stupid question, what are you attempting to do > which necessitates the use of Apache2::Directive? I am randomly thrashing around trying to get started with the mod_perl API. More accurately I was. I have my bearings now and am making some progress. I have used the API today to get document_root (thank-you j...@lariat.co) and to filter by IP. cheers Worik > > > On Wed, May 14, 2014 at 5:01 PM, Worik Stanton wrote: > >> On another matter... >> >> On 15/05/14 05:16, Perrin Harkins wrote: >>> simpler things like PerlSetVar. There is an automated test for this >>> though: >>> >> http://cpansearch.perl.org/src/PHRED/mod_perl-2.0.8/t/response/TestApache/conftree.pm >> >> I have not used this testing frame work before (other than watch tests >> go by during the build process). >> >> I looked up http://perl.apache.org/docs/general/testing/testing.html but >> there does not seem to be a tutorial to get started. Where is the >> documentation that shows how to arrange the files and run these tests? >> >> I tried creating a directory t/ and t/TestApache and put conftree.pm >> into TestApache and created a file contree.pl which used >> TestApache::conftree >> >> (I had to add a "1;" to the last line of conftree.pm which was an >> indication I was on the wrong track). >> >> I then called TestApache::conftree->new(@ARGV)->run(); >> >> Anyway clearly I am doing the wrong thing, no matter how natural it >> seems and I need some help to get on the right track >> >> cheers >> Worik >> >> -- >> The only true evil is turning people into things >> Granny Weatherwax >>worik.stan...@gmail.com 021-1680650, (03) 4821804 >> Aotearoa (New Zealand) >> >> > -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: API Docs
On 15/05/14 23:55, Perrin Harkins wrote: > The $r there is the Apache2::RequestRec object. It gets passed to > your handler. See the handler example in the overview: > https://perl.apache.org/docs/2.0/user/intro/start_fast.html Thank-you. That looks very useful. I can see where it was linked to now from the documentation at perl.apache.org. Now I can see what I was missing, a "handler" method from a registered module Worik > > - Perrin > > On Wed, May 14, 2014 at 7:52 PM, Worik Stanton > wrote: >> I am still trying to fathom the API. >> >> I have struck a snag with the documentation. >> >> >> https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis >> says >> >> use Apache2::Connection (); >> use Apache2::RequestRec (); >> >> my $c = $r->connection; >> >> >> What is $r? >> >> I am missing something obvious, what is the context here I do not get? >> >> cheers >> Worik >> -- >> The only true evil is turning people into things >> Granny Weatherwax >>worik.stan...@gmail.com 021-1680650, (03) 4821804 >> Aotearoa (New Zealand) >> > . > -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Testing mod_perl
On another matter... On 15/05/14 05:16, Perrin Harkins wrote: > simpler things like PerlSetVar. There is an automated test for this > though: > http://cpansearch.perl.org/src/PHRED/mod_perl-2.0.8/t/response/TestApache/conftree.pm I have not used this testing frame work before (other than watch tests go by during the build process). I looked up http://perl.apache.org/docs/general/testing/testing.html but there does not seem to be a tutorial to get started. Where is the documentation that shows how to arrange the files and run these tests? I tried creating a directory t/ and t/TestApache and put conftree.pm into TestApache and created a file contree.pl which used TestApache::conftree (I had to add a "1;" to the last line of conftree.pm which was an indication I was on the wrong track). I then called TestApache::conftree->new(@ARGV)->run(); Anyway clearly I am doing the wrong thing, no matter how natural it seems and I need some help to get on the right track cheers Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: Trouble with mod_perl API: E.g., Apache2::Directive::conftree()
On 15/05/14 05:16, Perrin Harkins wrote: > Hi Worik, > > Your ErrorLog question isn't really a mod_perl issue, but I'd suggest > you check for warnings at startup. You may not have APACHE_LOG_DIR > defined, etc. > The ErrorLog issue only happens under mod_perl. Given that all logs were in the appropriate directory but I went and checked and it is set appropriately in apache2/envvars. If you look at the snippet of my configuration file you will see I set the error log just before setting up mod_perl. > I don't use Apache2::Directive, so I can't vouch for it. I prefer > simpler things like PerlSetVar. There is an automated test for this > though: > http://cpansearch.perl.org/src/PHRED/mod_perl-2.0.8/t/response/TestApache/conftree.pm Thank you that is useful. I will look into that. I have gotten that file. Is there some documentation to go with it? > > I'd suggest doing some more basic debugging, e.g. > > use Data::Dumper; > print Dumper $tree->as_hash; Thank you. That is helpful too. cheers Worik > > - Perrin > > On Tue, May 13, 2014 at 8:24 PM, Worik Stanton > wrote: >> I am having a lot of trouble with mod_perl APIs. >> >> The short of it is that when I say: >> >> use Apache2::Directive (); >> my $tree = Apache2::Directive::conftree(); >> my $documentroot = $tree->lookup('DocumentRoot'); >> warn "\$documentroot '$documentroot'"; >> >> I get: >> [Wed May 14 12:13:43 2014] -e: Use of uninitialized value $documentroot >> in concatenation (.) or string at /home/worik/Worik.org/cgi/track line 11. >> [Wed May 14 12:13:43 2014] -e: $documentroot '' at >> /home/worik/Worik.org/cgi/track line 11. >> >> in the logs. >> >> I copied the code from >> https://perl.apache.org/docs/2.0/api/Apache2/Directive.html >> >> The longer of it is: >> >> In the past (15 years ago) I installed mod_perl and forgot about it. I >> set up my perl cgi script handler to be mod_perl in httpd.conf, and the >> only real effect it had on my development cycle was I often had to >> restart Apache to get it to notice I had changed a script. >> >> These days I am more ambitious and am returning to Web programming after >> a long break. >> >> I expect mod_perl to still be useful to cut the overhead of starting >> Perl. I expect a high throughput this time around, each request will be >> worth very little to me so I want lots and lots of requests. SO far so >> good. >> >> I have set up my server: >> >> ## mod_perl2 configuration >> Alias /cgi/ /home/worik/Worik.org/cgi/ >> PerlModule ModPerl::Registry >> ## PerlModule Apache::Registry >> PerlSwitches -T >> ErrorLog ${APACHE_LOG_DIR}/Worik.error.log >> >>SetHandler perl-script >>PerlResponseHandler ModPerl::Registry >>PerlOptions +ParseHeaders >>Options +ExecCGI >>Order allow,deny >>Allow from all >> >> >> Now I would like to use the API. In the first instance I want to find >> what the directory is I am running in. So I want to say: >> >> use Apache2::Directive (); >> my $tree = Apache2::Directive::conftree(); >> my $pwd = $tree->lookup("cgi"); >> >> But that fails just like the example at the start of this email. >> >> Also my errors are coming out in the wrong log. When I say warn("foo") >> I expect it to come out in the file specified by the ErrorLog directive >> but it comes as: >> >> [Wed May 14 12:22:53 2014] -e: foo at /home/worik/Worik.org/cgi/track >> line 12. >> >> in /var/log/apache2/error.log which is not what I specified. >> >> I am at a loss. Is the documentation up to date? Is mod_perl still >> being used out there? >> >> cheers >> Worik >> >> -- >> The only true evil is turning people into things >> Granny Weatherwax >>worik.stan...@gmail.com 021-1680650, (03) 4821804 >> Aotearoa (New Zealand) >> >> > -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
API Docs
I am still trying to fathom the API. I have struck a snag with the documentation. https://perl.apache.org/docs/2.0/api/Apache2/Connection.html#Synopsis says use Apache2::Connection (); use Apache2::RequestRec (); my $c = $r->connection; What is $r? I am missing something obvious, what is the context here I do not get? cheers Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Trouble with mod_perl API: E.g., Apache2::Directive::conftree()
I am having a lot of trouble with mod_perl APIs. The short of it is that when I say: use Apache2::Directive (); my $tree = Apache2::Directive::conftree(); my $documentroot = $tree->lookup('DocumentRoot'); warn "\$documentroot '$documentroot'"; I get: [Wed May 14 12:13:43 2014] -e: Use of uninitialized value $documentroot in concatenation (.) or string at /home/worik/Worik.org/cgi/track line 11. [Wed May 14 12:13:43 2014] -e: $documentroot '' at /home/worik/Worik.org/cgi/track line 11. in the logs. I copied the code from https://perl.apache.org/docs/2.0/api/Apache2/Directive.html The longer of it is: In the past (15 years ago) I installed mod_perl and forgot about it. I set up my perl cgi script handler to be mod_perl in httpd.conf, and the only real effect it had on my development cycle was I often had to restart Apache to get it to notice I had changed a script. These days I am more ambitious and am returning to Web programming after a long break. I expect mod_perl to still be useful to cut the overhead of starting Perl. I expect a high throughput this time around, each request will be worth very little to me so I want lots and lots of requests. SO far so good. I have set up my server: ## mod_perl2 configuration Alias /cgi/ /home/worik/Worik.org/cgi/ PerlModule ModPerl::Registry ## PerlModule Apache::Registry PerlSwitches -T ErrorLog ${APACHE_LOG_DIR}/Worik.error.log SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI Order allow,deny Allow from all Now I would like to use the API. In the first instance I want to find what the directory is I am running in. So I want to say: use Apache2::Directive (); my $tree = Apache2::Directive::conftree(); my $pwd = $tree->lookup("cgi"); But that fails just like the example at the start of this email. Also my errors are coming out in the wrong log. When I say warn("foo") I expect it to come out in the file specified by the ErrorLog directive but it comes as: [Wed May 14 12:22:53 2014] -e: foo at /home/worik/Worik.org/cgi/track line 12. in /var/log/apache2/error.log which is not what I specified. I am at a loss. Is the documentation up to date? Is mod_perl still being used out there? cheers Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature