Re: libgtop gone?
Mithun Bhattacharya wrote: Tried compilling libgtop on a server without X and got the following. The error message seems to be self explanatory. -- configure: error: *** GNOME was not found on this system. *** *** If you want to use LibGTop without GNOME, you need *** to give configure the --without-gnome parameter. So give the configure the --without-gnome parameter, what's the big deal? __ 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: libgtop gone?
Perrin Harkins wrote: http://ftp.gnome.org/pub/GNOME/desktop/2.0/2.0.3/sources/libgtop-2.0.0.tar.gz Thanks to both of you for pointing out that it's on the Gnome FTP site. I'll send Doug a documentation patch to point to this location. And a week later this url will be broken. Notice that it includes a minor version in the path. __ 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: mod_perl and mod_cgi problems
Magnar Stav Johanssen wrote: Hi! On my Solaris 5.8 machine I'm running apache 1.3.27 with mod_cgi and mod_perl 1.0. mod_cgi is compiled into apache and mod_perl are loaded in my httpd.conf. When I'm requesting for any .cgi script (tested with: #!/usr/bin/perl or #!/bin/sh) everything works fine, and the scripts compile and return a 200 message to my browser. But after a request that involves mod_perl - .mpl (#!/usr/bin/perl), these cgi scripts crashes with 500: internal server error This is the error.log: libthread panic: cannot create new lwp : dumping core (PID: 9028 LWP 2) stacktrace: ff052030 0 If I start a truss -p on the apache process (all processes) the request will be OK and reply a 200 OK message. After I've turned off all trusses, the errormessage is still there. Then I need to restart apache and all cgi scripts are working fine again. What can I do to solve this? Have you tried looking in the archives? I have found: http://marc.theaimsgroup.com/?l=apache-modperlw=2r=1s=libthread+panicq=b In particular: http://marc.theaimsgroup.com/?l=apache-modperlm=91763462706496w=2 http://marc.theaimsgroup.com/?l=apache-modperlm=97363770902299w=2 __ 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: Needfurther help on MP2 config.
benjamin mccall wrote: I'm sorry, but i just cannot comprehend the doc or Doug's book explanation on how to further configure Apache to load any custom perl modules I might add. I dropped a perl dir under apache2: /usr/local/apache2/lib/perl/Apache per Doug's direction (from Apache Modules... p. 28). I don't believe I have a perl startup file. Or do i? And where do I place the PerlSetEnv directive? In httpd.conf? I cannot seem to make sense between the online doc and the book's direction. No criticism to the authors, I'm just a bit slow. I would like to pace myself learning how to build and implement my own perl and c modules with mod_perl as advocated by Steve and Doug. My testbed includes Apache 2.043: mod_perl(1.99_08): perl 5.8 on linux. If someone could help me with this, I'd really appreciate it. First, the eagle book covers mod_perl 1.0. Not 2.0. Though most of the Perl things should work in the same way under 2.0. The chapters on C are definitely applying only to Apache 1.3. Not Apache 2.0. Second, the online documentation for mod_perl 2.0 is far from being complete and you should refer to the 1.0 documentation for the missing parts. Use the search to find your way around. A help to port the 1.0 bits of docs to 2.0 is appreaciated. PerlSetEnv and other Perl* directives go to httpd.conf. The startup file should be created, it's not provided by mod_perl. So go to http://perl.apache.org/docs/1.0/guide and start reading from there. All your questions are already answered there. Finally, since mod_perl 2.0 is under development and the docs are incomplete you are much better off learning with mod_perl 1.0 which is stable and pretty much bug free. __ 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
cvs commit: modperl-2.0/src/modules/perl modperl_callback.c
stas2003/01/28 17:04:34 Modified:.Changes src/modules/perl modperl_callback.c Added: t/hooks stacked_handlers.t t/hooks/TestHooks stacked_handlers.pm Log: Stacked handlers chain execution is now aborted when a handler returns something other than OK or DECLINED Revision ChangesPath 1.116 +3 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.115 retrieving revision 1.116 diff -u -r1.115 -r1.116 --- Changes 25 Jan 2003 03:08:04 - 1.115 +++ Changes 29 Jan 2003 01:04:33 - 1.116 @@ -10,6 +10,9 @@ =item 1.99_09-dev +Stacked handlers chain execution is now aborted when a handler returns +something other than OK or DECLINED [Stas] + make $filter-read() in input streaming filters, use the same number of arguments as read() in the output filters. [Stas] 1.1 modperl-2.0/t/hooks/stacked_handlers.t Index: stacked_handlers.t === use strict; use warnings FATAL = 'all'; use Apache::Test; use Apache::TestUtil; use Apache::TestRequest; plan tests = 1; my $location = /TestHooks::stacked_handlers; my $expected = join \n, qw(one two three), ''; my $received = GET_BODY $location; ok t_cmp($expected, $received, stacked_handlers); 1.1 modperl-2.0/t/hooks/TestHooks/stacked_handlers.pm Index: stacked_handlers.pm === package TestHooks::stacked_handlers; use strict; use warnings FATAL = 'all'; use Apache::RequestRec (); use Apache::RequestIO (); use Apache::Const -compile = qw(OK DECLINED); sub handler { my $r = shift; $r-handler(modperl); $r-push_handlers(PerlResponseHandler = [\one, \two, \three, \four]); return Apache::OK; } sub one { my $r = shift; $r-content_type('text/plain'); $r-print(one\n); return Apache::OK; } sub two { my $r = shift; $r-print(two\n); return Apache::OK; } sub three { my $r = shift; $r-print(three\n); return Apache::DONE; } # this one shouldn't get called, because the three has returned DONE sub four { my $r = shift; $r-print(four\n); return Apache::OK; } 1; __DATA__ NoAutoConfig Location /TestHooks::stacked_handlers SetHandler modperl PerlHeaderParserHandler TestHooks::stacked_handlers /Location /NoAutoConfig 1.53 +12 -3 modperl-2.0/src/modules/perl/modperl_callback.c Index: modperl_callback.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- modperl_callback.c14 Jan 2003 06:42:43 - 1.52 +++ modperl_callback.c29 Jan 2003 01:04:33 - 1.53 @@ -182,12 +182,21 @@ handlers = (modperl_handler_t **)av-elts; for (i=0; inelts; i++) { -if ((status = modperl_callback(aTHX_ handlers[i], p, r, s, av_args)) != OK) { +status = modperl_callback(aTHX_ handlers[i], p, r, s, av_args); + +MP_TRACE_h(MP_FUNC, %s returned %d\n, handlers[i]-name, status); + +if ((status != OK) (status != DECLINED)) { status = modperl_errsv(aTHX_ status, r, s); +#ifdef MP_TRACE +if (i+1 != nelts) { +MP_TRACE_h(MP_FUNC, there were %d uncalled handlers\n, + nelts-i-1); +} +#endif +break; } -MP_TRACE_h(MP_FUNC, %s returned %d\n, - handlers[i]-name, status); } SvREFCNT_dec((SV*)av_args);
cvs commit: modperl-2.0/t/hooks/TestHooks push_handlers.pm
stas2003/01/28 17:25:46 Added: t/hooks push_handlers.t t/hooks/TestHooks push_handlers.pm Log: - add a test to exercise push_handlers in different ways - prepare for supporting anon handlers Revision ChangesPath 1.1 modperl-2.0/t/hooks/push_handlers.t Index: push_handlers.t === use strict; use warnings FATAL = 'all'; use Apache::Test; use Apache::TestUtil; use Apache::TestRequest; plan tests = 1; my @refs = qw(coderef full_coderef coderef1 coderef2 coderef3); my @anon = qw(anonymous anonymous1 coderef4 anonymous3); my @strings = @refs; # XXX: anon-handlers unsupported yet # push @strings, @anon my $location = /TestHooks::push_handlers; my $expected = join \n, @strings, ''; my $received = GET_BODY $location; ok t_cmp($expected, $received, push_handlers ways); 1.1 modperl-2.0/t/hooks/TestHooks/push_handlers.pm Index: push_handlers.pm === package TestHooks::push_handlers; # test various ways to push handlers use strict; use warnings FATAL = 'all'; use Apache::RequestRec (); use Apache::RequestIO (); use Apache::Const -compile = qw(OK DECLINED DONE); sub handler { my $r = shift; $r-handler(modperl); $r-push_handlers(PerlResponseHandler = \start); $r-push_handlers(PerlResponseHandler = \coderef); $r-push_handlers(PerlResponseHandler = \TestHooks::push_handlers::full_coderef); $r-push_handlers(PerlResponseHandler = [\coderef1, \coderef2, \coderef3]); # XXX: anon-handlers unsupported yet #$r-push_handlers(PerlResponseHandler = #sub { return say(shift, anonymous) }); #$r-push_handlers(PerlResponseHandler = #[sub { return say(shift, anonymous1) }, # \coderef4, # sub { return say(shift, anonymous3) }, #]); $r-push_handlers(PerlResponseHandler = \end); return Apache::DECLINED; } sub start { shift-content_type('text/plain'); return Apache::OK } sub end { return Apache::DONE } sub say { shift-print(shift,\n); return Apache::OK } sub coderef { return say(shift, coderef) } sub coderef1 { return say(shift, coderef1) } sub coderef2 { return say(shift, coderef2) } sub coderef3 { return say(shift, coderef3) } sub coderef4 { return say(shift, coderef4) } sub full_coderef { return say(shift, full_coderef) } 1; __DATA__ NoAutoConfig Location /TestHooks::push_handlers SetHandler modperl PerlHeaderParserHandler TestHooks::push_handlers /Location /NoAutoConfig
cvs commit: modperl-2.0/t/hooks/TestHooks push_handlers.pm
stas2003/01/28 17:33:17 Modified:t/hooks push_handlers.t t/hooks/TestHooks push_handlers.pm Log: mix in the handlers configured from httpd.conf Revision ChangesPath 1.2 +2 -1 modperl-2.0/t/hooks/push_handlers.t Index: push_handlers.t === RCS file: /home/cvs/modperl-2.0/t/hooks/push_handlers.t,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- push_handlers.t 29 Jan 2003 01:25:45 - 1.1 +++ push_handlers.t 29 Jan 2003 01:33:17 - 1.2 @@ -7,7 +7,8 @@ plan tests = 1; -my @refs = qw(coderef full_coderef coderef1 coderef2 coderef3); +my @refs = qw(conf conf1 conf2 coderef + full_coderef coderef1 coderef2 coderef3); my @anon = qw(anonymous anonymous1 coderef4 anonymous3); my @strings = @refs; 1.2 +12 -4 modperl-2.0/t/hooks/TestHooks/push_handlers.pm Index: push_handlers.pm === RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/push_handlers.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- push_handlers.pm 29 Jan 2003 01:25:45 - 1.1 +++ push_handlers.pm 29 Jan 2003 01:33:17 - 1.2 @@ -14,7 +14,6 @@ my $r = shift; $r-handler(modperl); -$r-push_handlers(PerlResponseHandler = \start); $r-push_handlers(PerlResponseHandler = \coderef); $r-push_handlers(PerlResponseHandler = @@ -38,11 +37,18 @@ return Apache::DECLINED; } +sub end { return Apache::DONE } +sub say { shift-print(shift,\n); return Apache::OK } -sub start { shift-content_type('text/plain'); return Apache::OK } -sub end { return Apache::DONE } -sub say { shift-print(shift,\n); return Apache::OK } +sub conf { +# this one is configured from httpd.conf +my $r= shift; +$r-content_type('text/plain'); +return say($r, conf); +} +sub conf1{ return say(shift, conf1)} +sub conf2{ return say(shift, conf2)} sub coderef { return say(shift, coderef) } sub coderef1 { return say(shift, coderef1) } sub coderef2 { return say(shift, coderef2) } @@ -56,6 +62,8 @@ Location /TestHooks::push_handlers SetHandler modperl PerlHeaderParserHandler TestHooks::push_handlers + PerlResponseHandler TestHooks::push_handlers::conf + PerlResponseHandler TestHooks::push_handlers::conf1 TestHooks::push_handlers::conf2 /Location /NoAutoConfig
cvs commit: modperl-2.0/t/hooks/TestHooks push_handlers.pm stacked_handlers.pm
stas2003/01/28 18:36:25 Modified:t/hooks/TestHooks push_handlers.pm stacked_handlers.pm Log: add the missing Apache::ServerUtil Revision ChangesPath 1.3 +1 -0 modperl-2.0/t/hooks/TestHooks/push_handlers.pm Index: push_handlers.pm === RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/push_handlers.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- push_handlers.pm 29 Jan 2003 01:33:17 - 1.2 +++ push_handlers.pm 29 Jan 2003 02:36:25 - 1.3 @@ -7,6 +7,7 @@ use Apache::RequestRec (); use Apache::RequestIO (); +use Apache::ServerUtil (); use Apache::Const -compile = qw(OK DECLINED DONE); 1.3 +1 -0 modperl-2.0/t/hooks/TestHooks/stacked_handlers.pm Index: stacked_handlers.pm === RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/stacked_handlers.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- stacked_handlers.pm 29 Jan 2003 01:09:06 - 1.2 +++ stacked_handlers.pm 29 Jan 2003 02:36:25 - 1.3 @@ -9,6 +9,7 @@ use Apache::RequestRec (); use Apache::RequestIO (); +use Apache::ServerUtil (); use Apache::Const -compile = qw(OK DECLINED DONE);
Re: Stacked Handlers Execution Chain
Geoffrey Young wrote: Helmut Zeilinger wrote: Hi, i am using mod_perl 1.99_08. I have two mod_perl handlers: ... PerlResponseHandler Test::handler0 Test::handler1 ... How can i brake the execution chain between handler0 and handler1? Whatever i try as handler0 return value (OK, DECLINED, FORBIDDEN, 404) the handler1 is still executed. The documentation says, that any value except DECLINED should do that. The documentation talks about a normal (one per phase) handler, not stacked handlers. Which certainly should be covered in the docs as well. it probably should say that OK, DECLINED, or DONE will allow the chain to continue. anything else ought to immediately terminate the chain - if not, it's probably a bug. you might want to see if there is a difference between returning FORBIDDEN, NOT_FOUND, and SERVER_ERROR (well, their 2.0 equivalents, anyway), just to help track things down. First of all let's clear up the 1.0 side: Quoting the eagle book: The exception to this rule [all handlers will run] is if one of the handlers in the series returns an error code (anything other than OK, DECLINED, or DONE) Though the code does *not* check for DONE: mod_perl.c:1375 if((status != OK) (status != DECLINED)) { ... return status; } so where is the bug? In the book or the code? Now the 2.0 side: Currently it runs all handlers no matter what, I'll fix that soon to do the same as in 1.0: i.e. checking for OK and DECLINED but not for 'DONE' to be consistent with 1.0. __ 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: Stacked Handlers Execution Chain
Try again with the current cvs. You can look at the test t/hooks/TestHooks/stacked_handlers.pm which aborts the execution chain when Apache::DONE is returned. __ 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: Stacked Handlers Execution Chain
Geoffrey Young wrote: First of all let's clear up the 1.0 side: Quoting the eagle book: The exception to this rule [all handlers will run] is if one of the handlers in the series returns an error code (anything other than OK, DECLINED, or DONE) Though the code does *not* check for DONE: mod_perl.c:1375 if((status != OK) (status != DECLINED)) { ... return status; } so where is the bug? In the book or the code? well, OK, DECLINED, and DONE are all success codes - everything else is an error and goes to the error document cycle. however, DONE is special - it indicates that all content has been sent and the request cycle should proceed straight to the logging phase. from a handler perspective, DONE behaves the same as an error code - it terminates the request cycle. But the book doesn't say that DONE does break the chain, though it does. I suspect that 1.0 logic handled DONE automatically - DONE was captured and passed back to Apache, which took appropriate action. and I suspect this is what you found in 2.0, since you test for DONE but didn't handle it explicitly. It works exactly the same in 2.0 as in 1.0 (using the current cvs ;), the chain is aborted on !(OK || DECLINED). Any return codes are passed further to Apache. kudos, stas, for always taking care of all the 2.0 stuff. ;) __ 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: Installation help
Blankenship, Scott R wrote: I'm on SunOS 5.6 (Solaris 2.6) I've installed perl 5.8.0 in own test area (not in /usr/local/...) Here's a link to the log of my installation efforts: http://home.earthlink.net/~sblanky/log.html Basically, I extract mod_perl 1.27, and apache 1.3.1, go through the mod_perl isntallation, it adds to my perl libraries, but I can't apache installed. I go to the src directory, do a make, but the make install at the end says I have to go to the parent directory to install. But, there's no Makefile in the parent directory... What am I doing wrong? Where have you picked these instructions? Your mistake (as seen from the neat log) is that you go and reconfigure Apache after mod_perl has done this for you already. See: http://perl.apache.org/docs/1.0/guide/install.html __ 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: do as temp solution for require problem ?
Justin Luster wrote: When a Perl script runs under Mod_Perl the current working directory is no longer the location of the Perl script (I think it is where Apache.exe is). You are talking about 2.0 here. And it should change to normal by the time its released. This issue is irrelevant to the original question. __ 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: mod_perl and current directory (was Re: Newbie Q on Apache::Include)
[...] Is it true what was said in one of the other threads -with mod_perl (Apache 1.3.27) the current working directory is different from the dir where the script lies? [...] As I've followed up (because I knew that that particular post will create confusion), it *is* the script's dir for mod_perl 1.x. (Apache::Registry and friends) It's *currently* not the case with mod_perl 2.0 (ModPerl::Registry and friends), but this should change to be the same as 1.x by the time 2.0 is released. __ 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: glitched install of mod_perl (1.99.08)
Stephen Clouse wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, Jan 27, 2003 at 06:25:26PM +1100, Stas Bekman wrote: Hmm, you have perl 5.8.0. How is it possible that you don't have CGI.pm, which is a part of the core? It's probably a perl installed from a vendor-supplied package. You'd be amazed at the shreds the standard Perl distribution can get ripped to. Redhat I know splits a standard Perl installation into no less than 20 packages. CGI,pm and friends get shoved off off into their own RPM (perl-CGI). Other Linux distros I can't speak for but they tend to be similar. In short, don't assume that their kit is complete. Their vendor may have done them a favor via package management. I wonder what would be the best way to handle that, require CGI.pm for installing mod_perl or simply adjust the tests to skip, if it's not available. It's just silly that we rely on the knowledge that certain modules are a part of the core, and the vendors break that assumption :( __ 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: libgtop gone?
Perrin Harkins wrote: I pointed someone at some mod_perl documentation that suggested installing GTop to measure shared memory, but he was unable to find libgtop for download at the URL in that module. I investigated and I don't see it anywhere! Is libgtop gone? Did it get replaced with something else? Any Gnome followers here who can shed some light on this? It's integrated into the gnome project and doesn't really exist as a standalone thing. At least I couldn't find it. When you install the gnome desktop, you get libgtop as well. So if you are on linux, simply check your distro for this package. e.g. use: http://fr.rpmfind.net/linux/rpm2html/search.php?query=libgtop in the worst case use the above resource to grap the src.rpm and then extract tar.gz from there. If somebody here is involved deeper with gnome, please share some light with us. While we are at this topic, I've patched GTop-0.10 to support libgtop-2.0 and libgtop-1.0 automatically (attached). I've also backported it to 5.005_03 by including ppport.h in it. Hopefully Doug will release the new version soonish. __ 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 --- GTop-0.10/Makefile.PL 2000-01-26 11:25:02.0 +1100 +++ GTop-0.10-dev/Makefile.PL 2002-12-27 11:36:26.0 +1100 @@ -231,12 +231,14 @@ ); } +my %config = get_glibtop_config(); + WriteMakefile( @insure, NAME = 'GTop', VERSION_FROM = 'GTop.pm', - INC = $GTOP_INCLUDE . $ginc, - LIBS = [$GTOP_LIB . -lgtop -lgtop_sysdeps -lgtop_common -lglib $xlibs], + INC = join( , $GTOP_INCLUDE, $ginc, $config{incs}), + LIBS = [join( , $GTOP_LIB, $config{libs})], TYPEMAPS = [qw(typemap.gtop typemap)], clean = { FILES = @{[*.boot, *.gtop]}, @@ -255,3 +257,27 @@ EOF } +# get libgtop CFLAGS/LIBS across 1.x-2.x versions +sub get_glibtop_config { +my %c = (); + +if (system('pkg-config --exists libgtop-2.0') == 0) { +# 2.x +chomp($c{incs} = qx|pkg-config --cflags libgtop-2.0|); +chomp($c{libs} = qx|pkg-config --libs libgtop-2.0|); + +# 2.0.0 bugfix +chomp(my $libdir = qx|pkg-config --variable=libdir libgtop-2.0|); +$c{libs} =~ s|\$\(libdir\)|$libdir|; +} +elsif (system('gnome-config --libs libgtop') == 0) { +chomp($c{incs} = qx|gnome-config --cflags libgtop|); +chomp($c{libs} = qx|gnome-config --libs libgtop|); + +# buggy ( 1.0.9?) versions fixup +$c{incs} =~ s|^/|-I/|; +$c{libs} =~ s|^/|-L/|; +} + +return %c; +} --- GTop-0.10/Server/Makefile.PL2000-02-01 09:05:49.0 +1100 +++ GTop-0.10-dev/Server/Makefile.PL2002-12-27 11:36:26.0 +1100 @@ -36,13 +36,41 @@ close FH; close CONST; +my %config = get_glibtop_config(); + WriteMakefile( NAME = GTop::Server, VERSION_FROM = Server.pm, -INC = $GTOP_INCLUDE . $ginc, -LIBS = [$GTOP_LIB . -lgtop -lgtop_sysdeps -lgtop_common -lglib], +INC = join( , $GTOP_INCLUDE, $ginc, $config{incs}), +LIBS = [join( , $GTOP_LIB, $config{libs})], OBJECT = 'io.o main.o gnuserv.o version.o access.o Server.o', clean = { FILES = server_config_flags.h constants.c, }, ); + + +# get libgtop CFLAGS/LIBS across 1.x-2.x versions +sub get_glibtop_config { +my %c = (); + +if (system('pkg-config --exists libgtop-2.0') == 0) { +# 2.x +chomp($c{incs} = qx|pkg-config --cflags libgtop-2.0|); +chomp($c{libs} = qx|pkg-config --libs libgtop-2.0|); + +# 2.0.0 bugfix +chomp(my $libdir = qx|pkg-config --variable=libdir libgtop-2.0|); +$c{libs} =~ s|\$\(libdir\)|$libdir|; +} +elsif (system('gnome-config --libs libgtop') == 0) { +chomp($c{incs} = qx|gnome-config --cflags libgtop|); +chomp($c{libs} = qx|gnome-config --libs libgtop|); + +# buggy ( 1.0.9?) versions fixup +$c{incs} =~ s|^/|-I/|; +$c{libs} =~ s|^/|-L/|; +} + +return %c; +}
Re: libgtop gone?
Perrin Harkins wrote: Stas Bekman wrote: It's integrated into the gnome project and doesn't really exist as a standalone thing. At least I couldn't find it. When you install the gnome desktop, you get libgtop as well. So if you are on linux, simply check your distro for this package. e.g. use: http://fr.rpmfind.net/linux/rpm2html/search.php?query=libgtop in the worst case use the above resource to grap the src.rpm and then extract tar.gz from there. This guy was on HPUX, and he just wanted source to this one library. It used to be available separately. I guess it's not a simple thing to do at this point if you don't want gnome and aren't on Red Hat. As I've mentioned, you can extract the source from the source rpm( either via 'rpm -i ...src.rpm' or using rpm2cpio). I've browsed the headers and it seems from libgtop-1.0/glibtop/global.h, that the gnome support is optional. Though you probably will have problems building on non-linux/bsd systems. I remember it was reported to work on certain Solaris systems. In any case they can always give it a try and in the worst case try to port it. __ 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
cvs commit: modperl-2.0/lib/Apache Status.pm
stas2003/01/27 20:53:15 Modified:lib/Apache Status.pm Log: - CGI.pm's script_name() appears to be broken, use $r-location instead - handle gracefully the stash dump for a child that doesn't have that stash Revision ChangesPath 1.2 +15 -12modperl-2.0/lib/Apache/Status.pm Index: Status.pm === RCS file: /home/cvs/modperl-2.0/lib/Apache/Status.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Status.pm 25 Jan 2003 13:26:11 - 1.1 +++ Status.pm 28 Jan 2003 04:53:15 - 1.2 @@ -312,7 +312,6 @@ my($r, $q) = @_; my($name, $type) = (split /, $r-uri)[-2,-1]; -my $script = $q-script_name; no strict 'refs'; my @retval = Data Dump of $name $type pre\n; @@ -336,17 +335,21 @@ no strict 'refs'; my($name, $type) = (split /, $r-uri)[-2,-1]; +# could be another child, which doesn't have this symbol table? +return unless *$name{CODE}; + my @retval = Subroutine info for b$name/b pre\n; -my $script = $q-script_name; my $obj= B::svref_2object(*$name{CODE}); my $file = cv_file($obj); my $stash = $obj-GV-STASH-NAME; +my $script = $r-location; push @retval, File: , (-e $file ? qq(a href=file:$file$file/a) : $file), \n; my $cv= $obj-GV-CV; my $proto = $cv-PV if $cv-can('PV'); + push @retval, qq(Package: a href=$script?$stash$stash/a\n); push @retval, Line: , $obj-GV-LINE, \n; push @retval, Prototype: , $proto || none, \n; @@ -376,7 +379,7 @@ return unless eval { require B::Graph }; B::Graph-UNIVERSAL::VERSION('0.03'); -my $script = $q-script_name; +my $script = $r-location; return qq(\na href=$script/$name?noh_b_graphOP Tree Graph/a\n); } @@ -386,7 +389,7 @@ return unless status_config($r, StatusLexInfo); return unless eval { require B::LexInfo }; -my $script = $q-script_name; +my $script = $q-location; return qq(\na href=$script/$name?noh_b_lexinfoLexical Info/a\n); } @@ -411,7 +414,7 @@ return unless status_config($r, StatusTerse); return unless eval { require B::Terse }; -my $script = $q-script_name; +my $script = $r-location; my @retval; for (qw(exec slow)) { my $exp = $b_terse_exp{$_} order; @@ -440,7 +443,7 @@ return unless status_config($r, StatusTerseSize); return unless eval { require B::TerseSize }; -my $script = $q-script_name; +my $script = $r-location; my @retval; for (qw(exec slow)) { my $exp = $b_terse_exp{$_} order; @@ -471,7 +474,7 @@ return unless status_config($r, StatusPackageSize); return unless eval { require B::TerseSize }; -my $script = $q-script_name; +my $script = $r-location; qq(a href=$script/$name?noh_b_package_sizeMemory Usage/a\n); } @@ -485,7 +488,7 @@ no strict 'refs'; my($package) = (split /, $r-uri)[-1]; -my $script = $q-script_name; +my $script = $r-location; $r-print(Memory Usage for package $package\n\n); my($subs, $opcount, $opsize) = B::TerseSize::package_size($package); $r-print(Totals: $opsize bytes | $opcount OPs\n\n); @@ -525,7 +528,7 @@ return unless eval { require B::Deparse }; return unless $B::Deparse::VERSION = 0.59; -my $script = $q-script_name; +my $script = $r-location; return qq(\na href=$script/$name?noh_b_deparseDeparse/a\n); } @@ -549,7 +552,7 @@ return unless eval { require B::Fathom }; return unless $B::Fathom::VERSION = 0.05; -my $script = $q-script_name; +my $script = $r-location; return qq(\na href=$script/$name?noh_b_fathomFathom Score/a\n); } @@ -571,7 +574,7 @@ return unless status_config($r, StatusPeek); return unless $is_installed{Apache::Peek}; -my $script = $q-script_name; +my $script = $r-location; return qq(\na href=$script/$name/$type?noh_peekPeek Dump/a\n); } @@ -592,7 +595,7 @@ return unless $is_installed{B::Xref}; -my $script = $q-script_name; +my $script = $r-location; return qq(\na href=$script/$name?noh_xrefCross Reference Report/a\n); }
Re: [mp2] Perl Sections, Method handlers
Randy J. Ray wrote: Any indication of when/if these features will make it to mp2? I've been trying to get my RPC::XML code (specifically the Apache::RPC::Server and Apache::RPC::Status modules) to work under Apache2 and mod_perl2 (thanks to Red Hat for pushing up my timetable on this by installing those). I guess Philippe can comment on the Perl sections part, I think it should be in RSN. What about method handlers? What's wrong with them? __ 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: How to test for mod_perl
Richard wrote: Ok, I just installed apache::asp which forced the install of mod_perl. How do I test to see if mod_perl is running ok on any given server? Thanks! PS. I'm currently reading the manpage mod_perl that is on my server, thus far I don't see anything regarding testing that it works. http://perl.apache.org/docs/1.0/guide/getwet.html http://perl.apache.org/docs/1.0/guide/install.html#How_can_I_tell_whether_mod_perl_is_running_ -- __ 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] Perl_Tstack_sp_ptr
Xiaodong Shen wrote: During the weekend I had no connectivity due to the worm, sorry. Okay I tried remove my old perl installation and compiled a new one (5.8.0), and then installed a new mod_perl 1.99_08, and got the exactly same error. So I don't think it was because of my Perl installation as I suspected before. Then I tried nm all the *.so under my /usr/local/lib/perl5, there are dozens of *.so contain symbol Perl_Tstack_sp_ptr, but all have 'U' (unresolved). Then I nm-ed my modules/mod_perl.so under /usr/local/apache2, no symbol Perl_Tstack_sp_ptr at all. From your analysis, my mod_perl.so must have perl library linked in, which should have a resolved Perl_Tstack_sp_ptr, but it doesn't contain this symbol at all. OK, let's step back and see first why this kind of errors happen in first place. Let's say you have a program that says: test.c: --- #include something.h ... foo(); ... where something.h includes a declaration: void foo(); The test.c program will compile, though if you look at test.o it'll have the foo symbol undefined (U) and should be resolved at linking time against libsomething.so (we are talking dynamic linking here). Now if libsomethings.so includes the symbol for foo, everything is cool. If it doesn't than you get the 'unresolved symbol' error. And this error may come from using the wrong header file or having some defines wrong. Now getting back to our business, I've two versions of perl5.8.0 installed. One with ithreads enabled and the other without. Let's see: % nm ~/perl/5.8.0/lib/5.8.0/i686-linux/CORE/libperl.so | grep stack_sp_ptr nada % nm ~/perl/5.8.0-ithread/lib/5.8.0/i686-linux-thread-multi/CORE/libperl.so | grep stack_sp_ptr 0011c6c8 T Perl_Tstack_sp_ptr so I have this symbol in the lib built with ithreads. Now let's look at the perlapi.h: grep -n stack_sp_ptr /home/stas/perl/5.8.0/lib/5.8.0/i686-linux/CORE/perlapi.h 920:#define PL_stack_sp (*Perl_Tstack_sp_ptr(aTHX)) it's also defined in CORE/thdrvar.h via a macro: PERLVAR(Tstack_sp, SV **) /* top of the stack */ one of these definitions will work only if #if defined (MULTIPLICITY) which is true in the ithreads build. And you can see it from the nm's output above. So which libperl.so do you link against? Use 'ldd' on mod_perl.so to see. Does that libperl.so has the symbol in question defined? (use 'nm'). Most likely, your problem happends because you build with compile options for ithreads perl, but using the libperl.so lib which was built without ithreads. please post your build env, see: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems __ 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] Perl Sections, Method handlers
[please always reply to the list! thank you!] Randy J. Ray wrote: I guess Philippe can comment on the Perl sections part, I think it should be in RSN. What about method handlers? What's wrong with them? Only that my handlers, both prototyped as ($$), received only the request object (Apache::RequestRec reference) in their arg list, rather than getting the class as the first argument. Of course, the intent behind having the server classes be method-handlers is to assign the the server object as the handler directly, but that requires the Perl section support. Which makes me think-- I always found it odd in mp1 that assigning an object as a location-handler required a frozen reference of sorts-- '$obj' vs. simple $obj. The latter seems so much more intuitive. Is this changing for mp2? See: http://perl.apache.org/docs/2.0/user/compat/compat.html#Method_Handlers __ 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: glitched install of mod_perl (1.99.08)
benjamin mccall wrote: sorry, Stas...my former isp bit the dust and slammed me over to monopolistic wolf, verizon. so, i had no access since your last post. well, mod_perl is up and running. apparently the 'perlio' issue was corrected by some simple authentication sweeps. as for the mysteriously missing 'cgi.pm', i still couldn't fish it out among my greps; so i fetched it and plugged it. no issues. all tests passed successfully. yeAH! I suppose that if this is a real issue, someone will hit it soon again. If things work for you, that's cool! thanks for your help. ;) __ 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
large files support article and links
This post is mainly for the archiving purpose, for those who seek to resolve problems with large files ( 2GB) support (which happens to be reported quite often on the modperl list). The following article describes in details the problem and the possible solutions: http://freshmeat.net/articles/view/709/ But the best value is in its 'Links' section which points to a lot more information on this issue, on Linux and general: * Largefile Problems http://ac-archive.sourceforge.net/largefile * Large File/File System Support http://ftp.sas.com/standards/large.file/ * Adding Large File Support to the Single UNIX Specification http://unix.org/version2/whatsnew/lfs.html * Large File Support in Linux http://www.suse.de/~aj/linux_lfs.html p.s. also there is a followup thread on /.org: http://slashdot.org/articles/03/01/26/1444232.shtml?tid=126tid=130 __ 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: glitched install of mod_perl (1.99.08)
[benjamin, please always reply to the list, not to the poster who has answered your question, unless asked otherwise] benjamin mccall wrote: Thanks for the quick reply on this one, Stas. I ran the script, 'localhost' resulted. I applied the patch as you advised, and it seems as though (i'm building as i composed this) resolved the issue absolutely. Thanks a heap! That's weird. Because my patch doesn't solve the problem, it only asserts if the default servername wasn't found. Could it be a temporary glitch on your system? What happens if you reverse the patch and try again? Does it still fail as before? could you point me to some documentation that my relate to this problem? i'm quite new to perl. i surmise it was network-related from some of the modules and patch work applied. The problem was at Apache-Test/lib/Apache/TestConfig.pm: sub our_remote_addr { my $self = shift; my $name = $self-default_servername; $remote_addr ||= Socket::inet_ntoa((gethostbyname($name))[-1]); } $name was undef. Socket::inet_ntoa() has died because of that. __ 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: glitched install of mod_perl (1.99.08)
benjamin mccall wrote: well, i edited the /etc/hosts file and it seemed to've done the trick. Earlier you said that the patch to Apache/TestConfig.pm has done the trick. but now it seems i'm taking heaps of test failures from 'make test' run. if apache is inactive, would that cause these failures? for instance, most of my failures resulted from the 'apr/perlio.t', 'modules/cgiupload.t', and 'modules/cgi.t'. My guess is that you aren't running the loopback interface. What do you get when you run: su -c /sbin/ifconfig there should be an entry for 'lo' (guessing that you are on unix, from your mentioning of /usr/local/ in your original post). e.g. on my machine in addition to 'eth0' entry I have: loLink encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:37981 errors:0 dropped:0 overruns:0 frame:0 TX packets:37981 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:5738173 (5.4 Mb) TX bytes:5738173 (5.4 Mb) If you don't have it and you don't know how to fix that, you have to read the manual for your operating system, or some howtos, e.g.: http://www.linux.org/docs/ldp/howto/Net-HOWTO/x540.html If you are still in trouble, you should refer to the appropriate list for your OS to solve it, since this is not a mod_perl problem. __ 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: glitched install of mod_perl (1.99.08)
benjamin mccall wrote: well, yes, by trick i meant that 'makefile.pl' and 'make make test' parts of the build proceeded rather normally. my loopback is up and running: ... loLink encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:11793 errors:0 dropped:0 overruns:0 frame:0 TX packets:11793 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4163692 (3.9 Mb) TX bytes:4163692 (3.9 Mb) OK, so it must be the dns resolution problem. So my patch will catch it. incidently, do i have to install cgi.pm and apache::register modules? i checked t/error_logs and here is what i get as result of test: END in modperl_extra.pl, pid=7711 END in modperl_extra.pl, pid=7711 [Sun Jan 26 00:14:19 2003] [notice] Apache/2.0.43 (Unix) mod_perl/1.99_08 Perl/v5.8.0 PHP/4.3.0 configured -- resuming normal operations Hmm, you have perl 5.8.0. How is it possible that you don't have CGI.pm, which is a part of the core? What do you get from running: find /usr/lib/perl5/5.8.0 |grep CGI.pm __ 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
cvs commit: modperl-2.0/lib/Apache Status.pm
stas2003/01/25 05:26:11 Added: lib/Apache Status.pm Log: started porting Apache::Status to 2.0: - adjust style - use mod_perl 2.0 api (trying to get away from using compat.pm) - adjust the 'registry scripts' logic to work with the new registry cache (present scripts by the handler they are compiled in) Revision ChangesPath 1.1 modperl-2.0/lib/Apache/Status.pm Index: Status.pm === package Apache::Status; use strict; #use warnings; #XXX FATAL = 'all'; no warnings; # 'redefine'; # XXX: something is wrong with bleadperl, it warns about redefine # warnings, when no warnings 'redefine' is set (test with 5.8.0). even # when used with 'no warnings' it still barks on redefinining the # constants # XXX # use mod_perl 2.0; use Apache::RequestRec (); use Apache::RequestUtil (); use Apache::ServerUtil (); $Apache::Status::VERSION = '3.00'; # mod_perl 2.0 use constant IS_WIN32 = ($^O eq MSWin32); my $Is_Win32 = ($^O eq MSWin32); my %is_installed = (); { local $SIG{__DIE__}; %is_installed = map { $_, (eval(require $_) || 0); } qw (Data::Dumper Devel::Symdump B Apache::Request Apache::Peek Apache::Symbol); } our $newQ; if ($is_installed{Apache::Request}) { $newQ ||= sub { Apache::Request-new(@_) }; } else { $is_installed{CGI} = eval(require CGI) || 0; $newQ ||= sub { CGI-new; }; } my $CPAN_base = http://cpan.org/modules/by-module/;; my $install_symdump = EOF; Please install the a href=$CPAN_base/Devel/Devel::Symdump/a module. EOF my %status = ( script= PerlRequire'd Files, inc = Loaded Modules, rgysubs = Compiled Registry Scripts, 'symdump' = Symbol Table Dump, inh_tree = Inheritance Tree, isa_tree = ISA Tree, env = Environment, sig = Signal Handlers, myconfig = Perl Configuration, hooks = Enabled mod_perl Hooks, ); delete $status{'hooks'} if $mod_perl::VERSION = 1.9901; delete $status{'sig'} if IS_WIN32; # XXX: needs porting if ($Apache::Server::SaveConfig) { $status{section_config} = Perl Section Configuration; } sub menu_item { my($self, $key, $val, $sub) = @_; $status{$key} = $val; no strict; *{status_${key}} = $sub if $sub and ref $sub eq 'CODE'; } sub handler { my($r) = @_; Apache-request($r); #for Apache::CGI my $qs = $r-args || ; my $sub = status_$qs; no strict 'refs'; if ($qs =~ s/^(noh_\w+).*/$1/) { return {$qs}($r, $newQ-($r)); } header($r); if (defined $sub) { $r-print(@{ {$sub}($r, $newQ-($r)) }); } elsif ($qs and %{$qs.::}) { $r-print(symdump($r, $newQ-($r), $qs)); } else { my $uri = $r-uri; $r-print( map { qq[a href=$uri?$_$status{$_}/abr\n] } keys %status ); } $r-print(/body/html); 1; } sub header { my $r = shift; my $start = scalar localtime $^T; my $srv = Apache::get_server_version(); $r-content_type(text/html); my $v = $^V ? sprintf v%vd, $^V : $]; $r-print(EOF); html headtitleApache::Status/title/head body Embedded Perl version b$v/b for b$srv/b process b$$/b, br running since $starthr EOF } sub symdump { my($r, $q, $package) = @_; return $install_symdump unless $is_installed{Devel::Symdump}; my $meth = new; $meth = rnew if lc($r-dir_config(StatusRdump)) eq on; my $sob = Devel::Symdump-$meth($package); return $sob-Apache::Status::as_HTML($package, $r, $q); } sub status_symdump { my($r, $q) = @_; [symdump($r, $q, 'main')]; } sub status_section_config { my($r, $q) = @_; require Apache::PerlSections; [pre, Apache::PerlSections-dump, /pre]; } sub status_hooks { my($r, $q) = @_; # XXX: hooks list access doesn't exist yet in 2.0 require mod_perl; require mod_perl_hooks; my @retval = qw(table); my @list = mod_perl::hooks(); for my $hook (sort @list) { my $on_off = mod_perl::hook($hook) ? bEnabled/b : iDisabled/i; push @retval, trtd$hook/tdtd$on_off/td/tr\n; } push @retval, qw(/table); \@retval; } sub status_inc { my($r, $q) = @_; my $uri = $r-uri; my @retval = ( table border=1, tr, (map tdb$_/b/td, qw(Package Version Modified File)), /tr\n ); foreach my $file (sort keys %INC) { local $^W = 0; next if $file =~ m:^/:; next unless $file =~ m:\.pm:; next unless $INC{$file}; #e.g. fake Apache/TieHandle.pm no strict 'refs'; (my $module = $file
Re: [MP2] Perl_Tstack_sp_ptr
Xiaodong Shen wrote: Thanks for the reply. Several things to clear: 1. I have successfully passed the make make test make install phase. 2. I have moved into Server configuration phase and was doing the mod_perl rocks thingy, where the error happens. 3. Before seeing your reply, I already found a solution: I renamed Const.so to Const.so.bak (there are several other xxx.so mod_perl complains about, I removed them as well). It works, mod_perl did rock. 4. However this put me into a bigger misery, I can't explain why!!! After reading the thread, I delved into my setting and found: - my perl installation doesn't have libperl.so (libperl.a only). Meaning that you perl is compiled without shared library support. - my httpd is DSO enabled. - my mod_perl is mod_perl.so (mod_perl.a is not used). Currently mod_perl builds itself as static and dynamic, no matter what you choose, so at the later point you can simply link the static archive. - my mod_perl.so is not linked against ibperl.so. So it must have the perl library linked in. do you have that symbol that was reported missing in mod_perl.so? (hint: use 'nm') So I assume that httpd loads mod_perl.so, which loads other xxx.so, such as Const.so, but when does mod_perl load libperl.so (from the thread I assume those undefined symbols would be resolved by libperl.so)? before laoding Const.so? but why did it not complain about no libperl.so on my system? see above. I suppose that we have a problem here of installing dynamic .so objects, when the static build is used and perl trying to load them. But it's also possible that you've the leftovers from an older install as you suggest below. Now I start to have some ideas, it must have to do with my Perl installation, which contains some leftovers that should have been cleaned up before I made numerous rebuilds, everytime Perl uses a package it looks for *.so by going through @INC, lots of library files with same names. I will let you after I clean up my perl. Have you installed mod_perl using the shared libperl.so before into the same directory? __ 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: PerlSwitches -M and @INC
Dr. Helmut Zeilinger wrote: I tried: PerlOptions +Parent # PerlOptions +Clone PerlModule Apache2 PerlModule Apache::compat PerlSwitches -Mlib=/et/www/envirotex/lib The result is a Segmentation fault without any further messages on the screen and in the error_log file. I can't reproduce it. Please send in the backtrace from the core file and the rest of the details. See: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems When I try: # PerlOptions +Parent PerlOptions +Clone PerlModule Apache2 PerlModule Apache::compat PerlSwitches -Mlib=/et/www/envirotex/lib If you use the +Clone, it already inherits everything from the parent, including @INC. So you don't need the last 3 lines. It works just fine for me with 'PerlOptions +Clone'. Perhaps you can send in your httpd.conf after you have reduced it to the very minimum (including the minimal startup.pl that still reproduces the problem) the result is: [Thu Jan 23 09:12:19 2003] [error] Can't locate Emma/AuthCookieHandler.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache2 /usr/lib/perl5/5.8.0/i686-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl .) at (eval 5) line 3. [Thu Jan 23 09:12:19 2003] [error] Can't load Perl module Emma::AuthCookieHandler for server www.et:0, exiting... The Module Emma::AuthCookieHandler is in the path /et/www/envirotex/lib. As i see from the message above the additional lib path is missing from the @INC Array. __ 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: [OT] MLDBM size limit?? :'(
Jim Morrison wrote: Guys, Sorry this is a little off topic... Is there a size limit on DBM's? (Or Linux files for that matter.. ) I've thrown some details of my box/code below.. Thing is I'm getting a write error and it seems to always happen when the DBM gets to 2.0Gb .. (you may think I'm mad for trying to make 2G DBM's - but they don't usually get more than a couple of 100k - it's just a big site.. Honest ;-) You need to have Perl built with largefiles support to work with files larger than 2GB. Do: ./Configure -Duselargefiles [...] make install (check if you don't have it already via 'perl -V|grep uselargefiles') and afterwards you need to rebuild mod_perl so it'll pick the new compile flags. You may need to have Apache compiled with largefiles support as well, which normally happens automatically if your fs/os supports it. Or it can be forced with: % CFLAGS=D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 ./configure [...] __ 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: do as temp solution for require problem ?
[EMAIL PROTECTED] wrote: Hi, I think mod_perl is wonderful but unfortunately enough the require function does not work as it does in CGI. Is using the function do the only workaround as temporary solution till this problem is fixed in a/the next mod_perl version? Have you read: http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modules_and_libs ? If you are referring to a different problem, what mod_perl version are you talking about? __ 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: data loss when using $r-get_client_block mod_perl 1.99_08
Udo Rader wrote: hi, I see that the new version of mod_perl has $r-read fixed now to read exactly the given bytes. $r-get_client_block however is still buggy. If for example I do the following: CUT my $len = $r-headers_in-{'content-length'}; print reported length is $lenbr; my $buf; $r-get_client_block( $buf, $len ); print read length is: .length($buf).br; CUT ... then I get extremely different values for the reported and the read length. This does _not_ happen on small amounts of data, I think the threshold is somewhere near 7K of data pending to be read. The example works perfect, if I use $r-read instead, so I am quite happy with 1.99_08 ;-) Because get_client_block must be called in a loop. That's how Apache implements it: /* get_client_block is called in a loop to get the request message body. * This is quite simple if the client includes a content-length * (the normal case), but gets messy if the body is chunked. Note that * r-remaining is used to maintain state across calls and that * r-read_length is the total number of bytes given to the caller * across all invocations. It is messy because we have to be careful not * to read past the data provided by the client, since these reads block. * Returns 0 on End-of-body, -1 on error or premature chunk end. * */ Here is an example we use in the test suite to read the the request body: sub ModPerl::Test::read_post { my $r = shift; $r-setup_client_block; return undef unless $r-should_client_block; my $data = ''; my $buf; while (my $read_len = $r-get_client_block($buf, IOBUFSIZE)) { if ($read_len == -1) { die some error while reading with get_client_block; } $data .= $buf; } return $data; } __ 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] Perl_Tstack_sp_ptr
Xiaodong Shen wrote: Hi all, Does anyone have experience of seeing from error_log: /usr/local/apache2/bin/httpd: error while loading shared libraries: /usr/local/lib/perl5/site_perl/5.8.0/i686-linux/auto/Apache/Const/Const.so: undefined symbol: Perl_Tstack_sp_ptr I am playing with 2.0.44 (-with-mpm=prefork) with mod_perl 2.0 (moer specifically 1.99_08) on linux 2.4.7 with Perl 5.8.0 (no thread), I saw the above error message when requesting the mod_perl 2.0 rocks testing page (see mod_perl 2.0 User Guide). any hint is welcomed. xd Take a look at this thread: http://marc.theaimsgroup.com/?t=10430802132r=1w=2 In particular at: http://marc.theaimsgroup.com/?l=apache-modperlm=104312560827233w=2 Does this help? __ 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] AuthDBI breaking with RH httpd-2.0.40-11 rpm
Christopher Hicks wrote: I brought a new server up yesterday using Red Hat 8's httpd-2.0.40-8 and based on the patches and comments I found in the list archive all was eventually well. Today I updated various rpms on the box from the official Red Hat updates and how AuthDBI is no longer working. I stuck various debugging statements in until I drilled down to the point of finding that crypt() seems to be the problem. Running perl from the command line produces correct results: # perl -e 'print crypt(test,0y),\n'; 0y5fZG4UG8Bd. but when I add the logging statement into AuthDBI $r-log_reason(password='$password' passwd_to_check='$passwd_to_check' salt='$salt' accessing , $r-uri); between these lines: my $passwd_to_check = $Attr-{encrypted} eq 'on' ? crypt($passwd_sent, $password) : $passwd_sent; # here in other words if ($passwd_to_check eq $password) { the logs show: [Fri Jan 24 16:27:19 2003] [error] password='0y5fZG4UG8Bd.' passwd_to_check='0ypz5H80XtTxw' salt='0y' accessing /cgi/test So why did upgrading httpd break crypt?!? Since you didn't remember to fill a complete report as explained here: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems I can only guess that you are using the threaded mpm and perl 5.8.0. In which case you need to install mod_perl 1.99_08. From Changes: workaround glibc/Perl-5.8.0 crypt() bug (seen with threaded MPMs) __ 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]: Is there a package for Debian/testing?
Nick Tonkin wrote: On 23 Jan 2003, Joachim Zobel wrote: Hi. I would like to start testing mp2, but I remember that compiling apache/mp1 was no fun at all. The important part of the testing at this stage is that the build works properly on all platforms. I found one in debian unstable, but this requires perl 5.8. I can't say about other perls, as I said I have 5.8 You should be fine with 5.6.1 if you want to work with prefork mpm. Stay away from 5.6.0. __ 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: mysql question
Martin Moss wrote: oooh handbags! Apologies to the group this is my last email on this topic. Apologies accepted ;) As Perrin said, we all do mistakes. Now let's move on to the fun with mod_perl. __ 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
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas2003/01/22 16:31:28 Modified:src/modules/perl mod_perl.c mod_perl.h modperl_filter.c modperl_util.h .Changes xs/Apache/RequestIO Apache__RequestIO.h xs/Apache/SubRequest Apache__SubRequest.h xs/tables/current/ModPerl FunctionTable.pm Log: - add a new MP_FAILURE_CROAK macro to handle failures - all response functions are now returning status and the callers check and croak on failure or progate them further. Revision ChangesPath 1.147 +10 -4 modperl-2.0/src/modules/perl/mod_perl.c Index: mod_perl.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v retrieving revision 1.146 retrieving revision 1.147 diff -u -r1.146 -r1.147 --- mod_perl.c12 Jan 2003 02:15:58 - 1.146 +++ mod_perl.c23 Jan 2003 00:31:28 - 1.147 @@ -709,12 +709,12 @@ wb-r = r; } -void modperl_response_finish(request_rec *r) +apr_status_t modperl_response_finish(request_rec *r) { MP_dRCFG; /* flush output buffer */ -modperl_wbucket_flush(rcfg-wbucket); +return modperl_wbucket_flush(rcfg-wbucket); } static int modperl_response_handler_run(request_rec *r, int finish) @@ -730,7 +730,10 @@ } if (finish) { -modperl_response_finish(r); +apr_status_t rc = modperl_response_finish(r); +if (rc != APR_SUCCESS) { +retval = rc; +} } return retval; @@ -803,7 +806,10 @@ #endif /* flush output buffer after interpreter is putback */ -modperl_response_finish(r); +apr_status_t rc = modperl_response_finish(r); +if (rc != APR_SUCCESS) { +retval = rc; +} switch (rcfg-status) { case HTTP_MOVED_TEMPORARILY: 1.56 +1 -1 modperl-2.0/src/modules/perl/mod_perl.h Index: mod_perl.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- mod_perl.h12 Dec 2002 10:05:08 - 1.55 +++ mod_perl.h23 Jan 2003 00:31:28 - 1.56 @@ -88,7 +88,7 @@ void xs_init(pTHX); void modperl_response_init(request_rec *r); -void modperl_response_finish(request_rec *r); +apr_status_t modperl_response_finish(request_rec *r); int modperl_response_handler(request_rec *r); int modperl_response_handler_cgi(request_rec *r); 1.45 +5 -6 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- modperl_filter.c 17 Jan 2003 03:08:31 - 1.44 +++ modperl_filter.c 23 Jan 2003 00:31:28 - 1.45 @@ -23,6 +23,8 @@ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r-server, %s did not send an HTTP header, r-uri); +/* XXX: bodytext == NULL here */ +return status; } else if (!bodytext) { return APR_SUCCESS; @@ -190,17 +192,14 @@ * first modperl_input_filter_read, so it must be * destroyed at the end of the filter invocation */ -/* XXX: may be the filter must consume all the data? add a - * test to check */ apr_brigade_destroy(filter-bb_in); filter-bb_in = NULL; } -modperl_input_filter_flush(filter); +MP_FAILURE_CROAK(modperl_input_filter_flush(filter)); } else { -modperl_output_filter_flush(filter); +MP_FAILURE_CROAK(modperl_output_filter_flush(filter)); } - return status; } @@ -457,7 +456,7 @@ if (filter-flush len == 0) { /* if len 0 then $filter-write will flush */ -modperl_output_filter_flush(filter); +MP_FAILURE_CROAK(modperl_output_filter_flush(filter)); } return len; 1.38 +7 -0 modperl-2.0/src/modules/perl/modperl_util.h Index: modperl_util.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- modperl_util.h11 Jan 2003 00:02:16 - 1.37 +++ modperl_util.h23 Jan 2003 00:31:28 - 1.38 @@ -50,6 +50,13 @@ #define MP_magical_tie(sv, mg_flags) \ SvFLAGS((SV*)sv) |= mg_flags +#define
cvs commit: modperl-2.0 Makefile.PL Changes
stas2003/01/22 21:16:30 Modified:.Makefile.PL Changes Log: the top level 'make test' now descends into the ModPerl-Registry dir to run 'make test' there Revision ChangesPath 1.90 +24 -1 modperl-2.0/Makefile.PL Index: Makefile.PL === RCS file: /home/cvs/modperl-2.0/Makefile.PL,v retrieving revision 1.89 retrieving revision 1.90 diff -u -r1.89 -r1.90 --- Makefile.PL 11 Jan 2003 03:20:54 - 1.89 +++ Makefile.PL 23 Jan 2003 05:16:30 - 1.90 @@ -29,7 +29,6 @@ use Apache::TestReportPerl (); use Apache::TestSmokePerl (); use Apache::TestTrace; -use Apache::TestMM qw(test); use ModPerl::TestRun (); use ModPerl::Code (); use ModPerl::MM (); @@ -442,6 +441,30 @@ ModPerl::MM::add_dep(\$string, clean = 'modperl_src_clean'); ModPerl::MM::add_dep(\$string, clean = 'test_clean'); $string; +} + +sub MY::test { + +my $env = Apache::TestConfig-passenv_makestr(); + +my $preamble = Apache::TestConfig::WIN32 ? : EOF; +PASSENV = $env +EOF + +return $preamble . 'EOF'; +test_clean : + $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \ + t/TEST -clean + +run_tests : test_clean + $(PASSENV) \ + $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \ + t/TEST + cd ModPerl-Registry make test + +test :: pure_all run_tests test_clean +EOF + } sub MY::postamble { 1.112 +3 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.111 retrieving revision 1.112 diff -u -r1.111 -r1.112 --- Changes 23 Jan 2003 04:06:38 - 1.111 +++ Changes 23 Jan 2003 05:16:30 - 1.112 @@ -10,6 +10,9 @@ =item 1.99_09-dev +the top level 'make test' now descend into the ModPerl-Registry dir +to run 'make test' there [Stas] + Apache::Test: don't inherit loading of the mod_perl object from the system-wide config, since we already add it [Stas]
Re: [mp2] Apache::RequestRec, IPC::Open[23] problem
Ville Skyttä wrote: On Wed, 2003-01-22 at 08:10, Stas Bekman wrote: Please try again with the latest cvs, I've just ported FILENO, OPEN and CLOSE interfaces from 1.0. Though I doubt that this will work, IPC::Open* have always had problems with mod_perl. IPC::Run should be used instead for now. Hopefully will be able to look more into this issue much later unless someone beats me to it. Thanks for the quick reply, Stas. I tried it out and that particular error is gone now, but the W3C Validator still doesn't quite work, whereas as a normal CGI it does. I didn't notice any errors, but valid pages just don't validate under mod_perl (they do as normal CGI). I know this is a too vague explanation, but I don't have time to dig deeper now. As I said, the IPC::Open* family is usually not working under mod_perl (1.0 and 2.0). Nobody has looked into resolving this issue, mainly because IPC::Run seems to be a much better alternative. But that doesn't solve the problem for those who are stuck with an existing code and aren't able to adjust it. Therefore since IPC::Run provides the same functionality and more, may be a special IPC::Open* layer can be provided which will transparently replace IPC::Open* with IPC::Run. __ 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: PerlSwitches -M and @INC
Helmut Zeilinger wrote: Hi, i am trying Apache 2.0.44 and mod_perl 1.99_08. httpd.conf :Bevor all virtual hosts PerlRequire /usr/local/apache2/conf/virtual/startup.pl The content of startup.pl is as in the mod_perl documentation including the use Apache::compat() directive. I one of my V-hosts i say (as described in the documentation): PerlOptions +Parent PerlSwitches -Mlib=/et/www/envirotex/lib When I start the server i get the error message: [Wed Jan 22 13:52:07 2003] [error] Can't locate loadable object for module Apache::Constants in @INC (@INC contains: /et/www/envirotex/lib /usr/lib/perl5/5.8.0/i686-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl .) at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/mod_perl.pm line 14 Compilation failed in require at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6. Compilation failed in require at /et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3. BEGIN failed--compilation aborted at /et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3. Compilation failed in require at (eval 1) line 3. [Wed Jan 22 13:52:07 2003] [error] Can't load Perl module Emma::AuthCookieHandler for server www.et:0, exiting... It seems to me, that all of the Apache2 paths create by the use Apache2 directive are no more present in the @INC Array. I tried a lot of things with several combinations of PerlSwitches (-M, -I, -Mblib, -Mlib), and startup files, but I never got the result i want: I would like to load some private Modules under /et/www/envirotex/lib and all the other things should work too. That's because you get a completely new interpreter. So you have to run Apache2 again PerlOptions +Parent PerlModule Apache2 Does that work for you? I agree that this is not-intuitive and adds to a clutter. I suppose that this should be documented for the time being. And hopefully by the time 2.0 is released we will come up with a transparent solution. Have you tried using the +Clone option instead? http://perl.apache.org/docs/2.0/user/config/config.html#C_Clone_ __ 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
cvs commit: modperl Makefile.PL Changes
stas2003/01/22 20:25:05 Modified:.Makefile.PL Changes Log: use $Config{'installstyle'} instead of hardcoded 'lib', to handle Makefile.PL's PREFIX option correctly Submitted by: Philippe M. Chiasson [EMAIL PROTECTED] Reviewed by: stas Revision ChangesPath 1.205 +1 -1 modperl/Makefile.PL Index: Makefile.PL === RCS file: /home/cvs/modperl/Makefile.PL,v retrieving revision 1.204 retrieving revision 1.205 diff -u -r1.204 -r1.205 --- Makefile.PL 19 Jun 2002 16:31:52 - 1.204 +++ Makefile.PL 23 Jan 2003 04:25:04 - 1.205 @@ -347,7 +347,7 @@ if ($k eq 'PREFIX') { require File::Spec; $MOD_PERL_PREFIX = - File::Spec-catfile($v, 'lib', 'site_perl', + File::Spec-catfile($v, $Config{'installstyle'}, 'site_perl', $Config{'version'}, $Config{'archname'}); } 1.659 +4 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.658 retrieving revision 1.659 diff -u -r1.658 -r1.659 --- Changes 25 Dec 2002 01:46:09 - 1.658 +++ Changes 23 Jan 2003 04:25:04 - 1.659 @@ -10,6 +10,10 @@ =item 1.27_01-dev +use $Config{'installstyle'} instead of hardcoded 'lib', to handle +Makefile.PL's PREFIX option correctly [Philippe M. Chiasson +[EMAIL PROTECTED]] + prevent segfaults in mod_perl_mark_where() when a sub can't get resolved [Gerald Richter [EMAIL PROTECTED]]
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas2003/01/21 19:19:43 Modified:.Changes src/modules/perl modperl_io.c modperl_io.h t/modperl .cvsignore todo api.txt xs/Apache/RequestIO Apache__RequestIO.h xs/maps modperl_functions.map xs/tables/current/ModPerl FunctionTable.pm Added: t/response/TestModperl request_rec_tie_api.pm Log: - expose useful macros from modperl_io.c via modperl_io.h - add $r-FILENO implementation - add a test Revision ChangesPath 1.107 +2 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.106 retrieving revision 1.107 diff -u -r1.106 -r1.107 --- Changes 20 Jan 2003 07:54:52 - 1.106 +++ Changes 22 Jan 2003 03:19:43 - 1.107 @@ -10,6 +10,8 @@ =item 1.99_09-dev +Add $r-FILENO implementation [Stas] + Apache::Test: Support NoAutoConfig /NoAutoConfig blocks in .pm files, so we can have a full manual control over generated config sections. These sections are fully parsed and variables are 1.1 modperl-2.0/t/response/TestModperl/request_rec_tie_api.pm Index: request_rec_tie_api.pm === package TestModperl::request_rec_tie_api; use strict; use warnings FATAL = 'all'; use Apache::RequestIO (); use Apache::Test; use Apache::TestUtil; use Apache::Const -compile = 'OK'; sub handler { my $r = shift; plan $r, tests = 1; ok t_cmp(fileno(STDOUT), $r-FILENO(), FILENO); return Apache::OK; } 1; 1.9 +0 -13 modperl-2.0/src/modules/perl/modperl_io.c Index: modperl_io.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- modperl_io.c 24 Mar 2002 02:41:29 - 1.8 +++ modperl_io.c 22 Jan 2003 03:19:43 - 1.9 @@ -1,18 +1,5 @@ #include mod_perl.h -/* - * bleedperl change #11639 switch tied handle magic - * from living in the gv to the GvIOp(gv), so we have to deal - * with both to support 5.6.x - */ -#if ((PERL_REVISION == 5) (PERL_VERSION = 7)) -# define TIEHANDLE_SV(handle) (SV*)GvIOp((SV*)handle) -#else -# define TIEHANDLE_SV(handle) (SV*)handle -#endif - -#define dHANDLE(name) GV *handle = gv_fetchpv(name, TRUE, SVt_PVIO) - #define TIEHANDLE(handle,r) \ modperl_io_handle_tie(aTHX_ handle, Apache::RequestRec, (void *)r) 1.2 +13 -0 modperl-2.0/src/modules/perl/modperl_io.h Index: modperl_io.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- modperl_io.h 5 May 2001 22:06:41 - 1.1 +++ modperl_io.h 22 Jan 2003 03:19:43 - 1.2 @@ -1,6 +1,19 @@ #ifndef MODPERL_IO_H #define MODPERL_IO_H +/* + * bleedperl change #11639 switch tied handle magic + * from living in the gv to the GvIOp(gv), so we have to deal + * with both to support 5.6.x + */ +#if ((PERL_REVISION == 5) (PERL_VERSION = 7)) +# define TIEHANDLE_SV(handle) (SV*)GvIOp((SV*)handle) +#else +# define TIEHANDLE_SV(handle) (SV*)handle +#endif + +#define dHANDLE(name) GV *handle = gv_fetchpv(name, TRUE, SVt_PVIO) + #define IoFLUSH_off(gv) \ IoFLAGS(GvIOp((gv))) = ~IOf_FLUSH 1.11 +1 -0 modperl-2.0/t/modperl/.cvsignore Index: .cvsignore === RCS file: /home/cvs/modperl-2.0/t/modperl/.cvsignore,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- .cvsignore22 Oct 2002 15:13:22 - 1.10 +++ .cvsignore22 Jan 2003 03:19:43 - 1.11 @@ -10,3 +10,4 @@ methodobj.t method.t setauth.t +request_rec_tie_api.t 1.30 +1 -1 modperl-2.0/todo/api.txt Index: api.txt === RCS file: /home/cvs/modperl-2.0/todo/api.txt,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- api.txt 6 Dec 2002 16:19:36 - 1.29 +++ api.txt 22 Jan 2003 03:19:43 - 1.30 @@ -3,7 +3,7 @@ -- tied filehandle interface: - -CLOSE, OPEN, EOF, TELL, SEEK, FILENO + -CLOSE, OPEN, EOF, TELL, SEEK -READLINE - proper implementation (see comment in Apache::compat) $r-finfo: 1.31 +7 -0 modperl-2.0/xs/Apache/RequestIO
cvs commit: modperl-2.0/t/error push_handlers.t
stas2003/01/21 23:00:29 Modified:t/error push_handlers.t Log: use the new under_construction test to print a descriptive skip reason Revision ChangesPath 1.3 +1 -1 modperl-2.0/t/error/push_handlers.t Index: push_handlers.t === RCS file: /home/cvs/modperl-2.0/t/error/push_handlers.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- push_handlers.t 21 Jan 2003 06:30:23 - 1.2 +++ push_handlers.t 22 Jan 2003 07:00:29 - 1.3 @@ -7,7 +7,7 @@ # XXX: the misuse of push_handlers exercised by this test is different # at least on FreeBSD, so it fails, skip for now. -plan tests = 1, have { ignore = sub { 0 } }; +plan tests = 1, under_construction; my $location = /TestError::push_handlers; my $expected = ok;
cvs commit: modperl-2.0 Changes
stas2003/01/21 23:02:14 Modified:.Changes Log: log the recent changes Revision ChangesPath 1.109 +5 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.108 retrieving revision 1.109 diff -u -r1.108 -r1.109 --- Changes 22 Jan 2003 06:12:42 - 1.108 +++ Changes 22 Jan 2003 07:02:14 - 1.109 @@ -10,6 +10,11 @@ =item 1.99_09-dev +Apache::Test: support two new shortcuts for skip functionality: + - have_threads: checks whether both Apache and Perl support threads + - under_construction: to print a consistent/clear skip reason +[Stas] + OPEN, CLOSE and FILENO implementation for Apache::RequestRec [Stas] Apache::Test: Support NoAutoConfig /NoAutoConfig blocks in .pm
Re: [mp2]make test fails
Steve Glaus wrote: [...] Ok, I know we're probably going of topic here, but I'll ask anyways.. You can't run mod_perl, so it's pretty ontopic. I did what you said...the symbol wasn't there in lipperl.so. So. I rebuilt my perl, rebuilt the library, rebuilt my perl again.. I only have one perl library on my system.. It still fails. This is a pretty new version of the perl library, so is it possible that I need an older one? (libperl-5.8.0). I'm at a bit of a loss as to where to go from here. That means one thing: you use the perl include files from the new build, however you link against another library. Does your newly rebuilt library has this symbol defined? __ 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] e-Commerce
Perrin Harkins wrote: Stas Bekman wrote: Where did you see the benchmarks showing that Apache 2.0 has a better performance than 1.3? All over! Thanks Perrin. [...] Some good graphs, including thttpd: http://www.zeuscat.com/andrew/work/aprbench/ It shows that threaded mpm's throughput is worse than preforked, which sounds dubious unless things were broken (blocking mutexes). Hopefully someone can run a benchmark on more updated versions of Apache. __ 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: ANNOUNCE: Loggerithim 6.1.4
Cory 'G' Watson wrote: http://loggerithim.sourceforge.net Loggerithim is monitoring package for Linux and Solaris (with early [...] It will be added to http://perl.apache.org/products/products.html on the next update. p.s. If you have written useful apps running under mod_perl and they aren't listed on perl.apache.org let us know. __ 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: name space problem
[EMAIL PROTECTED] wrote: Okay, So I may be a fool for asking this question, but I hope you will all forgive me. I am fairly new to Perl and really really new to mod_perl. I am working to convert my site to use mod_perl and am having problems with two require statements that exist in most of my scripts. Basically, the require statements point to two other scripts that are back end handler scripts. They are comprised of a couple of subroutines each. Everything works great if I don't run the site through mod_perl as you can imagine. When I do run the site through mod_perl I get internal server errors reported from apache. The errors in the error_log report: ModPerl::Registry: Undefined subroutine ModPerl::ROOT::ModPerl::Registry::var_www_test_home::doSession called at /var/www/test/home line 48. The line in the home script is: my ($user_id,$session_key) = doSession ($page_number,$command,$secure,$page_name); with the require line reading: require /var/www/test/session_key.pl; I'm still reading the numerous web sites that refer to this problem, am hoping to find a quick fix/good explanation of this problem. I don't think anybody will call you a fool for asking a question. The worst you can get is the RTFM reply, which follows :) Don't read numerous sites, read the *only* site, perl.apache.org. Because the majority of sites that have mirrored the guide are badly outdated. 1. go perl.apache.org 2. search for Undefined subroutine the 4th and 5th hits give you want you want. since this problem is the same in mod_perl 1.0 and 2.0 the solution should be moved out from the 1.0 guide, into the generic docs. Doc patches are welcome. __ 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] Apache::RequestRec, IPC::Open[23] problem
Ville Skyttä wrote: Hi, The script below under mod_perl 1.99_08 (ModPerl::Registry), gives me this: Can't locate object method FILENO via package Apache::RequestRec at /usr/lib/perl5/5.8.0/IPC/Open3.pm line 196. A real world example of a script that has these problems is the W3C Markup Validator, http://dev.w3.org/cvsweb/validator/httpd/cgi-bin/check?rev=1.200.2.79. The validator works under mod_perl 1, and I guess the test script would as well (I'm unable to verify that at the moment, though). Maybe a mod_perl 2 bug/missing feature? My installation is Red Hat 8.0, Apache 2.0.40, mod_perl 1.99_08 and Perl 5.8.0. The test script: use IPC::Open2 qw(open2); use IO::File (); my $in = IO::File-new_tmpfile(); my $out = IO::File-new_tmpfile(); print $in foobar\n; seek $in, 0, 0; print Content-Type: text/plain\n\n; my $pid = open2($out, $in, 'tee'); undef $in; waitpid $pid, 0; seek $out, 0, 0; while ($out) { print; } undef $out; Please try again with the latest cvs, I've just ported FILENO, OPEN and CLOSE interfaces from 1.0. Though I doubt that this will work, IPC::Open* have always had problems with mod_perl. IPC::Run should be used instead for now. Hopefully will be able to look more into this issue much later unless someone beats me to it. __ 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: stability of apache 2.0 implications on mod_perl?
Vivek Khera wrote: The announcement of Apache 2.0.44 includes this: The 2.0.44 release marks a change in the Apache release process and a new level of stability in the 2.0 series. Beginning with this release, we will make every effort to retain forward compatibility in the configuration and module API, so that upgrading along the 2.0 series should be much easier. This compatibility extends backwards to 2.0.42, so users of that version or later should be able to upgrade without changing configurations or updating DSO modules. (Users of earlier releases will need to recompile all modules in order to upgrade to 2.0.44.) Does this mean that mod_perl 2.0 can finally be finished? I recall this being dougm's main objection to finishing it all up... We still have to see that this promise will be kept (we will make every effort...). Don't forget that we also rely on the apr project, whose API is not frozen yet. But otherwise it can be finished sooner if we get more people trying to shake out bugs and send patches for features that are still missing. Also helping us to have a more covering test suite would be very helpful. Currently, I believe, we have most of the functionality tested at the very basic level. Covering the odd cases and the whole API is what we need. So read on how to write tests and send in new tests or extend the existing ones. Currently I'm trying to finish the filtering API, which keeps on getting delayed to solve the bug reports. Then I'll go back to work on the other missing things. Philippe has promised to finish the Perl sections, so I think the configuration functionality will be completed soon. If you have a burning need for some missing functionality, speak up. __ 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
cvs commit: modperl-2.0/t/filter .cvsignore
stas2003/01/20 15:14:40 Modified:t/filter .cvsignore Log: adjust the ignore list Revision ChangesPath 1.4 +2 -5 modperl-2.0/t/filter/.cvsignore Index: .cvsignore === RCS file: /home/cvs/modperl-2.0/t/filter/.cvsignore,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- .cvsignore25 Nov 2002 22:46:29 - 1.3 +++ .cvsignore20 Jan 2003 23:14:40 - 1.4 @@ -1,6 +1,3 @@ -api.t -buckets.t -input_body.t -input_msg.t -lc.t +out_bbs_basic.t +out_str_api.t
cvs commit: modperl-2.0/t/error push_handlers.t
stas2003/01/20 22:30:23 Modified:t/error push_handlers.t Log: disable this test for now: the misuse of push_handlers exercised by this test is different at least on FreeBSD, so it fails, skip for now. Revision ChangesPath 1.2 +3 -1 modperl-2.0/t/error/push_handlers.t Index: push_handlers.t === RCS file: /home/cvs/modperl-2.0/t/error/push_handlers.t,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- push_handlers.t 14 Jan 2003 06:42:44 - 1.1 +++ push_handlers.t 21 Jan 2003 06:30:23 - 1.2 @@ -5,7 +5,9 @@ use Apache::TestUtil; use Apache::TestRequest; -plan tests = 1; +# XXX: the misuse of push_handlers exercised by this test is different +# at least on FreeBSD, so it fails, skip for now. +plan tests = 1, have { ignore = sub { 0 } }; my $location = /TestError::push_handlers; my $expected = ok;
cvs commit: modperl-2.0/t/response/TestAPR threadmutex.pm
stas2003/01/20 22:54:22 Modified:t/response/TestAPR threadmutex.pm Log: fix the plan skip condition, which wasn't skipping the test before Revision ChangesPath 1.3 +1 -1 modperl-2.0/t/response/TestAPR/threadmutex.pm Index: threadmutex.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/threadmutex.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- threadmutex.pm23 Jun 2002 22:14:26 - 1.2 +++ threadmutex.pm21 Jan 2003 06:54:22 - 1.3 @@ -12,7 +12,7 @@ sub handler { my $r = shift; -plan $r, tests = 3, 'APR::ThreadMutex'; +plan $r, tests = 3, have 'APR::ThreadMutex'; require APR::ThreadMutex;
Re: [mp2]make test fails
Steve Glaus wrote: On Mon, 20 Jan 2003 11:29:01 -0500 [EMAIL PROTECTED] wrote: Hi, I'm trying to build mod_perl2 with threads enabled. I recompiled apache with the worker mpm, built mod_perl which seemd to build fine.. however, when I go to 'make test' it gives me the following error: Cannot load /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so into server: /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so: undefined symbol: Perl_Ipatchlevel_ptr!!! what's the output of: nm /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so should be something like: U Perl_Ipatchlevel_ptr which is an unresolved symbol, which gets resolved when libperl.so is loaded. To find out which perl library you have linked against, do: ldd modules/mod_perl.so |grep perl libperl.so = /home/stas/perl/blead-ithread/lib/5.9.0/i686-linux-thread-multi/CORE/libperl.so (0x4002e000) Now you can check whether the symbol is there. in my case: nm /home/stas/perl/blead-ithread/lib/5.9.0/i686-linux-thread-multi/CORE/libperl.so |grep Perl_Ipatch 0011fa41 T Perl_Ipatchlevel_ptr Chances are that you are linking against the wrong perl library, which will explain the resolving problem. __ 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] e-Commerce
Ged Haywood wrote: modperl 2 with apache 2 thread is stable enought for start one big project of ecommerce? If it were my decision I'd say not yet, use mod_perl 1.27 with Apache 1.3.27. It depends on your needs. The majority of the features is there and should work just fine. The stability can be ensured only when more people will start using it and see that things are stable. So it's a chicken and egg problem. __ 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] e-Commerce
Perrin Harkins wrote: Eric Frazier wrote: On that note, how about just using Apache2 for the proxy front end, and mod_perl /apache 1.x for the back end? I have wanted to try to avoid the thttpd stuff for images and from what I have heard about apache2 it can handle static pages a lot faster than the 1.x did. You really should be able to get more than enough performance out of 1.x for static files, unless you are using very old hardware. We used a slim 1.x build with mod_proxy, mod_ssl, and mod_rewrite for all of our static files at eToys and it ran like a champ. It's true that both thttpd and apache 2 have better performance, Where did you see the benchmarks showing that Apache 2.0 has a better performance than 1.3? Apache 2.0 should scale better when threads are used (on platforms where threads are faster than processes) and it's definitely a must for win32, but I haven't seen any numbers other than some reports to the httpd-dev list, so I don't know. Also Apache 2.0 provides features like filters, which were almost impossible with 1.3, though how things get slowed down when these are used is a question. Please notice that I'm not saying that 2.0 is slower, I'm just asking to see the numbers ;) __ 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
cvs commit: modperl-2.0/t/preconnection/TestPreConnection - New directory
stas2003/01/19 23:55:35 modperl-2.0/t/preconnection/TestPreConnection - New directory
cvs commit: modperl-2.0/t/preconnection/TestPreConnection note.pm
stas2003/01/19 23:56:17 Added: t/preconnection note.t t/preconnection/TestPreConnection note.pm Log: add a simple test to verify that PreConnection handlers are working Revision ChangesPath 1.1 modperl-2.0/t/preconnection/note.t Index: note.t === use strict; use warnings FATAL = 'all'; use Apache::Test; use Apache::TestUtil; use Apache::TestRequest; my $module = TestPreConnection::note; Apache::TestRequest::module($module); my $hostport = Apache::TestRequest::hostport(Apache::Test::config()); my $location = http://$hostport/$module;; t_debug(connecting to $location); plan tests = 1; ok t_cmp( 'ok', GET_BODY($location), connection notes); 1.1 modperl-2.0/t/preconnection/TestPreConnection/note.pm Index: note.pm === package TestPreConnection::note; use strict; use warnings;# FATAL = 'all'; use Apache::Connection (); use Apache::Const -compile = qw(OK); sub handler { my Apache::Connection $c = shift; $c-notes-set(preconnection = 'ok'); return Apache::OK; } use constant BUFF_LEN = 1024; sub response { my $r = shift; $r-content_type('text/plain'); $r-print($r-connection-notes-get('preconnection') || ''); return Apache::OK } 1; __END__ NoAutoConfig VirtualHost TestPreConnection::note PerlPreConnectionHandler TestPreConnection::note Location /TestPreConnection::note SetHandler modperl PerlResponseHandler TestPreConnection::note::response /Location /VirtualHost /NoAutoConfig
cvs commit: modperl-2.0/t/preconnection/TestPreConnection note.pm
stas2003/01/19 23:59:44 Modified:t/preconnection/TestPreConnection note.pm Log: cleanup Revision ChangesPath 1.2 +1 -3 modperl-2.0/t/preconnection/TestPreConnection/note.pm Index: note.pm === RCS file: /home/cvs/modperl-2.0/t/preconnection/TestPreConnection/note.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- note.pm 20 Jan 2003 07:56:17 - 1.1 +++ note.pm 20 Jan 2003 07:59:44 - 1.2 @@ -1,7 +1,7 @@ package TestPreConnection::note; use strict; -use warnings;# FATAL = 'all'; +use warnings FATAL = 'all'; use Apache::Connection (); @@ -14,8 +14,6 @@ return Apache::OK; } - -use constant BUFF_LEN = 1024; sub response { my $r = shift;
Re: DBI Mod_perl2
Daryl Lee wrote: Should I expect DBI to work with mod_perl2? I have a simple script that just connects to a MySQL database and reports success or faiure. When I run it from cgi-bin as a regular CGI script, it succeeds. When I put it in my mod_perl script directory, it runs, but fails to connect. My mod_perl directory is configured as: Alias /cgi /usr/local/apache2/perl Location /cgi SetHandlerperl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders /Location The script is named dbi.pl. Thus, http://localhost/cgi-bin/dbi.pl connects okay, but http://localhost/cgi/dbi.pl fails to connect Should work just fine, but you need the latest DBI version. I believe 1.31 (but 1.32 is out). Does anybody remember the exact version required, I don't see anything relevant in the Changes file. I've added this item to the troubleshooting version. If the problem persists please send a complete report as explained here: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems and attach the the shortest possible version of the script that still reproduces the problem. __ 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: mod_rewrite + PerlTransHandler
Torsten Foertsch wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I am trying to get a PerlTransHandler called *after* some mod_rewrite processing. I thought if I configure the rewrite rules *before* the PerlTransHandler: RewriteEngine On RewriteRule ... [PT] PerlTransHandler Apache::TestTrans::transhandler it would work that way. But it does not. Apache::TestTrans::transhandler is always called *before* mod_rewrite processing. Is there a way to determine the handler order? Not in mod_perl 1.0. Your best bet is probably to move the mod_rewrite's rules into your perl transhandler. It should be possible in 2.0, though the API is not there yet. Apache 2.0 allows to insert handlers before/after a specified handler + other options. __ 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: mod_perl 2 APache 2.0 MPM
Sinclair, Alan (CORP, GEAccess) wrote: All, Starting to strike the first blows with Apache 2.0. I am now wondering about thread safety with mod_perl 2. Will mod_perl support a threaded MPM Apache config ? Why using the future tense, it does support the threaded mpm pretty much from the very beginning. re: thread-safety see: http://perl.apache.org/search/swish.cgi?query=thread-safesbm=SecIsubmit=search __ 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] failed test building mp2
Nick Tonkin wrote: On Sun, 19 Jan 2003, Stas Bekman wrote: Nick Tonkin wrote: On Fri, 17 Jan 2003, Nick Tonkin wrote: Hey all, Building the latest mp2 I get: protocol/echo_filter.ok Failed Test Stat Wstat Total Fail Failed List of Failed --- apr/threadmutex.t33 100.00% 1-3 *** server localhost.rlnt.net:8529 shutdown !!! error running tests (please examine t/logs/error_log) *** Error code 1 Nick et al, please submit a complete bug report as explained here: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems (linked from the shortcuts menu!). grumble Hrmph. There should be a lynx-friendly version of these sites. All that cool template-driven menu stuff just turns into a long long list of links! /grumble Eh? What user-unfriendly do you find about perl.apache.org when using lynx? It looks very good in it. In any case let's not mix too many things in one thread and if you think you can offer to make it better docs-dev / perl.apache.org is the list to discuss this kind of issues. OK. Bug report sent under different mail, using latest cvs sources. There's two errors now, used to be one! That's OK. See the followup in reply to your report. [...] Patch made no difference to the error. Can you try to step through with gdb and see what the problem is? This should help: http://perl.apache.org/docs/2.0/devel/debug/c.html#Precooked_gdb_Startup_Scripts You should break at modperl_mgv_resolve, which is probably called from modperl_handler_resolve and step through to see where it fails. __ 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
[Fwd: mod perl error and fix]
[this should have been posted to the list] Can somebody on solaris post a proper patch to the build system? Thanks. Original Message Subject: mod perl error and fix Date: Sat, 18 Jan 2003 02:41:22 -0500 From: Michael Johnson [EMAIL PROTECTED] To: [EMAIL PROTECTED] I got this error compiling 1.27 under solaris 8. Seems G was not being resolved as gcc... hope this help some other people as well. Thanks -MJ ---ERROR- c gcc -B/usr/ccs/bin/ -fPIC -O -I/usr/local/lib/perl5/5.8.0/sun4-solaris/CORE -fno-strict-aliasing -DMOD_PERL_VERSION=\1.27\ -DMOD_PERL_STRING_VERSION=\mod_perl/1.27\ -I/home/www/apache/include -DMOD_PERL -DSOLARIS2=280 -DMOD_SSL=208112 -DEAPI -DUSE_EXPAT -I../lib/expat-lite -fPIC -DSHARED_CORE -c Table.c mv Table.o Table.lo rm -f libperl.so G -L/usr/local/lib -o libperl.so mod_perl.lo perlxsi.lo perl_config.lo perl_util.lo perlio.lo mod_perl_opmask.lo Apache.lo Constants.lo ModuleConfig.lo Log.lo URI.lo Util.lo Connection.lo Server.lo File.lo Table.lo -L/usr/local/lib /usr/local/lib/perl5/5.8.0/sun4-solaris/auto/DynaLoader/DynaLoader.a -L/usr/local/lib/perl5/5.8.0/sun4-solaris/CORE -lperl -lsocket -lnsl -ldl -lm -lc make: G: Command not found make: [libperl.so] Error 127 (ignored) ---FIXed by manually compile - [2:37] mjohnson@hq[/home/mjohnson/apache/mod_perl-1.27/apaci]gcc -B/usr/ccs/bin/ -fPIC -O -I/usr/local/lib/perl5/5.8.0/sun4-solaris/CORE -fno-strict-aliasing -DMOD_PERL_VERSION=\1.27\ -DMOD_PERL_STRING_VERSION=\mod_perl/1.27\ -I/home/www/apache/include -DMOD_PERL -DSOLARIS2=280 -DMOD_SSL=208112 -DEAPI -DUSE_EXPAT -I../lib/expat-lite -fPIC -DSHARED_CORE -c Table.c mv Table.o Table.lo [2:37] mjohnson@hq[/home/mjohnson/apache/mod_perl-1.27/apaci]gcc -G -L/usr/local/lib -o libperl.so mod_perl.lo perlxsi.lo perl_config.lo perl_util.lo perlio.lo mod_perl_opmask.lo Apache.lo Constants.lo ModuleConfig.lo Log.lo URI.lo Util.lo Connection.lo Server.lo File.lo Table.lo -L/usr/local/lib /usr/local/lib/perl5/5.8.0/sun4-solaris/auto/DynaLoader/DynaLoader.a -L/usr/local/lib/perl5/5.8.0/sun4-solaris/CORE -lperl -lsocket -lnsl -ldl -lm -lc -- __ 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] failed test building mp2
Nick Tonkin wrote: On Fri, 17 Jan 2003, Nick Tonkin wrote: Hey all, Building the latest mp2 I get: protocol/echo_filter.ok Failed Test Stat Wstat Total Fail Failed List of Failed --- apr/threadmutex.t33 100.00% 1-3 *** server localhost.rlnt.net:8529 shutdown !!! error running tests (please examine t/logs/error_log) *** Error code 1 Nick et al, please submit a complete bug report as explained here: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems (linked from the shortcuts menu!). Based on the previous thread I'd guess that you are using a prefork mpm with non-threaded perl. The perl error was that APR/ThreadMutex.pm was not found. But it's right next to everything else. Please specify the exact error mesasge, not the rephrasing version of it. 2.0 is trying to be very smart about finding the modules the handlers reside in. And so far it seems to create more trouble than help. The real error wasn't that the file wasn't found. Please try again with the patch below. It's not a patch destined to go in, but just to see that the real problem is elsewhere. I changed the 'require APR::ThreadMutex' to 'use APR::ThreadMutex' (outside the handler() sub) anow test suite skips the threadmutex.pm test. What does this mean? Again, the autogenerated client test would report skipped, when there was an error. I've fixed it in the cvs. please try again with the cvs version, where the client aborts the test rather than skipping it, when the server side fails. Here is something to try with the prev error Index: src/modules/perl/modperl_util.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v retrieving revision 1.50 diff -u -r1.50 modperl_util.c --- src/modules/perl/modperl_util.c 11 Jan 2003 00:02:16 - 1.50 +++ src/modules/perl/modperl_util.c 19 Jan 2003 02:07:30 - @@ -15,7 +15,7 @@ POPSTACK; if (SvTRUE(ERRSV)) { -if (logfailure) { +if (1) { (void)modperl_errsv(aTHX_ HTTP_INTERNAL_SERVER_ERROR, NULL, NULL); } __ 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
cvs commit: modperl-2.0 Changes
stas2003/01/17 17:59:22 Modified:ModPerl-Registry/lib/ModPerl RegistryCooker.pm .Changes Log: Another fix for the handling of the return status in ModPerl::RegistryCooker: reset the status to the original one only if it was changed by the script, otherwise return the execution status Revision ChangesPath 1.28 +6 -2 modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm Index: RegistryCooker.pm === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- RegistryCooker.pm 6 Jan 2003 10:42:38 - 1.27 +++ RegistryCooker.pm 18 Jan 2003 01:59:21 - 1.28 @@ -163,9 +163,13 @@ # handlers shouldn't set $r-status but return it my $old_status = $self-[REQ]-status; my $rc = $self-run; -$self-[REQ]-status($old_status); +my $new_status = $self-[REQ]-status; -return ($rc != Apache::OK) ? $rc : $self-[STATUS]; +# only if the script has changed the status, reset to the old +# status and return the new status +return $old_status != $new_status +? $self-[REQ]-status($old_status) +: $rc; } # 1.105 +5 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.104 retrieving revision 1.105 diff -u -r1.104 -r1.105 --- Changes 17 Jan 2003 03:23:24 - 1.104 +++ Changes 18 Jan 2003 01:59:22 - 1.105 @@ -10,6 +10,11 @@ =item 1.99_09-dev +Another fix for the handling of the return status in +ModPerl::RegistryCooker: reset the status to the original one only if +it was changed by the script, otherwise return the execution status +[Stas] + prevent segfault in $r-print / $filter-print (in output filter) and related functions when they are called before the response phase [Stas]
cvs commit: modperl-2.0/ModPerl-Registry/lib/ModPerl RegistryCooker.pm
stas2003/01/17 18:04:32 Modified:ModPerl-Registry/lib/ModPerl RegistryCooker.pm Log: apparently there is not much use for the return status of eval Revision ChangesPath 1.29 +3 -6 modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm Index: RegistryCooker.pm === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- RegistryCooker.pm 18 Jan 2003 01:59:21 - 1.28 +++ RegistryCooker.pm 18 Jan 2003 02:04:32 - 1.29 @@ -64,7 +64,6 @@ use constant MTIME = 3; use constant PACKAGE = 4; use constant CODE = 5; -use constant STATUS= 6; # # OS specific constants @@ -189,15 +188,13 @@ $self-set_script_name; $self-chdir_file; -my $rc = Apache::OK; my $cv = \{$package\::handler}; my %orig_inc = %INC; { # run the code and preserve warnings setup when it's done no warnings; -eval { $rc = $cv-($r, @_) }; -$self-[STATUS] = $rc; +eval { $cv-($r, @_) }; ModPerl::Global::special_list_call(END = $package); } @@ -212,8 +209,8 @@ #XXX: $self-chdir_file($Apache::Server::CWD/); -if ( ($rc = $self-error_check) != Apache::OK) { -return $rc; +if ( (my $err_rc = $self-error_check) != Apache::OK) { +return $err_rc; } return Apache::OK;
Re: mp2.0 Apache::Request
Steve wrote: In the documentation of nodperl-2.0, I cannot find any references to libapreq and $r-param. Because it's not there yet. correct me if I'm wrong anyone,but I don't think Apache::Request has been ported to modperl2 yet.. True. The C porting of libapreq is almost complete. The Perl glue will come next. (A few months?) for now I'm using cgi Steve probably means CGI.pm ;0) Though make sure that you use the latest version if you want to run it under mod_perl 2.0. __ 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] Conflicting instructions in docs?
Nick Tonkin wrote: Well, I'm taking the plunge. I have a brand new spiffy machine I'm configuring and I've decided, since for once I don't have to get it up and running urgently, to go the whole hog and move to the 2.0 world. For me this means upgrading not only from apache 1.3x and mod_perl 1.2x but also from perl 5.005. I'm going to install 5.8 but am confused by an apparent contradiction in the mod_perl2 docs. In http://perl.apache.org/docs/2.0/user/install/install.html it first says: Remember that threads support slows things down, so don't enable it unless you really need it. But then under 'Configuring and Installing Prerequisites' it gives an an example: % ./Configure -des -Dusethreads I'm confused. Where's the quick answer to whether or not I should use threads? I'm on FreeBSD 4.7. As Geoff has replied, plus it's documented: http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites I'll change the example to have both ways demonstrated. __ 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] Conflicting instructions in docs?
That would help remove the perception of a suggestion towards threading. But what I was really looking for was something to help me choose whether or not to use threads at all. I couldn't find this clear answer in the perl documentation. Geoff suggested that if stability was a priority and performance was not, particularly, then I might as well stay away from threads both in apache and in perl. Later I found a tip for installing apache2 for FreeBSD (in the apache docs) that warned against using threads on FreeBSD in any event. So I made what seems now to be an obvious decision to not use 'em. I've heard similar things about FreeBSD and threads. But I think it would be better if the pointer you _do_ have in the docs, which I quoted, saying that threqads should be avoided unless there's a really good reason why not, could be emphasized or clarified more. See if it's any better now. Go to: http://perl.apache.org/docs/2.0/user/install/install.html#Configuring_and_Installing_Prerequisites which takes you to: http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites which mentions all the probs in the prefork mpm section. Obviously the threaded-mpm requires threads. If you have an idea how to make things better please post a patch against the pod source (use cvs or grab the source following the [src] button at the right top corner of the page you are on). Thanks. __ 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: rfc: new filtering APIs
Geoffrey Young wrote: [...] no, you need the real filter_init hook. the issue here is that default_handler has meets_condiditions() logic in it, so it makes decisions about whether or not to send content down the chain. this is generally bad for filters, since they may have their own criteria for determining what gets involved in making that decision - if default-handler doesn't have all the information, it can return NOT_MODIFIED when the filter would have chosen to re-modify the content (based on, say, the fact that the version of the code has changed so it does things differently now). filter_init is a hook that runs code before any handlers run, I suspect for adding calls to update_mtime() and other similar things. ok I agree that having a dedicated filter_init seems to be cleaner and probably more efficient. If filter_init is wanted, how should it be set by the Perl code? Using an optional second argument to the filter configuration? PerlOutputFilterHandler MyFilter MyFilter::init I would want at least a real-time interface for this, something similar to $filter-init(sub {shift-update_mtime($package_mtime)} ); where would you run this code? sub handler { ... } it's important that the filter be able to insert this logic itself without relying on httpd.conf stuff. that makes the filter self-contained and a bit more DWIMmy. of course, the subroutine/coderef would have to run on each request, similar to $r-register_cleanup, just at the other end. Obviously for each conf option there should be a perl interface (add/remove filters pending) Also can you please give me some useful test I can play with? Probably one of the examples from your book will do ;) I'm working on something now, but without a tie into filter_init there's not much to show :) if you come up with the interface, I'll write the tests to make sure it does what we need. Cool. Is there some C module that uses that hook so I can look at it? I guess somewhere in PHP, because I don't seem to see any in the core modules. __ 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: rfc: new filtering APIs
Geoffrey Young wrote: I would want at least a real-time interface for this, something similar to $filter-init(sub {shift-update_mtime($package_mtime)} ); where would you run this code? outsite of a handler() subroutine, pretty much like I showed it - on module load. I suspect you'd have to register the init handler that way for a few reasons, namely that you'd miss the first request if you waited until after default_handler runs to register your init filter. it's also good to do it outside of handler() to handle stuff like reloads, where the init routine might use a closure to avoid recalculating the package mtime on each request. The problem is that currently the resolving (read: module compiling and handler resolving) is postponed till the first invocation of the handler unless the module was manually preloaded or PerlOptions +Autoload was set. I suppose that this could be a documented thing. e.g.: if you use filter_init, you must preload the module at the server startup. I'm not sure what that means for actually getting at the filter object outside of a request :) I don't think that's how it'll work. I was thinking of having a subroutine with a special attribute. So after the module has been compiled we can walk through all the CODE entries and check whether any of them is having the FilterInitHandler attribute and take it from there. Does this sound good? if you come up with the interface, I'll write the tests to make sure it does what we need. Cool. Is there some C module that uses that hook so I can look at it? I guess somewhere in PHP, because I don't seem to see any in the core modules. yeah, the bug report points to PHP. it also mentions mod_include, but I haven't looked at it yet. I read the thread at the URL you've provided. The latest comment from Dec says that the bug is still there. So I suppose that the feature was added but not really used so far. I could be wrong. I'll try to look into this a bit more next week. Cool. Thanks Geoff! __ 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
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas2003/01/16 18:26:32 Modified:.Changes xs/Apache/Response Apache__Response.h xs/tables/current/ModPerl FunctionTable.pm Log: fix segfault in send_http_header when it's called before the response phase Revision ChangesPath 1.102 +3 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.101 retrieving revision 1.102 diff -u -r1.101 -r1.102 --- Changes 16 Jan 2003 02:38:09 - 1.101 +++ Changes 17 Jan 2003 02:26:31 - 1.102 @@ -10,6 +10,9 @@ =item 1.99_09-dev +fix segfault in send_http_header when it's called before the response +phase [Stas] + input stream filtering support was added + tests (plus renaming filter tests so we can know from the test name what kind of filter is tested) [Stas] 1.8 +11 -2 modperl-2.0/xs/Apache/Response/Apache__Response.h Index: Apache__Response.h === RCS file: /home/cvs/modperl-2.0/xs/Apache/Response/Apache__Response.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Apache__Response.h19 May 2002 23:01:12 - 1.7 +++ Apache__Response.h17 Jan 2003 02:26:31 - 1.8 @@ -15,7 +15,8 @@ /* XXX: should only be part of Apache::compat */ static MP_INLINE void -mpxs_Apache__RequestRec_send_http_header(request_rec *r, const char *type) +mpxs_Apache__RequestRec_send_http_header(pTHX_ request_rec *r, + const char *type) { MP_dRCFG; @@ -23,7 +24,15 @@ ap_set_content_type(r, apr_pstrdup(r-pool, type)); } -rcfg-wbucket-header_parse = 0; /* turn off PerlOptions +ParseHeaders */ +if (rcfg-wbucket) { +/* turn off PerlOptions +ParseHeaders */ +rcfg-wbucket-header_parse = 0; +} +else { +/* the response is not initialized yet */ +Perl_croak(aTHX_ send_http_header() can't be called before + the response phase); +} } static MP_INLINE void 1.95 +4 -0 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm Index: FunctionTable.pm === RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v retrieving revision 1.94 retrieving revision 1.95 diff -u -r1.94 -r1.95 --- FunctionTable.pm 15 Jan 2003 06:07:10 - 1.94 +++ FunctionTable.pm 17 Jan 2003 02:26:32 - 1.95 @@ -5370,6 +5370,10 @@ 'name' = 'mpxs_Apache__RequestRec_send_http_header', 'args' = [ { +'type' = 'PerlInterpreter *', +'name' = 'my_perl' + }, + { 'type' = 'request_rec *', 'name' = 'r' },
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas2003/01/16 19:08:31 Modified:src/modules/perl modperl_filter.c modperl_filter.h .Changes xs modperl_xs_util.h xs/Apache/RequestIO Apache__RequestIO.h xs/tables/current/ModPerl FunctionTable.pm Log: prevent segfault in $r-print / $filter-print (in output filter) and related functions when they are called before the response phase Revision ChangesPath 1.44 +11 -4 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- modperl_filter.c 15 Jan 2003 06:07:10 - 1.43 +++ modperl_filter.c 17 Jan 2003 03:08:31 - 1.44 @@ -55,13 +55,18 @@ return rv; } -MP_INLINE apr_status_t modperl_wbucket_write(modperl_wbucket_t *wb, +MP_INLINE apr_status_t modperl_wbucket_write(pTHX_ modperl_wbucket_t *wb, const char *buf, apr_size_t *wlen) { apr_size_t len = *wlen; *wlen = 0; +if (!wb) { +/* the response is not initialized yet */ +Perl_croak(aTHX_ can't be called before the response phase); +} + if ((len + wb-outcnt) sizeof(wb-outbuf)) { apr_status_t rv; if ((rv = modperl_wbucket_flush(wb)) != APR_SUCCESS) { @@ -505,7 +510,8 @@ return filter-rc; } -MP_INLINE apr_status_t modperl_input_filter_write(modperl_filter_t *filter, +MP_INLINE apr_status_t modperl_input_filter_write(pTHX_ + modperl_filter_t *filter, const char *buf, apr_size_t *len) { @@ -519,11 +525,12 @@ return APR_SUCCESS; } -MP_INLINE apr_status_t modperl_output_filter_write(modperl_filter_t *filter, +MP_INLINE apr_status_t modperl_output_filter_write(pTHX_ + modperl_filter_t *filter, const char *buf, apr_size_t *len) { -return modperl_wbucket_write(filter-wbucket, buf, len); +return modperl_wbucket_write(aTHX_ filter-wbucket, buf, len); } apr_status_t modperl_output_filter_handler(ap_filter_t *f, 1.17 +6 -3 modperl-2.0/src/modules/perl/modperl_filter.h Index: modperl_filter.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- modperl_filter.h 15 Jan 2003 06:07:10 - 1.16 +++ modperl_filter.h 17 Jan 2003 03:08:31 - 1.17 @@ -16,7 +16,8 @@ MP_INLINE apr_status_t modperl_wbucket_flush(modperl_wbucket_t *b); -MP_INLINE apr_status_t modperl_wbucket_write(modperl_wbucket_t *b, +MP_INLINE apr_status_t modperl_wbucket_write(pTHX_ + modperl_wbucket_t *b, const char *buf, apr_size_t *wlen); @@ -50,7 +51,8 @@ SV *buffer, apr_size_t wanted); -MP_INLINE apr_status_t modperl_output_filter_write(modperl_filter_t *filter, +MP_INLINE apr_status_t modperl_output_filter_write(pTHX_ + modperl_filter_t *filter, const char *buf, apr_size_t *len); @@ -75,7 +77,8 @@ SV *buffer, apr_size_t wanted); -MP_INLINE apr_status_t modperl_input_filter_write(modperl_filter_t *filter, +MP_INLINE apr_status_t modperl_input_filter_write(pTHX_ + modperl_filter_t *filter, const char *buf, apr_size_t *len); 1.103 +5 -2 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.102 retrieving revision 1.103 diff -u -r1.102 -r1.103 --- Changes 17 Jan 2003 02:26:31 - 1.102 +++ Changes 17 Jan 2003 03:08:31 - 1.103 @@ -10,8 +10,11 @@ =item 1.99_09-dev -fix
Re: PerlSections grief with VirtualHosts
Michael A Nachbaur wrote: I'm pulling my hair out. I have an extremely complicated Perl section that I'm trying to load in Apache, and I'm having one hell of a time debugging everything. To make a long story short, I'm defining multiple virtualhosts that each are configured to run AxKit. I have my Perl section defined in a separate file, and Include it into my main httpd.conf. I have some debugging code that dumps the PerlSections data to STDOUT when the server starts up. When Apache starts, it dies silently with a core dump (after outputting the Data::Dumper representation of my PerlSections). If I copy/paste the outputted Perl code and re-munge it into Apache's configuration syntax and include this file, the server starts without a problem. Therefore, I know there isn't a problem with the modules I'm loading in the virtualhosts, but I can't seem to track the problem down because I can't get any debugging information. First of all I assume that you are talking about mod_perl 1.0 here. You need to get a core file and send in the backtrace as explained here: http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems If you can't get it see the tips at: http://perl.apache.org/docs/2.0/devel/debug/c.html#Getting_the_core_File_Dumped __ 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: cgi-script to handler communication
[Please mention mp2 in the subject/body of the message so we don't have to guess what version you are talking about] a. How can I communicate a value from my cgi-script to a mod_perl handler. I know you can pass values from handlers to cgi-scripts using $r-args and environment variables. But, what if I want to pass a value from the cgi-script to a handler? It's obvious that the handler should get called after the cgi-script gets executed. You don't detail what kind of handler you are talking about. But look at notes/pnotes (search perl.apache.org for examples), which are useful for passing data around. b.Also, I don't know of any handler that gets called after the content has been generated. PerlOutputFilterHandler is not what I want, because, there I have to read and manually 'print' all the output using $filter-print. If PerlOutputFilterHandler is the only option, then, can I modify the output headers in it? Looks like you are a bit confused with 'handlers'. You may want to read the handler chapters at http://perl.apache.org/docs/2.0/user/index.html You can insert several handlers (for each phase) using push_handlers or using the configuration file. Depending on the phase's behavior described here: http://perl.apache.org/docs/2.0/user/handlers/intro.html#Single_Phase_s_Multiple_Handlers_Behavior only the first handler returning OK (or error) or all of the handlers will be run. And yes, you can modify output headers in PerlOutputFilterHandler, if the filter is a connection filter. Here is an example that does that for input headers, but will work the same for the output handlers: http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_Input_Filters Though it's probably not as fast as adjusting the headers via the api in the response handlers. However since you aren't telling what you are trying to do I can't give you a better advice. __ 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: modperl : how resolve conflict funtion name in different package
Ouimet, Pierre wrote: hi! I have that (by exemple ) : package pack1.pm sub get_data { # ... } package pack2.pm sub get_data { # same name, but doing other thing } I don't use export and I have conflict with this 2 package in log file (because it detect same function) In modperl I can't have same function ? That's impossible ! I can't beleive that! Is it possible to allow it ? In apache config or... !? Please RTFM: http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modules_and_libs __ 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: Fw: Passing CGI environment to subprograms
Erich Oliphant wrote: - Original Message - From: Erich Oliphant [EMAIL PROTECTED] To: Stas Bekman [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 9:21 PM Subject: Re: Passing CGI environment to subprograms Duh :) Sorry, I thought I included the rev in my original post, yes I am using 2.0. Hmm, and no hacks or workarounds at this point? That sucks ;) Well I will poke around the code and see if I can help out. I think the suggestion was to enable this feature for non-threaded mpms. But what we are trying to achieve is that any module will run identically on threaded and non-threaded mpms (the same reason why Registry modules don't chdir to the script's dir). Also, are the probs I described with getting the output of spawn_proc_prog() known? As I indicated that approach did set the env vars correctly, but I was not able to read the output handle per the example. It's quite possible that there is a bug. Can you please send a test case to reproduce the problem? Thanks. __ 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: rfc: new filtering APIs
Geoffrey Young wrote: Finally, other than add/remove filters APIs which we have talked about, what other APIs do you want for filters? is there an interface to filter_init? see the discussion on http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9673 or CHANGES file for a description of why it was added. this API may be crucial to mod_perl developers who want to handle conditional GET requests properly with their filters. First of all you can always do: unless ($filter-ctx) { # filter is called for the first time # and this code won't be run only once $filter-ctx(1); } so if you want to do something once, or e.g. remove yourself you can do it in this block. So it seems to be similar to filter_init. Or am I wrong here? I agree that having a dedicated filter_init seems to be cleaner and probably more efficient. If filter_init is wanted, how should it be set by the Perl code? Using an optional second argument to the filter configuration? PerlOutputFilterHandler MyFilter MyFilter::init Also can you please give me some useful test I can play with? Probably one of the examples from your book will do ;) Thanks Geoff. __ 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: cgi-script to handler communication [MP2]
Vishal Verma wrote: Though it's probably not as fast as adjusting the headers via the api in the response handlers. However since you aren't telling what you are trying to do I can't give you a better advice. Here's what I'm trying to do: I am implementing a login/logout mechanism. The user can't access any page till he logs in. That is any attempt to access pages without logging in will be redirected to the login screen. I have successfully implemented this part. The login page is generated by a CGI script. Once the user logs in successfully, I want to set a cookie. That's the reason why I want the login CGI script to pass the result to my handler. The handler, which must be run after the CGI script has been run, will decide to modify the output header (to set cookie) depending upon the result code passed to it by the login screen. I don't understand why don't you do that in your cgi script (btw, is it running under mod_perl/registry or just mod_cgi?). Why do you need yet another handler? I have read all the documentation about handlers etc., and couldn't find a way to do this. I know about notes/pnotes, but aren't they for passing values from one handler to other. How can my CGI script use them? And if it is possible for my CGI script to use them, would that be safe when multiple users are trying to log in? If it's a mod_perl registry script, you have an access to the request object. Either via my $r = shift; at the beginning of your script or via Apache-request (which retrieves the globally stored req object) If it's a script running under the mod_cgi handler, I don't think you can. One more question. I redirect the incoming request by calling $r-uri($new_uri) in my PerlTransHandler. How can I make the browser show this new location in its address bar? in mod_cgi scripts: print Location: $new_location; or use CGI; print CGI-new-redirect($new_location); or talking mod_perl, see for example: http://perl.apache.org/docs/1.0/guide/snippets.html#Sending_Cookies_in_REDIRECT_Response __ 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: mod_perl 2.0 and print/send_http_header method SEGFAULT
Jérôme Augé wrote: On Thu, Jan 16, 2003 at 10:27:38AM +1100, Stas Bekman wrote: Cool. Now can you please send the shortest possible example that you still get the SEGFAULT with, so I can reproduce it and fix? Thanks. I finally got a working apache2+mod_perl working in my $HOME dir (I could not find the core files of the RedHat httpd, problems with uid permission i guess) So here are the backtraces. I included two backtraces : - the first one is for the crash with $r-send_http_header() - the second one is for the crash with $r-print() when I remove the send_http_header() statement The problem is that you were calling these functions before the response phase (PerlTransHandler in your case), hence triggered the segfaults. I've fixed those in cvs. Now if you call any of these functions too early mod_perl will croak. Please verify with the latest cvs. To solve your particular case, you need to use: $r-set_handlers(PerlResponseHandler = \response); inside the PerlTransHandler handler, and move all the code that generates the response there. __ 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
cvs commit: modperl-2.0 Changes
stas2003/01/15 18:38:09 Modified:.Changes Log: log the recent changes Revision ChangesPath 1.101 +14 -2 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.100 retrieving revision 1.101 diff -u -r1.100 -r1.101 --- Changes 14 Jan 2003 06:42:44 - 1.100 +++ Changes 16 Jan 2003 02:38:09 - 1.101 @@ -10,9 +10,21 @@ =item 1.99_09-dev -prevent a segfault when push_handlers are used to push a handler into -the currently phase and switching the handler (perl-script/modperl) +input stream filtering support was added + tests (plus renaming filter +tests so we can know from the test name what kind of filter is tested) [Stas] + +Add proper support for mis-behaved feeding filters that send more than +one EOS bucket in streaming filters + test. [Stas] + +implement a more robust autogenerated client .t test in +Apache::TestConfigPerl. Before this fix if the server side returned +500, the test would get skipped, not good. Now it will die a horrible +death. [Stas] + +prevent a segfault when push_handlers are used to push a handler into +the currently phase and switching the handler (perl-script/modperl) + +tests [Stas] Add $filter-seen_eos to the streaming filter api to know when eos has been seen, so special signatures can be passed and any data stored in
cvs commit: modperl-2.0/t/filter/TestFilter in_str_consume.pm
stas2003/01/15 21:15:18 Added: t/filter in_str_consume.t t/filter/TestFilter in_str_consume.pm Log: add a faulty filter test, but keep the fault disabled for now Revision ChangesPath 1.1 modperl-2.0/t/filter/in_str_consume.t Index: in_str_consume.t === use strict; use warnings FATAL = 'all'; use Apache::Test; use Apache::TestUtil; use Apache::TestRequest; plan tests = 1; my $location = '/TestFilter::in_str_consume'; # send a message bigger than 8k, so to make sure that the input filter # will get more than one bucket brigade with data. my $data = A 22 chars long string x 500; # about 11k my $received = POST_BODY $location, content = $data; my $expected = read just the first 1024b from the first brigade; ok t_cmp($expected, $received, input stream filter partial consume) 1.1 modperl-2.0/t/filter/TestFilter/in_str_consume.pm Index: in_str_consume.pm === package TestFilter::in_str_consume; # this test verifies that streaming filters framework handles # gracefully the case when a filter doesn't print anything at all to # the caller. I figure it's absolutely doesn't matter if the incoming # bb from the upstream is consumed or not. What matter is that the # filter sends something downstream (an empty bb will do). # # e.g. a filter that cleans up the incoming stream (extra spaces?) # might reduce the whole bb into nothing (e.g. if it was made of only # white spaces) then it should send down. # # another problem with not reading in the while() loop, is that the # eos bucket won't be detected by the streaming framework and # consequently won't be sent downstream, probably breaking other # filters who rely on receiving the EOS bucket. use strict; use warnings FATAL = 'all'; use Apache::Filter (); use Apache::Const -compile = qw(OK M_POST); sub handler { my($filter, $bb, $mode, $block, $readbytes) = @_; my $ctx = $filter-ctx; unless ($ctx) { # read a bit from the first brigade and leave the second # brigade completely unconsumed. we assume that there are two # brigades because the core input filter will split data in # 8kb chunks per brigade and we have sent 11k of data (1st bb: # 8kb, 2nd bb: ~3kb) my $len = $filter-read($mode, $block, $readbytes, my $buffer, 1024); warn FILTER READ: $len bytes\n; $filter-print(read just the first 1024b from the first brigade); $filter-ctx(1); } else { unless ($filter-seen_eos) { # XXX: comment out the next line to reproduce the segfault $filter-print(); } } return Apache::OK; } sub response { my $r = shift; $r-content_type('text/plain'); if ($r-method_number == Apache::M_POST) { my $data = ModPerl::Test::read_post($r); #warn HANDLER READ: $data\n; $r-print($data); } return Apache::OK; } 1; __DATA__ SetHandler modperl PerlResponseHandler TestFilter::in_str_consume::response
Re: mod_perl 2.0 and print/send_http_header method SEGFAULT
Jérôme Augé wrote: On Wed, Jan 15, 2003 at 09:09:37AM +1100, Stas Bekman wrote: I've applied a fix that hopefully cures this thing in cvs. Please try again with the latest cvs version. http://perl.apache.org/download/source.html#2_0_Development_Source_Distribution Since you've never sent the backtrace of SEGFAULT, as explained here: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems there can be more than one problem. I've fixed one, but there can be more lurking behind the first one. So if you can send the backtrace, that will help a lot. I installed the CVS version (1.9909) and I still get a SEGFAULT when using $r-send_http_header() or $r-print() ... - I fetched the mod_perl CVS sources then launched : $ perl Makefile.PL MP_APXS=/usr/sbin/apxs $ make $ make install - modified the /etc/httpd/conf.d/perl.conf file - restarted httpd Cool. Now can you please send the shortest possible example that you still get the SEGFAULT with, so I can reproduce it and fix? Thanks. I also tested with the Apache::ProxyPassThru module (from http://perl.apache.org/dist/contrib/ProxyPassThru.pm) I added a use Apache::compat statement, removed the $r-handler()/$r-push_handlers() part and I also get a SEGFAULT when it reach the http_send_header() statement ... send_http_header is indeed doesn't exist in 2.0, but implemented in Apache::compat and should work just fine, as it's exercised in many tests: grep -Ir send_http_header t t/compat/request_body.t:# $r-send_http_header('text/plain'); t/compat/request_body.t:q{$r-send_http_header('text/plain')} t/response/TestCompat/request_body.pm:$r-send_http_header('text/plain'); t/response/TestCompat/apache.pm:$r-send_http_header('text/plain'); t/response/TestCompat/apache_file.pm:$r-send_http_header('text/plain'); t/response/TestCompat/apache_table.pm:$r-send_http_header('text/plain'); t/response/TestCompat/apache_util.pm:$r-send_http_header('text/plain'); t/response/TestCompat/request.pm:$r-send_http_header('text/plain'); __ 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: mod_perl 2.0 and print/send_http_header method SEGFAULT
Jérôme Augé wrote: I grep'ed into the mod_perl sources and found in examples/lib/Apache/HelloWorld.pm that send_http_header does not exists in mod_perl 2.0 and print is not yet implemented. Is this right ? so this could easily explain my problems :) It's an old example, I've removed it. in examples/lib/Apache/HelloWorld.pm : [...] sub handler { my $r = shift; $r-content_type('text/plain'); #send_http_header API function does not exist in 2.0 $r-puts(__PACKAGE__); #print not yet implemented return Apache::OK; } [...] -- __ 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: Re-installing 1.99_08 binary or 1.99_05 RPM in Red Hat 8 [mp2]
Jon wrote: At 16:34 15/01/2003 +0100, Jérôme Augé wrote: You must install the httpd-devel package, /usr/sbin/apxs is in this package. OK, I've installed this, but I would like one more go at getting the RPM working, so I don't get more problems when the next RPM is released - I guess I have to choose one method to follow, but am more used to dealing with RPM's. I reinstalled the mod_perl-1.99_05-3 RPM thinking that might give me less problems, it looked OK but now: [Wed Jan 15 14:37:02 2003] [error] failed to resolve handler `ModPerl::Registry::handler' [Wed Jan 15 14:43:12 2003] [error] [client 192.168.1.30] Can't locate ModPerl/Registry/handler.pm in @INC (@INC contains: [snip] Try with the 99_08 version. it should be pretty easy to grab the src package for mod_perl-1.99_05-3, rpm -i it, replace the modperl tar.gz in the SOURCES dir, adjust the spec file and rebuild a new package. But I'd go with the build from source. At least to get you going. __ 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: 1.3.27 DSO hassles
Sinclair, Alan (CORP, GEAccess) wrote: Here's the solution to resolve the __floatdisf symbol error. Thanks to Paul Weiss who provided the hint. Configure and install Apache Relink mod_negotiation.so with libgcc.a (I opted to statically link mod_perl into the core) cd apache_1.3.27/src/modules ld -G -o mod_negotiation.so mod_negotiation.lo /pathto/libgcc.a This will extract the floatdisf function from libgcc.a and link it into mod_negotiation.so which can be verified with nm. The libgcc.a archive will be contained into your gcc build tree under gcc-3.2.1/gcc Thanks to all who replied. Fantastic! I've documented this solution at http://perl.apache.org/docs/1.0/guide/troubleshooting.html (auto-update pending) Thank you! __ 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] config: $Listen won't listen.
Dmitri Tikhonov wrote: Hi everyone, I just upgraded to 1.99_08, and it lets me do all my old Perl configurations. Except for one. When I try to do something like Perl push @Listen, 80; # or this: # $Listen = 80; /Perl Apache refuses to bind to that port, telling me that the socket is already in use. No matter which port I specify, this happens. My question is, does this happen because of when Perl directives are actually processed (too late for Listen?), and if so, how would I go about determining which port to listen on dynamically? My setup: apache 2.0.43, mod_perl 1.99_08. Thanks in advance, - Dmitri. P.S. Any word on when more more documentation for Perl configuration is coming? I think that Philippe is on vacation now and he promised to commit a fixed version once he comes back. I believe that once it works completely it'll be the time to add docs. Though if you can contribute the docs (should be pretty easy since all you need is to port them from 1.0 guide/eagle book/cookbook) that would help a lot so we can spend more time coding the old/new features, rather than writing docs. While you've asked about the docs. This is a call for everyone who's playing/developing with 2.0. If you see that some docs are missing, please send patches against the modperl-docs cvs repository. Most of the time all you need is to port the docs from 1.0. Your help is *very* appreciated. Post the patches here, or the docs-dev list. Thanks. __ 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
cvs commit: modperl-2.0 STATUS
stas2003/01/14 21:22:53 Modified:.STATUS Log: an issue to resolve Revision ChangesPath 1.33 +8 -1 modperl-2.0/STATUS Index: STATUS === RCS file: /home/cvs/modperl-2.0/STATUS,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- STATUS11 Jan 2003 04:14:55 - 1.32 +++ STATUS15 Jan 2003 05:22:53 - 1.33 @@ -50,6 +50,13 @@ Needs Patch or Further Investigation: - +* Currently modperl_filter_add_{connection|request} check the filter + handler function attrs before accepting the filter. If the module + wasn't preloaded the check fails and filter handler is skipped. We + could have this issue documented (which is OK, but might raise too + many questions), but we could also always preload the filter + handlers. To test see TestFilter::input_msg + * we still have a problem with mod_perl starting from a vhost. consider the following config:
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas2003/01/14 22:07:11 Modified:src/modules/perl modperl_filter.c modperl_filter.h modperl_types.h xs/tables/current/ModPerl FunctionTable.pm Log: - implementation of the input stream filtering support (1st phase) - code refactoring to be re-use for input and output filtering - proper support for mis-behaved feeding filters that send more than one EOS bucket Revision ChangesPath 1.43 +225 -66 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- modperl_filter.c 12 Jan 2003 02:21:37 - 1.42 +++ modperl_filter.c 15 Jan 2003 06:07:10 - 1.43 @@ -94,15 +94,23 @@ filter-mode = mode; filter-f = f; -filter-bb = bb; filter-pool = p; filter-wbucket.pool = p; filter-wbucket.filters = f-next; filter-wbucket.outcnt = 0; +if (mode == MP_INPUT_FILTER_MODE) { +filter-bb_in = NULL; +filter-bb_out = bb; +} +else { +filter-bb_in = bb; +filter-bb_out = NULL; +} + MP_TRACE_f(MP_FUNC, filter=0x%lx, mode=%s\n, - (unsigned long)filter, mode == MP_OUTPUT_FILTER_MODE ? - output : input); + (unsigned long)filter, + mode == MP_INPUT_FILTER_MODE ? input : output); return filter; } @@ -138,7 +146,10 @@ modperl_handler_make_args(aTHX_ args, Apache::Filter, filter-f, - APR::Brigade, filter-bb, + APR::Brigade, + (filter-mode == MP_INPUT_FILTER_MODE + ? filter-bb_out + : filter-bb_in), NULL); modperl_filter_mg_set(aTHX_ AvARRAY(args)[0], filter); @@ -168,26 +179,59 @@ filter-seen_eos = 0; } -if (filter-mode == MP_OUTPUT_FILTER_MODE) { +if (filter-mode == MP_INPUT_FILTER_MODE) { +if (filter-bb_in) { +/* in the streaming mode filter-bb_in is populated on the + * first modperl_input_filter_read, so it must be + * destroyed at the end of the filter invocation + */ +/* XXX: may be the filter must consume all the data? add a + * test to check */ +apr_brigade_destroy(filter-bb_in); +filter-bb_in = NULL; +} +modperl_input_filter_flush(filter); +} +else { modperl_output_filter_flush(filter); } + return status; } /* output filters */ -MP_INLINE static apr_status_t send_eos(ap_filter_t *f) +MP_INLINE static apr_status_t send_input_eos(modperl_filter_t *filter) +{ +apr_bucket_alloc_t *ba = filter-f-c-bucket_alloc; +apr_bucket *b = apr_bucket_eos_create(ba); +APR_BRIGADE_INSERT_TAIL(filter-bb_out, b); +((modperl_filter_ctx_t *)filter-f-ctx)-sent_eos = 1; +return APR_SUCCESS; + +} + +MP_INLINE static apr_status_t send_input_flush(modperl_filter_t *filter) +{ +apr_bucket_alloc_t *ba = filter-f-c-bucket_alloc; +apr_bucket *b = apr_bucket_flush_create(ba); +APR_BRIGADE_INSERT_TAIL(filter-bb_out, b); +return APR_SUCCESS; +} + +MP_INLINE static apr_status_t send_output_eos(ap_filter_t *f) { apr_bucket_alloc_t *ba = f-c-bucket_alloc; apr_bucket_brigade *bb = apr_brigade_create(MP_FILTER_POOL(f), ba); apr_bucket *b = apr_bucket_eos_create(ba); APR_BRIGADE_INSERT_TAIL(bb, b); +((modperl_filter_ctx_t *)f-ctx)-sent_eos = 1; return ap_pass_brigade(f-next, bb); } -MP_INLINE static apr_status_t send_flush(ap_filter_t *f) +MP_INLINE static apr_status_t send_output_flush(ap_filter_t *f) { apr_bucket_alloc_t *ba = f-c-bucket_alloc; apr_bucket_brigade *bb = apr_brigade_create(MP_FILTER_POOL(f), @@ -199,11 +243,14 @@ /* unrolled APR_BRIGADE_FOREACH loop */ +#define MP_FILTER_EMPTY(filter) \ +APR_BRIGADE_EMPTY(filter-bb_in) + #define MP_FILTER_SENTINEL(filter) \ -APR_BRIGADE_SENTINEL(filter-bb) +APR_BRIGADE_SENTINEL(filter-bb_in) #define MP_FILTER_FIRST(filter) \ -APR_BRIGADE_FIRST(filter-bb) +APR_BRIGADE_FIRST(filter-bb_in) #define MP_FILTER_NEXT(filter) \ APR_BUCKET_NEXT(filter-bucket) @@ -216,52 +263,83 @@ MP_INLINE static int get_bucket(modperl_filter_t *filter) { -if (!filter-bb) { +if (!filter-bb_in || MP_FILTER_EMPTY(filter)) { +MP_TRACE_f(MP_FUNC, %s
cvs commit: modperl-2.0/t/filter input_body.t
stas2003/01/14 22:08:16 Modified:t/filter input_body.t Log: no more need for XXX Revision ChangesPath 1.5 +0 -1 modperl-2.0/t/filter/input_body.t Index: input_body.t === RCS file: /home/cvs/modperl-2.0/t/filter/input_body.t,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- input_body.t 20 Dec 2001 03:54:41 - 1.4 +++ input_body.t 15 Jan 2003 06:08:16 - 1.5 @@ -4,7 +4,6 @@ use Apache::Test; use Apache::TestRequest; -#XXX: skip input_body filter test until filter changes dust settles plan tests = 2; my $location = '/TestFilter::input_body';
cvs commit: modperl-2.0/xs/Apache/Filter Apache__Filter.h
stas2003/01/14 22:11:09 Modified:xs/Apache/Filter Apache__Filter.h Log: input filters are now supported Revision ChangesPath 1.22 +21 -8 modperl-2.0/xs/Apache/Filter/Apache__Filter.h Index: Apache__Filter.h === RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- Apache__Filter.h 12 Jan 2003 02:33:27 - 1.21 +++ Apache__Filter.h 15 Jan 2003 06:11:08 - 1.22 @@ -26,7 +26,7 @@ mpxs_write_loop(modperl_output_filter_write, modperl_filter); } else { -Perl_croak(aTHX_ input filters not yet supported); +mpxs_write_loop(modperl_input_filter_write, modperl_filter); } /* XXX: ap_rflush if $| */ @@ -38,23 +38,36 @@ SV **MARK, SV **SP) { modperl_filter_t *modperl_filter; +ap_input_mode_t mode = 0; +apr_read_type_e block = 0; +apr_off_t readbytes = 0; apr_size_t wanted, len=0; SV *buffer; - -mpxs_usage_va_2(modperl_filter, buffer, $filter-read(buf, [len])); - -if (items 2) { + +if (items 4) { +mpxs_usage_va_2(modperl_filter, buffer, $filter-read(buf, [len])); +} +else { +modperl_filter = mp_xs_sv2_modperl_filter(*MARK); MARK++; +mode = (ap_input_mode_t)SvIV(*MARK); MARK++; +block = (apr_read_type_e)SvIV(*MARK); MARK++; +readbytes = (apr_off_t)SvIV(*MARK); MARK++; +buffer = *MARK++; +} + +if (items == 3 || items == 6) { wanted = SvIV(*MARK); } else { wanted = MP_IOBUFSIZE; } -if (modperl_filter-mode == MP_OUTPUT_FILTER_MODE) { -len = modperl_output_filter_read(aTHX_ modperl_filter, buffer, wanted); +if (modperl_filter-mode == MP_INPUT_FILTER_MODE) { +len = modperl_input_filter_read(aTHX_ modperl_filter, mode, +block, readbytes, buffer, wanted); } else { -Perl_croak(aTHX_ input filters not yet supported); +len = modperl_output_filter_read(aTHX_ modperl_filter, buffer, wanted); } return len;
cvs commit: modperl-2.0/t/filter/TestFilter in_bbs_body.pm in_bbs_msg.pm out_bbs_basic.pm out_bbs_ctx.pm out_str_api.pm out_str_ctx.pm out_str_lc.pm out_str_reverse.pm in_str_msg.pm api.pm buckets.pm context.pm context_stream.pm input_body.pm input_msg.pm lc.pm reverse.pm
stas2003/01/14 22:47:16 Modified:t/filter/TestFilter in_str_msg.pm Added: t/filter in_bbs_body.t in_bbs_msg.t out_bbs_basic.t out_bbs_ctx.t out_str_api.t out_str_ctx.t out_str_lc.t out_str_reverse.t t/filter/TestFilter in_bbs_body.pm in_bbs_msg.pm out_bbs_basic.pm out_bbs_ctx.pm out_str_api.pm out_str_ctx.pm out_str_lc.pm out_str_reverse.pm Removed: t/filter context.t context_stream.t input_body.t input_msg.t lc.t reverse.t t/filter/TestFilter api.pm buckets.pm context.pm context_stream.pm input_body.pm input_msg.pm lc.pm reverse.pm Log: rename filter tests so it's easy to test what kind of filter is run from its name (also to tell the streaming interface from BBs.) Revision ChangesPath 1.1 modperl-2.0/t/filter/in_bbs_body.t Index: in_bbs_body.t === use strict; use warnings FATAL = 'all'; use Apache::Test; use Apache::TestRequest; plan tests = 2; my $location = '/TestFilter::in_bbs_body'; for my $x (1,2) { my $data = scalar reverse ok $x\n; print POST_BODY $location, content = $data; } 1.1 modperl-2.0/t/filter/in_bbs_msg.t Index: in_bbs_msg.t === use Apache::TestRequest; use Apache::Test (); use Apache::TestUtil; my $module = 'TestFilter::in_bbs_msg'; Apache::TestRequest::scheme('http'); #force http for t/TEST -ssl Apache::TestRequest::module($module); my $config = Apache::Test::config(); my $hostport = Apache::TestRequest::hostport($config); t_debug(connecting to $hostport); print GET_BODY(/input_filter.html); 1.1 modperl-2.0/t/filter/out_bbs_basic.t Index: out_bbs_basic.t === # WARNING: this file is generated, do not edit # 01: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:696 # 02: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:713 # 03: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfigPerl.pm:83 # 04: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfigPerl.pm:407 # 05: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:407 # 06: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:422 # 07: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:1215 # 08: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestRun.pm:398 # 09: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestRunPerl.pm:32 # 10: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestRun.pm:569 # 11: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestRun.pm:569 # 12: t/TEST:19 use Apache::TestRequest 'GET_BODY'; print GET_BODY /TestFilter::out_bbs_basic; 1.1 modperl-2.0/t/filter/out_bbs_ctx.t Index: out_bbs_ctx.t === use strict; use warnings FATAL = 'all'; use Apache::Test; use Apache::TestRequest; use Apache::TestUtil; plan tests = 1; my $blocks = 33; my $invoked = 100; my $sig = join \n, received $blocks complete blocks, filter invoked $invoked times\n; my $data = # x $blocks . x x $blocks; my $expected = join \n, $data, $sig; { # test the filtering of the mod_perl response handler my $location = '/TestFilter::out_bbs_ctx'; my $response = GET_BODY $location; ok t_cmp($expected, $response, context filter); } 1.1 modperl-2.0/t/filter/out_str_api.t Index: out_str_api.t === # WARNING: this file is generated, do not edit # 01: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:696 # 02: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:713 # 03: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfigPerl.pm:83 # 04: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfigPerl.pm:407 # 05: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:407 # 06: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:422 # 07: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestConfig.pm:1215 # 08: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestRun.pm:398 # 09: /home/stas/apache.org/modperl-2.0/t/../Apache-Test/lib/Apache/TestRunPerl.pm:32 # 10: /home/stas
cvs commit: modperl-2.0/t/response/TestError - New directory
stas2003/01/13 22:41:49 modperl-2.0/t/response/TestError - New directory
cvs commit: modperl-2.0/t/error - New directory
stas2003/01/13 22:41:49 modperl-2.0/t/error - New directory
cvs commit: modperl-2.0/t/response/TestError push_handlers.pm
stas2003/01/13 22:42:44 Modified:src/modules/perl modperl_callback.c .Changes Added: t/error push_handlers.t t/response/TestError push_handlers.pm Log: prevent a segfault when push_handlers are used to push a handler into the currently phase and switching the handler (perl-script/modperl) + tests Revision ChangesPath 1.52 +8 -4 modperl-2.0/src/modules/perl/modperl_callback.c Index: modperl_callback.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- modperl_callback.c1 Jan 2003 03:45:54 - 1.51 +++ modperl_callback.c14 Jan 2003 06:42:43 - 1.52 @@ -93,7 +93,7 @@ modperl_handler_t **handlers; apr_pool_t *p = NULL; MpAV *av, **avp; -int i, status = OK; +int i, nelts, status = OK; const char *desc = NULL; AV *av_args = Nullav; @@ -173,11 +173,15 @@ }; /* XXX: deal with {push,set}_handler of the phase we're currently in */ -MP_TRACE_h(MP_FUNC, running %d %s handlers\n, - av-nelts, desc); +/* for now avoid the segfault by not letting av-nelts grow if + * somebody push_handlers to the phase we are currently in, but + * different handler e.g. jumping from 'modperl' to 'perl-script', + * before calling push_handler */ +nelts = av-nelts; +MP_TRACE_h(MP_FUNC, running %d %s handlers\n, nelts, desc); handlers = (modperl_handler_t **)av-elts; -for (i=0; iav-nelts; i++) { +for (i=0; inelts; i++) { if ((status = modperl_callback(aTHX_ handlers[i], p, r, s, av_args)) != OK) { status = modperl_errsv(aTHX_ status, r, s); } 1.100 +4 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.99 retrieving revision 1.100 diff -u -r1.99 -r1.100 --- Changes 12 Jan 2003 04:05:48 - 1.99 +++ Changes 14 Jan 2003 06:42:44 - 1.100 @@ -10,6 +10,10 @@ =item 1.99_09-dev +prevent a segfault when push_handlers are used to push a handler into +the currently phase and switching the handler (perl-script/modperl) +[Stas] + Add $filter-seen_eos to the streaming filter api to know when eos has been seen, so special signatures can be passed and any data stored in the context flushed + tests. [Stas] 1.1 modperl-2.0/t/error/push_handlers.t Index: push_handlers.t === use strict; use warnings FATAL = 'all'; use Apache::Test; use Apache::TestUtil; use Apache::TestRequest; plan tests = 1; my $location = /TestError::push_handlers; my $expected = ok; my $received = GET_BODY $location; ok t_cmp($expected, $received); 1.1 modperl-2.0/t/response/TestError/push_handlers.pm Index: push_handlers.pm === package TestError::push_handlers; # This test verifies that we don't segfault when push_handlers are # used incorrectly. Here the handler() is running under # SetHandler modperl # and it modifies its handler to be 'perl-script', plus pushes another # handler to run. The result is that the first time handler() is run # under the 'modperl' handler it returns declined, therefore Apache # runs the registered 'perl-script' handler (which handler() has # pushed in plus itself. So the handler() is executed again, followed # by real_response(). Notice that it pushes yet another real_response # callback onto the list of handlers. # # suprisingly the response eventually works, but this is a wrong way # to accomplish that thing. And one of the earlier stages should be # used to push handlers. # # Don't modify the handler (modperl|perl-script) during the response # handler run-time, because if OK is not returned, the handler will be # executed again. use strict; use warnings;# FATAL = 'all'; use Apache::RequestRec (); use Apache::RequestIO (); use Apache::RequestUtil (); use Apache::Const -compile = qw(OK DECLINED); sub handler { my $r = shift; #warn handler called\n; $r-handler(perl-script); $r-push_handlers(PerlResponseHandler = \real_response); return Apache::DECLINED; } sub real_response { my $r = shift; #warn real_response called\n; $r-content_type('text/plain'); $r-print('ok'); return Apache::OK; } 1; __END__
Re: Unregister streamed output filters
Esteban Fernandez Stafford wrote: On Sat, 11 Jan 2003, Stas Bekman wrote: Esteban Fernandez Stafford wrote: Hello all, is there a way to unregister a streamed filter? I have seen this in many (all?) apache (C programmed) filters; they are able of declining the filtering of a certain stream, for example, when they do not know how to handle a certain content type. In the apache api this is done with ap_remove_output_filter(f). Is there something similar in mp2? Not at this moment, but hopefully it'll be supported soon. Since you need this feature, telling us in what situation you'd like to remove a filter will help us to build a better test case and provide a good real-world example for documentation. The easiest example that comes to mind is a filter for text/html that performs some sort of transformation. This filter should unregister for any content type that is not text/html. Browsing through some apache code I have found two ways of doing this. One involves the ap_remove_output_filter function (modules/filters/mod_deflate.c) and the other returns a DECLINED at a cetrtain point (modules/filters/mod_include.c). I am not sure about the internals of each approach but I thought it might help. Yup, I was reading mod_deflate just yesterday and saw it too. Thanks! It occurs to me just now that it maybe also be possible to do this staticaly in httpd.conf. Something like: PerlOutputFilterHandler MyApache::MyHtmlFilter text/html Good idea, eventually there should be TIMTOWTDI ;) __ 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: mod_perl mod_jk
MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1) wrote: I think I found the problem - it was because of a LoadModule directive that was defined in 1.99-07, but renamed to PerlLoadModule in 1.99-08. The reason why I ran into the problem of unable to load mod_jk, was because I was trying to load mod_jk after the mod_perl is loaded. What was happening is that the mod_perl directives' gets registered with Apache as soon as mod_perl is loaded. With the LoadModule defined by mod_perl also, apache's ap_find_command_in_modules command returns a pointer to mod_perl's loadmodule function (modperl_cmd_load_module), instead of apache's load_module function (because mod_perl is the first in the modp list). And then, to complicate the matters, the cmd-req_override is not set to EXEC_ON_READ - thus mod_jk is never loaded.. Question: Is it okay if I rename LoadModule to PerlLoadModule in 1.99-07, and continue with it ?. Does it need more modifications than just renaming it ?.. Should be just that (though some tests will fail, but ignore that) Index: src/modules/perl/mod_perl.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v retrieving revision 1.141 retrieving revision 1.142 diff -u -r1.141 -r1.142 --- src/modules/perl/mod_perl.c 17 Sep 2002 02:05:21 - 1.141 +++ src/modules/perl/mod_perl.c 7 Oct 2002 02:05:43 - 1.142 @@ -636,7 +636,7 @@ MP_CMD_DIR_RAW_ARGS_ON_READ(=cut, pod_cut, End of POD), MP_CMD_DIR_RAW_ARGS_ON_READ(__END__, END, Stop reading config), -MP_CMD_SRV_RAW_ARGS(LoadModule, load_module, A Perl module), +MP_CMD_SRV_RAW_ARGS(PerlLoadModule, load_module, A Perl module), #ifdef MP_TRACE MP_CMD_SRV_TAKE1(PerlTrace, trace, Trace level), #endif Thanks for the debugging pointers, You are welcome ;) __ 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: unsubscribe modperl
[EMAIL PROTECTED] wrote: unsubscribe modperl The information to unsubscribe is in the header of the email: list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:[EMAIL PROTECTED] You have to unsubscribe yourself, I can't help you, so please don't email me. ;) __ 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