[email protected]

2004-02-18 Thread frederik
Using Apache/1.3.27 (Unix) mod_gzip/1.3.26.1a mod_perl/1.27, perl
5.8.0.

Hi,

I'm working with some servers which print debugging messages through a
wrapper function that calls Apache::Log::debug, here is a simplified
version:

sub mydebug {
my $msg = shift;
Apache->server()->log()->debug($msg);
}

Since Apache::Log::debug inserts the file and line number of its
calling location into each log entry, this means that our log entries
all contain the same file and line number, corresponding to the
location of the Apache::Log::debug call inside 'mydebug'.

I'm trying to figure out how to get Apache::Log to use the correct
file and line numbers, i.e. those of the caller of our wrapper
function, instead. The perlfunc man page suggests that the 'goto
&NAME' form of 'goto' can be used to trick 'caller', but rewriting the
wrapper function in the following manner:

sub mydebug {
my $msg = shift;
@_=(Apache->server()->log(), $msg);
goto &Apache::Log::debug;
}

doesn't change the behavior - it still manages to print the file and
line number of the 'goto' statement, not of the caller of 'mydebug'.
Can anyone help us with this?

Thanks in advance,

Frederik Eaton


Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
osname=linux, osvers=2.4.20, archname=i686-linux-64int
uname='linux yourmom 2.4.20 #4 smp thu feb 27 15:11:19 pst 2003 i686 unknown '
config_args='-Duse64bitint -de'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-fno-strict-aliasing'
ccversion='', gccversion='2.96 2731 (Red Hat Linux 7.1 2.96-98)', 
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
  Linker and Libraries:
ld='cc', ldflags =''
libpth=/lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.2.4'
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_64_BIT_INT USE_LARGE_FILES
  Built under linux
  Compiled at Feb  5 2003 07:25:46

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



[email protected]

2004-02-19 Thread frederik
Stas Bekman <[EMAIL PROTECTED]> writes:

> [EMAIL PROTECTED] wrote:
>> Using Apache/1.3.27 (Unix) mod_gzip/1.3.26.1a mod_perl/1.27, perl
>> 5.8.0.
>> Hi,
>> I'm working with some servers which print debugging messages through
>> a
>> wrapper function that calls Apache::Log::debug, here is a simplified
>> version:
>> sub mydebug {
>> my $msg = shift;
>> Apache->server()->log()->debug($msg);
>> }
>> Since Apache::Log::debug inserts the file and line number of its
>> calling location into each log entry, this means that our log entries
>> all contain the same file and line number, corresponding to the
>> location of the Apache::Log::debug call inside 'mydebug'.
>> I'm trying to figure out how to get Apache::Log to use the correct
>> file and line numbers, i.e. those of the caller of our wrapper
>> function, instead. The perlfunc man page suggests that the 'goto
>> &NAME' form of 'goto' can be used to trick 'caller', but rewriting the
>> wrapper function in the following manner:
>
> If you don't care about a little slowdown (and you probably don't,
> since it's a debug), you can do:
>
> sub mydebug {
>  my $msg = shift;
>  my($filename, $line) = (caller)[1..2];
> return eval < #line $line $filename
>  Apache->server()->log()->debug($msg);
> EOE
>
> }
>
> mod_perl 2.0 API allows you to explicitly path __LINE__ and __FILE__
> arguments, to the logging functions.

Thanks for the tip! We'll probably end up using something like this.

I guess there is still the question of why 'goto &NAME' doesn't work.
Is this a bug? Is it a known bug?

Frederik

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



mod_perl installed via yum but not used by application (RedHat 6.5 Apache 2.2.15 mod_perl 2.0.4)

2015-01-14 Thread BOUX Frederik
Hello,

I am using OTRS on a RedHat 6.5 with apache2 and mod_perl2. We are using these 
packages (yum info feedback):

Installed Packages
Name: httpd
Arch: x86_64
Version : 2.2.15
Release : 39.el6

Name: mod_perl
Arch: x86_64
Version : 2.0.4
Release : 11.el6_5

We noticed a performance difference with the Development server. I can see in 
htop that the apache user is spawning /usr/bin/perl processes to run all the 
perl scripts instead of handling them in an httpd process. So I placed the 
following script in the same directory as my index.pl to see if mod_perl was 
being used:

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "Server's environment\n";
foreach ( keys %ENV ) {
print "$_\t$ENV{$_}\n";
}

Dev shows these two variables that are completely missing on Sandbox:

MOD_PERL_API_VERSION 2
MOD_PERL mod_perl/2.0.4

So I'm pretty sure mod_perl isn't being used . But as far as I can tell 
everything is configured:

1) /etc/httpd/conf.d/perl.conf contains the line: LoadModule perl_module 
modules/mod_perl.so

2) /etc/httpd/conf/httpd.conf contains an Include: Include conf.d/*.conf

3) this is the default .conf from OTRS but I can't find a mistake:

# Setup environment and preload modules
Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl

# Reload Perl modules when changed on disk
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload

# general mod_perl2 options

#ErrorDocument 403 /otrs/customer.pl
ErrorDocument 403 /otrs/index.pl
SetHandler  perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
PerlOptions +ParseHeaders
PerlOptions +SetupEnv



   Order allow,deny
   Allow from all

= 2.4>
Require all granted



Order allow,deny
Allow from all



# mod_perl2 options for GenericInterface

PerlOptions -ParseHeaders






And yet the module is loaded:

[user@server httpd]$ httpd -M | grep perl
Syntax OK
perl_module (shared)
[user@server httpd]$ httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c


Anyone who can spot a mistake or who has additional steps to troubleshoot why 
mod_perl isn't being used?