[Slightly OT] Port forwarding (Was: How to restart the root serverfrom within modperl?)
Hello, MLIf you absolutely need to be in port 80, either setup a simple MLlightweight apache on port 80 as a reverse proxy (see the mod_perl MLguide) or, even simpler, do some port forwarding from port 80 to your MLhigh port of choice. Has anybody had very good experiences using a simple port forwarder in a production setup? We had a somewhat bad experience with using portfwd under Solaris (images and other binary data got randomly corrupted, and we never got around to figuring out why), and I'm wondering what others use instead. It seems like the port forwarder involved would also be important performance wise. The applications I am typically interested in are forwarding ports on the same interface (like the port 80 example here) as well as between interfaces (or between external interfaces and loopback). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
[JOB] Integration architect; Database, VoiceXML, and QA engineers
Hello, We have several open positions at Tellme. Folks on this list are usually fine candidates for engineering positions at Tellme as our web backend environment is mainly mod_perl based, involving externally visible, traditional web applications, as well as internal VoiceXML applications and XML data feeds. Tellme systems use HTTP and XML extensively as a generic data-passing mechanism, and webservers are involved in everything from dynamic configuration for our hundreds of production machines, to integration with customer billing systems. Here are the job descriptions: = SENIOR QA ENGINEER = Tellme seeks a quality assurance engineer with systems integration experience to design and implement test suites and lead operational triage for Tellme's automated directory assistance product offering. Position based in downtown Mountain View, Calif. Some travel may be required. Resumes to: Eugene Koh - [EMAIL PROTECTED] - 650.930.9023 -- 5+ years experience in QA for web service applications at scale -- experience in production Oracle 8i/9i and/or MySQL environments -- firm grasp of testing methodologies/automated test development, multi-tier network design, performance testing, perl scripting -- proactive, demonstrated written and verbal communication skills -- Solaris x86 admin and/or network operations background a plus = SENIOR INTEGRATION ARCHITECT = Tellme seeks a senior integration architect to lead services teams, defining and communicating the technical roadmaps for call center integration and web projects and anticipating issues for the team. Position based in downtown Mountain View, Calif. Some travel may be required. Resumes to: Eugene Koh - [EMAIL PROTECTED] - 650.930.9023 -- 7+ years software engineering and systems integration experience in a services environment with significant client interaction -- operational experience deploying web server architectures, call center integration systems, and/or speech technology at scale -- commercial programming experience using VoiceXML, JavaScript, Document Object Model, and/or perl at scale -- practical experience implementing unified development processes and delivering budgetary estimates for web application projects -- excellent client-facing and internal communication skills; people management experience a plus = VOICEXML APPLICATION ENGINEER = Tellme seeks an application engineer to design and implement speech activated IVR solutions for Tellme's enterprise call center clients, working with cross-functional teams of subject matter experts. Position based in downtown Mountain View, Calif. Some travel may be required. Resumes to: Eugene Koh - [EMAIL PROTECTED] - 650.930.9023 -- 3+ years software engineering and systems integration experience in a services environment with significant client interaction -- extensive web programming experience using VoiceXML, JavaScript, Document Object Model, and perl at scale -- excellent client-facing and internal communication skills -- practical experience delivering budgetary estimates a plus = DATABASE APPLICATION ENGINEER = Tellme seeks a database application engineer with strong integration architecture skills to design and develop core database applications for Tellme's automated directory assistance product offering. Position based in downtown Mountain View, Calif. Some travel may be required. Resumes to: Eugene Koh - [EMAIL PROTECTED] - 650.930.9023 -- 5+ years experience building database applications at scale -- Oracle 8i/9i and MySQL expertise, especially in schema design, PL/SQL, and query optimization -- demonstrated understanding of data topologies and multi-tier network design -- strong perl or Java web application development background -- excellent communication skills; client-facing skills a plus = For more information on Tellme, visit the Tellme corporate website at http://www.tellme.com/. To get an idea of some of the possibilities of our technology, call our free voice portal at 1-800-555-TELL or get toll free directory assistance by dialing 1-800-555-1212. If you have any questions, you can e-mail me at [EMAIL PROTECTED] Submit resumes to Eugene Koh ([EMAIL PROTECTED], and you can send him questions directly as well). Humbly, Andrew -- Andrew Ho
Re: Privilege separation revisited
Hello, JPThe question is, what is the state-of-the-art approach for protecting data JPwritten to a file by mod_perl from being overwritten by an untrusted user? JPIs it possible to run all mod_perl things as a separate user (without JPhaving to keep two parallel apache installations)? pYou don't need, parallel installations, just parallel instances. p pOne main server running on port 80 set up to proxy requests to the prelevant user's process. p pIndividual users have their own httpd.conf set up with a unique port punder a unique user (themselves, for instance). On an Internet exposed system you don't necessarily want to permit those httpds to run as actual users. Instead, it is probably safer to make a number of unprivileged users (www-perl, www-username, www-php, or whatever) that have no shells (or whatever other security restrictions you are interested in) and have the httpds run as them. You can put them in the same group as the related user (for example if user andrew is in group andrew, you can create a www-andrew user with no shell, but in group andrew so files can be shared). This minimizes the damage a badly written CGI can do (blow away any group writeable files in group andrew, for example, rather than blow away any of user andrew's files plus do bad stuff masquerading as user andrew). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
Re: Apache::Request for CGI? (was: Re: A::Registry vs. mod_perlhandlerphilosophy)
Hello, GYmod_perl allows you to let your content handlers to focus on content - GYall other parts of your application (authentication, session management, GYproxying, URL rewriting tricks, etc) can programmed at the server level GYvia other parts of the request cycle. I think the question isn't why is Apache::Registry not sufficient to handle all functions within an HTTP request but why is it bad to use Apache::Request specifically for the content generation phase? Perrin had some good practical reasons for this--caused by the generated-namespace, sub-wrapped, eval'ed nature of Apache::Registry. I totally agree with the fact that Apache::Registry can introduce many hard-to-debug-problems. I've had enough headaches debugging some of these issues myself. It's unclear to me, though, that there are unimaginably cool things you can get to in a real content handler that you can't get to from an Apache::Registry script--which seems to be the assertion. I mean, even from the lowest common denominator CGI you can get all parts of the incoming HTTP request, plus output arbitrary headers. I have found that often the Apache::Registry functionality of not having to restart servers when simple scripts change is worth the potential of bugs tickled by the Apache::Registry sub-wrap approach. I think it's a fine tool for simple content generation scripts and that it doesn't limit you at all in that aspect. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
Re: Not reading $ENV variable
Hello, CPI'm seeing a weird thing. Sometimes my script sees nothing in the CP$ENV{HTTP_REFERER} variable. Im not sure what is causing this. It CPworks some of the time. You are never guaranteed to receive a Referer header; first of all, it is sent by the client, and the HTTP client involved has no obligation to set it at all on outgoing requests--it's just a convention that most desktop browsers follow. Second, some application level HTTP proxies block outgoing Referer headers for security reasons. Finally, it's possible that a user bookmarked a page or typed in a URL and hence no Referer was involved at all. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
Re: the deprecation of Apache-request in mp2
Hello, NTI sure hope not! I second John Siracusa's post on this. Keep the HTML NTgeneration well away from request parsing, please! I personally am 100% in the camp of keeping HTML generation separate from quest parsing, but I do recognize the advantage of having API level compatibility between Apache::Request and CGI, so that you could switch from one to another easily. I think this would be a big win for mod_perl overall from the port your scripts quickly point of view. I think a good compromise would be to keep the HTML generation code in an entirely separate module, like Apache::Request::HTML or something. That class could augment Apache::Request with new methods. (This is somewhat similar to how Apache::File and Apache::Log augment the Apache class with new methods.) This seems to satisfy both sides, and accomplish the laudable goal of making CGI and Apache::Request API compatible without bloating up the normal use of Apache::Request. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
RE: Content-Type not working on MSIE
Hello, AFAs an aside, if anyone on the list knows of ways to defang this really AFannoying IE behavior, I would be most interested in knowing about it Two (and probably more) ways to do it. This is probably in a FAQ somewhere as it is a common problem. (1) Fool IE by snarfing another extension in the URL. For example, instead of requesting http://www.example.com/foo.pl, tack on a dummy parameter and request http://www.example.com/foo.pl?filename=foo.txt. (2) Send a Content-Disposition header. This is a MIME header and not in the HTTP spec but IE respects it: Content-Disposition: inline; filename=foo.txt Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
Re: Content-Type not working on MSIE
Hello, SBCan someone please summarize the problem and add possible solutions and SBpost it here so we can add it to this document: SBhttp://perl.apache.org/docs/tutorials/client/browserbugs/browserbugs.html Sometimes, MSIE will ignore the MIME type specified in a Content-Type header, and instead guess the type of a file based on its extension. For example, on most Windows systems files with a .reg extension are registry files. So if you happen to have a Perl script on your mod_perl webserver called foo.reg, even if it outputs a Content-Type: text/plain webserver, MSIE may treat the output from the URL as a registry file (and pop up a dialog box asking if you want to run the file, e.g., attempt to merge its contents with the registry, in this example). This is especially a problem if the computer running MSIE does something special for .pl files (for example, feed the file to ActiveState Perl). Here is how to reproduce the bug. Make a simple script like this: #!/usr/local/bin/perl -w use strict; use Apache (); my $r = Apache-request; $r-content_type('text/plain'); $r-send_http_header; $r-print('ok'); Call it plain.reg, and associate .reg files with Apache::Registry. An .htaccess entry like this may do the trick: FilesMatch \.reg$ SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader On /FilesMatch Now if you access http://www.example.com/plain.reg with MSIE, you may trigger this bug. (I'm not positive what causes MSIE to ignore Content-Type on some extensions but not others. If plain.reg doesn't work for you, try plain.exe, plain.bin, or some other file extensions.) There are a variety of workarounds. Easiest is to just fool IE, by making it think the script is named something else. Most foolproof is to use extra path information: http://www.example.com/plain.reg/plain.txt You can also append a dummy parameter. Apparently, MSIE uses a simple string match to find the extension. http://www.example.com/plain.reg?bogus=plain.txt Finally, MSIE respects the Content-Disposition MIME header. This isn't officially part of the HTTP spec, but is especially useful because you can suggest a filename. This is nice so that if the user does Save As... or if your script produces a CSV file or some other application specific output, a pretty filename will be suggested. Just include a line like this in the Apache::Registry script before calling send_http_header(): $r-header_out('Content-Disposition' = 'inline; filename=plain.txt'); I just verified all of this on freshly patched IE 6. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
Re: Content-Type not working on MSIE
Hello, AGcalled foo.reg, even if it outputs a Content-Type: text/plain webserver, s/webserver,/header,/ Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
Re: Content-Type not working on MSIE
Heyas, AHFinally, MSIE respects the Content-Disposition MIME header. This isn't AHofficially part of the HTTP spec, but is especially useful because you AHcan suggest a filename. One more addition. While poking around RFC 2616 for some other stuff I found that Content-Disposition is in fact mentioned in it: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1 Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
Transparent front-end proxying for many VirtualHosts
Hello, I've looked through the mod_rewrite and Guide documentation and can't seem find an answer for this, but feel free to point me at TFM to R if I just missed it. I have an Apache with many VirtualHosts, and I want to setup proxying so that a lightweight frontend Apache with mod_rewrite/mod_proxy proxies Apache::Registry script requests back to a heavyweight backend Apache running on a localhost-only port. I want to simplify my configuration in two ways. I'd prefer not to maintain two sets of VirtualHost configuration data, and I'd like it if the block that proxies .pl files to the backend proxy not be replicated per VirtualHost. The conceptual behavior I want, is for FilesMatch \.pl$ to be proxied by the backend server, and everything else by the frontend. I've tried many combinations which don't work, which I can post if it's relevant... it seems that having a map outside of VirtualHost blocks doesn't work (I get a GET /real/path/on/filesystem/to/foo.pl HTTP/1.0 on the backend) and that requests with path_info don't work. Does anybody have a pointer to a setup that looks like this? Thanks in advance! Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer1-800-555-TELL Voice 650-930-9062 Tellme Networks, Inc. Fax 650-930-9101 --
Re: Please wait Handler
Hello, MMI guess in a nutshell I'm wondering if there is a way to send HTML MMheaders to a browser which tells it to scrap the html it has already MMreceived and display the new HTML I am passing it. MM MMIf this isn't possible, can somebody point me in the direction of a MM'please wait' mechanism that is possible - Is there one? If the long-running process will finish within the usual amount of time that a browser waits before timing out, this is easy--use an HTTP Refresh header. For example: Long running operation is http://www.example.com/getresults.pl Please wait page is at http://www.example.com/pleasewait.pl Make an HTML page which does a form submit to pleasewait.pl. pleasewait.pl just displays an HTML page with an animated please wait image on it, and its headers include the following header: Refresh: 1; url=http://www.example.com/getresults.pl?args... The browser displays the HTML on that page, and then a second later (the 1 in the Refresh header, it could be longer), the browser fetches the second page. Since the HTML and animated image are already loaded, the user sees that while waiting for the second page to load. If the process runs a very long time, you are safer writing getresults.pl (in this example) to be able to kick off a long-running job in the background, and just display the status of the job. You can snarf a Refresh header in that too so that users see it constantly updated. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [Slightly OT] [mp2] e-Commerce
Hey Stas, PHSome good graphs, including thttpd: PHhttp://www.zeuscat.com/andrew/work/aprbench/ SBIt shows that threaded mpm's throughput is worse than preforked, which SBsounds dubious unless things were broken (blocking mutexes). Hopefully SBsomeone can run a benchmark on more updated versions of Apache. There were in fact some known problems with the worker MPM in the early versions of Apache 2. There was some discussion on the Apache developers mailing list about this in April/May 2002. I'd really like to run my benchmarks on a current version of Apache... maybe in my copious free time... sigh. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [RFC] Apache::AuthDigest
Heyas, GYa few months ago I posted an RFC for a Digest authentication module... GYif a few people speak up and say they'd like it on CPAN I'll push it GYover... In the parlance of the Apache developer, list, +1 from me. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
mod_perl recommended version matrix
Hello, Today I went to the mod_perl website with the intention of asking, what version of mod_perl works with Perl 5.8? I found that there wasn't an easy way to find this out. We seem to get a lot of questions on the list about mod_perl with Apache 2 and so forth. Perhaps it would be a good idea to have a recommended version matrix for mod_perl? For example, to indicate that mod_perl 1.27, Apache 1.3.26, and Perl 5.6.1 are a stable combination, whereas if you have Apache 2.0.40, you need mod_perl 1.99 and whichever version of Perl. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Is it possible to change the browser's address/location URL without Redirect?
Hello, HZI was wondering if that network trip can be avoided. The answer is no. You might be able to use JavaScript to do it on certain browsers, but I'm reasonably sure you can't do it on recent IE and Netscape browsers. Why do you want to do this? You could use base href/ or similar if your goal is just to make links are relative to a certain root. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Getting ugly: mod_perl and traditional forms of writing CGI
Hello, SSThe below is a sample bit of code I am using for very simple forum SSsoftware. It acts erratically, sometimes seeing the contents of the form SSbeing POSTed to it and sometimes not. If a form POSTed is under 500 SSbytes in length it works fine. Anything higher is hit and miss. SS SScommunity.cgi: SS-- SSpackage Kittens::Community; You don't want to use an explicit package statement in an Apache::Registry script because Apache::Registry creates its own package name for the current script. I can't find a on-line reference for this right now, but I recall it causing sporadic problems. SSI'm thinking that the step of going from writing simple Perl CGI scripts SSto mod_perl is one that many people will be going through and a SSdocumenting a lot of this (basic mod_perl writing techniques) online SSwould be incredibly helpful. So you're not just helping me, you're SShelping an entire future community of mod_perl developers. You should really take some time to look through the excellent mod_perl Guide, which is exactly this, a bunch of knowledge compiled together in a tutorial type way. You can read the Guide on-line here: http://perl.apache.org/docs/1.0/guide/ In fact, there is a section specifically discussing converting CGI scripts to run under mod_perl. http://perl.apache.org/docs/1.0/guide/getwet.html#Porting_Existing_CGI_Scripts_to_run_under_mod_perl In general, you will get much better error reporting and if you are running with warnings and use strict in all of your scripts. You can find out how to enable these in the Guide. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
[JOB] Backend mod_perl programmer, frontend HTML/VoiceXML developer
Hello, We have two positions open at Tellme, one for a web backend developer doing mod_perl development, and the other for a VoiceXML and HTML frontend developer who would produce content in a mod_perl framework. We are looking for a web backend developer who: * has experience architecting, implementing, and maintaining server-side web applications (using mod_perl, ISAPI, NSAPI, etc.) * is a hardcore coder, expert at slinging Perl code around, and familiar with at least one other good language (C/C++, Java, etc.) * knows the challenges of building highly reliable web applications * has a thorough understanding of the HTTP protocol * can identify and fix website security issues * has worked with systems which pass data around using XML * is obsessed with robustness and performance Our web backend environment is mainly mod_perl based, involving externally visible, traditional web applications, as well as internal VoiceXML applications and XML data feeds. Tellme systems use HTTP and XML extensively as a generic data-passing mechanism, and webservers are involved in everything from dynamic configuration for our hundreds of production machines, to integration with customer billing systems. We are looking for a frontend developer who: * has some production level experience with JavaScript, HTML, XML, or other client-interpreted markup type language * has a passion for creating applications with great UI * has experience with, or can quickly learn, basic server-side scripting (for example, server page templates) VoiceXML development experience is a plus. Having built a voice application using Tellme Studio (http://studio.tellme.com/) just because you were interested in this job, is a double plus. :) For more information on Tellme, visit the Tellme corporate website at http://www.tellme.com/. To get an idea of some of the possibilities of our technology, call our free voice portal at 1-800-555-TELL or get toll free directory assistance by dialing 1-800-555-1212. If you have any questions, or if you would like to submit a resume, please e-mail me at [EMAIL PROTECTED] and include Resume in the subject line. Thanks! Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [RFC] Apache::DigestAPI
Hello, GYApache::DigestAPI is a release of Recipe 13.8 in the Cookbook - a simple GYAPI for supporting Digest authentication a la mod_digest.c from the GYApache distribution. I think this is a great idea. I'm a huge fan of digest authentication as a simple basic authentication replacement, and many modern clients now support it. One comment, why the odd name? Shouldn't it be Apache::AuthDigest or similar? Every library is an API so it seems kind of odd to call it Apache::DigestAPI. GYkeep in mind that the current implementation doesn't work with MSIE, so GYyou'll have to use something like Opera or Konqueror (or mozilla now, I GYhear?) to play around with it. MSIE does do digest authentication that works with mod_digest.c. And Mozilla past 0.9.7 should do digest authentication. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [RFC] Apache::DigestAPI
Hello, GYwell, it's an API in that it doesn't do anything for you except provide GYan API. meaning, I'd expect Apache::AuthDigest to work as so: GY GYPerlAuthenHandler Apache::AuthDigest GY GYall this module does is provide methods that parallel GY$r-get_basic_auth_pw() and $r-note_basic_auth_failure - you need to GYuse the methods yourself to build an actual authentication mechanism. I just commented this because it would make more sense to me as someone looking to implement digest authentication in Perl if an Apache::AuthDigest module existed which WAS useable directly as a PerlAuthenHandler (with a configuration API identical or similar to mod_digest.c), and the API came bundled with it if you wanted to use it directly. I could imagine there being a different namespace (I want the methods, so I use Apache::AuthDigest::API), or Deep Perl Magick (when I use Apache::AuthDigest::API in a handler or an Apache::Registry script, $r-note_basic_auth_failure() suddenly just works because someone mucked with Apache's namespace), or some permutation thereof (when I have Apache::AuthDigest as a PerlAuthenHandler, $r-note_basic_auth_failure() just works in any associated mod_perl handlers or scripts). That would mean that you could just download one package, with a name one would expect when asking the question how can I implement digest authentication in a mod_perl enabled server without recompiling Apache? On a totally different note, I can't seem to get this module to load properly at build time: % perl Makefile.PL % make % perl -Mblib -MApache::DigestAPI -e0 Can't locate loadable object for module Apache::DigestAPI in @INC (@INC contains: /home/andrew/install/pm/Apache-DigestAPI-0.01/blib/arch /home/andrew/install/pm/Apache-DigestAPI-0.01/blib/lib /usr/libdata/perl5/i386-openbsd/5.6.1 /usr/local/libdata/perl5/i386-openbsd/5.6.1 /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 /usr/local/lib/perl5/site_perl .) at -e line 0 This is on OpenBSD 3.1, with Perl 5.6.1. After installing the module anyway and trying it inside mod_perl itself, I get a similar error in the server error_log: [Thu May 23 14:21:30 2002] [error] Can't locate loadable object for module Apache::DigestAPI in @INC (@INC contains: /home/andrew/pm/Zeuscat-Addressbook/blib/arch /home/andrew/pm/Zeuscat-Addressbook/blib/lib /usr/local/encap/mod_perl-1.26/lib/site_perl/5.6.1/i386-openbsd /usr/libdata/perl5/i386-openbsd/5.6.1 /usr/local/libdata/perl5/i386-openbsd/5.6.1 /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 /usr/local/lib/perl5/site_perl . /home/andrew/httpd/ /home/andrew/httpd/lib/perl) at /var/www/htdocs/zeuscat.com/andrew/test/digest/digest.pl line 9 Compilation failed in require at /var/www/htdocs/zeuscat.com/andrew/test/digest/digest.pl line 9. BEGIN failed--compilation aborted at /var/www/htdocs/zeuscat.com/andrew/test/digest/digest.pl line 9. I also note that during building, I end up with a Session.so in blib/arch, but after doing make install, Session.so disappears. There is also an DigestAPI.xs that gets copied into blib/lib/Apache, which seems fishy. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
RE: Cheap and unique
Hello, OCNSYou could try - Math::TrulyRandom CPAN module. Perrin's comments still apply. There is no guarantee that a random number generator of any type (truly random or otherwise) will return unique values. In fact, one would fully expect repetition after some amount of time. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [Q maybe OT] forward
Hello, MHTforwarding is a term that i borrowed from the JSP concept - which i'm MHTcurrently trying to implement in perl. PHJSP forward is directly equivalent to an internal redirect. It's just PHan include that doesn't return. In short, it's a GOTO statement. Thank PHyou Sun. This concept is supported better in Apache::ASP, where you can just pass arguments directly to the target page. If you use the internal_redirect() method, you have to use notes(), pnotes(), globals, or some other cumbersome method to pass arguments. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [OT] Encrypting Embedded URLs
Hello, JSIf you just want to obfuscate, you can do a rot13, with special JSsubstitutions for non alpha charachters. Or any other 'roll your own' JSsolution [XOR against 'snakeoil' then URL encode what needs it]. For simple obfuscation, I would prefer Base64 (using MIME::Base64 in Perl). It's simple, fast, standard, results in string totally composed from a well known character set that needs little further encoding, and well known with implementations in just about any language. You don't need to do anything special for non-alphanumeric characters, either (or indeed, for 8-bit data, which is the whole point of Base64 encoding). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Problem with DBM concurrent access
Hello, DWI would also suggest using BerkeleyDB.pm, but with the DWDB_INIT_MPOOL|DB_INIT_CDB flags. In this mode, only one writer is DWallowed at a time, and Berkeley automatically handles all the locking DWand flushing. Just don't forget to use db_close() to close the file DWbefore untie'ing it. One caveat on this, BerkeleyDB maintains its locks and other environment information in a local memory segment so this won't work if multiple machines share the same BerkeleyDB file (e.g., you are using the BerkeleyDB file over NFS). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: SSL Installation Questions - Help
Hello, LDMHaving to compile, install, integrate everything yourself is a huge LDMwaste of time. Your are duplicating all the efforts put in by the LDMdistributions, for zero added value. Huh? Having control over what modules go into your Apache, plus having one compiled on your machine for your version, is zero added value? I think most people on this list would disagree with you. Most of us who depend on Apache build our own for one reason or another. You can generally make an Apache that fulfills your needs and no more which consumes less memory and has less dependencies than a prebuilt binary from somewhere. And being tied to a vendor release schedule probably qualifies as far more of an upgrade nightmare than having to occasionally pull out the text file where you put your build procedure. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Apache+Modperl Website Statistics
Hello, FFCan you not just set a cookie from the javascript itself, rather than FFhaving it redirect to a location which then has to read it from the FFquery string and set the cookie. Saves you one step, if it's possible FFto set the cookie directly from the javascript (which it seems like FFshould be possible, but I don't know for sure). This is indeed possible and will save you a step. It also avoids the issue of setting a cookie in a redirect. http://www.mozilla.org/docs/dom/domref/dom_doc_ref10.html#1003548 Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Apache::DBI or What ?
Hello, CHWhat would be ideal is if the database would allow you to change the CHuser on the current connection. I know PostgreSQL will allow this using CHthe command line interface psql tool (just do \connect database CHuser), but I'm not sure if you can do this using DBI. CH CHDoes anyone know if any datbases support this sort of thing? This occurred to me in the case of Oracle (one of my co-workers was facing a very similar problem in the preliminary stages of one of his designs), and I actually had asked our DBAs about this (since the Oracle SQL*Plus also allows you to change users). As I suspected (from the similar connect terminology), our DBAs confirmed that Oracle just does a disconnect and reconnect under the hood. I would bet the psql client does the same thing. I don't have a PostgreSQL installation handy at the moment, but I seem to recall it has a statement logger similar to MySQL's... if you have it handy, you could try the \connect from psql and see if it results in a disconnect and reconnect. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Apache::DBI or What ?
Hello, EFI will have many different users, users as in database users. So am I EFjust screwed and won't be able to keep connections open? Do you mean users as in actual RDBMS level users? In other words, when you say database users you mean different username/passwords used from, say, a command-line SQL client? If your answer is yes then indeed, this is exactly the situation the Guide is talking about--you're screwed and probably shouldn't keep connections open. You'll have to incur a connect on each HTTP request. EFI am using Postgress, I am wondering how big DBs deal with this sort of EFthing. I am also wondering what the actual overhead is in starting the EFconnection and if there is anything that I could to to limit that EFwithout validating a specific user. In large DB projects where you expect high levels of concurrency I haven't heard of anybody using RDBMS-level users for authentication purposes. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [ANNOUNCE] The New mod_perl logo - results now in...
Hello, WKA single button that matches the logo will be simplier, and more WKdistinct. Too many choices is making it harder for the newcomers. I agree here. But then, TMTOWTDI is a big part of Perl culture. I suggest a democratic solution: present the logo and the favorite logo-based button as the logo and button. Then, also present a page which has some alternate buttons on it, including the two winners of the present contest. Make the page with the official logo and button easy to find so users will see it first. Since there was a landslide winner I would say there is probably no need for alternate logos although it may be interesting for historical reasons (the Google logo archives do it the right way, in my opinion: http://www.google.com/stickers.html). DRI really like the new logo, and in fact I voted for it. However, I just DRrealized that the logo uses modperl, whereas mod_perl's name is DRmod_perl, with the underscore. Does anyone else see this as a problem? BMIt's a graphic design so I don't see that it needs to follow the Apache BMmodule naming convention exactly... It's a design -- it doesn't have to BMbe accurate to the name. I agree with both these statements. I think the issue isn't that the design must follow the name, but that users often get confused between the two, and if the design doesn't follow the name, that confusion will certainly be exacerbated. Of course, this is probably not a big problem as long as the conventional term is used in the documentation and website and as long as modperl on Google leads to the mod_perl site. I might also point out that any mod_perl hostnames come out as modperl (since underscores are not allowed in hostnames) and that modperl is often used as a directory name even though underscores ARE allowed in filenames. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: performance testing - emulating real world use
Heyas, BHAnyone know of good guides or general info on BHperformance testing and emulating real use of BHan application. As a general rule, it's easiest if you have a production system already running. Record all information that you need to reproduce the requests (typically, HTTP request headers and POST data if applicable), from a production server and you can replay any amount of data on a sandboxed QA environment. You can either eliminate or proportionally shorten the time period between requests to space out load arbitrarily. This is extremely effective if you have enough real user data because you're not inventing user load. You're using real user load. I don't know of any product that does this all at once, but it's not hard to hack together. If your site is entirely GET based, you can probably just make do with parsing access logs and turning those into requests. I believe Apache::DumpHeaders might get you most of the way on the capturing side if you need special headers, cookies, or POST information. Feeding scripts into commercial products like SilkPerformer will give you the best client side testing and reports. However, a homebrew Perl user agent will do okay, too. Unfortunately, ab doesn't support taking in a custom URL workload. For a simple record/replay load test tool that works remarkably well, check out the resource CD that ships with Windows 2000 and you will find the Microsoft Web Stress Tester. It's free and GUI based and can record IE sessions and replay them with an arbitrary number of threads. It uses Access databases to hold the tests and results so you can probably use Perl on Windows to populate it with your custom tests. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: performance testing - emulating real world use
Hello, ABHNot really; you also have to emulate the connection speeds of the ABHusers. Or does the tools you mentioned do that? Both of the commercially produced tools I mentioned (SilkPerformer and the free Microsoft Web Stress program) can throttle bandwidth. Rolling your own is a bunch harder. So you're correct. My point though is not so much that the load profile of what pages get loaded in what order, and what data calls and dynamic scripts are run in what order are genuine. If you simulate the timing between requests, you'll even get spikes that are similar to the real thing. It's definitely not reality! You also miss anomalies like users closing browsers and (unless you capture full headers) which clients support keep-alives for example. But, it's closer to reality than most scripts that are invented (especially be developers ;)). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: performance testing - emulating real world use
Hello, AHSo you're correct. My point though is not so much that the load profile of AHwhat pages get loaded in what order, and what data calls and dynamic AHscripts are run in what order are genuine. If you simulate the timing AHbetween requests, you'll even get spikes that are similar to the real AHthing. It's definitely not reality! You also miss anomalies like users AHclosing browsers and (unless you capture full headers) which clients AHsupport keep-alives for example. But, it's closer to reality than most AHscripts that are invented (especially be developers ;)). Man, I can't type worth anything today. The gist of what I meant to type was this: the exact load of the production server will not be replicated in your simulation; but the load from data calls and dynamically generated content will be similar in nature, patterned after how your server is hit in real life. This will likely be a better exercise of your server than a developer-invented test script. If you have a production environment (or proxy) set up that can capture real user requests, this is also far less work for creating a convincing simulation load than having to sit down and write a new script every time your application changes. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: here is a good modperl question on perlmonk
Hello, PLOne other tip... write a small script (or modify apachectl) to start PLapache with a port number matched to your unix UID. This keeps PLdevelopers from using clashing port numbers. PL PL httpd -c Port $UID -c Listen $UID At Tellme we find it easiest to run multiple Apaches, one per developer. We share the same base Perl and Perl modules; we develop modules with Makefile.PL's and use use blib in our included personal httpd.pl's to get to our own versions of library code. We run our Apaches on a shared box, because our production infrastructure is pretty different from a userland Linux box. We just run on multiple ports, by default we use our telephone extensions for the port number--so we don't have any conflicts between users. If there are problems with load, lower MinServers/MaxServers/StartServers/MaxClients. The individual configs and logs go into our home directories, the only caveat for our setup is that our homedirs are mounted over NFS so we have to explicitly specify a Lockfile on local disk. We usually go one up on Paul's suggestion and just put a personal copy of apachectl into our personal bin directories (perhaps renamed myapache) and just change some paths and add a -f when running Apache to make it find the right config file. We find that this works great for development, and lets us still depend on the same Perl/Apache builds we use on production. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Calling an Apache::ASP page from an Apache::Registry script
Hello, Apologies if this has been asked before; I searched the archives but couldn't find a reference to this. It's been discussed in the context of MVC design a while back, but I don't have a solid answer to the following question: can you call an Apache::ASP page from an Apache::Registry script? Couched in MVC terminology, can I forward control from a .pl controller to a .asp template, and pass arguments in a natural way? I can imagine doing an internal redirect, and passing arguments via pnotes()... but something like this would be way cooler: Inside caller.pl: use Apache::ASP (); Apache::ASP-forward('template.asp', @args); Inside template.asp: % my @args = @_ % My arguments were: %= join ', ', @args %. Using an internal redirect you'd have to find the previous request and its pnotes, and do various other mucky stuff. Of course the interface above is kind of arbitrary. You could choose some ASP style object to cram the passed parameters into, or have a built in program call to retrieve parameters passed from the caller. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Calling an Apache::ASP page from an Apache::Registry script
Hello, AH...can you call an Apache::ASP page from an Apache::Registry script? AHCouched in MVC terminology, can I forward control from a .pl controller AHto a .asp template, and pass arguments in a natural way? JCThe safest thing to do right now would probably be to do an external JCredirect to the ASP page like: JC Apache-request-header_out('Location', script.asp?$ARGS); Thanks for the quick response. I didn't think of the POST data reading conflict. A related question, is there any way to make Apache::ASP not initialize its $Request object by default? This is the only blocker from using the Apache::Request API in an Apache::ASP page. JCIf what you really want is to simply load an external ASP script as a JCtemplate for further processing in the script.pl, and you only want to JCrun script.pl as an Apache::Registry script, there is not an API for JCdoing this currently. Specifically what I'm trying to do is to emulate $Server-Transfer but from an Apache::Registry script. I don't need to further process the Apache::ASP template in the Apache::Registry script. I think an .asp that has % at the top of the file and % at the end of it would be similar; but I'd prefer using Apache::Registry to (1) eliminate the % % tokens and more importantly (2) continue using the Apache::Request interface which I'm used to. We actually wrote our own template language at Tellme a long time ago to support specifically this paradigm, which is really convenient for simple templates (we considered releasing it--running templates is usually as fast as or faster than running Apache::Registry scripts--but just then, there was a don't write another stupid template system flame war, so we decided not to!). It's also super convenient for MVC style programming (modules are the M, Apache::Registry scripts the C, templates the V). I've been investigating other template systems to try to find similar functionality in an existing package for a non-Tellme related project and haven't been able to find any embedded-Perl solutions that can be called from a .pl and still have the benefits of template caching. I prefer embedded Perl because it's so convenient for little niceties (for example, Your search found %= $n || 'no' % document%= $n == 1 ? '' : 's' %.) that real-world HTML interfaces need. So that's what I'm looking for. :) Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [OT] RE: modperl growth
Hello, JHI've found it possible to dispense with a separate configuration file JHfor almost any application, even those with an RDBMS back-end. Under JH*nix it's really easy to automate things, under Win32 it's a little more JHdifficult (file permissions are a bastard to manipulate). Perl can JHanalyse its own environment very accurately, and once it has this JHawareness it's really easy to achieve automation. So you are right about this, but let me add a caveat. Many times you need to cooperate with a third-party package management system. For example, an RPM database, or a stow or encap repository. In the latter case especially the paths that files are referenced at (typically /usr/local) differ from the places they actually live (typically a mounted repository). (I believe the Andrew File System has a similar problem, too.) Stuff using GNU autoconf is pretty easy to work into this by specifying a PREFIX at configure time. As of Perl 5.6.0 the Perl base install system accomodates for this as well, allowing you to specify different stuff to go into @INC versus where make install puts the package. Perl modules aren't as nice to fix. They automatically want to go where Perl is installed. If you want to rev packages separately, regular make install doesn't do the right thing. One last thing that is hard is where is your DocumentRoot? This is a huge problem for web applications being installable out of the box. Perl can't necessarily figure that out by itself, either. I guess my point is that installation is hard. Rather than trying to make it work for everybody out of the box, you should make it work for the typical case out of the box, and then provide hooks for installing it in custom places. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Apache::args vs Apache::Request speed
Heyas, JSWould someone PLEASE volunteer to try to compile and test JSapache+mod_perl libapreq on OS/X using the experimental JScode I posted there? Even if you can't get it working, JSANY feedback about what happened when you tried would be JSVERY helpful. Slightly off topic; I'd like to help with this but I have this curious problem. I'm trying to build Perl 5.6.itself 1 on Mac OS X (with the latest 10.1.2 update freshly installed, using the compiler from the developer tools CD that comes with OS X when you buy the 10.1 boxed version) before building Apache/mod_perl. So I go through the entire Configure sequence, and then no Makefile gets created (it goes through the entire routine of saying it's generating a Makefile, but whether I run Makefile.SH or have it done through Configure, no Makefile actually ever gets created). Has anybody else seen this really weird behavior trying to build Perl 5.6.1 on Mac OS X? A web search didn't turn up any relevant posts. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
[OT] Mac OS X compilation woes (Was: Apache::args vs Apache::Requestspeed)
Hello, JSAn initial build and install of: JShttp://www.apache.org/~joes/libapreq-1.0-rc1.tar.gz JS JSon a previously-working apache 1.3.22 mod_perl 1.26 server on OS X 10.1.2 JSwith this: JSuse Apache::Request; JSuse Apache::Cookie; JS JSIn its startup.pl file causes the following: JS JS# bin/httpd -d /usr/local/apache -f conf/httpd.conf JSdyld: bin/httpd Undefined symbols: JS_ap_day_snames JS... JS_sv2request_rec I'm having a similar problem but it's for ANY symbols in a .a that you compile something with. e.g. say I have a C library and it lives in /usr/local/lib/libfoo.a (include in /usr/local/include/foo.h) and exports void foo(). If I have a test C program tester.c: #include foo.h int main { foo(); return 0 } And I compile it so: % cc -o tester -lfoo tester.c And I run it, I'll get the undefined symbols error that you paste above. This happens for me with a variety of existing open source libraries that I've built. I theorize your problem with libapreq may stem from a similar problem (I'm also running 10.1.2). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Single login/sign-on for different web apps?
Hello, PLOf course, the best authentication system for banking I've seen is PLfrom UBS. They send you a scratchlist of around 100 numbers. Every PLtime you login you use one of the numbers and cross it off. Very PLslick. GBDoes that really work in practice? That sounds really annoying. Is this GBfor business banking or for retail? How do they get the next 100 numbers GBto the user? Do they mail it out when they've used 90? The ACE SecurID system (I think they're owned by RSA now) refines this process well. You have a hardy little credit-card sized (or key fob sized, and I'm sure they have other form factors) object. It has a little LCD screen and every 30 seconds the 4- to 6-digit number on it changes. When you log into the server, you give it your ID, a password, AND the number currently on your SecurID card or key fob. The key fob is nice. It's hardy and lasts a long time. I have one from Motorola from my stint there many years ago. You could probably toss it on the sidewalk from my third-story balcony and it'd be okay, plus it's small and easy to read. This is inferior to a true zero-knowledge challenge-response system which would require a little calculator, but it's far more secure than a password and far easier to use than paper and pencil. Here's the RSA SecurID URL: http://www.rsasecurity.com/products/securid/ Here's a picture of some of the hardware tokens: http://www.rsasecurity.com/products/securid/hardware_token.html I guess they DO have a challenge-response calculator. Neat. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [RFC] Apache::CacheContent - Caching PerlFixupHandler
Hello, PLThat's the price you pay for this functionality. Because we use PLApache's native file serving code we need a url-directory mapping PLsomewhere. PL PLOf course you don't need to make the entire docroot writable, just the PLdirectory corresponding to your script. Apologies if this is obvious--I haven't downloaded and tried this module yet. But would it not be possible to specify a separate directory altogether and make it serveable (Directory ... ... Allow from all ...)? If so perhaps it'd be easy to add this as a configurable parameter. In general it is a fine idea to not make the DocumentRoot writeable by the web user. In fact, I believe it is a good policy that the web user should be able to write only to a small subset of controlled locations. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Multiple Sites
Hello, SPBut if I put in URL/directory and a forward slash/ eg. SPhttp://URL/directory/ then it shows the default.htm page. But I know my SPcustomers, and they will not put in the directory forward slash. How do SPI get around this issue? RedirectMatch permanent ^/directory$ http://URL/directory/ Will do you what you want. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Cookie authentication
Hello, CDIt seems you can't do anything online without having cookies turned on CD(yahoo, bankone, huntington, ebay, etrade ) and I think internet users CDhave accepted this. Not those clever European governmental folks, though. http://www.vnunet.com/News/107416 http://news.zdnet.co.uk/story/0,,t269-s2099128,00.html http://news.bbc.co.uk/hi/english/sci/tech/newsid_1653000/1653907.stm http://www.cnn.com/2001/TECH/internet/11/14/eu.spam.cookies.idg/ Methinks there is a need to write a transparent store cookies on URL module. I seem to recall at least one major Apache module having an option to use URL-based authentication instead of cookie-based... but I can't seem to find that from a cursory perusal of CPAN. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Cache::* and MD5 collisions [was: [OT] Data store options]
Hello, DCFor example, file system caches fill their directories roughly equally DCwhen their paths are created from MD5 hashed keys. Doing something DCsimple and unique like URL-encoding the key to make a legal identifier DC(legal in the sense that it is a valid filename) wouldn't distribute as DCevenly. Let me point out that if you are using MD5 hashes for directory spreading (i.e. to spread a large number of files across a tree of directories so that no one directory is filled with too many files for efficient filesystem access), the easy solution is to just append the unique key that you are hashing to the files involved. For example, say your keys are e-mail addresses and you just want to use an MD5 hash to spread your data files over directories so that no one directory has too many files in it. Say your original key is [EMAIL PROTECTED] (hex encoded MD5 hash of this is RfbmPiuRLyPGGt3oHBagt). Instead of just storing the key in the file R/Rf/Rfb/Rfbm/RfbmPiuRLyPGGt3oHBagt.dat, store the key in the file [EMAIL PROTECTED] Presto... collisions are impossible. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [OT] Data store options
Hello, PHIf you do use BerkeleyDB, I suggest you just use the simple PHdatabase-level lock. Otherwise, you have to think about deadlocks and I PHfound the deadlock daemon that comes with it kind of difficult to use. Later versions of BerkeleyDB have a row-level lock available which works pretty transparently. However, this works using mmap() so it won't work if your BerkeleyDB file(s) is/are mounted via NFS. flock()'s scalability over NFS using lockd under Solaris is also questionable so many people end up implementing their own database-level lock using, say, atomic moves. It's an icky world out there. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [OT] ApacheBench says my site is unstable?
Hello, PMI'm using ApacheBench to perform stress testing on my mod_perl server. PMIt's not always working, though. Observe the following two runs: (first PMis Broken pipe; second has some failed requests) Try writing a Perl (or other language) client that hits the URL you test over and over again to inspect what is actually returned to the client at any given time. For example, just use LWP::Simple to GET that URL over and over again, and save the result (for example) in a hash and report all the different variations you get. Perhaps your script fails sporadically, not core dumping, but returning no headers or similarly confusing a regular HTTP client. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Excellent article on Apache/mod_perl at eToys
Hello, I checked the list archives and it didn't look like this had been posted yet. For those of you who haven't seen it yet... a great read on perl.com about the Apache/mod_perl setup at eToys, co-authored by our own mod_perl regular contributer Perrin Harkins. http://www.perl.com/pub/a/2001/10/17/etoys.html Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Environment variable $ENV{MOD_PERL}
Hello, MMAnd even Apache::DBI.pm itslef does not talk about it and there is no MMway that I know of that one can tell, if we do indeed have a persistant MMconnection or have simply required some dumb packages... The documentation mentions that you can use Apache::Status to check on statistics about Apache::DBI. This is directly from perldoc Apache::DBI. Three clicks into the mod_perl guide gives you this: http://perl.apache.org/guide/databases.html#Debugging_Apache_DBI Which is about how to turn on debugging information from Apache::DBI. Do these things not work for you? If so, tell us and we can perhaps help you further. By the way, you will likely receive more polite and helpful replies if you do not persist in calling technology that many of us rely on for production sites dumb. MMWe appreciate the technology such package authors bring to us...but MMplease regard the documentation part as important as other parts... We MMare doing out best to keep the Perl and open source flag up, but we can MMnot read source code all day long, our Microsoftish developers are way MMahead of us with their fancy IDEs Use what works for you and your situation. You shouldn't be using Perl and open source software if you really want to be using a Microsoft language and its related IDE. That being said, point out the relevant documentation pieces that are missing--I think you just missed what you needed in this case--to the authors and this list! Then we can all help fill in the pieces. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Why do RaQ4is run mod_perl so slowly?
Philip, PMI have a RaQ4i server (450MHz AMD K-6 processor). If I have 20 mod_perl PMhttpd processes running concurrently, then the system's load average goes PMup over 10.0 and CPU usage is 100%. The machine has RAM to spare, so PMswapping is not the problem. If you have top installed, try top -o cpu -b (list of processes sorted by CPU usage). You should see several httpd processes using up lots of CPU if your mod_perl processes are indeed at fault. Then check mod_status to see what requests those corresponding httpd processes are processing. If all of them are running a certain script, it's likely that script has an infinite loop or other resource-sucking problem in it. If ALL your httpd processes are sucking up lots of CPU, then it's like something else altogether, perhaps a bad global configuration or TransHandler. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [OT] Reference to a method using a scaler?
Hello, GSI have a Perl scalar ($mystr) that holds a string. I want to use the GSscalar to form a hash reference to a method after the Perl code is GScompiled. I'm not sure exactly what you're trying to do with this, but here's two things that can help you. Perl allows you to delay resolution of a method until run-time: $method = 'foo'; $object-$method($a, $b, $c) Perl also allows you to form closures that encapsulate a method of an existing object instance: $method_sub = sub { $object-foo(@_) }; In your case it sounds like you want to combine the two. $method = $foo; $method_sub = sub { $object-$method(@_) }; return $method_sub; Hope that helps. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Apache::Request
Hello, RHI get the following error on RHmy $i = Apache::Request-instance($r); RH RHCan't locate object method instance via package Apache::Request Just to avoid the whoops factor: make sure you have use Apache::Request in your script, too. This can also cause the error you are reporting. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Children dying
Hello, AVI am running a perl 5.6.0, mod_perl 1.26, apache 1.3.19 on Solaris 2.6. AHIn general, you want to compile mod_perl statically on Solaris because AHit will core otherwise. ABUntrue. We ship mod_perl in Solaris 8 as a DSO, and it works fine. I apologize. Let me qualify my original statement. In general, you want to compile mod_perl statically on Solaris 2.6 or 2.7 because in many instances, it core dumps when built as a DSO. FWIW, my particular experiences were with Perl 5.005_03 and 5.6.0, mod_perl 1.24 and 1.25, and Apache 1.3.12, 1.3.14, 1.3.17, and 1.3.19 under Solaris 2.6 (both Sparc and Intel) and 2.7 (Intel only). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Children dying
Hello, AVI am running a perl 5.6.0, mod_perl 1.26, apache 1.3.19 on Solaris 2.6. AVI get the following error in my logs: AV AV[Tue Aug 14 10:45:10 2001] [notice] child pid 2630 exit signal Segmentation Fault (11) AV AVIt looks like the child serves a request and immidiately dies. A few other folks have given useful references on how to get stack traces, as well as some other common causes of core dumps (compiling Apache with its bundled expat is a big one). Here's another one--did you build mod_perl on Solaris as a DSO? In general, you want to compile mod_perl statically on Solaris because it will core otherwise. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: my OR our that is the question ?!
Hello, rI have the following situation... it is not big issue but ri'm interested why this happen... r rmy $ID = 555; rsub blah { r... r$ID = selectrow query; r... r} This is, in fact, a big issue. You should see a message in your error log shared variable $ID will not stay shared. You should not use a my variable defined at the top level of your Apache::Registry script in a subroutine. See this entry in the mod_perl guide: http://perl.apache.org/guide/perl.html#my_Scoped_Variable_in_Nested_S The workaround is to make $ID a package global (use vars qw($ID)). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Weird IE cookie behaviour
Hello, CEI've gotten Apache::AuthCookie to run against Netscape CEand Mozilla browsers. However, when I try to get it CEto work with IE with prompting enabled for accepting CEcookies, I never get prompted to accept a cookie, so CEit appears that the browser is refusing to acknowlegde CEthat the cookie was received. Check to make sure the domain of your cookie has a leading dot. I seem to dimly recall that sometimes Netscape would accept a domain without a leading dot (e.g. ceverett.com) whereas IE would not accept it unless it had a leading dot (e.g. .ceverett.com). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: RFC: new module: Apache::FakeEnv
Hello, GYthere was a more advanced Apache::FakeRequest floating around somewhere... TKI knew this script (it was posted here, too), and while it is definitly TKbetter than Apache::FakeRequest, it still doesn't handle dir_config TKcalls. That's my script. The caveat is, that it will *never* be possible to simulate mod_perl entirely--that would be so complex that you might as well have everybody run a single-child Apache with mod_perl instead. We do this for our mod_perl developers. There is perl -wc for simple syntax checking, the apr script for running dead-simple mod_perl scripts for debugging, and then everybody runs a small Apache against their own conf file to test stuff. GYany chance you can expand the existing Apache::FakeRequest GYand offer a patch? TKSure I could try to patch Apache::FakeRequest, but I think the TKchanges are quite fundamental. What to the mantainers of TKApache::FakeRequest (or mod_perl) think of this? I agree that the changes are quite fundamental. I haven't really found Apache::FakeRequest terribly useful. It doesn't really make debugging mod_perl handlers any easier by itself. Rather than patching it, perhaps you could subclass it or replace it altogether. TKIs it possible to subclass mod_perl or Apache::Request from TKoutside of Apache (i.e. in a plain perl environment) ? Nope, as you guessed. :( TKIf not (which it seems to be), what would be the best way to TKimplement all (more or less..) mod_perl methods and subclasses TK(Apache::Request et.al) ? Can one use the C code that mod_perl TKis based on? (Well, I guess I can't because I've never done any real TKC coding ...) ? The best way to do it would probably just be to write code for 'em all. I think many web developers have many of the pieces lying around anyway from web client libraries. The hard work is in faking out everything and matching the API. But then you run into the problem that the code you're making isn't really mod_perl and Apache anyway. I'd say that having something pretty good for doing fast testing of mod_perl scripts is good, but you'll never be 100% mod_perl unless you're using mod_perl itself. :) Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: which perl?
Todd, Perl and mod_perl are separate entities altogether. Perl is the scripting language. mod_perl is an extension to Apache, which builds a Perl interpreter into the Apache webserver. The binary components are mostly separate, e.g. you could theoretically run Perl and mod_perl at different versions; the actual perl binary and the mod_perl extensions are separate. However, the Perl interpreter built into the Apache webserver, plus all the associated Perl modules that implement mod_perl's functionality, inherit all the characteristics of the Perl it was built against--bugs in the interpreter, language characteristics, or where to find libraries. In your case it sounds like your mod_perl is built for a different version of Perl. As several others have suggested, the best way is to rebuild mod_perl so it is built against your version of Perl. Another easier to do it would be to use your vendor's package system, for example if you are using RedHat or Debian, you may be able to find Perl and mod_perl packages (RPMs or whatnot) and install them to fix the versioning issues. I still recommend building it; for the base case, it's pretty easy to do. Follow the all-in-one directions in the mod_perl download and it usually Just Works. The symlinking and changing the @INC path may work, but this is a hacky, symptomatic solution at best. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: which perl?
Hello, RReally R RI asked this question and didn't get much of an answer from folks other Rthan they THOUGHT it was built in the perl binary. RI recommend whatever stas is saying. Stop being an ass, and maybe people will help you out. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Requests using If-Modified-Since cause response Set-Cookie tobe discarded
Hello, DMi'm willing to accept a valid reason why set-cookie shouldn't be DMincluded in a 304 response, but i have yet to hear one. For the record, I agree, and I agree that mod_perl should allow this. From a practical point of view, though, I've tended to avoid this situation altogether in the past. There's just too many bugs out there in caches and clients in dealing with 304s. I tend to assume that if the client sees a 304, auxillary tags (e.g. Expires, cookies, etc.) will be ignored. This reflects the unfortunate real-world state of affairs with RFC noncompliance. My advice is to just try to sidestep this issue where possible. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Best way to attach a module to /
Hello, JKWhat is the best way to attach a module to be run when a user first JKenters the site? GEDCan you be a bit more specific? I think the question is better phrased by the subject, how can I use mod_perl to handle all requests? This is less intuitive than the much more easily understandable how can I use mod_perl to handle a request for a certain URL? In the latter case you can use Apache::Registry (and associate it with LocationMatch or FilesMatch or whatever) or an explicit handler. In the former case, it's not as obvious. One solution is to use a PerlTransHandler with a dispatch table in it. The PerlTransHandler will be called on all requests, and you can inspect $r-uri to see if you want to handle it. Return DECLINED if it's not something you're interested in handling (say a /images URL); otherwise, handle the request right away, internally redirect to another handler, or just directly add the handlers you want down the chain. Hope that helps-- Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: HTTP 1.1
Hello, RSStrange numbers appeares, when I use HTTP 1.1 protocol to get response RSfrom my mod_perl server... RS RSWhat does mean number 1 before line 1234567? And what does mean 0 RSafter all? Is there a way to cut off the line with number 1 and cut RSoff the line with number 0? I need only line 1234567 in response! It RSis vital for me! The numbers are chunk sizes, which is part of chunked Transfer-Encoding, part of the HTTP/1.1 specification. You should read this: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1 For dynamically generated content, there is no Content-Length (unless your script sets one with $r-header_out('Content-Length' = $length) or you use the associated method in Apache::File). In HTTP/1.0, the server closes the connection after the script exists, so the missing Content-Length does not present a problem. With HTTP/1.1 Keep-Alive, the browser needs to know when to stop reading the response. The chunked Transfer-Encoding sends chunk sizes, then chunks, like lots of mini Content-Length fields. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [OT] 128 bit encryption and IE
Hello, GYsorry for the OT, but has anyone figured out how to tell whether a browser GYsupports 56 or 128 bit encryption? Apparently, users of IE with 56 bit, GYwhen entering a 128 bit page, get the standard Cannot Find Server error page GYwith little in the way directions to help the EU know to upgrade. GY GYhas anyone battled this and come up with an elegant solution? Mainly, this just sucks. One possibility is that on any page the user is supposed to hit BEFORE going SSL, to have a warning if the browser sniffs to be a recent IE. I would just add the warning for any IE browser. It's harder if your entire site is SSL. I'm hoping someone will answer with a better solution than dumbing down encryption altogether. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Apache::DBI + persistent connections
Wayne, WIIt is my understanding that when the app is running WIand I look at the status under MySQL, that I should WIsee only one connection. However, what I see is plenty WIof connections, as many as there were before I added WIApache::DBI to the mix. Apache is a forking server. There are x forked child processes serving requests, each of which has a full Perl interpreter in it. What you are seeing is likely one database connection per server child. Use ps and count the number of Apache processes (or check /server-status) and that number should match the number of MySQL connections. The difference by using Apache::DBI is that those connections will stick around, rather than being created/destroyed per HTTP request per child. The number extant at any given time may be more or less than before, the important thing is that they are persistent, saving resources on both sides for connection establishing. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: readdir()
Hello, LSPerl 5.6.0 breaks the readdir() function when running under mod_perl. LSThis is with the most recent versions of Apache and mod_perl, as well LSas with older versions. I see the same problem reported in the LSmailing list going back to December 2000, but no hint of a LSresolution. Is there any fix? Are there references to the problem reports? readdir() works fine for me with Apache 1.3.19, mod_perl 1.25, and Perl 5.6.0 on Solaris 2.7 (x86). Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
RE: Extracting required files
Hello, FHDoes anyone know of a perl command/or a simple way that would extract FHall .pm and .pl that a perl script needs in order to run? SLI think the question being asked is , how to resolve ALL dependencies , SLnot just the first level given in the app. For example , I may use some SLlibs that in turn use others , and so on in multiple levels of nesting. If the program actually runs (e.g. all the dependencies are already there) then you can just use Data::Dumper or simple Perl to print out the contents of %INC. This will tell you what has loaded. There's probably more correct ways using -D or one of the Devel:: modules, but printing out %INC is pretty easy. If it doesn't actually run (e.g. you're missing some dependencies) then it's more difficult--in fact you can't figure out your dependencies because your missing dependencies may require other modules you don't have. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Simple password method?
Hello, MHWe are working with some financial folks who would like us to set MHpasswords when we bring apache up, rather than using a config file. MHWe tried various permutations of inputting variables in the 'setup.pl' MHfile and so on - although we could echo the variable, if we input it, MHit was not available to the child processes. If we set the variable MHto a string it is always set, however. The logic of having webserver that needs human intervention to set up, in a production environment, is somewhat doubtful. What happens if your webserver goes down and needs to be brought up automatically? That aside, your question is a bit confusing. Do you mean that, if you do this is the startup script: $password = 'constant'; That the children get the value of $password, but when you prompt for the password during startup, the children don't? If you put the password in a global, it should persist across the children as the Perl startup script is run before forking. Perhaps you should try fully qualifying the namespace: chomp($My_Company_Name::PASSWORD = STDIN); And then refering to $My_Company_Name::PASSWORD in your scripts. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Unwanted \n in output
Hello, WLOne of my scrips has a problem that in the response , 7 times a '\n' WLcharecter is put before the actual XML text (seen by using ethereal ). WLThis confuses my clients XML parser (M$ parser ). Actually, I think you are misdiagnosing your problem. The "7\n" that you are seeing in your packet sniff sounds like a chunked Transfer-Encoding byte size (check RFC 2616, the HTTP 1.1 specification, and read up on chunked Transfer-Encoding). This would be perfectly normal in the case that Apache doesn't know the Content-Length to send (which for scripts, it won't unless you set it yourself). Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Better FakeRequest.pm?
O Nameless One, SWere testing some modperl code and some of the modules are dependant Sapon a request object to get data from... I looked into SApache::FakeRequest and it appears that It just returns the sub name as Sthe data for the sub which doesn't provide true input. I have a script "apr" that I use for this purpose. I have attached it here. It fakes out an Apache request object and, more usefully, fakes out Apache::Request too. It behaves not unlike CGI.pm in that if it detects that it is being run interactively, it prompts for name/value pairs. Sounds like this is what you want. I was going to add basic HTTP request parsing to this module (I have all the bits for that from other scripts I've written anyway) so you could pass in a "real" looking HTTP request as well, and maybe release it if anybody else found it useful. Of course, this isn't the same as using Apache itself--but it's super useful to be able to run things from the command line from time to time. I think it'd be good to have something like this in the main mod_perl distribution. Humbly, Andrew ---------- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 -- #!/usr/local/bin/perl -w # # apr - fake an Apache request object # Andrew Ho ([EMAIL PROTECTED]) # # Copyright (c) 2001 Tellme Networks, Inc. # All rights reserved. # # Last modified March 20, 2001 # use strict; package Apache; require 5.6.0; use Tie::IxHash; use vars qw($VERSION); $VERSION = 1.0; sub access_or_mutate { my $self = shift; my $key = shift; my $value = shift; $self-{$key} = $value if $value; return $self-{$key}; } sub request { my $class = shift; my $self = {}; $self-{headers_in} = {}; tie %{$self-{headers_in}}, 'Tie::IxHash'; $self-{headers_out} = {}; tie %{$self-{headers_out}}, 'Tie::IxHash'; $self-{headers_out}-{Server} = 'Schmapache 1.0'; $self-{apr_param} = {}; $self-{apr_cookie} = {}; if(-t STDIN -t STDOUT) { print "(offline mode: enter name=value pairs on standard input)\n"; while(STDIN) { chomp if defined $_; s/^[\?]+//; while($_ s/^([^]+)\*//) { my($key, $value) = split(/=/, $1, 2); if(defined($key) defined($value)) { $self-{apr_param}-{$key} = $value; } elsif($1) { $self-{apr_param}-{$1} = undef; } } } } return bless $self, $class; } sub as_string { my $self = shift; print "as_string()\n"; } sub main { undef } sub prev { undef } sub next { undef } sub last { undef } sub is_main{ 1 } sub is_initial_req { 1 } sub method { shift-access_or_mutate(@_) } sub header_only { return } sub protocol { 'HTTP/1.0' } sub print { my $self = shift; CORE::print @_ if @_; } sub header_out { my $self = shift; my($key, $value) = @_; die 'usage: $r-header_out($key = $value)' unless $key $value; $self-{headers_out}-{$key} = $value; } sub send_http_header { my $self = shift; while(my($key, $value) = each %{$self-{headers_out}}) { print $key, ': ', $value, "\n"; } print "\n"; } sub content_type { shift-header_out( 'Content-Type' = shift ) } sub content_encoding { shift-header_out( 'Content-Encoding' = shift ) } # # Fake out Apache::Request as well package Apache::Request; use Apache::Constants qw(:common); use vars qw(@ISA); @ISA = qw(Apache); sub new { my $class = shift; my $r = shift; $r-{apr_param} = {} unless exists $r-{apr_param}; return bless $r, $class; } sub instance { new } sub parse{ OK } sub param { my $self = shift; my $key = shift; my $value = shift; if($value) { $self-{apr_param}-{$key} = $value; } if(exists $self-{apr_param}-{$key}) { return $self-{apr_param}-{$key}; } else { return; } } # # Fake out Apache::Cookie, too package Apache::Cookie; use CGI::Cookie; sub new { my $class = shift; my $r = shift; my $cookie = CGI::Cookie-new(@_); bless [ $r, $cookie ], $class; } sub fetch { my $self = shift; return (); } sub bake {
Re: [OT]: POST/GET semantics
Hello, JZI have found that having a session object is a rather bad idea. What JZhappens if there is such a beast is essentially communication of JZfunctions through global variables. So I thought about the cure and JZfound that having server side "objects" that can be retrieved through an JZid enables "passing of parameters by reference". The client does a JZrequest and gets an id with the response, which he will return to the JZserver with further requests to refer to an object created with the JZfirst request. What you describe is exactly, I think, what most people think of when they talk about a session object. The client must always somehow indicate who they are, so you know what session to associate them with. JZThe question however is: If I create an object on the server that is JZonly accessible to the requesting client (the id can be thaught of as a JZpassword) - may this be done with a GET request? RFC 2616 says that the JZidea of GET is that the client can not be held accountable for the side JZeffects of GET. If I however return an id to the client so that only JZthis client has access to the effects of the request this client is in JZfull control. It can be done with either GET or POST. However, if you use GET, you have to prepare for receiving GET requests possibly more than once (although sending Cache-Control headers should minimize this). In your case, since your search application does not change any permanent server state, it's fine to use either GET or POST. Note: in HTTP, the client is ALWAYS in "full control". HTTP is always a client-pull model. Whether you use GET or POST, the client can always choose to replay a previous request. So you have to prepare to handle this case no matter what. You may want to read the chapter on server-side state in the Eagle book. Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Redirect with anchors.
Hello, AL$req_rec-header_out("Location" = "intranet.html?action=show#anchor_name"); EMI think you should provide the _complete_ URL, including the EMhttp://server part. Some browser do not handle incomplete URL's like EMthis in a redirect correctly. Please someone correct me if I'm wrong EMhere... Actually, there was a long thread on this a while back on this mailing list. Apache will intercept any URL without http:// and tack on the right hostname. You can verify this by doing the above code and telnetting to port 80 manually. So it doesn't matter whether you add the hostname or not (although I like to, because I like to rely as little as possible on magic API behavior). EMSome browsers support the ?action#anchor syntax. Some don't EM(particularly not too recent MSIE's). If you really want to reliably do EMthis, you should hide your parameter in the URL and use a RewriteRule or EMa mod_perl handler to extract the parameter, e.g. instead of EM"intranet.html?action=show#anchor_name" use a URL in the form EM"/show/intranet.html#anchor". Actually, the syntax ?foo=bar#anchor is correct according to the URI specification--the anchor always goes last. My version of MSIE barfs on this, but Netscape picks it up correctly. The moral is, that this is a very badly understood and poorly implemented form of a URI, so your advice on hiding either the query arguments or the anchor is exactly correct. Humbly, Andrew ---------- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: no_cache pragma/cache-control headers : confusion
Hello, KOFrom the code in Apache.xs, it seems like setting $r-no_cache(0) will KOunset the flag, but not remove the headers. Well, the Expires header is also removed. But it's still broken; you can verify this buggy behavior with this simple script: use Apache (); my $r = Apache-request; $r-no_cache(1); $r-no_cache(0); $r-send_http_header; With mod_perls 1.24_01 and 1.25 on Apaches 1.3.14 and 1.3.19, this call leaves me with Pragma and Cache-Control headers. Sadly, the nice (but broken as per above) no_cache() behavior of sending those two headers is also undocumented in the mod_perl guide to begin with. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Shared memory between child processes
Hello, RRI'm needing to implement a handler that uses a true Singleton pattern for RRthe class instance. One per server, not just one per process (or thread). SLYou'll need to use some form of persistance mechanism such as a SLdatabase, file, or perhaps (assuming you're on a Unix system) SLsomething like System V shared memory or semaphores. You can find more information on maintaining server-side state in the mod_perl guide or from the mod_perl book (at perl.apache.org and www.modperl.com, respectively). SLOne quick 'n cheap way to implement mutual exclusion between Unix SLprocesses (executing on the same processor) is to use mkdir, which is SLatomic (ie once a process requests a mkdir, the mkdir will either be SLdone or rejected before the requesting process is preempted by any SLother process). IMO, this is sort of cumbersome; on a single processor, you can just use advisory file locking. It's when you get onto NFS mounted systems with high concurrency that you have to muck with rolling your own mutexes (I find I usually use atomic move for that purpose). But on a single system, use flock() and a known lockfile, or sysopen with O_CREAT|O_EXCL if you can't put the file there beforehand. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Getting unbuffered output from a subprocess
Hello, So, when doing a CGI and needing to execute a subprocess with input based on user input, I always do a open()-fork()-exec() like so: if(defined(my $pid = open(KID, '-|'))) { if($pid) { print while KID; close KID; } else { %ENV = ( ... ); exec('/full/path/to/bin', @args); } } When using a mod_perl script, I "use Apache::SubProcess" and the above stuff still works. However, let's say the subprocess I kicked off takes a while to process, but prints status information in the meantime (for example, tagging a big CVS tree, or indexing textfiles, or whatnot). I want the user to see the information "real-time" (so I'd probably have local $| = 1 inside the if($pid) block above). This no longer works under Apache::SubProcess. Tt buffers up all the output and then sends it all at once. So my parent process reads in an unbuffered way, but the child "exec()" outputs all at once. Is there any way to remedy this situation? Thanks in advance. Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Getting MAC address
Hello, JWIs there a way to get a person MAC address using apache, mod_perl or JWjavascript. I have yet to find a way to do this? I need a way to JWuniquely identify the computer a person is using (i.e. not ip address). If you mean the MAC address of the remote client who is connecting to your server, no. This information isn't included in the request sent to you. Using cookies as identification mechanisms is probably the way to go. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: cgi_to_mod_perl manpage suggestion
Hello, SBA small correction: "PerlSendHeader On makes mod_perl act just like SBmod_cgi with regard to HTTP headers" :) +1 vote for adding this simple sentence, which IMO would clear up lots of CGI to mod_perl beginner confusion. Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: cgi_to_mod_perl manpage suggestion
Hello, PHUm, you're getting me confused now, but PerlSendHeader On means that PHmod_perl WILL send headers. I recognize this confusion. Most recovering CGI programmers think that "PerlSendHeader On" means that you no longer have to do this in your CGI: print "Content-type: text/html\n\n"; When in fact you still do. The manpage makes it sound like you don't. Perhaps a note to that effect would be helpful. Humbly, Andrew ---------- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [OT] Dynamic package name
Andrew, AMIs there any way to tell perl that from now on the namespace is AM$namespace? `package' does not accept scalars, and its scope is AMeval block, so if I use eval to pass scalar to "package" I have to AMinclude entire program text into that eval as well. You can kind of do this via XS, but definitely not from regular Perl without an eval(). Of course, you shouldn't be shy with eval() in mod_perl as Apache::Registry, Apache::ASP, and most everything else uses eval() anyway. Anyway, for doing it from XS something like this works: void declare_package(pTHX_ SV *sv_name) { PL_curstash = gv_stashsv(sv_name, TRUE); sv_setsv(PL_curstname, sv_name); } Take a look at the Perl documentation for stashes in perlguts(1): http://www.perl.com/CPAN/doc/manual/html/pod/perlguts.html#Stashes_and_Globs Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Installing global handler breaks CGI
Stas, SBTry adding: SBLocation /cgi-bin/ SB Options +ExecCGI SB/Location This is a fine fix; I'm actually curious, now that it's been brought up, as to why ScriptAlias suddenly breaks. In my config if I have this outside of a Directory, Location, or other container: FilesMatch "\.pl$" SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader On /FilesMatch Then anything before like this which IS inside a container: Location ... ... ScriptAlias /cgi-bin/ /path/to/cgi-bin/ Directory /path/to/cgi-bin/ Options FollowSymLinks AllowOverrideNone /Directory /Location Stops working. Fixing this is easy--I just SetHandler cgi-script inside the Directory ... container. So is the ScriptAlias priority lower than the FilesMatch assignment? I always thought ScriptAlias was just shorthand for Alias + Location ... + SetHandler. Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [OT] security!
Hello, GRBy looking the way modperl works today, it's clearly it were not GRdesgined to SECURELY support a multi-user environment. For instance: Any GRuser can write a script that will be able to read any file owned by the GRhttpd server, in a multi-user environment it should not be allowed. This is a general Unix webserver issue and not specific to mod_perl, so I've marked your message [OT] for off-topic. You cannot easily avoid this problem in general. (1) HTTP requests can come from anybody. (2) All HTTP requests are serviced by the same webserver. (3) The webserver needs to be able to read and execute scripts. Therefore, in general if untrusted users can write webserver executed scripts, they can read anything the webserver can. GRA gentle way to prevent this would be not to allow a script read a file GRwhose owner id is not the same from the script owner id, isn't it? This is fine, but you're talking about revamping Unix permissions here, not at the webserver level. The webserver cannot enforce this condition because the webserver only runs the script, it is not the OS that the script runs on. GRAnother problem: process creation should be wrapped by apache suexec GRmechanism, is it currently done this way? Why not? This could help sidestep the issue. It is not done this way by default, because even using suexec doesn't automatically make your scripts secure, and in fact it can make the situation worse. GRMay some here confirm me that if i am a security concious admin, i GRshould not make modperl+embperl available to my user? If you are a security conscious admin, and you cannot trust your users, you should not make mod_perl available to them. In fact you should not make any dynamic HTTP functionality available to them--CGI, ISAPI, FastCGI, or anything else. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Apache::Registry, mod_perl interface, and post data
Hello, I'm writing an Apache::Registry and I can't seem to retrieve POST information. I usually write handlers rather than Apache::Registry scripts, so this is a mystery to me. From a sample form: form method="post" action="post.pl" input type="hidden" name="hello" value="world" /form To this simple Apache::Registry script: #!/usr/local/bin/perl my $r = Apache-request; print "Content-type: text/plain\n\n"; print "Post = ( ", join(", ", $r-content), " )\n"; Gives me nothing. My second thought was that Apache::Registry was eating the POST information to feed it to the script via STDIN (for compatibility with conventional CGI), so I tried this: #!/usr/local/bin/perl use CGI (); my $cgi = new CGI; print "Content-type: text/plain\n\n"; print "CGI = ( ", join(", ", map { ($_, $cgi-param($_)) } $cgi-param), " )\n"; The POSTed information has still gone away! Am I on crack?! This should be the simplest script ever! Just to check, I ran the above script as a CGI as the target of the same HTML form and it worked fine. I'm using Perl 5.6.0, mod_perl 1.24_01, and Apache 1.3.14 on Solaris x86, CGI.pm 2.56. The client I use doesn't seem to make a difference. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Apache::Registry, mod_perl interface, and post data
Hello, JBI added a button and push it. It works. ;) Urgh, I had a button on my actual test page; it just magically disappeared when I retyped it in the e-mail. FWIW, after debugging it a bit further, I am getting a Content-length of the appropriate size, too. The Content-type is also correct for a POST; I sniffed the packets and the request is correct. Just no input. Nothing on STDIN, either. I'm frankly mystified, wondering if I'm just totally missing something obvious. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Apache::Registry, mod_perl interface, and post data
Hello, JBI don't think the problem is with what you posted. I tried your snippets JBon two different systems and they worked as expects. What's your config JBlook like? Do you get the 'Post = ()' output from the Registry script? JBAre you running any other software that might interfere? Thanks for forcing me to check my config and discovering that Someone left .pl's set to a different handler of their own, devious creation in UserDirs (this is a dev box) instead of Apache::Registry. Doh! Mystery solved. Thanks for the jolt. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Environnement stability and maturity
Hello, RBI've been quite happy with 5.6 in production for quite some time. I used RBthe source provided by activestate because it includes a number of RBpatches but now that 5.6.1rev2 is out it might be better. What is the "official" home of 5.6.1rev2? I can't seem to locate it on CPAN anywhere. The p5p summary on http://www.perl.com/ seems to be under the impression that 5.6.1 isn't going to be out for a while. I remember seeing a pointer to one of the very early patches, but I can't seem to find it again. Thanks in advance-- Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: [RFC] mod_perl Digest path...
Hello, MSMailing a link is easy, converting to a format that looks almost exactly MSlike the current version Geoff sends out is a bit harder (yes, I can MSspawn lynx, which gets most of the way there, but its all coding that MShas to be done). I think the point is emphatically NOT that it has to look *exactly* the same as it does not, but that it should definitely be sent to the list as it is now, as readable text rather than a link. I mean, this IS a *mailing list digest* we're talking about, isn't it? Since I skip some messages with less interesting subject lines, I love getting the mod_perl digest in my INBOX to fill me in on things I may have missed and I'm sure many people feel the same way. FWIW, I'd be glad to write the HTML-text script and send it out to the list, myself, if the digest switches to e-mail-the-link; I could even write a procmail recipe so it happens automatically. MSI mean, we're all web developers right? If you don't have a browser MSrunning the majority of your day then something is seriously up (or MSyou're out of work :-). And we want the digest more widely viewed than MSjust this list - not everyone interested in mod_perl development MSsubscribes here, and take23 is the right forum to host the digest MS(IMHO). It's just a matter of, sometimes you check your e-mail over a slow link or whatever, and it's nice to just be able to skim it right then and there instead of inserting it into your mental queue to check it later. I agree strongly that digests should be mirrored on take23. Have we thought about just taking the current digest e-mail and putting it there? I'm sure as mod_perl developers nobody would find the lack of pretty HTML horribly disconcerting. MSIf someone wants to do the work it takes to make Geoff's life easy for MSgenerating the digest in both HTML and plain text then please volunteer MS(and please don't volunteer unless you really mean it - we get lots of MSvolunteers for take23 work that barely ever turn out to be people who MScan afford the time). If it means that we'll lose the e-mailed digest, I'll put in whatever effort is necessary for this. MSBut it has to be as easy as uploading one version, and the take23 CMS MSautomatically sending out an email to the list. Anything else isn't MSworth it. I think you're being unfair here; it's impossible for it to be exactly as easy given that the task has gone from (send plaintext to list) to (upload XML to take23, convert to HTML, convert to text, send to list). You just mean it isn't worth it to *you*, the maintainer of take23. :) Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Development Environment
Hello, STI was wondering if anyone has successfully setup a development STenvironment to allow for multiple development copies of modules used STwithin Mason components. Also, to have the appropriate changes to the STmodules shown within the development environment. This can also be a general mod_perl question, because it's also not easily solved for handlers and shared Perl modules (there are a couple hacks, like translating the source code to munge package names, but they're usually not pretty). GEDIs there some reason you don't want to run several independent GEDinstances of Apache? What if there are 20 mod_perl developers at your company? You either need to do admin work to partition the developers by what modules they write, or run 20 Apache instances, which may be very expensive. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Apache/mod_perl mysteriously closing connection
Hello, So we've had an extremely odd situation happeningly lately and I thought I'd query this list to see if anybody has experienced anything similar. I have Apache 1.3.14, mod_perl 1.24_01 statically compiled into it, and Perl 5.6.0 running on Solaris x86. A variety of mod_perl scripts (at the moment, all Apache::Registry style) and CGIs runs on this box. Both CGIs and Apache::Registry scripts use DBI with Oracle (all recent versions). Sporaically (perhaps 1 in 100 requests) and unpredictatably, requests seem to be getting dropped without being logged. In a browser, this would be indicated by a "document contains no data" error. Absolutely no headers or content are sent. The strange thing is that Apache also does not log any sort of access or error. Doing a packet sniff, I see that the request is delivered to Apache, then Apache gives back a TCP FIN and ACK, closing the connection without sending anything at all. On the most telling case, Apache::StatINC gave out the typical "subroutine redefined" errors, then browser indicated "document contains no data" and nothing was logged in Apache. Others seeing this have reported the bug to occur in batches, e.g. if it's good, it's good for thousands of requests at a time, then if it fails, it fails several times in a row. I'm totally mystified and it's really hard to reproduce. Has anybody else seen any behavior similar to this? Thanks in advance-- Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
[OT] Dynamically changing current package
Hello, This isn't strictly a mod_perl question, but is there a good way in general Perl to dynamically change the current package name? Thanks in advance-- Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Development Environment
Hello, AHWhat if there are 20 mod_perl developers at your company? You either need AHto do admin work to partition the developers by what modules they write, AHor run 20 Apache instances, which may be very expensive. VKAnd these 20 developers don't have workstations of their own? You can VKbuild a development environment on a workstation just as easily as you VKcan on a server... Not if there are platform-specific dependencies. Say your servers are heavy duty Sparc machines, and you maintain code for Solaris Sparc only. Buying workstations for everybody can be quite expensive in that case. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Apache/mod_perl mysteriously closing connection
Hello, GEDIt sounds a little like a crash which happens before the logging routines GEDget a chance to do any logging. Yup. But if the child dies, doesn't Apache catch the SIGCHLD and report something to the global error log? I'm not seeing any messages to this effect (and I haven't been able to programmatically reproduce the error, so it's hard to catch a glimpse of the process table before-and-after). GEDAre you getting core dumps? No such luck. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
[OT] Apache wedges when log filesystem is full
Hello, The other day we had a system fail because the partition that holds the logs became full, and Apache stopped responding to requests. Deleting some old log files in that partition solved the problem. We pipe logs to cronolog (http://www.ford-mason.co.uk/resources/cronolog/) to roll them daily, so this introduces a pipe and also means that the individual logfile being written to was relatively small. While this faulted our monitoring (we should have been monitoring free space on /var), I am also interested in something I was unable to find on-line: how to configure Apache to robustly failover in such a case, e.g. keep serving responses but just stop writing to logs. Thanks in advance if anybody has any pointers. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: mod_perm and Java servlets
Hello, TNMy boss has asked me to set up a web server on Solaris 8 with mod_perl TNand (if possible) Java servlet capabilities as well. Has anybody done TNthis ? Any issues ? I've experimented with mod_perl and JRun on Solaris, and they've played together nicely. As long as you're hefty on memory, it'll likely be a while before you hit any significant memory problems as long as your load is distributed evenly between Perl and Java. If you use mostly one above the other, I'd do a proxied setup so you can scale them separately. The management is also easier. However, for a dev environment or a low-traffic one, having them co-exist is just fine. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Perl Script Source Code...
Hello, AFWe're developing a web based system here in Brazil for a Telecom AFEnterprise. The mod_perl was the choice of our efforts create this web AFbased system. We've already develope something in Perl and it was the AFeasiest way to work with internet. But now there is a problem. To this AFclient we don't want to put our scripts in their server. In general, the situation you are describing does not have a satisfactory solution. If you need to conceal scripts from those who are running it and administering it, you are probably doing something strange or wrong. The Perl FAQ has some references to how you can partially accomplish what you are talking about: http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq3.html#How_can_I_hide_the_source_for_my Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: ap_ctx_get with libperl.so problem.
Hello, ALThis is definitely related to libperl.so ... When I comment out ALLoadModule perl_module modules/libperl.so ALin httpd.conf, then apache will start. Unfortunately, I'd like to get ALmod_perl working. AL ALDoes anyone know about this ap_ctx_get? I understand that there could ALbe a bug in another module that I am loading infront of libperl.so, but ALwhich one? This sounds like a DSO loading problem. Are you on Solaris? It's been my experience that on Solaris, loading mod_perl as a DSO (especially if your Perl already has a libperl.so) is usually a disaster. On our Solaris x86 boxen, we statically compile in mod_perl. The ap_ctx_get was one of our core dumps (I don't remember which permutation of mod_perl as DSO or Perl with shared libperl.so this was, sorry). Others included failed calls to top_module. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: mod_perl / SSI conflict?
Tom, TKThis puts the footer nicely to all files .htm or .html TKHowever, I have a few .shtml pages as part of my site, which have worked TKwith no errors. After making this change: TK TK Files ~ "\.s?html?$" TKSetHandler perl-script TKPerlHandler Apache::Footer TK /Files TK TK..I imagined that .shtml files would show a footer at the bottom of pages. TK TKHowever, what I found is that, for the .shtml pages, while the mod_perl TKfooter works with no errors, the SSI does not work at all, and I can't find TKanything strange regarding this in error_log. The regular SSI mechanism (through mod_include) won't work with mod_perl, e.g. you don't get mod_perl output run through SSI out of the box. Basically, you've told Apache that .shtml files are now to be processed by a mod_perl PerlHandler, NOT by mod_include. So naturally your SSI is not showing up in the output. There are a couple workarounds; see the documentation for Apache::SSI (you can find it from CPAN) for more information/references. Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Modperl + DBI + Postgresql = Crash (file table full)
Hello, FSI am currently building an intranet site which uses a Postgresql database FSbackend. Unfortunately the database server is opening more files for every FSSQL request from the web site. This quickly leads to a crash after the FSkernels file table has filled up. I've run mod_perl with a PostgreSQL database before under moderate traffic and did not encounter the problem you describe. The file descriptor limit mentioned earlier is a general issue with running Apache, and should not be related to mod_perl or PostgreSQL per se. Adding "ulimit -n x" to the apachectl script (where x is some large number, I use 4096) makes this easy and unforgettable. Does the file descriptor problem occur when you run as a regular CGI? FSAs of today I have no idea about the cause of the problem. Initially I FSblamed Apache::DBI and therefore I disabled it, adding $dbh-disconnect FSstatements to my code. However this has not solved the problem. You should add $dbh-disconnect statements regardless; Apache::DBI will render those statements harmless, and leaving them in is good practice, and leaves your script usable out of an Apache::DBI environment. FSApache 1.3 FSModPerl FSApache::DBI (disabling this doesn't change anything) What versions of this stuff, and of PostgreSQL are you using? I assume by "Apache 1.3" you really mean 1.3.x, where x is something recent... Humbly, Andrew ---------- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: comparison of html/perl methodologies
Hello, PPNow, I'm interested in looking at web authoring from the reverse PPperspective - embedding Perl in html. PP PPA quick look tells me that there are a number of possibilities out there -- PPApache ASP PPMason PPEmbperl PPHTML::Template HTML::Template is not an embedded Perl solution per se, but rather a templating system. It's a rather fine line but the crux of it is that rather than embedding Perl code in non-Perl text per se, it's Perl that interprets non-Perl text in a special way. In contrast Apache::ASP, Mason, and Embperl are all full-fledged embedded Perl implementations. I would say that the embedded Perl implementations are better for data-driven pages (e.g. there is more non-Perl text (HTML or XML or whatever) than Perl code), whereas the template systems (other ones include homegrown variable substitution and Text::Template) are better for pages where there is more Perl code than output. An example of the former (data-driven) might be a website that displays and lets you manage a stock portfolio--most of it stays the same except for some dynamic data parts. An example of the latter could be an HTTP data server that returns XML. Generally, it's easier to transition from a pure CGI based system to a templatized system rather than an embedded Perl system, because a template system basically centralizes all your print() statements into a template fill-in call. However, I think the embedded Perl syntax gives a more powerful separation of code and presentation. One advantage of Apache::ASP is that its syntax (% code %, %= expr %, etc.) and semantics are very well known, so this is great for working with coders who may have had some exposure to ASP in the past. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
[OT] Here document indenting (Was: XMas printing benchmark)
Hello, DC(my $text ='foo') =~ s/^\s+://mg; DC:h1Hello, World!/h1 DC: pa href="http://foo.org/"I/a am an indented link./p DC: pSo am a href="http://bar.org/"I/a./p DCfoo DCprint $text; This, and other methods (without the beginning colon, for example) are discussed in recipe 1.11 of the Perl Cookbook. If you just want to indent your code, and don't care about the indentation of the HTML, you can do something less expensive (let's pretend the above was in a loop, or had interpolated variables, in which case the regex could be potentially expensive): print"EndHTML"; pThis HTML code will appear indented in the output. But, the ending delimiter can also be delimited, yay./p EndHTML The only bad thing is that you have to count spaces carefully. Also if you DO indent your HTML (pretty rare as I've observed in dynamically generated pages that aren't templatized), you get slightly ugly code like this: print"EndHTML"; pThe HTML I'm outputting dictates that this lt;pgt; appears at the indent level shown here. This makes my code ugly./p EndHTML That's still better IMO than this: printEndHTML; pThe HTML I'm outputting dictates that this lt;pgt; appears at the indent level shown here. This makes my code ugly./p EndHTML Because the latter totally destroys your identation. FWIW, Ruby (http://www.ruby-lang.org/) has a nice abbreviation for the indented delimiter--if you use an end token with a prepended hyphen, it lets you indent the end token. Example: print -EndHTML pThis HTML code will appear indented in the output. In Ruby, this is slightly neater than the equivalent Perl syntax./p EndHTML This would be a great feature to port to Perl; it eliminates the tedious "how many spaces did I indent?" problem which results in a "Can't find string terminator..." error. Oddly enough, Ruby will complain, though, if you omit the space between the print and the . Humbly, Andrew ---------- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Mod_perl tutorials
Hello, Just wanted to add to this thread as to the suggestion for a modperl.org. I agree that this would help mod_perl programmers as a whole. The "official" mod_perl site is sort of sparse, sort of slow, and on the whole doesn't inspire confidence in mod_perl as an industrial strength tool. As someone else already mentioned, it also doesn't use mod_perl itself. :) I'm thinking somebody should probably take it upon themselves to spearhead this effort, and perhaps set up another list for potential volunteers to coordinate. Lots of open source projects are short on useful documentation and repositories, and having an archive of docs, modules, and real-world tips sounds like a good idea for mod_perl. I'd be myself glad to help in any way possible; I'm not too bad of a mod_perl programmer and don't mind getting my hands dirty with XHTML or template systems or whatnot. Humbly, Andrew ------ Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --