RE: Pre-compiling Embperl pages without Executing?
> ==> Question: will putting an eval around the call to Execute > mitigate the problems caused by the unwanted failures to run, > while still having the desired effect of pre-compiling those that > run correctly? Yes > Also: for those that compile OK but refuse to > run, will their compiled code still be retained by EmbPerl and > shared by child processes? > Yes > ==> Another proposed solution: calling "import" mode of Execute. > Would calling Execute in "import" mode have the same > code-caching benefits without actually trying to run the code on > the page at server startup time? No. It will only precompile the code between [$sub $] and [$ endsub $] > > ==> Would there be an advantage to combining the "eval" and > "import" approaches to protect against pages with Embperl syntax > errors clogging the server startup process? > I think, currently the eval method is the best one. Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
Pre-compiling Embperl pages without Executing?
Hi, The docs at http://perl.apache.org/embperl/Faq.pod.7.html#How_can_I_pre_compile_pages_so ... helpfully point out that calling Execute on your .epl pages at server startup time pre-compiles those pages into static shared memory which all subsequent child processes will share. I have a startup script that does this and it works well. But there's a problem. Execute seems to actually want to RUN, not just compile and cache all the code in the pages as well. So if any application on the site encounters a run-time error, it makes Apache startup fail. This is a problem if I push a site where someone might be in the middle of editing some code in a private area, then need to stop and restart the servers and their code won't compile, preventing the server from starting. A proposed solution: wrapping an "eval" around the call to Execute, like this: ## Locate and pre-compile any EPL files in the "live" directories of ## any of the sites. use File::Find; my @EPLFiles; sub FindEPLFiles { if (/\.AppleDouble/) {$File::Find::prune = 1; return}; if (/\.epl$/) {push @EPLFiles, $File::Find::name;} } &find(\&FindEPLFiles, glob ('/sites/*/live/')); foreach (@EPLFiles) { my $Ignored; eval { &HTML::Embperl::Execute ({ output => \$Ignored, inputfile => $_, virtlog =>$ENV{EMBPERL_VIRTLOG}, debug => $EmbPerlDebugOpts, options =>$EmbPerlOptions, }); } } ==> Question: will putting an eval around the call to Execute mitigate the problems caused by the unwanted failures to run, while still having the desired effect of pre-compiling those that run correctly? Also: for those that compile OK but refuse to run, will their compiled code still be retained by EmbPerl and shared by child processes? ==> Another proposed solution: calling "import" mode of Execute. Would calling Execute in "import" mode have the same code-caching benefits without actually trying to run the code on the page at server startup time? If so, this would seem to be the best solution of all. ==> Would there be an advantage to combining the "eval" and "import" approaches to protect against pages with Embperl syntax errors clogging the server startup process? -c -chris 870 Market Street #1270 (415) 394-9818 San Francisco, CA 94102 (413) 473-0853 fax
limiting code that DProf profiles
I'm using Apache::DProf to profile a mod_perl script. The specific section I am looking to improve is hard to get meaningful numbers for, because in the DProf output it is overwhelmed by the time of child process startup and other things that I'm not interested. Is there a way to limit the code that DProf profiles? If not, any idea on how difficult it would be to patch? Thanks, Chris
forking a perl process from modperl to execute a network program
Hi Folks: I have perl program that runs under modperl in a website, that needs to fork another perl program that executes a network program. The problem is that the tcp socket c program runs fine when executed from a modperl fork, but udp socket dies. This udp program runs fine when run from the console. I don't think it has anything to do with user permission. I have used rootto run the UDP socket and it still fails. The program also uses raw socket . Is there a way to close all the socket handles and environment inherited from the modperl. Sample codes and ideas welcome. Oliver __ Do You Yahoo!? Send instant messages with Yahoo! Messenger. http://im.yahoo.com/
RE: Apache::Session
>On Mon, Jun 19, 2000 at 05:31:42PM +0100, Miah Gregory wrote: >> The error I get off 1.03 on the new server is: >> >> Permission denied at >> /usr/lib/perl5/site_perl/5.6.0/Apache/Session/SysVSemaphoreLocker.pm line >> 63. >> (in cleanup) Permission denied at >> /usr/lib/perl5/site_perl/5.6.0/Apache/Session/SysVSemaphoreLocker.pm line >> 63. >> Iirc, one gets that error when setting up the semaphore somehow from the startup script (while Apache's running as root) and when later children try to modify it while running as nobody. The trick is 1) to delete the semaphore manually and 2) not to call it during startup. I may be wrong because I don't use Apache::Session anymore, but I bumped into that problem a few months ago and that's how I solved it. -- robin b. Mathematicians often resort to something called Hilbert space, which is described as being n-dimensional. Like modern sex, any number can play. -- Dr. Thor Wald
Re: ColdFusion in mod_perl?
and/or use the perl dbi and or postgresql's Pg lib most useful i used to have to use coldfusion, and it was not fun especially dealing w m$'s odbc Matt Sergeant wrote: > > On Mon, 19 Jun 2000 [EMAIL PROTECTED] wrote: > > > > > I was introduced to ColdFusion the other day. It seems like something > > which could easily be done in (mod_)perl. Has anyone done this? > > Bah, coldfusion is dated technology. Take a look at something with > completely customisable taglibs based on XML - AxKit: http://axkit.org/ > > Not that I'm biased or anything :) > > -- > > > 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: Apache::Session & Math::Currency thawing issue.
(If anyone else wants to mention how they use sessions I'm curious) > First off, I'm doing this becuase I need to store variables (in > currency) that are generated on a per-user session, for a short period of > time (3 to 5 requests). I'm using a database back-end for the session. > > I was initially wrong in my thinking about Math::Currency, and my solution > was to "stringify" the instance, so I only store "$10.45" instead of a > Math::Currency object. Right, yes that's cool. It's just a bit concerning when you try to store objects in a backing store..., string stuff is a-okay because it's small. I would probably push forward in a form for this instance probably, but that's just an implementation detail. > Where do you put your "more permanent" data, and what constitutes "more > permanent" data? I can't think of anything that would be faster/easier to > store and retrieve specific information related to that user or session. Well, putting it in a form requires no overhead for your system. This seems to not constitute "more permanent data". As far as specific information related to the user, you bet there's a better place to store it :-), in a database with real fields. See..., a session doesn't allow incremental data lookups, or incremental changes. You dump the whole thing in memory, and then manipulate it on the perl level. Not to mention if you change one aspect of the session, you trigger now a complete update of that field. Maybe you're working on a site that doesn't have anything related to "more permanent data"..., like userid's and that sort of thing. I somehow thought you were trying to store the users preference of currency in the session as an object to use to convert further stuff, or something like that. (Haven't used that module in particular, so I was just making a wild guess) > I'd agree that the session needs to be handled carefully, but I think the > careful part is not leaving stuff in the session that doesn't need to be > there, instead of not using it. Well obviously :-), it's there for a good reason... it makes our lives as site programmers a lot easier. I use sessions, but am really careful about how I use them, I usually just put stuff in a session that will be used on 80% of pages. Normally it turns out that I only insert/modify the session on login, and try to keep subsequent updates to a minimum. (Cost to benefit analysis, the session can save you a lot of sql queries, or it can add a lot) I'm working on sites right now that have very specific needs in terms of performance, but everyones needs are different. Thanks, Shane.
Re: ColdFusion in mod_perl?
On Mon, 19 Jun 2000 [EMAIL PROTECTED] wrote: > I was introduced to ColdFusion the other day. It seems like something > which could easily be done in (mod_)perl. Has anyone done this? Sure have! Try a google search for 'HTML obfuscation' and see if it turns up anything useful. Good luck, -- Blue Lang Unix Systems Admin QSP, Inc., 3200 Atlantic Ave, Ste 100, Raleigh, NC, 27604 Home: 919 835 1540 Work: 919 875 6994 Fax: 919 872 4015
Re: ColdFusion in mod_perl?
On Mon, 19 Jun 2000 [EMAIL PROTECTED] wrote: > > I was introduced to ColdFusion the other day. It seems like something > which could easily be done in (mod_)perl. Has anyone done this? Bah, coldfusion is dated technology. Take a look at something with completely customisable taglibs based on XML - AxKit: http://axkit.org/ Not that I'm biased or anything :) -- 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
ColdFusion in mod_perl?
I was introduced to ColdFusion the other day. It seems like something which could easily be done in (mod_)perl. Has anyone done this? ELB --- Get free personalized email at http://www.iname.com
Help to pinpoint installation problem.
Hi, I've done a little mod_perl last year but forget very quickly and I'm requesting some guidance to tell me where to start pinpointing a problem. I'm looking at an application that is supposedly running mod_perl. I"ve just started going thru the mod_perl Guide by Stas Bekman. It showed that if the environment variable GATEWAY_INTERFACE IS CGI-Perl/1.1 then all is okey BUT if its CGI/1.1 , its not running mod_perl. In the guide it says "it means that you have configured this location to run under mod_cgi and not mod_perl." My question - where do I start looking to change this to mod_perl and get it fixed. Is this a basic installation problem or is it configuration in the one of the .conf files such as httpd.conf Also whats mod_cgi? Thank-you in advance for your help. regards David
[OT]SegFaults, not PerlFreshRestart or module related
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. All too often, if you go back to a page in the cache (that you *just* c licked off from!), it refuses to hit any links on that page until you reload it. That sounds to me more like a browser problem, but it wasn't happening until we put the new server online. Can that be related? I hate being clueless. Finally, let me apologize for posting on this board with what appears not to be a mod_perl problem. I don't really kbnow if it is or not, but couldn't find a straight apache list. Thanks for your patience, and for any help you can offer. Paul __ Do You Yahoo!? Send instant messages with Yahoo! Messenger. http://im.yahoo.com/
Re: $r->print and references: Was RE: Slightly OT - Content-length
On Mon, 19 Jun 2000, John Hughes wrote: > > Incidentally, the $r->print() method conveniently lets you pass the string > > you want to send by reference. > > Why is that "convenient": It's convenient for me because I have a scalar ref that I want to print. Maybe dereferencing it and passing by value wouldn't hurt anything though. > (Hint - Perl passes all values by reference. The point $r->print doing > an auto-dereference is supposed to be to let you pass a reference around > in *your* code. Right, that's what I'm doing. - Perrin
Re: Apache::Session & Math::Currency thawing issue.
On Mon, 19 Jun 2000, Jay Jacobs wrote: > I'm trying to use Math::currency with sessions, and I've run into a > stumper. I initialize variables and make them Math::Currency objects, > and display them just fine, but when I come back (unthaw the session) > instead of seeing the value I get the reference showing > "Math::Currency=HASH(0x86b022)" instead of the value as it showed the > first time through. > > It's a reference going in, and a reference coming out, but for some reason > it doesn't like being stuck into Apache::Session. Which version of Apache::Session are you using? There was an issue with a recent version and storage of objects. Check the list archives for some posts on the subject by Jeffrey Baker. Your message doesn't really explain what the problem is, partly because I suspect most of us have never used Math::Currency and don't know its interface. All objects are references, so what's the problem with your object coming back as a reference? - Perrin
RE: Apache::Session
I have the problem on one server, and not the other.. I'll try to find out what's different between the two of them, and let you know. Cheers, Miah -Original Message- From: Jonathan Leto [mailto:[EMAIL PROTECTED]] Sent: Monday, June 19, 2000 6:28 PM To: Miah Gregory Cc: [EMAIL PROTECTED] Subject: Re: Apache::Session I got the same error until I made the file setuid root. If anybody knows a better way, please reply. On Mon, Jun 19, 2000 at 05:31:42PM +0100, Miah Gregory wrote: > Hi all, > > Does anyone have any example code using either version 1.51 or 1.03? > > I can't get either version to work correctly on one server, but 1.03 works > fine on another. > > The error I get off 1.03 on the new server is: > > Permission denied at > /usr/lib/perl5/site_perl/5.6.0/Apache/Session/SysVSemaphoreLocker.pm line > 63. > (in cleanup) Permission denied at > /usr/lib/perl5/site_perl/5.6.0/Apache/Session/SysVSemaphoreLocker.pm line > 63. > > I'm not using 1.51 atm, because it doesn't seem, from the documentation, to > do what I want. > > Cheers, > > Miah -- [EMAIL PROTECTED] "With pain come clarity."
Re: Apache::Session
I got the same error until I made the file setuid root. If anybody knows a better way, please reply. On Mon, Jun 19, 2000 at 05:31:42PM +0100, Miah Gregory wrote: > Hi all, > > Does anyone have any example code using either version 1.51 or 1.03? > > I can't get either version to work correctly on one server, but 1.03 works > fine on another. > > The error I get off 1.03 on the new server is: > > Permission denied at > /usr/lib/perl5/site_perl/5.6.0/Apache/Session/SysVSemaphoreLocker.pm line > 63. > (in cleanup) Permission denied at > /usr/lib/perl5/site_perl/5.6.0/Apache/Session/SysVSemaphoreLocker.pm line > 63. > > I'm not using 1.51 atm, because it doesn't seem, from the documentation, to > do what I want. > > Cheers, > > Miah -- [EMAIL PROTECTED] "With pain come clarity."
Re: Apache::Session & Math::Currency thawing issue.
First off, I'm doing this becuase I need to store variables (in currency) that are generated on a per-user session, for a short period of time (3 to 5 requests). I'm using a database back-end for the session. I was initially wrong in my thinking about Math::Currency, and my solution was to "stringify" the instance, so I only store "$10.45" instead of a Math::Currency object. Where do you put your "more permanent" data, and what constitutes "more permanent" data? I can't think of anything that would be faster/easier to store and retrieve specific information related to that user or session. I'd agree that the session needs to be handled carefully, but I think the careful part is not leaving stuff in the session that doesn't need to be there, instead of not using it. Jay On Mon, 19 Jun 2000, Shane Nay wrote: > Okay, backup a second..., you're doing this... why? Do you need a > Math::Currency object stored inside the session?..., that could be quite a > hefty object. See, everything you write to a session you have to read back in, > and any time you update any small part of it it has to re-write the whole > record. What storage mechanism are you using for sessions, Filestore, > Database? Generally I think it's a best practice to be careful about what > you're stuff in your sessions, i.e. how much data you're putting in there. A > complete update of several objects could be pretty hairy since you have to do a > complete re-write of that record whenever you change one small detail. You > also have to read in that entire session, and decompose it which could take a > little while. Basically you're adding quite a bit of overhead to your > web-application. Personally I like to keep my sessions really small, and put > more permanent data elsewhere, does anyone else have a "best practices" sort of > thing on what should/should not be stored in a session? (This seems to come up > almost weekly I think) > > Thanks, > Shane. > (Also you should read up on freeze thaw, because they can't store _everything_) > > On Mon, 19 Jun 2000, you wrote: > > Hello, > > I'm trying to use Math::currency with sessions, and I've run into a > > stumper. I initialize variables and make them Math::Currency objects, and > > display them just fine, but when I come back (unthaw the session) instead > > of seeing the value I get the reference showing > > "Math::Currency=HASH(0x86b022)" instead of the value as it showed the > > first time through. > > > > It's a reference going in, and a reference coming out, but for some reason > > it doesn't like being stuck into Apache::Session. > > > > I can work around it by testing if it's a Math::Currency reference, and > > call Math::Currency->new. But this seems a little silly. Anyone seen > > this before? > > > > Jay Jacobs >
Re: Apache::Session & Math::Currency thawing issue.
Okay, backup a second..., you're doing this... why? Do you need a Math::Currency object stored inside the session?..., that could be quite a hefty object. See, everything you write to a session you have to read back in, and any time you update any small part of it it has to re-write the whole record. What storage mechanism are you using for sessions, Filestore, Database? Generally I think it's a best practice to be careful about what you're stuff in your sessions, i.e. how much data you're putting in there. A complete update of several objects could be pretty hairy since you have to do a complete re-write of that record whenever you change one small detail. You also have to read in that entire session, and decompose it which could take a little while. Basically you're adding quite a bit of overhead to your web-application. Personally I like to keep my sessions really small, and put more permanent data elsewhere, does anyone else have a "best practices" sort of thing on what should/should not be stored in a session? (This seems to come up almost weekly I think) Thanks, Shane. (Also you should read up on freeze thaw, because they can't store _everything_) On Mon, 19 Jun 2000, you wrote: > Hello, > I'm trying to use Math::currency with sessions, and I've run into a > stumper. I initialize variables and make them Math::Currency objects, and > display them just fine, but when I come back (unthaw the session) instead > of seeing the value I get the reference showing > "Math::Currency=HASH(0x86b022)" instead of the value as it showed the > first time through. > > It's a reference going in, and a reference coming out, but for some reason > it doesn't like being stuck into Apache::Session. > > I can work around it by testing if it's a Math::Currency reference, and > call Math::Currency->new. But this seems a little silly. Anyone seen > this before? > > Jay Jacobs
RE: Pages stopping and not loading completely...
> From: Matt Sergeant [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 19, 2000 12:38 PM > To: Farley, Scott > Cc: '[EMAIL PROTECTED]' > Subject: Re: Pages stopping and not loading completely... > > > On Mon, 19 Jun 2000, Farley, Scott wrote: > > > I'm running an application Apache + mod_perl that connects to an MySQL > > database and the pages every so often decide not fully load. You can even > > see the the HTML printed to the screen sometimes because the stream is > > broken in the middle. Some of the error messages include: > > > > [Mon Jun 19 11:07:33 2000] [info] mod_perl: Apache->print timed out for > > xxx.xxx.xxx.xxx > > [Mon Jun 19 11:07:33 2000] [debug] Apache.xs(1040): mod_perl: rwrite > > returned -1 > > Its a long fixed bug. Upgrade your mod_perl. > > -- > I know the "rwrite returned -1" is a long fixed bug but what about the pages not completely loading? What version? Scott [EMAIL PROTECTED]
Re: Pages stopping and not loading completely...
On Mon, 19 Jun 2000, Farley, Scott wrote: > I'm running an application Apache + mod_perl that connects to an MySQL > database and the pages every so often decide not fully load. You can even > see the the HTML printed to the screen sometimes because the stream is > broken in the middle. Some of the error messages include: > > [Mon Jun 19 11:07:33 2000] [info] mod_perl: Apache->print timed out for > xxx.xxx.xxx.xxx > [Mon Jun 19 11:07:33 2000] [debug] Apache.xs(1040): mod_perl: rwrite > returned -1 Its a long fixed bug. Upgrade your mod_perl. -- 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: Apache::Session & Math::Currency thawing issue.
I think I caught it. For some reason (little help here), you need to "stringify" the Math::Currency instance, and store it as a scalar. And calling ->new on a thawed object isn't a work around... Jay On Mon, 19 Jun 2000, Jay Jacobs wrote: > Hello, > I'm trying to use Math::currency with sessions, and I've run into a > stumper. I initialize variables and make them Math::Currency objects, and > display them just fine, but when I come back (unthaw the session) instead > of seeing the value I get the reference showing > "Math::Currency=HASH(0x86b022)" instead of the value as it showed the > first time through. > > It's a reference going in, and a reference coming out, but for some reason > it doesn't like being stuck into Apache::Session. > > I can work around it by testing if it's a Math::Currency reference, and > call Math::Currency->new. But this seems a little silly. Anyone seen > this before? > > Jay Jacobs > >
Apache::Session
Hi all, Does anyone have any example code using either version 1.51 or 1.03? I can't get either version to work correctly on one server, but 1.03 works fine on another. The error I get off 1.03 on the new server is: Permission denied at /usr/lib/perl5/site_perl/5.6.0/Apache/Session/SysVSemaphoreLocker.pm line 63. (in cleanup) Permission denied at /usr/lib/perl5/site_perl/5.6.0/Apache/Session/SysVSemaphoreLocker.pm line 63. I'm not using 1.51 atm, because it doesn't seem, from the documentation, to do what I want. Cheers, Miah
Pages stopping and not loading completely...
I'm running an application Apache + mod_perl that connects to an MySQL database and the pages every so often decide not fully load. You can even see the the HTML printed to the screen sometimes because the stream is broken in the middle. Some of the error messages include: [Mon Jun 19 11:07:33 2000] [info] mod_perl: Apache->print timed out for xxx.xxx.xxx.xxx [Mon Jun 19 11:07:33 2000] [debug] Apache.xs(1040): mod_perl: rwrite returned -1 Any ideas? Scott [EMAIL PROTECTED]
Re: [OT] [advocacy] IIS v Apache article
On Mon, 19 Jun 2000, Mark Hewis wrote: > It would be really nice to see surveys based on pages served/web server and > not just number of server installations. Anyone heard of such stats? Pick a known high-traffic site, and see what it's running. All the portals I know of run Apache, as does a certain site based in Kingswood Warren that you might have heard of ;-) -- 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: [OT] Making apps (un)available solution
On Mon, 19 Jun 2000, Matt Sergeant wrote: > On Sun, 18 Jun 2000, Michael J Schout wrote: > > > On Tue, 13 Jun 2000, Erich L. Markert wrote: > > > > > I'm trying to figure out the best way to make apps (un)available without > > > having to edit the apache config files. > > > > We did something like this by making a handler like this: > > > > package Foo::PerlHandler; > > > > use Class::MethodMaker > > new_with_init => 'new', > > get_set => [qw/request/]; > > > > sub handler { > > my ($class, $r) = @_; > > You forgot prototypes here, otherwise handler always gets called with just > $r. Yeah.. thats right.. the real one has prototypes.I should have just cut/pasted it instead of reproducing it from memory :). > > > ($class, $r) = (__PACKAGE__, $class) unless defined $r; > > > > if (-f /tmp/foo.unavailable) { > > $r->headers_out->add('Location', '/maintenance/index.html'); > > return REDIRECT; > > } > > > > my $this = $class->new($r); > > $this->service; > > You've also forgotten your exception handling code here. Always try and > wrap your dispatch code in an eval: Yes.. our production version also has this.. actually, we use Error.pm from CPAN to catch a variety of exceptions... e.g.: try { $this->sevice; } catch Error::Foo with { # do something } catch Error::Foo2 with { # do something else } otherwise { # uncaught exception }; But I didnt feel it was worth showing all of that in my original msg :). Mike
[OT] [advocacy] IIS v Apache article
It would be really nice to see surveys based on pages served/web server and not just number of server installations. Anyone heard of such stats? >just thought everyone might be interested... >http://www.entmag.com/displayarticle.asp?ID=6150095626AM >BTW - Ged, you're quoted :) This e-mail, and any attachment, is confidential. If you have received it in error, please delete it from your system, do not use or disclose the information in any way, and notify me immediately. The contents of this message may contain personal views which are not the views of the BBC, unless specifically stated.
Apache::Session & Math::Currency thawing issue.
Hello, I'm trying to use Math::currency with sessions, and I've run into a stumper. I initialize variables and make them Math::Currency objects, and display them just fine, but when I come back (unthaw the session) instead of seeing the value I get the reference showing "Math::Currency=HASH(0x86b022)" instead of the value as it showed the first time through. It's a reference going in, and a reference coming out, but for some reason it doesn't like being stuck into Apache::Session. I can work around it by testing if it's a Math::Currency reference, and call Math::Currency->new. But this seems a little silly. Anyone seen this before? Jay Jacobs
RE: Get User Login Name
The user should not have to log in twice if you use the same AuthName (Realm) in both .htaccess files. On 19-Jun-2000 Wang, Pin-Chieh wrote: > Hi, > Is there any way to obtain user login name from perl if I put .htaccess > under /usr/local/apache/htdocs/restricted and put my cgi/perl script under > cgi-bin with no restriction. The reason I put no restriction for cgi-bin is > to avoid user to login twice so I only place restriction under > htdocs/restricted directory. ( but I lost "remote_user" environmental > variable). > I could get "remote_user" if I put the restriction on both cgi-bin and > htdocs/restricted, but user has to login twice. > > Thanks > PC Wang -- Jason Bodnar + [EMAIL PROTECTED] + Team Linux Six simple words: I'm not gay, but I'll learn. -- Homer Simpson I Love Lisa
[advocacy] IIS v Apache article
just thought everyone might be interested... http://www.entmag.com/displayarticle.asp?ID=6150095626AM BTW - Ged, you're quoted :)
Re: Platform list
Jesús Lasso Sánchez wrote: > > Hi, > > Does anyone work with apache+mod_perl in Irix platforms. I need information > about this plattform, because i'm working in a project based in Irix. There > is any problem? does it works correctly ? > One of my former employers uses Irix and mod_perl running on some high-end SGI hardware. So the answer is yes, it does work - and pretty well from what I remember. :-) -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
Re: Reading config
On Mon, 19 Jun 2000, Edwin Pratomo wrote: > > Hi, > > how to get configuration values at run-time, such as DirectoryIndex? I don't think you can - that configuration directive is specific to mod_index, and only mod_index can access it, AFAIK. -- 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
Reading config
Hi, how to get configuration values at run-time, such as DirectoryIndex? TIA. Edwin.
Get User Login Name
Hi, Is there any way to obtain user login name from perl if I put .htaccess under /usr/local/apache/htdocs/restricted and put my cgi/perl script under cgi-bin with no restriction. The reason I put no restriction for cgi-bin is to avoid user to login twice so I only place restriction under htdocs/restricted directory. ( but I lost "remote_user" environmental variable). I could get "remote_user" if I put the restriction on both cgi-bin and htdocs/restricted, but user has to login twice. Thanks PC Wang
RE: ANNOUNCE: new draft mod_perl quick reference card
just a few things: I think I remember discussing that using %hash = $r->headers_out didn't work with multiple Set-Cookie fields in the header. IIRC, the discussion yielded @array = $r->headers_out as solving the problem. Although the eagle book says to call headers_out in a list or scalar context, the example shows a hash. Are people using hashes or arrays here? (I use Apache::Table myself :) also, I noticed that $r->pnotes() and $r->server->loglevel() are not represented? --Geoff > -Original Message- > From: Andrew Ford [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 14, 2000 5:12 AM > To: [EMAIL PROTECTED] > Subject: ANNOUNCE: new draft mod_perl quick reference card > > > I have just updated the mod_perl quick reference card for mod_perl > version 1.24 and would be grateful for any comments and corrections > before I announce it more widely and put it in the normal location. > > This draft version can be downloaded from: > > > http://www.refcards.com/download/drafts/mod_perl-refcard.ps > (PostScript) > > http://www.refcards.com/download/drafts/mod_perl-refcard.pdf (PDF) > > Please don't link to these locations as the files will move when I'm > happy with them (and be replaced with A4, US letter and full > page versions). > > (Note that the fonts may be a bit strange on these cards, especially > on the PDF version). > > Regards > Andrew > -- > Andrew Ford, Director Ford & Mason Ltd +44 > 1531 829900 (tel) > [EMAIL PROTECTED] South Wing, Compton House +44 > 1531 829901 (fax) > http://www.ford-mason.co.uk Compton Green, Redmarley +44 > 385 258278 (mobile) > http://www.refcards.com Gloucester, GL19 3JB, UK >
RE: err_headers_out Q
> -Original Message- > From: Doug MacEachern [mailto:[EMAIL PROTECTED]] > Sent: Friday, June 09, 2000 1:21 PM > To: Geoffrey Young > Cc: '[EMAIL PROTECTED]' > Subject: Re: err_headers_out Q > > > On Fri, 2 Jun 2000, Geoffrey Young wrote: > > > hi all... > > > > this simple script: > > > > #!/usr/bin/perl > > > > my $r = shift; > > $r->err_headers_out->add('Set-Cookie' => "name=error"); > > warn "pre headers_out: " . $r->headers_out->get('Set-Cookie'); > > > > $r->send_http_header('text/plain'); > > > > warn "post headers_out: " . $r->headers_out->get('Set-Cookie'); > > print "done"; > > > > yields: > > pre headers_out: at /usr/local/apache/perl-bin/err.cgi line 7. > > post headers_out: name=error at > /usr/local/apache/perl-bin/err.cgi line 9. > > > > and sets the cookie... > > > > I was initially trying to create a PerlInitHandler to put a > cookie in > > err_headers_out, which I would expect to be set only if > other handlers down > > the line error out, but it was being set every request. > > > > am I misunderstanding err_headers_out, or is > send_http_header misbehaving? > > see http_protocol.c:send_http_header(): > > if (!ap_is_empty_table(r->err_headers_out)) > r->headers_out = ap_overlay_tables(r->pool, > r->err_headers_out, > r->headers_out); oh, that explains it. and thanks for pointing out the relevant code bits... sorry it took me so long to express my graditude :) --Geoff >
RE: $r->print and references: Was RE: Slightly OT - Content-length
While you're "on the line" as it were John, I have a question: In XS you can pop more than the number of args that were passed into the function, but "Bad Things will happen". But in perl, it's as if an actual array were passed into the function. Now everyone talks about subroutine "overhead" and it's pretty significant. Now there are probably two factors, one being the lookup in the symbol table (gv), and the other being the creation of that array. However the second part of the equation doesn't "seem" to happen in XS, so is there a lower "overhead" to a function call in XS? (I know it's all pretty trivial in terms of array creation of references, but I'm just _curious_, not to mention it probably has to do a dlopen to the library, so it might actually be higher..., but like I said I'm just sort of wondering) Thanks, Shane.
RE: $r->print and references: Was RE: Slightly OT - Content-length
> > I'm sorry, but I think you are simply wrong here. If I call a perl > function or an XS routine with a variable as an argument it is passed by > reference. There is *no* copy. > > A simple proof: > > sub hack { > $_[0] = 'a new string'; > } > > $a = 'an old string'; > hack $a; > print $a; Yep you're right. I'm used to passing by reference because it's just easier to avoid making copies of the references visa vi shift and you don't have to worry about it. I mean you could do: sub refcall { my $something=\$_[0]; } to avoid the copy I guess..., but that's just weird. Easier to just call it by \$myvariable. Hmm.., good point, and well taken. (hamster in brain whipped slightly for poor case creation..., ran a few test scripts prior to posting, but should have noted the copy when shifting off the args, implicit deep copy for '='s is still a strange thing for a primarily c programmer...) Thanks, Shane.
RE: $r->print and references: Was RE: Slightly OT - Content-length
De : Shane Nay [mailto:[EMAIL PROTECTED]] > To comment on what John originally said..., arg, here we go. The > difference between print \$somevariable, and print $somevariable can > be very significant. Nope. Not "very". > Everything is passed internally as a "reference", but that > doesn't me it's done in the same way. When you say "print $somevar", > and "print \$somevar" two VERY different things happen. case 1: > print $somevar (I'm assuming a type of string) > SV* somesv=(SV*)malloc(sizeof(SV)); > somesv->sv_any=(void*)malloc(sizeof(char*)*strlen(ourstring)); > //Notice, have to set aside memory > strcpy((char*)somesv->sv_any,ourstring); //Notice we have to copy our data > -->Call the "print function" and pass it a reference to "somesv" I'm sorry, but I think you are simply wrong here. If I call a perl function or an XS routine with a variable as an argument it is passed by reference. There is *no* copy. A simple proof: sub hack { $_[0] = 'a new string'; } $a = 'an old string'; hack $a; print $a; This part of your pseudo code: > SV* somesv=(SV*)malloc(sizeof(SV)); > somesv->sv_any=(void*)malloc(sizeof(char*)*strlen(ourstring)); > strcpy((char*)somesv->sv_any,ourstring); //Notice we have to copy our data is *not* part of the call. It's the code that puts a value in "somesv", i.e. $somesv = "ourstring". It is present in both the ref and the nonref cases. Passing a refrence to $r->print is *slower*(by an infinitessimal amount). The point of allowing it is to get around the problems with the normal Perl coding style: sub slow { my $r = shift; my $arg = shift; # A copy here! $r->print ($arg); } But note the copy is not in the argument passing, it's in the Perl code. sub fast_but_ugly { $_[0]->print ($_[1]); } -- John Hughes <[EMAIL PROTECTED]>, CalvaEDI SA.Tel: +33-1-4313-3131 66 rue du Moulin de la Pointe, Fax: +33-1-4313-3139 75013 PARIS.
RE: $r->print and references: Was RE: Slightly OT - Content-length
On Mon, 19 Jun 2000, you wrote: > > De : Matt Sergeant [mailto:[EMAIL PROTECTED]]> > > On Mon, 19 Jun 2000, John Hughes wrote: > > > (Hint - Perl passes all values by reference. > > > > Are you sure thats the case with XS code? > > Yes. To expand on John's answer... :), and delve into where this thread started...: In XS you just know how many variables are on the stack. The only thing that sits on the stack are pointers to SV's..., SV stands for "scalar value". Now as you might know, you can pass all sorts of things to XS functions, hashes, arrays, etc. So what happens is these things are "pushed" onto the stack of execution, and the XS function is called. It then peals things off of the stack, and uses perl macros to find out what sort of reference it is. To comment on what John originally said..., arg, here we go. The difference between print \$somevariable, and print $somevariable can be very significant. Everything is passed internally as a "reference", but that doesn't me it's done in the same way. When you say "print $somevar", and "print \$somevar" two VERY different things happen. case 1: print $somevar (I'm assuming a type of string) SV* somesv=(SV*)malloc(sizeof(SV)); somesv->sv_any=(void*)malloc(sizeof(char*)*strlen(ourstring)); //Notice, have to set aside memory strcpy((char*)somesv->sv_any,ourstring); //Notice we have to copy our data -->Call the "print function" and pass it a reference to "somesv" case2: print \$somevar SV* somesv=(SV*)malloc(sizeof(SV)); //still need memory for this somesv->sv_any=(void*)ourstring; -->Call the "print function" and pass it a reference to "somesv" Okay, so we need two less things to happen, we no longer need to set aside memory for the string, and we don't have to copy it. This is a big win in terms of speed. (Actually I think it happens quite a bit different internally, but this is the "gist" of it. There might even be one less SV malloc, because it passes by "reference", it would have to create the reference which is an SV, but it probably wouldn't have to create a second one like we need in case 1. Maybe Doug could help me out with this?) So that's why when you pass by reference (and use it as such) it's 1) faster 2) changes the value when it gets back to you, because it's not working from a copy, it's working from the "real deal". So if you're thinking of passing huge strings, then it is in your best interest to pass by reference..., and if you're passing hashes and arrays directly... SHAME ON YOU! :-) Happy perling! Shane. (I tried to use less obfuscated c code..., sorry if I failed :-( )
Re: Segfault Apache1.3.12/mod_perl1.24/Solaris2.6
Hi Eric, > > [Fri Jun 16 17:20:21 2000] [notice] \ > > child pid 22310 exit signal Segmentation Fault (11) On Mon, 19 Jun 2000, Eric Cholet wrote: > backtrace. (gdb) bt #0 0x2b444 in perl_handler_ismethod () #1 0x2c43c in perl_call_handler () #2 0x2bd5c in perl_run_stacked_handlers () #3 0x29920 in perl_handler () #4 0x7fce8 in ap_invoke_handler () #5 0x9bdfc in ap_some_auth_required () #6 0x9be7c in ap_process_request () #7 0x8fbac in ap_child_terminate () #8 0x8fe14 in ap_child_terminate () #9 0x90014 in ap_child_terminate () #10 0x908f4 in ap_child_terminate () #11 0x914a0 in main () Curiously enough, Apache::Registry seems to run ok with a simple "Hello world" type of script. Stay tuned. 73, Ged.
RE: $r->print and references: Was RE: Slightly OT - Content-length
> De : Matt Sergeant [mailto:[EMAIL PROTECTED]]> > On Mon, 19 Jun 2000, John Hughes wrote: > > (Hint - Perl passes all values by reference. > > Are you sure thats the case with XS code? Yes. -- John Hughes <[EMAIL PROTECTED]>, CalvaEDI SA.Tel: +33-1-4313-3131 66 rue du Moulin de la Pointe, Fax: +33-1-4313-3139 75013 PARIS.
Re: $r->print and references: Was RE: Slightly OT - Content-length
On Mon, 19 Jun 2000, John Hughes wrote: > (Hint - Perl passes all values by reference. Are you sure thats the case with XS code? I don't personally know XS very well, but there are some wierd things about it, and this might be one of them. I know for certain that XML::Parser has a lot of slow-down because of the Perl -> XS interface, and passing strings across it (although IIRC Ilya did some work on that for perl 5.6). -- 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: APACHE::ASP intermittent problem uploading images (CGI.pm)
Would you turn Debug to -2 and trace the output before it happens, and then send that bit of log since server restart? See if you have any StatINC* settings turned on, turn them off, as they will reload libraries, and might be tripping something up. Also, should we not get this worked out, try the $Request->{FileUpload} interface. --Joshua _ Joshua Chamas Chamas Enterprises Inc. NodeWorks >> free web link monitoring Huntington Beach, CA USA http://www.nodeworks.com1-714-625-4051 Eric B wrote: > > Using Apache::ASP (latest build) I have problems uploading images. > Sometimes, I get the following error through the http channel, (same error > is seen in error-log) > > Errors Output > > Undefined subroutine CGI::upload > , /usr/local/libdata/perl5/site_perl/Apache/ASP.pm line 1229 > > Clearly, this stems from my use of CGI.pm in my ASP page. > > my ($q) = new CGI; > > ( } > > my ($upfile) = $q->upload("newimage"); > > But... this is kind of strange because it only occurs SOMETIMES. And it > does not occur in a standard perl script. > > I included a dump of my config below. > > Thanks, > > Eric > > - > > Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: > Platform: > osname=openbsd, osvers=2.6, archname=i386-openbsd > uname='openbsd' > hint=recommended, useposix=true, d_sigaction=define > usethreads=undef useperlio=undef d_sfio=undef > Compiler: > cc='cc', optimize='-O2', gccversion=2.95.1 19990816 (release) > cppflags='' > ccflags ='' > stdchar='char', d_stdstdio=undef, usevfork=true > intsize=4, longsize=4, ptrsize=4, doublesize=8 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 > alignbytes=4, usemymalloc=n, prototype=define > Linker and Libraries: > ld='ld', ldflags ='' > libpth=/usr/lib > libs=-lm -lc > libc=/usr/lib/libc.so.23.1, so=so, useshrplib=false, libperl=libperl.a > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=define, ccdlflags=' ' > cccdlflags='-DPIC -fPIC ', lddlflags='-Bforcearchive -Bshareable ' > > Characteristics of this binary (from libperl): > Built under openbsd > Compiled at Oct 31 1999 11:41:08 > @INC: > /usr/libdata/perl5/i386-openbsd/5.00503 > /usr/local/libdata/perl5/i386-openbsd/5.00503 > /usr/libdata/perl5 > /usr/local/libdata/perl5 > /usr/local/libdata/perl5/site_perl/i386-openbsd > /usr/libdata/perl5/site_perl/i386-openbsd > /usr/local/libdata/perl5/site_perl > /usr/libdata/perl5/site_perl > > - > > Server version: Apache/1.3.12 (Unix) > Server built: Jun 17 2000 16:03:54 > Server's Module Magic Number: 19990320:7 > Server compiled with > -D HAVE_MMAP > -D HAVE_SHMGET > -D USE_MMAP_SCOREBOARD > -D USE_MMAP_FILES > -D USE_FLOCK_SERIALIZED_ACCEPT > -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT > -D HTTPD_ROOT="/usr/local/apache" > -D SUEXEC_BIN="/usr/local/apache/bin/suexec" > -D DEFAULT_PIDLOG="logs/httpd.pid" > -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" > -D DEFAULT_LOCKFILE="logs/accept.lock" > -D DEFAULT_XFERLOG="logs/access_log" > -D DEFAULT_ERRORLOG="logs/error_log" > -D TYPES_CONFIG_FILE="conf/mime.types" > -D SERVER_CONFIG_FILE="conf/httpd.conf" > -D ACCESS_CONFIG_FILE="conf/access.conf" > -D RESOURCE_CONFIG_FILE="conf/srm.conf" > > - > And, from my httpd.conf: > > > > > #SetHandler perl-script > AddHandler perl-script .asp > PerlSetVar Filter On > PerlHandler Apache::ASP Apache::SSI > PerlSetVar Global /home/euro/asp > PerlSetVar DynamicIncludes 0 > PerlSetVar StateDB DB_File > PerlSetVar GlobalPackage main > PerlSetVar UseStrict 0 > PerlSetVar Debug 2 > PerlSetVar StatINC 0 > > > Options Includes ExecCGI FollowSymLinks > #Options Indexes FollowSymLinks ExecCGI Includes > #AllowOverride AuthConfig Limit > #Order allow,deny > Allow from all >
$r->print and references: Was RE: Slightly OT - Content-length
> Incidentally, the $r->print() method conveniently lets you pass the string > you want to send by reference. Why is that "convenient": Fast: my $x = "fred" x 1; $r->print $x; More obscure and microscopicaly slower: my $x = "fred" x 1; $r->print \$x; (Hint - Perl passes all values by reference. The point $r->print doing an auto-dereference is supposed to be to let you pass a reference around in *your* code. Personaly I don't think this was a good idea. If that's what the user wanted he could have done it himself). -- John Hughes <[EMAIL PROTECTED]>, CalvaEDI SA.Tel: +33-1-4313-3131 66 rue du Moulin de la Pointe, Fax: +33-1-4313-3139 75013 PARIS.
Re: Platform list
Hi, Does anyone work with apache+mod_perl in Irix platforms. I need information about this plattform, because i'm working in a project based in Irix. There is any problem? does it works correctly ? Best regards Jesús - Original Message - From: "Randy Kobes" <[EMAIL PROTECTED]> To: "Matt Sergeant" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, June 18, 2000 7:49 PM Subject: Re: Platform list > On Sun, 18 Jun 2000, Matt Sergeant wrote: > > > Does anyone have a definitive list of working platforms for mod_perl? I > > realise its probably just a simple combination of the platforms that both > > Perl and Apache work on, but I was wondering if theres a simple list > > anywhere (I've looked, but can't find one). > > > > There's some platforms listed at > http://testers.cpan.org/search?request=dist&dist=mod_perl - > mostly linux (of various flavours), solaris, and MSWin32. > The lack of other platforms probably is more a reflection > of a lack of testers willing/able to do the testing. > > best regards, > randy kobes > >
Re: Segfault Apache1.3.12/mod_perl1.24/Solaris2.6
> Hi all, > > Sorry, this is a bit long. [snip] > [Fri Jun 16 17:20:21 2000] [notice] \ > child pid 22310 exit signal Segmentation Fault (11) [snip] > There is no core dump and the same thing happens with the -X switch. please see the instructions in SUPPORT on how to provide a backtrace. -- Eric
Re: [OT] Making apps (un)available solution
On Sun, 18 Jun 2000, Michael J Schout wrote: > On Tue, 13 Jun 2000, Erich L. Markert wrote: > > > I'm trying to figure out the best way to make apps (un)available without > > having to edit the apache config files. > > We did something like this by making a handler like this: > > package Foo::PerlHandler; > > use Class::MethodMaker > new_with_init => 'new', > get_set => [qw/request/]; > > sub handler { > my ($class, $r) = @_; You forgot prototypes here, otherwise handler always gets called with just $r. > ($class, $r) = (__PACKAGE__, $class) unless defined $r; > > if (-f /tmp/foo.unavailable) { > $r->headers_out->add('Location', '/maintenance/index.html'); > return REDIRECT; > } > > my $this = $class->new($r); > $this->service; You've also forgotten your exception handling code here. Always try and wrap your dispatch code in an eval: eval { $this->service; }; if ($@) { # catch exceptions } -- 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