Apache::Gallery
Hi, Apache::Gallery is a picture gallery implemented as a mod_perl handler, using libgd2 for on-the-fly image resizing (resized pictures are cached) and CGI::FastTemplate for easy customization. Demo can be seen at http://pictures.legart.dk/ordb/ and source can be downloaded from http://legart.dk/code/Apache-Gallery-0.1.1.tar.gz It is still at a very early stage, but i have alot of ideas for improvements... Would it be ok to upload this to CPAN in the Apache namespace? Thanks, Michael
Re: Why no core dump?
Benoit Caron wrote: Hello. I have a problem with my mod_perl process diying with a : [Wed Oct 3 13:32:12 2001] [notice] child pid 6732 exit signal Segmentation Fault (11) in the error log. I'm still trying to find out what could be the problem, but there's no core file to look out with gdb ou something I've set the CoreDumpDirectory Apache directive to a directory that is world writable, but there still no core dump... http:[EMAIL PROTECTED] check the rest of the thread too: http://forum.swarthmore.edu/epigone/modperl/geldploumon _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Using DOM to build your output documents
On Thursday 04 October 2001 01:43, Jeffrey W. Baker wrote: I believe that the canonical way to output a document using any web scripting language (Perl CGI, mod_perl, PHP, ASP, etc.) is to simply print out your markup, like this fictional example: while (my $row = $sth-fetchrow_arrayred()) { print trtd$row-[0]/tdtd$row-[1]/td/tr\n; } Yes, and I agree with you that this approach has severe drawbacks. Years of practice have made it usable through templating systems and various tricks that people discover as they learn. The linearity is one of the main problems as if the beginning of your output is dependent on something farther down you often have to resort to complex lookaheads. There are also problems with coupling, in that code meant to process one data structure into a string will often be able to process only that data structure. It's hard to make this approach generic, or even to abstract large parts of it. And recursing into arbitrarily deeply nested structures is up to you, whereas using the DOM with XPath (or iterators), or XSLT takes care of that for you. Another major advantage is pipeline processing. You can have several processors in a row, all of them specialised and dealing with the same kind of data structure (a DOM). This is similar to using filters, but filters are painful and require reparsing at every stage. I find it much easier to use a pipeline model, especially when I want to add a new feature as that new feature will live on its own, separate from the rest of the code. I'd love to hear any other experiences with using the DOM to build output from scratch. I'd also like to hear people's opinions on XML::DOM (I think it stinks and I've replaced it with a C DOM implementation). I gave up on XML::DOM the day I tried to patch it to make it DOM 2 compliant (or even only to add namespace support). I tend to use SAX whenever I don't need lookahead, and XML::LibXML for everything DOM related. It isn't 100% complete but it's close, and will soon be. Watch perl-xml for an annoucement of PerlDOM, as it seems likely to happen soon. In all of my recent websites I've used combinations of DOM and SAX processing, always with a pipeline approach. Most of the time this happens in AxKit but there are exceptions where I decided to hand build a few things. I also tend to make a growing use of XSP as it allows you to express the output XML DOM you want from your code in quite a direct manner. As all templating-like approaches you've got to be discplined for it to be readable, but that's easy enough. And more importantly, writing taglibs (in order to avoid embedded code) is rather trivial if you know SAX (and SAX is far from being hard to learn). -- ___ Robin Berjon [EMAIL PROTECTED] -- CTO k n o w s c a p e : // venture knowledge agency www.knowscape.com --- My girlfriend always laughs during sex, no matter what she's reading -- Steve Jobs
Re: OT: secure mod_perl enabled apache on MacOSX 10.1
John Siracusa [EMAIL PROTECTED] writes: P.S.- d) Apache::Request and Apache::Cookie still can't be loaded simultaneously! :( Why not? Does it work OK with a statically-linked mod_perl? -- Joe Schaefer
Re: OT: secure mod_perl enabled apache on MacOSX 10.1
On 10/4/01 9:26 AM, Joe Schaefer wrote: John Siracusa [EMAIL PROTECTED] writes: P.S.- d) Apache::Request and Apache::Cookie still can't be loaded simultaneously! :( Why not? Run-time symbol conflict. Does it work OK with a statically-linked mod_perl? I've never heard of anyone getting it to work correctly in any version of Mac OS X with any sort of apache or Perl installation. (if you're out there, tell us how! :) -John
[patch] overriding per directory PerlSetEnv
Hi, I rescently started to use mod_perl. It works fine, but a strange behavior have found. I have written a patch that collect the behavior. Please comment this. I think that per directory PerlSetEnv variable should be overridden by the value that in the most specific(longest) Directory section. http://localhost/cgi-bin/subdir/printenv with following config will generate VAR=/usr/local/apache/cgi-bin/subdir, but generated result is VAR=/usr/local/apache/cgi-bin. Directory /usr/local/apache/cgi-bin PerlSetEnv VAR /usr/local/apache/cgi-bin /Directory Directory /usr/local/apache/cgi-bin/subdir PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir /Directory Following patch corrects this behavior by modify overriding logic. It seems work well. --- mod_perl-1.26/src/modules/perl/perl_config.c.orig Thu Oct 4 09:31:00 2001 +++ mod_perl-1.26/src/modules/perl/perl_config.cThu Oct 4 09:32:04 2001 @@ -183,7 +183,8 @@ table_entry *elts = (table_entry *)arr-elts; int i; - for (i = 0; i arr-nelts; ++i) { + /* iterate in reverse order to override duplicate key properly */ + for (i = arr-nelts - 1; 0 = i; --i) { MP_TRACE_d(fprintf(stderr, mod_perl_dir_env: %s=`%s', elts[i].key, elts[i].val)); mp_setenv(elts[i].key, elts[i].val); I'm not familar with mod_perl internals and community. Please tell me relative topics, more appropriate place to send patch, etc. # Make my English writing correct is also welcome :-) - YAMAMOTO Kengo [EMAIL PROTECTED]
Re: [patch] overriding per directory PerlSetEnv
i don't think it is supposed to work this way according to the apache documentation. if you want the most specific (longest) one to take precedence, put it before the shorter one in the config file. the relevant documenation is here: http://httpd.apache.org/docs/sections.html YAMAMOTO Kengo wrote: I think that per directory PerlSetEnv variable should be overridden by the value that in the most specific(longest) Directory section. http://localhost/cgi-bin/subdir/printenv with following config will generate VAR=/usr/local/apache/cgi-bin/subdir, but generated result is VAR=/usr/local/apache/cgi-bin. Directory /usr/local/apache/cgi-bin PerlSetEnv VAR /usr/local/apache/cgi-bin /Directory Directory /usr/local/apache/cgi-bin/subdir PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir /Directory -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/
Re: [patch] overriding per directory PerlSetEnv
Couldn't you do the same thing by reversing the ordering of your Directory entries... Directory /usr/local/apache/cgi-bin/subdir PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir /Directory Directory /usr/local/apache/cgi-bin PerlSetEnv VAR /usr/local/apache/cgi-bin /Directory Rob At 1:08 AM +0900 10/5/01, YAMAMOTO Kengo wrote: Hi, I rescently started to use mod_perl. It works fine, but a strange behavior have found. I have written a patch that collect the behavior. Please comment this. I think that per directory PerlSetEnv variable should be overridden by the value that in the most specific(longest) Directory section. http://localhost/cgi-bin/subdir/printenv with following config will generate VAR=/usr/local/apache/cgi-bin/subdir, but generated result is VAR=/usr/local/apache/cgi-bin. Directory /usr/local/apache/cgi-bin PerlSetEnv VAR /usr/local/apache/cgi-bin /Directory Directory /usr/local/apache/cgi-bin/subdir PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir /Directory Following patch corrects this behavior by modify overriding logic. It seems work well. --- mod_perl-1.26/src/modules/perl/perl_config.c.orig Thu Oct 4 09:31:00 2001 +++ mod_perl-1.26/src/modules/perl/perl_config.c Thu Oct 4 09:32:04 2001 @@ -183,7 +183,8 @@ table_entry *elts = (table_entry *)arr-elts; int i; - for (i = 0; i arr-nelts; ++i) { + /* iterate in reverse order to override duplicate key properly */ + for (i = arr-nelts - 1; 0 = i; --i) { MP_TRACE_d(fprintf(stderr, mod_perl_dir_env: %s=`%s', elts[i].key, elts[i].val)); mp_setenv(elts[i].key, elts[i].val); I'm not familar with mod_perl internals and community. Please tell me relative topics, more appropriate place to send patch, etc. # Make my English writing correct is also welcome :-) - YAMAMOTO Kengo [EMAIL PROTECTED] -- Only two things are infinite: The universe, and human stupidity. And I'm not sure about the former. --Albert Einstein
Set VirtualHost IP-Address
hi, Can I set the IP Address of VirtualHost via script from inside Perl section in httpd.conf !? Example? Thanx = iVAN [EMAIL PROTECTED] =
nulls in 'print'
I have a problem with outputing '\0' under mod_perl: all '\0' are silently translated to '\20' when I printing them out. This behavior is mentioned only under mod_perl and not under raw perl. print Hello\0World; will print Hello\x20World I've searched mail-list archive and found that this problem is not only my. But I can't any solution for this. Dmitry Mottl
shared libraries
Hello everybody I'm triying to start a mod_perl apache in a Sun enterprise 450 with solaris 2.6. Everything compile very well, but when I try to start the server the following error message is displayed. ** cronos:/usr/local/apache/bin# ./apachectl start Syntax error on line 72 of /usr/local/apache/conf/httpd.conf: Can't load '/usr/local/lib/perl5/5.6.1/sun4-solaris/auto/B/B.so' for module B: ld.so.1: /usr/local/apache/bin/httpd: fatal: relocation error: file /usr/local/lib/perl5/5.6.1/sun4-solaris/auto/B/B.so: symbol main: referenced symbol not found at /usr/local/lib/perl5/5.6.1/sun4-solaris/XSLoader.pm line 75. at /usr/local/lib/perl5/5.6.1/sun4-solaris/B.pm line 284 Compilation failed in require at /usr/local/lib/perl5/5.6.1/sun4-solaris/B/Terse.pm line 3. BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.6.1/sun4-solaris/B/Terse.pm line 4. Compilation failed in require at (eval 3) line 3. ./apachectl start: httpd could not be started * I have followed this set of instruction to compile everything a. Unpack the apache and mod_perl distributions: gunzip apache_1.3.14.tar.gz tar -xvf apache_1.3.14.tar gunzip mod_perl-1.24_01.tar.gz tar -xvf mod_perl-1.24_01.tar b. Using the perl version 5.6.0 to compile into apache: cd mod_perl-1.24_01 /path/to/perl5.6.0 Makefile.PL \ APACHE_SRC=../apache_1.3.14/src \ USE_APACI=1 \ EVERYTHING=1 \ DO_HTTPD=1 make make install cd ../apache_1.3.14/src configure \ --prefix=/path/to/install/of/www \ --activate-module=src/modules/perl/libperl.a \ --enable-module=unique_id \ --enable-module=info make make install Editing httpd.conf (Apache/mod_perl installations only): Set these values in httpd.conf in addition to other normal configuration settings. NOTE: This is for Apache/mod_perl installations only. If you choose not to take advantage of this configuration, edit your httpd.conf in the usual manner. # Do NOT adjust MaxRequestsPerChild or ExcessRequestsPerChild! MaxRequestsPerChild 50 ExcessRequestsPerChild 1 ExtendedStatus On # Do NOT set these next 4 settings too low, or too high or performance will suffer # Adjust according to hardware capabilities MinSpareServers 5 MaxSpareServers 200 StartServers20 MaxClients 256 PerlTaintCheck Off PerlWarn Off # Do NOT turn PerlFreshRestart On PerlFreshRestart Off PerlModule B::Terse PerlModule B::LexInfo PerlModule B::Deparse PerlPassEnv TERM EDITOR NOCHANCE USER PERL5LIB PerlSetEnv KeyForPerlSetEnv OK PerlSetVar KeyForPerlSetVar OK # This sets @INC for the applications modules PerlRequire lib/perl/startup.pl Alias /perl/ /path/to/server_root/lib/perl/ Location /perl SetHandler perl-script PerlHandler Apache::Registry::handler PerlInitHandler Apache::StatINC Options +ExecCGI PerlSendHeader On /Location Location /server-info order deny,allow deny from all allow from add.your.ip.here SetHandler server info /Location Location /server-status order deny,allow deny from all allow from add.your.ip.here SetHandler server status /Location Location /perl-status order deny,allow deny from all allow from add.your.ip.here PerlSetVar StatusOptionsAll On PerlSetVar StatusDeparse On PerlSetVar StatusTerse On PerlSetVar StatusLexInfo On SetHandler perl-script PerlHandler +Apache::Status /Location Directory /path/to/install/WoS Options FollowSymLinks ExecCGI AllowOverride None Order allow,deny allow from all DirectoryIndex CIW.cgi Files ~ CIW\.cgi$ SetHandler perl-script PerlHandler Apache::Registry::handler Options +ExecCGI PerlSendHeader On /Files
RE: shared libraries
It sounds like you either haven't obtained the B:: module, or there was a compilation problem. You can try to get your current server up and running by commenting out the PerlModule B:: ... references, then try starting it up. Check on the Perl and Apache web sites (www.perl.org, www.apache.org) for information about properly incorporating/using modules with Apache and mod_perl. The perl site has PerlModules available for download if you need the code. Hope this helps, Laurie Laurie Knox ATT - NETAC [EMAIL PROTECTED] -Original Message- From: Gilberto Diaz [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 04, 2001 4:55 PM To: [EMAIL PROTECTED] Subject: shared libraries Hello everybody I'm triying to start a mod_perl apache in a Sun enterprise 450 with solaris 2.6. Everything compile very well, but when I try to start the server the following error message is displayed. ** cronos:/usr/local/apache/bin# ./apachectl start Syntax error on line 72 of /usr/local/apache/conf/httpd.conf: Can't load '/usr/local/lib/perl5/5.6.1/sun4-solaris/auto/B/B.so' for module B: ld.so.1: /usr/local/apache/bin/httpd: fatal: relocation error: file /usr/local/lib/perl5/5.6.1/sun4-solaris/auto/B/B.so: symbol main: referenced symbol not found at /usr/local/lib/perl5/5.6.1/sun4-solaris/XSLoader.pm line 75. at /usr/local/lib/perl5/5.6.1/sun4-solaris/B.pm line 284 Compilation failed in require at /usr/local/lib/perl5/5.6.1/sun4-solaris/B/Terse.pm line 3. BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.6.1/sun4-solaris/B/Terse.pm line 4. Compilation failed in require at (eval 3) line 3. ./apachectl start: httpd could not be started * I have followed this set of instruction to compile everything a. Unpack the apache and mod_perl distributions: gunzip apache_1.3.14.tar.gz tar -xvf apache_1.3.14.tar gunzip mod_perl-1.24_01.tar.gz tar -xvf mod_perl-1.24_01.tar b. Using the perl version 5.6.0 to compile into apache: cd mod_perl-1.24_01 /path/to/perl5.6.0 Makefile.PL \ APACHE_SRC=../apache_1.3.14/src \ USE_APACI=1 \ EVERYTHING=1 \ DO_HTTPD=1 make make install cd ../apache_1.3.14/src configure \ --prefix=/path/to/install/of/www \ --activate-module=src/modules/perl/libperl.a \ --enable-module=unique_id \ --enable-module=info make make install Editing httpd.conf (Apache/mod_perl installations only): Set these values in httpd.conf in addition to other normal configuration settings. NOTE: This is for Apache/mod_perl installations only. If you choose not to take advantage of this configuration, edit your httpd.conf in the usual manner. # Do NOT adjust MaxRequestsPerChild or ExcessRequestsPerChild! MaxRequestsPerChild 50 ExcessRequestsPerChild 1 ExtendedStatus On # Do NOT set these next 4 settings too low, or too high or performance will suffer # Adjust according to hardware capabilities MinSpareServers 5 MaxSpareServers 200 StartServers20 MaxClients 256 PerlTaintCheck Off PerlWarn Off # Do NOT turn PerlFreshRestart On PerlFreshRestart Off PerlModule B::Terse PerlModule B::LexInfo PerlModule B::Deparse PerlPassEnv TERM EDITOR NOCHANCE USER PERL5LIB PerlSetEnv KeyForPerlSetEnv OK PerlSetVar KeyForPerlSetVar OK # This sets @INC for the applications modules PerlRequire lib/perl/startup.pl Alias /perl/ /path/to/server_root/lib/perl/ Location /perl SetHandler perl-script PerlHandler Apache::Registry::handler PerlInitHandler Apache::StatINC Options +ExecCGI PerlSendHeader On /Location Location /server-info order deny,allow deny from all allow from add.your.ip.here SetHandler server info /Location Location /server-status order deny,allow deny from all allow from add.your.ip.here SetHandler server status /Location Location /perl-status order deny,allow deny from all allow from add.your.ip.here PerlSetVar StatusOptionsAll On