Re: Seg fault (11) backtrace (long email) - was RE: does anyone havea fix for this?
On Thu, 3 Aug 2000, Jamie Krasnoo wrote: Program received signal SIGSEGV, Segmentation fault. 0x8086ef0 in perl_handler_ismethod () yes, cvs should fix this, here's the diff: --- mod_perl.c 2000/05/25 18:06:23 1.121 +++ mod_perl.c 2000/06/02 17:23:07 1.122 @@ -1222,7 +1222,7 @@ } #ifdef CVf_METHOD -if (CvFLAGS(cv) CVf_METHOD) { +if (cv (CvFLAGS(cv) CVf_METHOD)) { is_method = 1; } #endif
Re: [OT]SegFaults, not PerlFreshRestart or module related
On Mon, 19 Jun 2000, Paul wrote: I'm running out of ideas. PerlFreshRestart was completely unused, then explicitly set Off. I have two handlers, which seem to work well. My logs report nothing amiss aside from the stream of segmentation faults killing off my server children, usually several in quick succession, then minutes or hours apart. This makes me think it's usage-based (duh), but I can't seem to pin it down. And there are no core files. Shouldn't a segmentation fault that kills a process produce a core file? What gives? I even logged in as root and did a "find / -name 'core'", in case it was dumping it in some obscure spot off the normal web directories. Not a single hit. We don't have gdb on this server, but I assumed it was GNUware and was going to install it -- but doesn't it need a core file? I hate to even post this, but I'm completely baffled. I have users trying to hit the site from bookmarks, and getting the "document contained no data" popup; I can only assume it's my children segfaulting, and on no particular page. core files might not be produced depending on the user your server runs as, i think ulimit can change that or something, but don't know off the top of my head. if you can't reproduce the problem at will, attach to a any apache child (make sure it's not the parent!) with gdb (see the SUPPORT doc for hints) and wait for a segv. then pass along `bt' and `curinfo' to us.
RE: Question about $sth-finish;
From: Jay Jacobs [mailto:[EMAIL PROTECTED]] On Tue, 15 Aug 2000, Tom Mornini wrote: It is my understanding of the DBI docs that you only need to call $sth-finish when you DON'T fetch all the rows that the $sth has ready to return. From "Writing Apache Modules with Perl and C": "You should still call finish() at the end of each series of fetches, even though you are going to reuse the statement handler. Failure to do so can lead to memory leaks." You picked the wrong authority for this! The right place (tm) to look when discussing DBI is 'perldoc DBI'. The relevant quote is: finish $rc = $sth-finish; Indicates that no more data will be fetched from this statement handle before it is either executed again or destroyed. It is rarely needed but can sometimes be helpful in very specific situations in order to allow the server to free up resources currently being held (such as sort buffers). When all the data has been fetched from a select statement the driver should automatically call finish for you. So you should not normally need to call it explicitly. Note the last sentence! If I remember correctly, it also frees up any resources used by the database (depending on db) for the query, like for sorting, joining, etc. But I can't quote a source for that one. There is no authoritative source for that fallacy - I hope! From my point of view, it never hurts to call finish()... Quite true. Do you also undef all your variables just before they go out of scope? Thats comparable. There are a *few* situations where finish is needed (Michael Peppler has shown one, the DBI docs list another) but must DBI programmers won't need finish ever. Henrik
RE: Question about $sth-finish;
From: Vladislav Safronov [mailto:[EMAIL PROTECTED]] What can you say about this code? is it ok (overwriting previous handle)? == sub foo { my $dbh = shift; my $sql1 = "select *... my $sql2 = "select *... my $sth = $dbh-prepare($sql1); $sth-execute; .. fetch some data. # should be $sth-finish inserted?? $sth = $dbh-prepare($sql2); # we overwrite previous handle saved in $sth .. $sth-execute; .. fetch some data. return; } == $sth-finish should be inserted if (and ONLY if) the C...fetch some data does NOT fetch ALL data in the select. If you do some thing like: while (my $r=$sth-fetchrow_arrayref) { .. handle data; } there is no reason to call finish, but if you do while (...$sth-fetch..) { last if some condition; } you will have to call finish, but I would reccomend using another name for the second statement (that would help the poor sod who will try to understand this in a years time :) Henrik
Re: DIR_MERGE and .htaccess
On Tue, 15 Aug 2000, Doug MacEachern wrote: On Tue, 4 Jul 2000, Matt Sergeant wrote: Shouldn't DIR_MERGE be called when .htaccess files are found at different levels, e.g: /axkit/.htaccess and /axkit/test/.htaccess I ask for /axkit/test/test.xsp I would have expected it to ask for both .htaccess files and try and merge the two using DIR_MERGE, but it doesn't. Am I missing something, or is this expected functionality? it's up to apache when dir_merge gets called. do you see other apache config getting merged in that scenario? i'm not sure what's supposed to happen in that case without testing. I can't recall either now - but I don't seem to have a problem with it any more... Glad to see you're off read-only mode again :-) -- Matt/ Fastnet Software Ltd. High Performance Web Specialists Providing mod_perl, XML, Sybase and Oracle solutions Email for training and consultancy availability. http://sergeant.org | AxKit: http://axkit.org
Re: RFC: Apache::Reload
On Fri, 11 Aug 2000, Matt Sergeant wrote: sub handler { my $r = shift; my $do_undef = ref($r) (lc($r-dir_config("UndefOnReload") || '') eq 'on'); Would be neat to have this as an import parameter. I don't know why I never got it into StatINC, but I've changed that to have a parameter for what files to reload and other things like that. It would make a lot of sense to merge your reload and StatINC I think, with an on/off switch for "old StatINC behavior", possibly invoked by loading Apache::StatINC (which would load Apache::Reload). It should be called Apache::Reload and be distributed in the mod_perl package, IMO. - ask -- ask bjoern hansen - http://www.netcetera.dk/~ask/ more than 70M impressions per day, http://valueclick.com
Re: crash in modperl-1.24
On Tue, 15 Aug 2000, Mark D. Anderson wrote: (not sure whose email got delayed since i posted this question some time ago -- thanks for the tip though on how to get more meaningful modperl crash info). The problem was the symbol conflict between XML::Parser and apache when built with expat. This has been apparently known for over a year, but has still not been fixed last i checked, presumably because it involves 4 different products interacting: apache builds with expat, modperl gets linked in, then modperl pulls in XML::Parser which pulls in expat again. I rebuilt apache disabling expat and all was fine. This is so common a configuration (apache, modperl, and XML::Parser), i have to assume that the only reason there is not rioting in the streets is because perhaps it only happens the way i built it (apache statically linking modperl). I'm rioting, I'm rioting... But I don't have quite enough time to devote to it... And I wanted to register the domain name 4expat.org to try and sort this out but my ISP wants £100 a year to do dns on an extra domain name!!! Anyway, this is a much larger problem than you expect. Not only is XML::Parser pulling in a custom non-dso expat, but so is PHP, and so is Sablotron (XSLT processor), and so is some TCL module... We need a single DSO expat that is used by everyone, but I don't have the time or resources to fix it... :-( -- Matt/ Fastnet Software Ltd. High Performance Web Specialists Providing mod_perl, XML, Sybase and Oracle solutions Email for training and consultancy availability. http://sergeant.org | AxKit: http://axkit.org
Re: RFC: Apache::Reload
On Tue, 15 Aug 2000, Ask Bjoern Hansen wrote: On Fri, 11 Aug 2000, Matt Sergeant wrote: sub handler { my $r = shift; my $do_undef = ref($r) (lc($r-dir_config("UndefOnReload") || '') eq 'on'); Would be neat to have this as an import parameter. I've removed it from 0.02, apparently its unnecessary. I don't know why I never got it into StatINC, but I've changed that to have a parameter for what files to reload and other things like that. It would make a lot of sense to merge your reload and StatINC I think, with an on/off switch for "old StatINC behavior", possibly invoked by loading Apache::StatINC (which would load Apache::Reload). See 0.02, its now a fully fledged StatINC replacement along with the new functionality. -- Matt/ Fastnet Software Ltd. High Performance Web Specialists Providing mod_perl, XML, Sybase and Oracle solutions Email for training and consultancy availability. http://sergeant.org | AxKit: http://axkit.org
RE: Question about $sth-finish;
Well, summarizing all the answers and assuming using Mysql 1. $sth-finish should be used if (and ONLY if) the the returned data (any SELECT, but not INSERT, UPDATE?) has not been fetched ALL and $sth is going to be overwritten.. 2. $sth (defined as 'my') should not call finish before it gets out of scope.. Vlad/
getting rid of nested sub lexical problem
Due to forgetfulness I was recently bitten by the infamous "my() Scoped Variable in Nested Subroutines" problem using Apache::Registry, and it got me thinking about whether it is fixable. From the diagnostics: This problem can usually be solved by making the inner subroutine anonymous, using the sub {} syntax. When inner anonymous subs that reference variables in outer subroutines are called or referenced, they are automatically rebound to the current values of such variables. I think it should be possible for Registry to pre-process the source code to turn all top-level named subroutines into sub refs. For example, convert subroutines of the form sub foo { CODE } into sub foo { { sub { CODE } } } Are there cases for which this would not work? I have a sneaking suspicion that I am missing something important. If it is a reasonable solution, I imagine there are better ways to do this transformation than fancy regexps? Parse/modify/deparse? Below is a processed version of the increment_counter example from the guide that works as expected. --Chris #!/usr/bin/perl -w use strict; for (1..3){ print "run: [time $_]\n"; run(); } sub run { my $counter = 0; increment_counter(); increment_counter(); sub increment_counter {{sub{ $counter++; print "Counter is equal to $counter !\n"; }}} } # end of sub run
Printing under MOD_Perl
Hi all, I try to print to a local printer from an CGI script running under mod_perl. Using the open pipe function does not work. How can I manage ? (systemcall?). tnx in advance, mfs
Re: Redirects issues...
Trevor Phillips [EMAIL PROTECTED] wrote: I'm revisiting a routine I have which in the ContentHandler phase, redirects to another URI (status 302). While redirecting, I'd like to also set a cookie. I set the URI header as well, due to habit. Didn't there used to be a browser which required URI instead of Location? Is it safe to only use Location?? However, in my output from the above, I don't see the URI heading, and I don't see the cookie heading. So I came up with the following alternative: [ $r-status(302); ... return OK ] I've come across the same problem, and I like to set URI along with Location too. I don't like the workaround solution, because it makes Apache log a '200' return code. What I did was something like this: $r-header_out(Location = $url); $r-err_header_out(URI = $url); err_cookies($r); return REDIRECT; where err_cookies is: sub err_cookies { my $r = shift; my @cookies = $r-headers_out-get("Set-Cookie"); $r-err_headers_out-add("Set-Cookie" = \@cookies); } That seems to do the trick for me. -- Roger Espel Llima, [EMAIL PROTECTED] http://www.iagora.com/~espel/index.html
RE: $r-get_handlers bug/oversight?
-Original Message- From: Doug MacEachern [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 15, 2000 11:22 PM To: Geoffrey Young Cc: '[EMAIL PROTECTED]' Subject: Re: $r-get_handlers bug/oversight? On Tue, 25 Apr 2000, Geoffrey Young wrote: Hi all... I've noticed that get_handlers() will return the enabled handlers for a PerlPostReadRequestHandler, but not when it is specified as a PerlInitHandler (either by calling $r-get_handlers('PerlPostReadRequestHandler') or $r-get_handlers('PerlInitHandler'). It is the same with PerlHeaderParserHandler. An oversight? PerlInitHandler is just an alias for PerlPostReadRequestHandler and PerlHeaderParserHandler. mod_perl can only know at config-time if InitHandler should be alias to PostReadRequest or HeaderParser, i don't think get_handlers() can figure out which you mean at request time. ack... so the alias only goes one way? I guess it makes sense that we can't know at run time what the Init handler stands for, but how come get_handlers('PerlInitHandler') comes up blank? Isn't it just a table entry? Also, I can't get anything for PerlCleanupHandlers, which kinda makes sense, since Cleanup isn't really a phase, per se (at least according to the book). Does it make sense to add this to get_handlers() as well? the get_handlers() patch posted earlier should enable get/set of PerlCleanupHandlers. well, it got the handler ok, but I couldn't set it properly: #!/usr/bin/perl my $r = shift; $r-set_handlers(PerlCleanupHandler = [\cleanup]); $r-send_http_header('text/plain'); print "done"; sub cleanup { warn "hi"; } is a no go. same with using ['My::Cleanup'] as the arg... I also noticed that the patch didn't fix the get_handlers() coderef bug: #!/usr/bin/perl my $r = shift; $r-push_handlers(PerlCleanupHandler = sub { warn "hi"; }); #my $handlers = $r-get_handlers('PerlCleanupHandler'); $r-send_http_header('text/plain'); print "done"; uncomment the get_handlers() line and the cleanup handler never runs and you get "Attempt to free unreferenced scalar" if you have some tuits :) --Geoff
RE: Printing under MOD_Perl
Did you think about http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subproce ss I mean that if you detach an subproc witch deals with printings your main mod_perl server doesn't wait for the print Job complete . Best Constantin - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 16, 2000 12:40 PM Subject: Printing under MOD_Perl Hi all, I try to print to a local printer from an CGI script running under mod_perl. Using the open pipe function does not work. How can I manage ? (systemcall?). tnx in advance, mfs
SSI and PerlHandler
Hello All, I currently have a PerlHandler that simply appends some data to all outgoing text/html files. In my .htaccess file: SetHandler perl-script PerlHandler AddHtml Then in the AddHtml.pm file: ... ## Print the page asis my $rqh = Apache::File-new($r-filename) || return DECLINED; ## Print the content $r-send_http_header(); $r-send_fd($rqh); ## Append the secret message $r-print("\n\n Hi!"); It works well for the most part, but there are a few quirks: 1) text/html output from cgi scripts isn't modified and 2) all server-parsed .shtml SSI directives are ignored. I just bought the "Writing Apache Modules" book, but haven't been able to find a quick fix to my problem (I guess I /am/ lazy). Is there a Handler stage in which I can gain access to all parsed/compiled html right before it gets spit out to the client? Thanks, Jim Sproull [EMAIL PROTECTED]
Re: SSI and PerlHandler
You might use Apache::Filter and chain your output into Apache::SSI. Works for me but ymmv :-) Simon Wilcox Williams Lea Group. From "Jim Sproull" [EMAIL PROTECTED] Date 14:34:15 16 August 2000 To: [EMAIL PROTECTED] cc:(bcc: Simon Wilcox/BASE/WilliamsLea) Fax to: Subject: SSI and PerlHandler Hello All, I currently have a PerlHandler that simply appends some data to all outgoing text/html files. In my .htaccess file: SetHandler perl-script PerlHandler AddHtml Then in the AddHtml.pm file: ... ## Print the page asis my $rqh = Apache::File-new($r-filename) || return DECLINED; ## Print the content $r-send_http_header(); $r-send_fd($rqh); ## Append the secret message $r-print("\n\n Hi!"); It works well for the most part, but there are a few quirks: 1) text/html output from cgi scripts isn't modified and 2) all server-parsed .shtml SSI directives are ignored. I just bought the "Writing Apache Modules" book, but haven't been able to find a quick fix to my problem (I guess I /am/ lazy). Is there a Handler stage in which I can gain access to all parsed/compiled html right before it gets spit out to the client? Thanks, Jim Sproull [EMAIL PROTECTED]
Re: Session manager(s)-how to set an outbound session ?
Bill Moseley wrote: FWIW -- I'm using a modified version of Ken Williams' Apache::AuthCookie to handle session control via cookies or munged URLs. I originally wanted to use his custom login script instead of the pop-up browser login, but I had clients that don't have cookies enabled. So I added the URL munge into AuthCookie. [...] If anyone is interested, please let me know. (Ken, are these features worth adding to AuthCookie?) Quite possibly. I'm away from my home turf now, but I'll take a look when I get home. Of course, having a module called AuthCookie that doesn't necessarily use cookies might be a tad strange. =) BTW -- Why can't I use PerlTransHandler Sample::AuthCookieHandler instead of PerlTransHandler Sample::AuthCookie Shouldn't handler() be found in @ISA? Probably because mod_perl is invoking your handler as a function and not a method. Does it work if you change it to Sample::AuthCookieHandler-handler, or fix the prototype of the handler subroutine to ($$)?
Problems installing Apache::Scoreboard
Title: Problems installing Apache::Scoreboard I am running RH6.0 / Perl 5.005_03 / mod_perl 1.22 and I'm getting the following errors when trying to install Apache::Scoreboard. Any ideas? # make mkdir blib mkdir blib/lib mkdir blib/lib/Apache mkdir blib/arch mkdir blib/arch/auto mkdir blib/arch/auto/Apache mkdir blib/arch/auto/Apache/Scoreboard mkdir blib/lib/auto mkdir blib/lib/auto/Apache mkdir blib/lib/auto/Apache/Scoreboard mkdir blib/man3 cp lib/Apache/ScoreboardGraph.pm blib/lib/Apache/ScoreboardGraph.pm cp Scoreboard.pm blib/lib/Apache/Scoreboard.pm make[1]: Entering directory `/root/.cpan/build/Apache-Scoreboard-0.10/Dummy' mkdir ../blib/arch/auto/Apache/DummyScoreboard mkdir ../blib/lib/auto/Apache/DummyScoreboard cp DummyScoreboard.pm ../blib/lib/Apache/DummyScoreboard.pm /usr/bin/perl -I/usr/lib/perl5/5.00503/i386-linux -I/usr/lib/perl5/5.00503 /usr/lib/perl5/5.00503/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.00503/ExtUtils/typemap -typemap /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Apache/typemap -typemap typemap DummyScoreboard.xs xstmp.c mv xstmp.c DummyScoreboard.c Please specify prototyping behavior for DummyScoreboard.xs (see perlxs manual) cc -c -I../ -I/usr/lib/perl5/site_perl/5.005/i386-linux/auto/Apache/include -I/usr/lib/perl5/site_perl/5.005/i386-linux/auto/Apache/include/modules/perl -I/usr/lib/perl5/site_perl/5.005/i386-linux/auto/Apache/include/include -I/usr/lib/perl5/site_perl/5.005/i386-linux/auto/Apache/include/regex -I/usr/lib/perl5/site_perl/5.005/i386-linux/auto/Apache/include/os/unix -I/usr/include/apache -Dbool=char -DHAS_BOOL -I/usr/local/include -O2 -DVERSION=\0.04\ -DXS_VERSION=\0.04\ -fpic -I/usr/lib/perl5/5.00503/i386-linux/CORE DummyScoreboard.c In file included from DummyScoreboard.xs:2: /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Apache/include/include/scoreboard.h:150: field `start_time' has incomplete type /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Apache/include/include/scoreboard.h:151: field `stop_time' has incomplete type make[1]: *** [DummyScoreboard.o] Error 1 make[1]: Leaving directory `/root/.cpan/build/Apache-Scoreboard-0.10/Dummy' make: *** [subdirs] Error 2 -- Robert Jenks [EMAIL PROTECTED] Sr. Software Engineer Physia Corporation http://www.physia.com
RE: getting rid of nested sub lexical problem
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 16, 2000 2:17 AM To: [EMAIL PROTECTED] Subject: getting rid of nested sub lexical problem Below is a processed version of the increment_counter example from the guide that works as expected. --Chris #!/usr/bin/perl -w use strict; for (1..3){ print "run: [time $_]\n"; run(); } sub run { my $counter = 0; increment_counter(); increment_counter(); sub increment_counter {{sub{ $counter++; print "Counter is equal to $counter !\n"; }}} } # end of sub run That gives me a 'Variable "$counter" may be unavailable at ./tst2 line 17.' warning. And its sort of obfuscated (to me, anyway). I'd probably do it this way: #!/usr/local/bin/perl -w use strict; #!/usr/bin/perl -w use strict; for (1..3){ print "run: [time $_]\n"; run(); } { my $counter; sub run { $counter = 0; print $counter,"\n"; increment_counter(); increment_counter(); } sub increment_counter { $counter++; print "Counter is equal to $counter !\n"; } }
Re: getting rid of nested sub lexical problem
"Douglas" == Douglas Wilson [EMAIL PROTECTED] writes: Douglas That gives me a 'Variable "$counter" may be unavailable at ./tst2 line 17.' Douglas warning. And its sort of obfuscated (to me, anyway). I'd probably do it this Douglas way: Douglas #!/usr/local/bin/perl -w Douglas use strict; Douglas #!/usr/bin/perl -w Douglas use strict; Douglas for (1..3){ Douglas print "run: [time $_]\n"; Douglas run(); Douglas } Douglas { Douglas my $counter; Douglas sub run { Douglas $counter = 0; Douglas print $counter,"\n"; Douglas increment_counter(); Douglas increment_counter(); Douglas } Douglas sub increment_counter { Douglas$counter++; Douglasprint "Counter is equal to $counter !\n"; Douglas } Douglas } But *that* won't work inside the big subroutine created by Apache::Registry (which is NOT the same as mod_perl, even though too many people think so :), and that was the original point. I'm not sure the new code fixes it. I think the problem is intractable, or equivalent to the Travelling Salesman and the Farmer's Daughter problem or something like that. :) -- 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!
$r-custom_response
Apache/1.3.12 (Unix) mod_perl/1.24 Perl 5.6.0 In which handlers can $r-custom_response be set? Is there any way to chain ErrorDocuments? I'd like to add a header and do some special logging on some errors, but let the normal error response do its work. And, as has been said before, it would be nice to be able to set up error documents all within my module. So, instead of this: ErrorDocument 302 /MISSING ErrorDocument 301 /MISSING Location /MISSING SetHandler perl-script PerlHandler Apache::SomeModule-error_document /Location I'd like to be able to do something like all within some handler: $r-custom_response( REDIRECT , \error_document ); $r-custom_response( MOVED , \error_document ); But I guess that's an issue with Apache and not with mod_perl. Thanks, Bill Moseley mailto:[EMAIL PROTECTED]
Errors from Apache.pm
All, I am seeing the following errors in my apache error log. These have appeared since moving to a Linux/mod_perl1.24 combination (from NT/1.23) so I don't know if they come from 1.24 or from the -w switch being handled better under unix. Anyone know what these are and how to get rid of them ? I had a look but I really don't feel confident enough do start playing around with this module :-) [Wed Aug 16 17:45:12 2000] null: Use of uninitialized value at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache.pm line 184. [Wed Aug 16 17:45:12 2000] null: Use of uninitialized value at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache.pm line 184. [Wed Aug 16 17:45:13 2000] null: Use of uninitialized value at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache.pm line 184. Many thanks, Simon Wilcox.
canned footers
hello, all I am trying to write a module that generates a canned footer for all html and cgi pages on my site. the html part is pretty easy and I have already implemented it. However, I am currently having trouble adding it to standalone cgi scripts that are not parsed by the server. I have tried a number of variations with mod_perl subrequests but none of them seem to work right. I also thought about reading the scripts contents in the module and using eval. However, that seems a little cumbersome. Have any of you implemented such thing before? Any ideas? -amen
RE: canned footers
It may not be exactly what you're looking for but try looking at Apache::Sandwich or Apache::ProxyStuff On 16-Aug-2000 Alex Menendez wrote: hello, all I am trying to write a module that generates a canned footer for all html and cgi pages on my site. the html part is pretty easy and I have already implemented it. However, I am currently having trouble adding it to standalone cgi scripts that are not parsed by the server. I have tried a number of variations with mod_perl subrequests but none of them seem to work right. I also thought about reading the scripts contents in the module and using eval. However, that seems a little cumbersome. Have any of you implemented such thing before? Any ideas? -amen -- Jason Bodnar + [EMAIL PROTECTED] + Team Linux It's okay, Marge. I've learned my lesson. A mountain of sugar is too much for one man. It's clear now why God portions it out in those tiny packets, and why he lives on a plantation in Hawaii. -- Homer Simpson Lisa's Rival
RE: canned footers
This already exists, can't get more canned than that. checkout mod_layout here: http://www.tangent.org/mod_layout/ Granted it's not a perl module, but it works and is rather customizable... -Original Message- From: Alex Menendez [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 16, 2000 1:26 PM To: [EMAIL PROTECTED] Subject: canned footers hello, all I am trying to write a module that generates a canned footer for all html and cgi pages on my site. the html part is pretty easy and I have already implemented it. However, I am currently having trouble adding it to standalone cgi scripts that are not parsed by the server. I have tried a number of variations with mod_perl subrequests but none of them seem to work right. I also thought about reading the scripts contents in the module and using eval. However, that seems a little cumbersome. Have any of you implemented such thing before? Any ideas? -amen
Re: canned footers
Have you looked at Apache::Sandwich from CPAN? It is easy to implement and I have used it for awhile now to add confidentiality headers and footers to pages in a small to medium site. cpan m /Apache::Sandwich/ Module id = Apache::Sandwich CPAN_USERID VKHERA (Vivek Khera [EMAIL PROTECTED]) CPAN_VERSION 2.04 CPAN_FILEV/VK/VKHERA/Apache-Sandwich-2.04.tar.gz MANPAGE Apache::Sandwich - Layered document (sandwich) maker INST_FILE/opt/gnu/lib/perl5/site_perl/5.005/Apache/Sandwich.pm INST_VERSION 2.04 It could most certainly be use as a basis for your needs and requirements. Peace.
DB persistence
Hi all, I think I misled everybody with my previous question on this topic. To put it in simple words: Apache 1.3.12/mod_perl 1.24/Solaris 2.7 I'm establishing db connection at server startup and the logs indicate that's done. But in my subsequent calls to 'connect' in my scripts, I see the same message "Establishing connection to PURCHASEDB:purchasedb" in my webserver error log. Does this mean it's ignoring the already available db handle and making fresh connections? In other words, how do I make sure whether the original handle is used or if a fresh connection is established? Any help is greatly appreciated. Thanks, Pramod
Re: canned footers
Your right. this works great for html! Unfortunately, however, Apache sandwich really does not work for me because it only deals with GET requests and it can not deal with cgi requests directly. I would need to alter my cgi's in order to use sandwich. I am looking for a mod_perl solution that will add footers to unaltered stand alone cgis. any other ideas out there? thanx, -amen "Bruce W. Hoylman" wrote: Have you looked at Apache::Sandwich from CPAN? It is easy to implement and I have used it for awhile now to add confidentiality headers and footers to pages in a small to medium site. cpan m /Apache::Sandwich/ Module id = Apache::Sandwich CPAN_USERID VKHERA (Vivek Khera [EMAIL PROTECTED]) CPAN_VERSION 2.04 CPAN_FILEV/VK/VKHERA/Apache-Sandwich-2.04.tar.gz MANPAGE Apache::Sandwich - Layered document (sandwich) maker INST_FILE/opt/gnu/lib/perl5/site_perl/5.005/Apache/Sandwich.pm INST_VERSION 2.04 It could most certainly be use as a basis for your needs and requirements. Peace.
Re: canned footers
"BWH" == Bruce W Hoylman [EMAIL PROTECTED] writes: BWH Have you looked at Apache::Sandwich from CPAN? It is easy to implement BWH and I have used it for awhile now to add confidentiality headers and BWH footers to pages in a small to medium site. The only real trick is that you are responsible for the resulting "sandwich" to be valid HTML. Apache::Sandwich does not insert headers/footers in the right place within a complete HTML document. It just pastes text files together. That said, I find it most useful ;-) -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D.Khera Communications, Inc. Internet: [EMAIL PROTECTED] Rockville, MD +1-301-545-6996 GPG MIME spoken herehttp://www.khera.org/~vivek/
RE: DB persistence
Hmmm, the reason I'm not using Apache::DBI right now is coz our current scripts are using DBlib to talk to Sybase. Looks like I have to make thousands of changes all over the place after all and start using DBI. Those of you folks already using Apache::DBI, can you tell me what kind of message is logged in webserver error logs everytime a call to 'connect' is made? Thanks, Pramod At 02:21 PM 8/16/00 -0400, Shimon Rura wrote: It seems to be starting a new connection each time. If you want connection pooling, you should use the Apache::DBI module, which will transparently pool DBI connections for you. Shimon Rura Hi all, I think I misled everybody with my previous question on this topic. To put it in simple words: Apache 1.3.12/mod_perl 1.24/Solaris 2.7 I'm establishing db connection at server startup and the logs indicate that's done. But in my subsequent calls to 'connect' in my scripts, I see the same message "Establishing connection to PURCHASEDB:purchasedb" in my webserver error log. Does this mean it's ignoring the already available db handle and making fresh connections? In other words, how do I make sure whether the original handle is used or if a fresh connection is established? Any help is greatly appreciated. Thanks, Pramod
RE: DB persistence
If I have mod_perl installed, will CGI's not running under mod_perl benefit from Apache::DBI as well if they connect to the same database? Mark W -Original Message- From: Shimon Rura [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 16, 2000 2:22 PM To: Pramod Sokke; [EMAIL PROTECTED] Subject: RE: DB persistence It seems to be starting a new connection each time. If you want connection pooling, you should use the Apache::DBI module, which will transparently pool DBI connections for you. Shimon Rura -Original Message- From: Pramod Sokke [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 16, 2000 2:00 PM To: [EMAIL PROTECTED] Subject: DB persistence Hi all, I think I misled everybody with my previous question on this topic. To put it in simple words: Apache 1.3.12/mod_perl 1.24/Solaris 2.7 I'm establishing db connection at server startup and the logs indicate that's done. But in my subsequent calls to 'connect' in my scripts, I see the same message "Establishing connection to PURCHASEDB:purchasedb" in my webserver error log. Does this mean it's ignoring the already available db handle and making fresh connections? In other words, how do I make sure whether the original handle is used or if a fresh connection is established? Any help is greatly appreciated. Thanks, Pramod
RE: DB persistence
Pramod Sokke writes: Hmmm, the reason I'm not using Apache::DBI right now is coz our current scripts are using DBlib to talk to Sybase. Looks like I have to make thousands of changes all over the place after all and start using DBI. Those of you folks already using Apache::DBI, can you tell me what kind of message is logged in webserver error logs everytime a call to 'connect' is made? There's an Apache::Sybase::DBlib module floating around somewhere that you could use if you don't want to make all those changes. However, in general it's a lot better if you can avoid having API calls all over the place. For example in the app I'm currently writing there is only 1 subroutine that calls the database API (Sybase::CTlib, in this case). This adds a bit of overhead in the perl code, but cuts *way* down on the code maintenance! Michael At 02:21 PM 8/16/00 -0400, Shimon Rura wrote: It seems to be starting a new connection each time. If you want connection pooling, you should use the Apache::DBI module, which will transparently pool DBI connections for you. Shimon Rura Hi all, I think I misled everybody with my previous question on this topic. To put it in simple words: Apache 1.3.12/mod_perl 1.24/Solaris 2.7 I'm establishing db connection at server startup and the logs indicate that's done. But in my subsequent calls to 'connect' in my scripts, I see the same message "Establishing connection to PURCHASEDB:purchasedb" in my webserver error log. Does this mean it's ignoring the already available db handle and making fresh connections? In other words, how do I make sure whether the original handle is used or if a fresh connection is established? Any help is greatly appreciated. Thanks, Pramod -- Michael Peppler -||- Data Migrations Inc. [EMAIL PROTECTED]-||- http://www.mbay.net/~mpeppler Int. Sybase User Group -||- http://www.isug.com Sybase on Linux mailing list: [EMAIL PROTECTED]
RE: canned footers
-Original Message- From: Alex Menendez [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 16, 2000 2:07 PM To: [EMAIL PROTECTED] Cc: The MODPERL Subject: Re: canned footers Your right. this works great for html! Unfortunately, however, Apache sandwich really does not work for me because it only deals with GET requests and it can not deal with cgi requests directly. I would need to alter my cgi's in order to use sandwich. I am looking for a mod_perl solution that will add footers to unaltered stand alone cgis. any other ideas out there? you would need to implement a filter that was capable of parsing the output of your cgi script... look into using Apache::Filter along with a slightly modified version the Apache::Footer example in the eagle book that puts the the footer in the right place... HTH --Geoff thanx, -amen "Bruce W. Hoylman" wrote: Have you looked at Apache::Sandwich from CPAN? It is easy to implement and I have used it for awhile now to add confidentiality headers and footers to pages in a small to medium site. cpan m /Apache::Sandwich/ Module id = Apache::Sandwich CPAN_USERID VKHERA (Vivek Khera [EMAIL PROTECTED]) CPAN_VERSION 2.04 CPAN_FILEV/VK/VKHERA/Apache-Sandwich-2.04.tar.gz MANPAGE Apache::Sandwich - Layered document (sandwich) maker INST_FILE /opt/gnu/lib/perl5/site_perl/5.005/Apache/Sandwich.pm INST_VERSION 2.04 It could most certainly be use as a basis for your needs and requirements. Peace.
RE: DB persistence
-Original Message- From: Mark D Wolinski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 16, 2000 2:32 PM To: [EMAIL PROTECTED] Subject: RE: DB persistence If I have mod_perl installed, will CGI's not running under mod_perl benefit from Apache::DBI as well if they connect to the same database? Mark W no - Apache::DBI is mod_perl specific... --Geoff -Original Message- From: Shimon Rura [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 16, 2000 2:22 PM To: Pramod Sokke; [EMAIL PROTECTED] Subject: RE: DB persistence It seems to be starting a new connection each time. If you want connection pooling, you should use the Apache::DBI module, which will transparently pool DBI connections for you. Shimon Rura -Original Message- From: Pramod Sokke [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 16, 2000 2:00 PM To: [EMAIL PROTECTED] Subject: DB persistence Hi all, I think I misled everybody with my previous question on this topic. To put it in simple words: Apache 1.3.12/mod_perl 1.24/Solaris 2.7 I'm establishing db connection at server startup and the logs indicate that's done. But in my subsequent calls to 'connect' in my scripts, I see the same message "Establishing connection to PURCHASEDB:purchasedb" in my webserver error log. Does this mean it's ignoring the already available db handle and making fresh connections? In other words, how do I make sure whether the original handle is used or if a fresh connection is established? Any help is greatly appreciated. Thanks, Pramod
Re: canned footers
Take a look at Apache::ProxyStuff. It requires you set another server (can be virtual) but it doesn't care about methods or content type. On 16-Aug-2000 Alex Menendez wrote: Your right. this works great for html! Unfortunately, however, Apache sandwich really does not work for me because it only deals with GET requests and it can not deal with cgi requests directly. I would need to alter my cgi's in order to use sandwich. I am looking for a mod_perl solution that will add footers to unaltered stand alone cgis. any other ideas out there? thanx, -amen "Bruce W. Hoylman" wrote: Have you looked at Apache::Sandwich from CPAN? It is easy to implement and I have used it for awhile now to add confidentiality headers and footers to pages in a small to medium site. cpan m /Apache::Sandwich/ Module id = Apache::Sandwich CPAN_USERID VKHERA (Vivek Khera [EMAIL PROTECTED]) CPAN_VERSION 2.04 CPAN_FILEV/VK/VKHERA/Apache-Sandwich-2.04.tar.gz MANPAGE Apache::Sandwich - Layered document (sandwich) maker INST_FILE/opt/gnu/lib/perl5/site_perl/5.005/Apache/Sandwich.pm INST_VERSION 2.04 It could most certainly be use as a basis for your needs and requirements. Peace. -- Jason Bodnar + [EMAIL PROTECTED] + Team Linux Marge: We're just going to have to cut down on luxuries. Homer: Well, you know, we're always buying Maggie vaccinations for diseases she doesn't even have. Lisa's Pony
RE: DB persistence
There's an Apache::Sybase::DBlib module floating around somewhere that you could use if you don't want to make all those changes. I'm right now using that module and it's with that module that I'm getting the message in my error logs about establishing connection to db for every connect call. That's what has left me totally confused whether it's actually using the established connection or not. However, in general it's a lot better if you can avoid having API calls all over the place. For example in the app I'm currently writing there is only 1 subroutine that calls the database API (Sybase::CTlib, in this case). This adds a bit of overhead in the perl code, but cuts *way* down on the code maintenance! I totally agree with you on this, but I'm helpless here because I have to work with already existing code that has API calls all over the place. -Pramod At 02:21 PM 8/16/00 -0400, Shimon Rura wrote: It seems to be starting a new connection each time. If you want connection pooling, you should use the Apache::DBI module, which will transparently pool DBI connections for you. Shimon Rura Hi all, I think I misled everybody with my previous question on this topic. To put it in simple words: Apache 1.3.12/mod_perl 1.24/Solaris 2.7 I'm establishing db connection at server startup and the logs indicate that's done. But in my subsequent calls to 'connect' in my scripts, I see the same message "Establishing connection to PURCHASEDB:purchasedb" in my webserver error log. Does this mean it's ignoring the already available db handle and making fresh connections? In other words, how do I make sure whether the original handle is used or if a fresh connection is established? Any help is greatly appreciated. Thanks, Pramod -- Michael Peppler -||- Data Migrations Inc. [EMAIL PROTECTED]-||- http://www.mbay.net/~mpeppler Int. Sybase User Group -||- http://www.isug.com Sybase on Linux mailing list: [EMAIL PROTECTED]
Re: canned footers
On 16-Aug-2000 Vivek Khera wrote: "BWH" == Bruce W Hoylman [EMAIL PROTECTED] writes: BWH Have you looked at Apache::Sandwich from CPAN? It is easy to implement BWH and I have used it for awhile now to add confidentiality headers and BWH footers to pages in a small to medium site. The only real trick is that you are responsible for the resulting "sandwich" to be valid HTML. Apache::Sandwich does not insert headers/footers in the right place within a complete HTML document. It just pastes text files together. Apache::ProxyStuff puts the headers and footers where they belong in the HTML document so you can use existing content and even modify the BODY attributes to meet your needs. -- Jason Bodnar + [EMAIL PROTECTED] + Team Linux I'm tired of being a wanna-be league bowler, I wanna be a league bowler! -- Homer Simpson Team Homer
RE: DB persistence
Pramod Sokke writes: There's an Apache::Sybase::DBlib module floating around somewhere that you could use if you don't want to make all those changes. I'm right now using that module and it's with that module that I'm getting the message in my error logs about establishing connection to db for every connect call. That's what has left me totally confused whether it's actually using the established connection or not. You're going to get a fresh connection for each apache child process when that process' connect() call is called. On subsequent calls you should not get this. You could verify this by adding: sub connect { my($self, @args) = @_; my($Uid, $Pwd, $Srv) = @args; my $idx = join ":", (@args) || (@{$self}); return $Connected{$idx} if $Connected{$idx}; print STDERR "($$) connecting to $idx...\n" if $main::DEBUG; #---^^^ $Connected{$idx} = Sybase::DBlib-dblogin($Uid, $Pwd, $Srv); } which will include the process id of the process connecting. However, in general it's a lot better if you can avoid having API calls all over the place. For example in the app I'm currently writing there is only 1 subroutine that calls the database API (Sybase::CTlib, in this case). This adds a bit of overhead in the perl code, but cuts *way* down on the code maintenance! I totally agree with you on this, but I'm helpless here because I have to work with already existing code that has API calls all over the place. I understand that - just a general comment. Michael -- Michael Peppler -||- Data Migrations Inc. [EMAIL PROTECTED]-||- http://www.mbay.net/~mpeppler Int. Sybase User Group -||- http://www.isug.com Sybase on Linux mailing list: [EMAIL PROTECTED]
[new module] Apache::PageKit
I have an addition for the Apache/Perl Module List, under PerlHandler's PageKit cmpOApplication framework w/ HTML::Template TJMATHER Here is a brief description of the module: PageKit is a set of Perl modules that provides an application framework based on mod_perl and HTML::Template. It is based on the Model/View/Controller approach to design, with complete seperation of Perl from HTML. It includes session management, authentication, form validation, sticky html forms, multiple views, modules and includes, and a content management system.
creating db handles externally
I have the following code in several of my mod_perl handlers: my $dbh = DBI-connect($c{db}{dsn}, $c{db}{user}, $c{db}{pass}) || die(DBI::errstr); Is there a way to do something like: my $dbh = $MyModules::DBH; instead of putting connect string in *EVERY* script? to get the database handle? Someone mentioned doing a ChildInitHandler and using Class::Singleton.. I'm a clueless newbie so I didn't get too far with this (code snippets anyone?). TIA Ian
Re: [new module] Apache::PageKit
On Tue, 15 Aug 2000, T.J. Mather wrote: I have an addition for the Apache/Perl Module List, under PerlHandler's PageKit cmpOApplication framework w/ HTML::Template TJMATHER Here is a brief description of the module: PageKit is a set of Perl modules that provides an application framework based on mod_perl and HTML::Template. It is based on the Model/View/Controller approach to design, with complete seperation of Perl from HTML. It includes session management, authentication, form validation, sticky html forms, multiple views, modules and includes, and a content management system. Can you expand on the functionality of the CMS part? -- Matt/ Fastnet Software Ltd. High Performance Web Specialists Providing mod_perl, XML, Sybase and Oracle solutions Email for training and consultancy availability. http://sergeant.org | AxKit: http://axkit.org
new cgi mod_perl question
does anyone know how to get the output of a standalone cgi script from a mod_perl module I have tried all the subrequest stuff but I can't get it to work. Apache seems to parse the cgi file once a handler has been called. simply writing a handler that returns DECLINED every time it is called like so: package LameModule; use Apache::Constants qw(:common); sub handler { my $r= shift; return DECLINED; } with a config entry like so: Files ~ "\.cgi$" SetHandler perl-script PerlHandler LameModule /Files will always parse the cgi file as text instead of just declining to handle it and letting the cgi do its thing. Any ideas on how to get this cgi to write some output to STDOUT even when a Handler has been called for its file extension? thanx, -amen
Re: [new module] Apache::PageKit
I got a couple of e-mails asking where this module could be found. I plan to release the module in a few days on CPAN. I will make an announcement on this list when I do. -TJ Mather
Sticky forms for Apache::ASP
Hi, We've worked out a solution to get sticky form fields inside Apache::ASP We use HTML::FillinForm and a custom tag to get the desired behaviour. Put this is in global.asa: sub fillin { my $args = shift; my $html = shift; my $fif = new HTML::FillInForm; my $output = $fif-fill( scalarref = \$html, fdat = $Apps::Param, ); $Response-Write($output); } Note $Apps::Param is set to either the querystring or form data. Replace with $Request-QueryString or $Request-Form if you wish. Then put something like this in your apache configuration: XMLSubsMatch fillin Finally, surround your forms like this: fillin form input name="myfield" /form /fillin And voila, instant filled in forms.. Note that a small variation to this technique allows for ASP3.0 style evaluation of forms. Instead use a 'form' function sub form { ... } Then check the args to see if the param 'runat' is set to 'server'. If so, do the funky stuff, if not, just spit it out... -- Paul Lindner [EMAIL PROTECTED] Red Hat Inc.
param quirk
It seems that Apache::Request::param returns inputs like [EMAIL PROTECTED] as email=mike [EMAIL PROTECTED] I can live with that, since + is a reserved character and lots of apps expect '+' to read as ' '. But the problem is that [EMAIL PROTECTED] also comes through as email=mike [EMAIL PROTECTED] instead of [EMAIL PROTECTED] Now, this seems like double-unescaping to me. I've been looking through the source to see if I can spot the bug, but maybe someone out there already knows? where to look? thanks, -- Mike
[JOB]: Seattle - perl/mod_perl programmer
Hi all, The NewSof Group is a Seatlle based company specializing in Content Development and building web based communities. We currently are looking for a Perl Programmer (~3+ yrs exp.) comfortable with working in a UNIX environment to help us build community/collaboration, asset managment and reporting tools. Experience with mod_perl or an interest in learning and using mod_perl required. Experience with MySQL or another SQL based database (using DBI) would also be nice. We are a telecomuting based company, but we will require applicants live in the Seattle area for occasional meetings at the local Tully's. You can check out our website at http://www.newsof.com - BUT beware, it has not been updated in quite a while. You can see some of the work we have done for the American Cancer Society at http://www.acscsn.org (totally mod_perl based site). If you are interested, please forward a resume directly to me at [EMAIL PROTECTED] Thanks, Andrew Wyllie ... Andrew Wyllie [EMAIL PROTECTED]Open Source Integrator v.206.729.7439 __We can catify or stringify, c.206.851.9876separately or together!__ perl-5.005_03
Re: getting rid of nested sub lexical problem
Converting "sub foo" into "local *foo = sub" won't work when the function is called before is declared, because the local only works for the rest of the block, not the entire block. i.e. you can't do foo(); local *foo = sub { ... }; Plus, I think you usually need the trailing semicolon anyway. --Chris On Wed, 16 Aug 2000, Dan Campbell wrote: [EMAIL PROTECTED] wrote: Due to forgetfulness I was recently bitten by the infamous "my() Scoped Variable in Nested Subroutines" problem using Apache::Registry, and it got me thinking about whether it is fixable. From the diagnostics: This problem can usually be solved by making the inner subroutine anonymous, using the sub {} syntax. When inner anonymous subs that reference variables in outer subroutines are called or referenced, they are automatically rebound to the current values of such variables. I think it should be possible for Registry to pre-process the source code to turn all top-level named subroutines into sub refs. For example, convert subroutines of the form sub foo { CODE } into sub foo { { sub { CODE } } } [snip] I think it would be easier to convert sub foo into local *foo = sub That way, you don't have to parse for the matching right brace. Something like: s/sub\s+(\w+)/local *\1 = sub/msg; # untested - just a guess might do the trick. -- Dan Campbell
Re: [new module] Apache::PageKit
Here is a brief description of the module: PageKit is a set of Perl modules that provides an application framework based on mod_perl and HTML::Template. It is based on the Model/View/Controller approach to design, with complete seperation of Perl from HTML. It includes session management, authentication, form validation, sticky html forms, multiple views, modules and includes, and a content management system. Can you expand on the functionality of the CMS part? For now, the CMS part is really simple. There are links on every page to edit the HTML template components, if the user has permission to edit. These links link to an edit page which edits the HTML template using one big textarea box. What would be much cooler would be to use XML and a content editor that would translate an XML file into HTML form elements for places in the XML document that the user can edit. There is an interesting chapter (7) in Open Source Linux Web Programming on this. I am moving this discussion to [EMAIL PROTECTED], which is a newly created list for discussing Apache::PageKit. To subscribe, go to http://lists.sourceforge.net/mailman/listinfo/pagekit-users -TJ
Solaris 2.6, mod_perl 1.24, DBD::Oracle 1.06, Oracle 8.1.6
The 'surgery on Oracle' technique described in the README.java file in the DBD::Oracle 1.06 distribution fixed all the problems I was having with DBD::Oracle and mod_perl. Whew. -- Larry Mulcahy [EMAIL PROTECTED] PGP public key at: http://pgpkeys.mit.edu:11371/pks/lookup?op=getsearch=0x2C4C5A03