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 <worik.stan...@gmail.com> 
> 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
>>         <Location /cgi/>
>>            SetHandler perl-script
>>            PerlResponseHandler ModPerl::Registry
>>            PerlOptions +ParseHeaders
>>            Options +ExecCGI
>>            Order allow,deny
>>            Allow from all
>>         </Location>
>>
>> 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)

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to