Re: [OT] Stack Operation
On Sat, 23 Nov 2002, Jonathan M. Hollin wrote: Can anyone offer me some pointers (pun intended) on how to implement a stack in Perl with an array? The description you give does not describe an 'academic' stack... You would probably need to read some good Perl books. I suggest the classical Programming Perl - Ed. O'Reilly I need to have an array of elements as follows: 0 - e1 1 - e2 2 - e3 ... @stack = (e1, e2, e3, ...) And I need to be able to insert items: e4 needs to go into $array[1]. 1 and 2 need to move down (or up or left or right - depending on how you visualise arrays) yet retain their contents: 0 - e1 1 - e4 2 - e2 3 - e3 splice @stack, 1, 0, e4; ... And, you guessed it, I need to be able to remove elements, and have the others move down... remove e2, leaving: 0 - e1 1 - e4 3 - e3 ... splice @stack, 2, 1; Franck. ESSENTIAL SOFTWARE - Ingénierie Informatique Solutions Linux Open Source en Polynésie française http://www.esoft.pf/ Tél: (689) 562 395 / 541 295 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Fiabilisez vos systèmes informatiques. Osez Linux, le choix moderne des gouvernements et des entreprises Fortune 500
Re: IPC::Open2, mod_perl and cvsweb
On Mon, 25 Nov 2002 23:01:44 -0500, Geoffrey Young [EMAIL PROTECTED] said: Look in archives. I think many people had problems with IPC::Open2 under mod_perl. So far the best solution I know is just replacing it with IPC::Run. Seconded. Go with IPC::Run and you won't regret, since it works under mod_perl and gives you much more than the IPC::Open* family. GY IPC::Run++ Question about IPC::Open2 under mod_perl seems to arise quite frequently. Maybe it should be added to mod_perl guide in 'Frequent mod_perl problems' section. -- Ilya Martynov, [EMAIL PROTECTED] CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org
Re: IPC::Open2, mod_perl and cvsweb
Ilya Martynov wrote: On Mon, 25 Nov 2002 23:01:44 -0500, Geoffrey Young [EMAIL PROTECTED] said: Look in archives. I think many people had problems with IPC::Open2 under mod_perl. So far the best solution I know is just replacing it with IPC::Run. Seconded. Go with IPC::Run and you won't regret, since it works under mod_perl and gives you much more than the IPC::Open* family. GY IPC::Run++ Question about IPC::Open2 under mod_perl seems to arise quite frequently. Maybe it should be added to mod_perl guide in 'Frequent mod_perl problems' section. done. will be online at the troubleshooting.html chapter on the next automatic update (within 6 hours). __ 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
Trouble with make source_scan
Hello, I wanted to add some functionality to mod_perl. I am following the 'mod_per 2.0 Source Code Explained' guide. Before doing any change at all I tried to run 'make source_scan' and I got some errors. Going through build/source_scan.pl I was able to tell which errors where generated from each instruction (see below), but this has not brougth me any further. Can anybody give me a hint about what I could do? Thanks! mod_per: 2.0 (checked out from CVS, Nov 26 2002) perl: 5.8.0 $p-write_structs_pm complains the following: -- failed on enum { APR_BUCKET_DATA = 0, APR_BUCKET_METADATA = 1 } is_metadata; with type=, id=enum, post= at pos=25 -- ... and $p-write_functions_pm complains the following: -- In file included from .apache_includes:4, from :1: xs/modperl_xs_sv_convert.h:149: warning: `mp_xs_sv2_APR__Table' redefined xs/modperl_xs_util.h:10: warning: this is the location of the previous definition xs/modperl_xs_sv_convert.h:321: warning: `mp_xs_sv2_r' redefined xs/modperl_xs_util.h:6: warning: this is the location of the previous definition In file included from .apache_includes:4, from :1: xs/modperl_xs_sv_convert.h:149: warning: `mp_xs_sv2_APR__Table' redefined xs/modperl_xs_util.h:10: warning: this is the location of the previous definition xs/modperl_xs_sv_convert.h:321: warning: `mp_xs_sv2_r' redefined xs/modperl_xs_util.h:6: warning: this is the location of the previous definition panic: multiple types without intervening comma in regexp*( *regcomp_t ) (register PerlInterpreter *my_perl, char* exp, char* xend, PMOP* pm) whited-out as regexp*( *regcomp_t ) ( ) Expecting parenth after identifier in `regcomp_t * Perl_Tregcompp_ptr(register PerlInterpreter *my_perl)' after `regcomp_t ' at /usr/lib/perl5/site_perl/5.8.0/C/Scan.pm line 783. C::Scan::do_declaration('extern\x{9}regcomp_t * Perl_Tregcompp_ptr(register PerlInter...','HASH(0x8782610)','HASH(0x878d788)') called at /usr/lib/perl5/site_perl/5.8.0/C/Scan.pm line 738 C::Scan::do_declarations('ARRAY(0x878261c)','HASH(0x8782610)','HASH(0x878d788)') called at /usr/lib/perl5/site_perl/5.8.0/Data/Flow.pm line 86 Data::Flow::request('Apache::ParseSource::Scan=ARRAY(0x8d3b7dc)','parsed_fdecls') called at /usr/lib/perl5/site_perl/5.8.0/Data/Flow.pm line 39 Data::Flow::get('Apache::ParseSource::Scan=ARRAY(0x8d3b7dc)','parsed_fdecls') called at lib/Apache/ParseSource.pm line 49 Apache::ParseSource::Scan::get('Apache::ParseSource::Scan=ARRAY(0x8d3b7dc)','parsed_fdecls') called at lib/Apache/ParseSource.pm line 311 Apache::ParseSource::get_functions('ModPerl::ParseSource=HASH(0x8ce0714)') called at lib/Apache/ParseSource.pm line 407 Apache::ParseSource::write_functions_pm('ModPerl::ParseSource=HASH(0x8ce0714)','FunctionTable.pm','ModPerl::FunctionTable') called at lib/ModPerl/ParseSource.pm line 40 ModPerl::ParseSource::write_functions_pm('ModPerl::ParseSource=HASH(0x8ce0714)') called at build/source_scan.pl line 34 make: *** [source_scan] Error 255 -- E s t eb a n! :wq
Re: Trouble with make source_scan
Esteban Fernandez Stafford wrote: Hello, I wanted to add some functionality to mod_perl. I am following the 'mod_per 2.0 Source Code Explained' guide. Before doing any change at all I tried to run 'make source_scan' and I got some errors. Going through build/source_scan.pl I was able to tell which errors where generated from each instruction (see below), but this has not brougth me any further. Can anybody give me a hint about what I could do? Thanks! mod_per: 2.0 (checked out from CVS, Nov 26 2002) perl: 5.8.0 It's not working most of the time, as Apache source gets changed all the time. You need the patched Scan.pm from apache.org/~dougm/, but it doesn't seem to work for me with the latest cvs. Hopefully Gerald Richter gets his generalized version to work asap, so we don't rely on C::Scan anymore. When the scan doesn't work, you should manually add the functions to xs/tables/current/, which is pretty easy to do if you don't have many of them. And if you have some improvements to the scarce notes in the 'mod_perl 2.0 Source Code Explained' chapter, please send me a patch... 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
Problems compiling mod_perl 1.99_07 in RH 8.0
Hi, This new RH 8.0 installation is resulting in a calvary. After finding that mod_cgi does not work, that the mod_perl that comes with it breaks all scripts I've got, I have decided to build the latest apache version and mod_perl from scratch. But looks like I am also bumping into problems here: when compiling it, I get this error LD_RUN_PATH=/usr/lib gcc -shared -L/usr/local/lib APR.o -o ../../../blib/arch/auto/APR/APR.so -L/usr/local/apache2/lib -lapr -laprutil /usr/bin/ld: cannot find -lapr Looks like that corresponds to libapreq ; but I'm not too sure where to get it. Is it included in the Apache release? Is it in apache-devel? I have found a RPM for it, but now I'm not sure that's reliable either. ¿Any idea? JJ -- J. J. Merelo [EMAIL PROTECTED] GeNeura
Apache 2?
These days, Apache 2 has become the default version of Apache. On my site, I run a front end Apache and a back end Apache. Front end: Apache 1.x, has mod_accel module which is like mod_proxy, but downloads all the data from the backend ASAP and frees it up immediately, so that a slow modem doesn't tie up the backend Back end: Apache 1.x with mod_perl Here's my question: Is it worth upgrading to Apache 2.x for either the front end or back end? And does Apache 2.x's mod_proxy free up the backend ASAP now?
Outdated link at http://perl.apache.org/products/products.html
I couldn't find a contact address on the modperl website, so I'm posting this here... On http://perl.apache.org/products/products.html there is an outdated link to mwForum. The new URL is: http://www.mwforum.org/
Re: Problems compiling mod_perl 1.99_07 in RH 8.0
J. J. Merelo wrote: Hi, This new RH 8.0 installation is resulting in a calvary. After finding that mod_cgi does not work, that the mod_perl that comes with it breaks all scripts I've got, I have decided to build the latest apache version and mod_perl from scratch. But looks like I am also bumping into problems here: when compiling it, I get this error LD_RUN_PATH=/usr/lib gcc -shared -L/usr/local/lib APR.o -o ../../../blib/arch/auto/APR/APR.so -L/usr/local/apache2/lib -lapr -laprutil /usr/bin/ld: cannot find -lapr Looks like that corresponds to libapreq ; but I'm not too sure where to get it. Is it included in the Apache release? Is it in apache-devel? I have found a RPM for it, but now I'm not sure that's reliable either. ¿Any idea? you have to install httpd-2.0, before you build mod_perl 2.0, and it installs apr and apr-util libs. see the online docs. __ 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: problems with characters being added to a request.
Brian Hirt wrote: Okay, I've been able to create a simple testcase that reproduces the problem I'm having. Hopefully some perl/mod_perl guru out there will be able to tell me what the deal is. The program basically print out three strings, concatinates a few strings and print them out too. I've attached two files, the handler, and the output of a page it created. can't reproduce it here. Were you able to isolate the problem outside mod_perl, so the test case can be sent to p5p? Any help would really be appreciated. On Wed, 2002-11-20 at 21:53, Brian Hirt wrote: I'm running into a problem with some characters being added during a mod_perl request. An  charater is getting added when i print the document STDOUT. When i print that exact same variable to STDERR the  is not added. Here are two hex dumps (via od -hc). The first is what is sent to the web browser, and the 2nd is what is sent to stderr. The issue is coming in with the hex92 and hex96 characters. This sounds like some encoding issue UTF8/ISO-8859-1?? I can't make heads or tails of it. Any ideas? Here is a dump (od -hc) of the document that is getting sent to the web browser: 0002740 6967 3d6e 3e32 6863 7261 6361 6574 c272 g i n = 2 c h a r a c t e r  0002760 7392 7720 7469 2068 96c2 6520 6576 686e 222 s w i t h  226 e v e n h And here is a partial dump of the exact same variable being sent to STDERR: 0002520 3130 302c 640a 636f 3343 635b 6168 6172 0 1 , 0 \n d o c C 3 [ c h a r a 0002540 7463 7265 7392 7720 7469 2068 2096 7665 c t e r 222 s w i t h 226 e v Notice that when the variable is sent to STDOUT, r  222 is getting printed, and when the variable is sent to STDERR r 222 is getting sent. I get the added character with IE, Netscape, telnet localhost 80 and wget. So i don't think it with the browser. And here are the exact two lines in my handler that are printing this variable: print STDERR docC3[$docContents]\n; print $docContents; I'm using perl 5.8.0, Apache/1.3.26 and mod_perl/1.27 package WierdHandler; use MIME::Base64; use Storable qw(freeze thaw); use Apache::Constants 'OK'; use strict; EOF; Add the handler to your httpd.conf file, and make sure the module is in your search path. Location /wierd SetHandler perl-script PerlHandler WierdHandler /Location EOF sub handler { my $apache = shift; $apache-content_type('text/html; charset=ISO-8859-1'); $apache-send_http_header; print htmlheadtitleblah/title/headbody; # notice that the frozen/base64 encoded strings are slightly different. my $string1 = thaw(decode_base64('BAUEMTIzNAQEBAgXhWh0dHA6Ly93d3cuYW1hem9uLmNvbS9leGVjL29iaWRvcy9yZWRpcmVjdD90YWc9bW9ieWdhbWVzJTI2Y3JlYXRpdmU9RDEySkVYSDg3QjRWTEslMjZjYW1wPTIwMjUlMjZsaW5rX2NvZGU9c3AxJTI2cGF0aD1BU0lOL0IwMDAwMlNVUVY=')); # ^AgXh^ my $string2 = thaw(decode_base64('BAUEMTIzNAQEBAgKhWh0dHA6Ly93d3cuYW1hem9uLmNvbS9leGVjL29iaWRvcy9yZWRpcmVjdD90YWc9bW9ieWdhbWVzJTI2Y3JlYXRpdmU9RDEySkVYSDg3QjRWTEslMjZjYW1wPTIwMjUlMjZsaW5rX2NvZGU9c3AxJTI2cGF0aD1BU0lOL0IwMDAwMlNVUVY=')); # ^AgKh^ my $string3 = characters with even; print h1perl says string 1 and 2 are identical/h1\n if $$string1 eq $$string2; print '$string1 is: ul',$$string1,/ul; print '$string2 is: ul',$$string2,/ul; print '$string3 is: ul',$string3,/ul; print hr; my $test1 = $string3 . $$string1; print '$test1 = $string3 . $string1 is: ul',$test1,/ul; my $test2 = $string3 . $$string2; print '$test2 = $string3 . $string2 is: ul',$test2,/ul; print hrWierd, huh? If you look in the error log, you'll see that both test1 and test2 printed out without that funny looking character.br; print /body/html; print STDERR test1:[$test1]\n; print STDERR test2:[$test2]\n; return OK; } 1; perl says string 1 and 2 are identical $string1 is: http://www.amazon.com/exec/obidos/redirect?tag=mobygames%26creative=D12JEXH87B4VLK%26camp=2025%26link_code=sp1%26path=ASIN/B2SUQV $string2 is: http://www.amazon.com/exec/obidos/redirect?tag=mobygames%26creative=D12JEXH87B4VLK%26camp=2025%26link_code=sp1%26path=ASIN/B2SUQV $string3 is: characters with even $test1 = $string3 . $string1 is: characterÂs with  evenhttp://www.amazon.com/exec/obidos/redirect?tag=mobygames%26creative=D12JEXH87B4VLK%26camp=2025%26link_code=sp1%26path=ASIN/B2SUQV $test2 = $string3 . $string2 is: characters with evenhttp://www.amazon.com/exec/obidos/redirect?tag=mobygames%26creative=D12JEXH87B4VLK%26camp=2025%26link_code=sp1%26path=ASIN/B2SUQV
Re: libapreq-1.1 Release Candidate 1
Joe Schaefer wrote: The apreq developers are planning a maintenance release of libapreq-1.1. This version does not include support for modperl-2, but it does address some outstanding problems in 1.0: I have made the below patch to make Apache::Request behave like CGI.pm when parsing multi-valued http POST data. Without the patch the matching of the variable names is case insensitive this results in a multi valued list instead of two separate hash entries if the following fragment is posted. input type=hidden name=GOTO value=up input type=hidden name=goto value=down Since the keys in perl hashes are case sensitive it makes no sense to believe that the above two keys should create a multivalued enty and not two entries, one with key 'GOTO' and the other with 'goto'. To make matters worse actual case used for the resulting multivalued key is only dependent on which field that was parsed first! /Martin -- Martin Nilsson, Civilingenjör M.Sc. CSE Svenska Butiker AB, S:t Larsväg 44, 222 70 Lund, Sweden [EMAIL PROTECTED] Phone: +46-46-304130 http://www.svenskabutiker.se --- Request/Request.xs.org Sun Jan 20 18:27:35 2002 +++ Request/Request.xs Wed Sep 11 18:11:11 2002 @@ -400,7 +400,7 @@ array_header *arr = ap_table_elts(req-parms); table_entry *elts = (table_entry *)arr-elts; for (i = 0; i arr-nelts; ++i) { - if (elts[i].key strcaseEQ(elts[i].key, key)) + if (elts[i].key strEQ(elts[i].key, key)) XPUSHs(sv_2mortal(newSVpv(elts[i].val,0))); } } @@ -429,7 +429,7 @@ if (!elts[i].key) continue; /* simple but inefficient uniqueness check */ for (j = 0; j i; ++j) { - if (strcaseEQ(elts[i].key, elts[j].key)) + if (strEQ(elts[i].key, elts[j].key)) break; } if ( i == j )
General interest question: PDF contents handling in PostgreSQL.
Dear Group, I wonder if using ModPerl and PostgreSQL there's any possibility to resemble what in Oracle is called 'Intermedia', in this particular case parsing/indexing content of PDF files inside PostgreSQL as a LOB or alternatively as a flat OS file with metadata parsed/indexed from it into the RDBMS. For what I can understand, this issue may involve directly PostgreSQL thought as having an analog functionality compared with Oracle 8i/9i so, as far as I know this feature is not implemented natively but probably could has been developed aside as a procedural object or similar. Perhaps something exists in regards of ModPerl used along the RDBMS itself. Any suggestion will be highly appreciated. Many thanks indeed. Fabian R. Breschi
Re: Problems compiling mod_perl 1.99_07 in RH 8.0
[please, post followups to the list! everybody else on the list wants to know the answer, not only you. thanks!] J. J. Merelo wrote: Hi, Looks like that corresponds to libapreq ; but I'm not too sure where to get it. Is it included in the Apache release? Is it in apache-devel? I have found a RPM for it, but now I'm not sure that's reliable either. ¿Any idea? you have to install httpd-2.0, before you build mod_perl 2.0, and it installs apr and apr-util libs. see the online docs. Sorry I didn't mention it, but I built apache 2.0.43 under the same upper dir, and installed it under /usr/local/apache2. The command line for building was: perl Makefile.PL MP_AP_PREFIX=/usr/local/apache2 It does have the apr and apr-util libs, in the correct directory I guess. ls /usr/local/apache2/lib/ apr.exp libapr-0.lalibapr-0.so.0.9.2 libaprutil-0.so aprutil.exp libapr-0.solibaprutil-0.a libaprutil-0.so.0 libapr-0.a libapr-0.so.0 libaprutil-0.lalibaprutil-0.so.0.9.2 Do I have to define another config variable or something? Oops, they did it again. Around mid-Sept the apr project has changed the way they name libs. None of us have had problems because we still had the old libs with the old conventions linked instead of the new ones. what used to be libapr.so.0.9.2, now is named libapr-0.so.0.0.2 (same for aprutil), similar to libdb's naming convention. So here is the patch that will get you going if you use the current cvs. Though it won't work with older aprs. Should probably hide the differences in the ModPerl::MM build. Index: xs/APR/APR/Makefile.PL === RCS file: /home/cvs/modperl-2.0/xs/APR/APR/Makefile.PL,v retrieving revision 1.4 diff -u -r1.4 Makefile.PL --- xs/APR/APR/Makefile.PL 6 Apr 2002 04:42:00 - 1.4 +++ xs/APR/APR/Makefile.PL 26 Nov 2002 13:56:11 - @@ -4,12 +4,11 @@ my $prefix = ModPerl::MM::build_config()-apxs(-q = 'PREFIX'); -my $libdir = $prefix/lib; - -my @libs = map -l$_, qw(apr aprutil); +my @libs = map { qx{$prefix/bin/$_-config --link-ld} } qw(apr apu); +chomp @libs; ModPerl::MM::WriteMakefile( 'NAME'= 'APR', 'VERSION_FROM' = 'APR.pm', -'LIBS' = [-L$libdir @libs], +'LIBS' = \@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: General interest question: PDF contents handling in PostgreSQL.
Fabián R. Breschi writes: I wonder if using ModPerl and PostgreSQL there's any possibility to resemble what in Oracle is called 'Intermedia', in this particular case parsing/indexing content of PDF files inside PostgreSQL as a LOB or alternatively as a flat OS file with metadata parsed/indexed from it into the RDBMS. We use Intermedia and Postres on separate projects. Oracle's PDF parsing can be emulated with pdftotext. You'll need a search engine. Frankly, I'm not totally pleased with Intermedia. It's indexer is slow, and you have to re-optimize often. This affects a bunch of stuff related to the database, e.g., redo logs, which makes db management more difficult. If I had the time, I'd probably drop it. Rob
Re: Problems compiling mod_perl 1.99_07 in RH 8.0
Hi, Looks like that corresponds to libapreq ; but I'm not too sure where to get it. Is it included in the Apache release? Is it in apache-devel? I have found a RPM for it, but now I'm not sure that's reliable either. ¿Any idea? you have to install httpd-2.0, before you build mod_perl 2.0, and it installs apr and apr-util libs. see the online docs. Sorry I didn't mention it, but I built apache 2.0.43 under the same upper dir, and installed it under /usr/local/apache2. The command line for building was: perl Makefile.PL MP_AP_PREFIX=/usr/local/apache2 It does have the apr and apr-util libs, in the correct directory I guess. ls /usr/local/apache2/lib/ apr.exp libapr-0.lalibapr-0.so.0.9.2 libaprutil-0.so aprutil.exp libapr-0.solibaprutil-0.a libaprutil-0.so.0 libapr-0.a libapr-0.so.0 libaprutil-0.lalibaprutil-0.so.0.9.2 Do I have to define another config variable or something? JJ -- J. J. Merelo [EMAIL PROTECTED] GeNeura
Re: Outdated link at http://perl.apache.org/products/products.html
At 11:35 26.11.2002, Philip Mak wrote: I couldn't find a contact address on the modperl website, so I'm posting this here... On http://perl.apache.org/products/products.html there is an outdated link to mwForum. The new URL is: http://www.mwforum.org/ Thank you Philip, it has been corrected. -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: General interest question: PDF contents handling in PostgreSQL.
Fabián R. Breschi wrote: I wonder if using ModPerl and PostgreSQL there's any possibility to resemble what in Oracle is called 'Intermedia', in this particular case parsing/indexing content of PDF files inside PostgreSQL as a LOB or alternatively as a flat OS file with metadata parsed/indexed from it into the RDBMS. You can easilly add this to DBIx::FullTextSearch. All you need to do is write a simple frontend that uses a PDF reading module to extract the text. However, it uses MySQL rather than PostgreSQL. - Perrin
Re: Apache 2?
What do yo mean a modem will tie up the Server? I've never heard this before. - Original Message - From: Philip Mak [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 2:15 AM Subject: Apache 2? These days, Apache 2 has become the default version of Apache. On my site, I run a front end Apache and a back end Apache. Front end: Apache 1.x, has mod_accel module which is like mod_proxy, but downloads all the data from the backend ASAP and frees it up immediately, so that a slow modem doesn't tie up the backend Back end: Apache 1.x with mod_perl Here's my question: Is it worth upgrading to Apache 2.x for either the front end or back end? And does Apache 2.x's mod_proxy free up the backend ASAP now?
Re: Apache 2?
On Tue, Nov 26, 2002 at 11:40:00AM -0800, Grant Cooper wrote: What do yo mean a modem will tie up the Server? I've never heard this before. Let's say you have a mod_perl page that returns a 100k document, and a 28.8k modem downloads that document. The mod_perl process that is serving that document will be tied up until that modem finishes downloading the document, which is inefficient since the mod_perl processes take up a lot of memory. A lightweight front-end proxy that loads the data from the mod_perl process all at once and then feeds it to the modem would save memory.
Identifying memory leaks
A Linux machine running Apache/2.0.35 (Unix) mod_perl/1.99_05-dev Perl/v5.6.1 mysql 4.0.1 uses increasing used memory (according /usr/bin/free), eventually resuting in all memory being consumed. Memory usage drops somewhat after a reboot of apache and mysql, but not completely. If a reference does not go out of scope between sessions, that memory will not be garbage collected. I would like to test for these types of difficulties. Questions: Are there tools to track total (all threads/processes) mod_perl, apache, mysql memory usage? What is the normal behavior for a module which connects (via a global) to a database in terms of mysql processes started?
partial page display
I would like to have some of the page display while the rest of the data for the page is still being retrieved (i.e. a Please wait, this operation takes several seconds... kind of message). I thought (perhaps naively) that a print Please wait.\n; at the beginning of my handler would accomplish this, but mod_perl seems to cache all output until the entire handler has returned. Is this possible without the use of a module like CGI::Push? Perhaps I need to modify the header? Thanks, Fran
Re: Apache 2?
On Tue, Nov 26, 2002 at 03:11:47PM -0800, Grant Cooper wrote: Is there any documention of a HOWTO or a tutorial about a lightweight front-end proxy that loads the data from the mod_perl I wrote a guide a while back on how to install mod_accel and mod_deflate with Apache. It's for Apache 1.3.x; I don't know if it will work with Apache 2.x. http://www.aaanime.net/pmak/apache/mod_accel/
Re: partial page display
local $|=1; - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:11 PM Subject: partial page display I would like to have some of the page display while the rest of the data for the page is still being retrieved (i.e. a Please wait, this operation takes several seconds... kind of message). I thought (perhaps naively) that a print Please wait.\n; at the beginning of my handler would accomplish this, but mod_perl seems to cache all output until the entire handler has returned. Is this possible without the use of a module like CGI::Push? Perhaps I need to modify the header? Thanks, Fran
RE: partial page display
That doesn't work for us. It seems that the browser also maintains a buffer, because if I loop the please wait message 1 times, it does show up immediately. I suspect possibly there's some massaging we can do to the header? Thanks, Fran -Original Message- From: Issac Goldstand [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 26, 2002 2:13 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: partial page display local $|=1; - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:11 PM Subject: partial page display I would like to have some of the page display while the rest of the data for the page is still being retrieved (i.e. a Please wait, this operation takes several seconds... kind of message). I thought (perhaps naively) that a print Please wait.\n; at the beginning of my handler would accomplish this, but mod_perl seems to cache all output until the entire handler has returned. Is this possible without the use of a module like CGI::Push? Perhaps I need to modify the header? Thanks, Fran
RE: partial page display
After much thought on Nov 26 [EMAIL PROTECTED] wrote: I suspect possibly there's some massaging we can do to the header? I wonder if your thinking of the meta tag refresh : META HTTP-EQUIV=Refresh CONTENT=45;URL=http://mydomain.com/tracking.pl Is this a good idea? I hope so, because I'm using it. Jim
Re: Identifying memory leaks
Charles wrote: A Linux machine running Apache/2.0.35 (Unix) mod_perl/1.99_05-dev Perl/v5.6.1 mysql 4.0.1 uses increasing used memory (according /usr/bin/free), eventually resuting in all memory being consumed. Memory usage drops somewhat after a reboot of apache and mysql, but not completely. Well, why it's possible. I doubt it does. Most likely your code causes the leakage. First of all, if you don't report the complete details about your build we can't even start helping to you. Use the proper procedure of reporting problem as described here: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems (linked from the shortcuts menu on the left of perl.apache.org so it's *easy* to find) Second, do you see the same behavior under mod_perl 1.0? If a reference does not go out of scope between sessions, that memory will not be garbage collected. I would like to test for these types of difficulties. First of all you should try and isolate the problem, so your test case is simple. Debugging a huge program can be a problem. The mod_perl guide discusses several ways to debug problems, though not all tools are available to 2.0 yet, so you better off debugging this with mod_perl 1.0 if possible. For example see: http://perl.apache.org/docs/1.0/guide/debug.html#How_can_I_find_out_if_a_mod_perl_code_has_a_memory_leak Questions: Are there tools to track total (all threads/processes) mod_perl, apache, mysql memory usage? Apache::VMonitor for mod_perl 1.0 should be of a good help. I've several obstacles that I'm trying to resolve at the httpd land and then I'll make it available for 2.0. What is the normal behavior for a module which connects (via a global) to a database in terms of mysql processes started? it's also possible that the way your wrote the code brings huge chunks of data from db into the memory and never frees them. (e.g. a closure problem http://perl.apache.org/docs/general/perl_reference/perl_reference.html). in summary, narrow down the test case if possible, hopefully without involving any rdbms code, send the complete details of your setup and we will see what can be done. __ 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: Apache 2?
Philip Mak wrote: On Tue, Nov 26, 2002 at 03:11:47PM -0800, Grant Cooper wrote: Is there any documention of a HOWTO or a tutorial about a lightweight front-end proxy that loads the data from the mod_perl I wrote a guide a while back on how to install mod_accel and mod_deflate with Apache. It's for Apache 1.3.x; I don't know if it will work with Apache 2.x. http://www.aaanime.net/pmak/apache/mod_accel/ and of course your perl.apache.org docs: http://perl.apache.org/docs/1.0/guide/strategy.html http://perl.apache.org/docs/1.0/guide/scenario.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: Apache 2?
Philip Mak wrote: These days, Apache 2 has become the default version of Apache. On my site, I run a front end Apache and a back end Apache. Front end: Apache 1.x, has mod_accel module which is like mod_proxy, but downloads all the data from the backend ASAP and frees it up immediately, so that a slow modem doesn't tie up the backend Back end: Apache 1.x with mod_perl Here's my question: Is it worth upgrading to Apache 2.x for either the front end or back end? And does Apache 2.x's mod_proxy free up the backend ASAP now? Theoretically with mod_perl 2.0 with Apache2.0 threaded mpms architecture the need for the front-end/back-end solution has gone away, because now you can have a few threads running Perl interpreters and many other threads which don't run Perl interpreters. So the front-end and the back-end can now co-exist on the same server. Practically we still need to work out the details. Since if your mod_perl handler sends the data to a thread which runs a filter that send the data to a client (and doesn't need perl) it'll still block on the network transfer, which will block the response handler sending the data. So I can imagine that we will need a special filter that buffers the data, immediately releasing the perl handler and then slowly feeding it to the the client. The prototype can be written in perl and then probably better ported to C. You can use the MyApache::FilterSnoop (http://perl.apache.org/docs/2.0/user/handlers/filters.html#All_in_One_Filter) to trace the data propogation through filters. Of course first you need to understand the 2.0 architecture, which is discussed in details at http://perl.apache.org/docs/2.0/user/index.html (Part IV: mod_perl Handlers). As this is a new documentation please help to improve it. Especially if you have more interesting examples, than the ones I've come up with. __ 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: partial page display
Add a BR/ tag. That's what I throw in to force the browser to flush whatever I fed it onto the screen... Issac - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:25 PM Subject: RE: partial page display That doesn't work for us. It seems that the browser also maintains a buffer, because if I loop the please wait message 1 times, it does show up immediately. I suspect possibly there's some massaging we can do to the header? Thanks, Fran -Original Message- From: Issac Goldstand [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 26, 2002 2:13 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: partial page display local $|=1; - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:11 PM Subject: partial page display I would like to have some of the page display while the rest of the data for the page is still being retrieved (i.e. a Please wait, this operation takes several seconds... kind of message). I thought (perhaps naively) that a print Please wait.\n; at the beginning of my handler would accomplish this, but mod_perl seems to cache all output until the entire handler has returned. Is this possible without the use of a module like CGI::Push? Perhaps I need to modify the header? Thanks, Fran
2.0 estimated release date?
Full of ideas from apachecon and Vegas (cha ching!), I wonder when mod perl 1.99 will become 2.0. Any guesses? Jim
RE: partial page display
Thanks, finally found the right combination... { local $| = 1; $r-content_type('text/html'); $r-send_http_header; print Testing...\n; } -Fran -Original Message- From: Issac Goldstand [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 26, 2002 4:28 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: partial page display Add a BR/ tag. That's what I throw in to force the browser to flush whatever I fed it onto the screen... Issac - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:25 PM Subject: RE: partial page display That doesn't work for us. It seems that the browser also maintains a buffer, because if I loop the please wait message 1 times, it does show up immediately. I suspect possibly there's some massaging we can do to the header? Thanks, Fran -Original Message- From: Issac Goldstand [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 26, 2002 2:13 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: partial page display local $|=1; - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:11 PM Subject: partial page display I would like to have some of the page display while the rest of the data for the page is still being retrieved (i.e. a Please wait, this operation takes several seconds... kind of message). I thought (perhaps naively) that a print Please wait.\n; at the beginning of my handler would accomplish this, but mod_perl seems to cache all output until the entire handler has returned. Is this possible without the use of a module like CGI::Push? Perhaps I need to modify the header? Thanks, Fran
Re: partial page display
[EMAIL PROTECTED] wrote: Thanks, finally found the right combination... { local $| = 1; $r-content_type('text/html'); $r-send_http_header; print Testing...\n; } Peruse the docs and they will save your time: http://perl.apache.org/docs/1.0/guide/performance.html#Using1_Under_mod_perl_and_Better_print___Techniques_ __ 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: partial page display
Jim Martinez wrote: After much thought on Nov 26 [EMAIL PROTECTED] wrote: I suspect possibly there's some massaging we can do to the header? I wonder if your thinking of the meta tag refresh : META HTTP-EQUIV=Refresh CONTENT=45;URL=http://mydomain.com/tracking.pl Is this a good idea? I hope so, because I'm using it. Nope, especially when you *can* control the HTTP response headers. This HTML extension is not supported by all browsers. See http://marc.theaimsgroup.com/?l=apache-modperlm=103658812122901w=2 Instead you should use the HTTP headers to do that. The following thread discusses this issue to death: http://marc.theaimsgroup.com/?t=10365327621r=1w=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: partial page display
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 26 November 2002 04:27 pm, Jim Martinez wrote: I wonder if your thinking of the meta tag refresh : META HTTP-EQUIV=Refresh CONTENT=45;URL=http://mydomain.com/tracking.pl Is this a good idea? I hope so, because I'm using it. One problem with meta-refresh is that it breaks the browser back button. After the refresh occurs and the new page is displayed, if the user hits the back button they wind up back at the meta-refresh page. This can be confusing for users, especially with a short delay. (can be fun on April fools day, though) Just read something about this on the web today, a couple days after using it myself. ... 30 minutes later, after firing up ircd, going to the basement machine where I read the article, and pasting the link into an irc client to retrieve up here... here is the first link in a series on this topic: http://www.w3.org/2001/06tips/reback Mike - -- Learn as if you will live forever, Live as if you will die tomorrow Gandhi http://www.bartley20.net Key servers: http://www-math.uni-paderborn.de/pgp/extract.html 228E3CDB 2002/05/24 Mike Williams (no comment) [EMAIL PROTECTED] Key fingerprint = F138 E5A8 F784 7F15 492C 8F9A B2EE E3EB 228E 3CDB -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE95AwMsu7j6yKOPNsRAhqiAKCqa2TQogtEhQwJ4psDf4NtwxZJFgCfRZbk KDb8egtBLqw+Neijxp2S0QA= =t+cf -END PGP SIGNATURE-
Re: 2.0 estimated release date?
Jim Martinez wrote: Full of ideas from apachecon and Vegas (cha ching!), I wonder when mod perl 1.99 will become 2.0. Any guesses? Somewhere next year? Though some people are already using it in production. It all depends what functionality is needed, since the core is pretty much done, but there are many angles to polish. Of course since you are talking about the ideas from apachecon, you must be talking about the new features 2.0 provides. Both filters and protocols handlers work and they will probably require some extra tuning as more people start using them. 2.0 does need early adopters, who are willing to try things and be patient to report problems and help workout the solutions. 2.0 needs a lot of real world testing before it will released, something that no test suite can replace. __ 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: make test failed when installing mod_perl 2.0 on Linux
Your attention please: [***] [*** ***] [*** please send the followups back to the list! ***] [*** ***] [***] Thank you! Now to the solutions: Dawn Sun wrote: I've used this patch Index: t/hooks/TestHooks/init.pm === RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/init.pm,v retrieving revision 1.3 diff -u -r1.3 init.pm --- t/hooks/TestHooks/init.pm 18 May 2002 02:02:32 - 1.3 +++ t/hooks/TestHooks/init.pm 26 Nov 2002 12:20:03 - @@ -56,6 +56,7 @@ __DATA__ PerlInitHandler TestHooks::init::second Base +PerlModule TestHooks::init PerlInitHandler TestHooks::init::first /Base PerlResponseHandler TestHooks::init But make test failed again. This time, the error changed from the Can't locate TestHooks/init/first.pm in @INC... to Can't locate TestHooks/trans.pm in @INC Other errors remain the same. Good, so probably adding PerlModule TestHook::trans in a similar way (inside Base/Base of t/hooks/TestHooks/trans.pm) should solve that problem too. Though it should have resolved the handlers automatically. You need to enable PERL_TRACE (see the online docs) and post the trace so we can see why these don't get resolved. __ 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: libapreq-1.1 Release Candidate 1
Edward, Instead of just ./configure, you'll need to do ./configure --with-apache-includes=/usr/include/httpd (assuming that's where your apache headers are). That'll get you farther, anyway. Joe, maybe this could be added as a default for Darwin or something? -Ken On Tuesday, November 26, 2002, at 01:12 PM, Edward Moon wrote: PowerBook Ti 667 Rev1 (1GB RAM 30GB HD) OS X 10.2 Apache 1.3.27 installed at Apple default (custom build w/ mod_perl 1.27) Apache 2.0.43 installed at /usr/local/apache2 Ran configure then make and got the error: cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode make[1]: *** [apache_cookie.lo] Error 1 make: *** [all-recursive] Error 1 Gory details follows: [honeycrisp:~/src/httpd-apreq] em% ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets ${MAKE}... yes checking for gcc... gcc checking for C compiler default output... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for style of include used by make... GNU checking dependency style of gcc... gcc checking build system type... powerpc-apple-darwin6.2 checking host system type... powerpc-apple-darwin6.2 checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... no checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -p checking whether ln -s works... yes checking how to recognise dependant libraries... file_magic Mach-O dynamically linked shared library checking command to parse /usr/bin/nm -p output... ok checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking dlfcn.h usability... no checking dlfcn.h presence... no checking for dlfcn.h... no checking for ranlib... ranlib checking for strip... strip checking for objdir... .libs checking for gcc option to produce PIC... -fno-common checking if gcc PIC flag -fno-common works... yes checking if gcc static flag -static works... no checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.lo... yes checking if gcc supports -fno-rtti -fno-exceptions... yes checking whether the linker (/usr/bin/ld) supports shared libraries... yes checking how to hardcode library paths into programs... unsupported checking whether stripping libraries is possible... no checking dynamic linker characteristics... darwin6.2 dyld checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes creating libtool checking for ranlib... (cached) ranlib checking for a BSD-compatible install... /usr/bin/install -c checking whether ln -s works... yes configure: creating ./config.status config.status: creating Makefile config.status: creating c/Makefile config.status: executing depfiles commands [honeycrisp:~/src/httpd-apreq] em% make Making all in c source='apache_cookie.c' object='apache_cookie.lo' libtool=yes \ depfile='.deps/apache_cookie.Plo' tmpdepfile='.deps/apache_cookie.TPlo' \ depmode=gcc /bin/sh ../depcomp \ /bin/sh ../libtool --mode=compile gcc -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -DPACKAGE=\libapreq\ -DVERSION=\1.1\ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -I. -I. -I/usr/local/apache/include-g -O2 -c -o apache_cookie.lo `test -f 'apache_cookie.c' || echo './'`apache_cookie.c mkdir .libs gcc -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -DPACKAGE=\libapreq\ -DVERSION=\1.1\ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -I. -I. -I/usr/local/apache/include -g -O2 -c apache_cookie.c -Wp,-MD,.deps/apache_cookie.TPlo -fno-common -DPIC -o ..libs/apache_cookie.lo apache_request.h:5: header file 'httpd.h' not found apache_request.h:6: header file 'http_config.h' not found apache_request.h:7: header file 'http_core.h' not found apache_request.h:8: header file 'http_log.h' not found apache_request.h:9: header file 'http_main.h' not found apache_request.h:10: header file 'http_protocol.h' not found
Re: Apache 2?
Philip == Philip Mak [EMAIL PROTECTED] writes: Philip Let's say you have a mod_perl page that returns a 100k document, and a Philip 28.8k modem downloads that document. Philip The mod_perl process that is serving that document will be tied up Philip until that modem finishes downloading the document, which is Philip inefficient since the mod_perl processes take up a lot of memory. A Philip lightweight front-end proxy that loads the data from the mod_perl Philip process all at once and then feeds it to the modem would save memory. Yeah, I did this to stonehenge.com about five months ago, and am now handling about 3-4 times the traffic for the same loadav. All on one machine. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!