Re: must I use mod-perl
Hi there, On Sun, 13 Jul 2003, Dennis Stout wrote: I downloaded source for Apache, PHP, and mod_perl and compiled it all and had it working in about the time it took to download it + compile time + about 5 minutes. There is no config to mod_perl really. Either it's there or it isn't. True, it's very quick to install once you get the hang of it. But let's not _over_simplify: you _do_ have to tell Apache what URLs need to be handled by mod_perl or it will just take up RAM and not do anything... :) Once you have an Apache with mod_perl either (I would say preferably) compiled in, or (I would say as a last resort) available as a loadable module, all it takes to get mod_perl to do things for you is a simple configuration directive or two in httpd.conf or your favourite Apache configuration file. Plus your Perl scripts of course. It's all in the documentation. 73, Ged.
Re: Few Important Questions
Eric Cholet wrote: Mustafa Tan wrote: Hi Everybody, mod_perl is a great software. Thanks for everybody who spent time on it and make it available. When you send a reply to this, can you also describe how we can help, as an individiual, to support mod_perl and people behind it financially. Mustafa, one way to provide financial support is a donation: http://www.apache.org/foundation/contributing.html There's a paypal button on that page, and an address for sending checks. The ASF is a non profit org which makes donations tax deductible. mod_perl relies on the ASF infrastructure for its CVS server, mailing lists and web sites. Donations help fund these infrastructure expenses. Actually I think it's better to contribute to perl foundation instead. Since it now supports specific grants for specific tasks/people, whereas ASF's donation won't go to the mod_perl developers but will be used to support the global ASF infrastructure (which is of course not least important, but that won't fulfill your goal) Therefore if you have someone who you want to sponsor you can submit a request for it here: http://www.perl-foundation.org/index.cgi?page=grants __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
[mp2] Apache::DBI
Hi - I am running Apache 2.0.47/mod_perl 1.99-dev-10-cvs on SuSE Linux 8.2. I am trying to install and use Apache::DBI. 1) I get this error in make test: is($thread_1, $thread_2, got the same connection both times); It seems the I do not get the same connection. 2) The documentation says to configure mod_perl with: perl Makefile.PL PERL_CHILD_INIT=1 PERL_AUTHEN=1 PERL_AUTHZ=1 PERL_CLEANUP=1 PERL_STACKED_HANDLERS=1 These are mod_perl 1 parameters. I could not find any corresponding mod_perl 2 parameters. 3) ADBI Changes states: 0.90_02 January 10, 2003 - Changes to make Apache::DBI load and function under mod_perl 2.0. A few important notes: connect_on_init does not work yet... Should I use 'connect' in my startup.pl? Have any of you sucessfully installed and used ADBI under mod_perl 2? Any advice on what I'm missing? Aloha = Beau;
[ANNOUNCE] Apache::SessionManager 0.05
The uploaded file Apache-SessionManager-0.05.tar.gz has entered CPAN as file: $CPAN/authors/id/E/EN/ENRYS/Apache-SessionManager-0.05.tar.gz size: 20891 bytes md5: 59a42fa50c52871843f50ae8e820e5a7 Changes from previous version - + Added syntax control over SessionManagerExpire directive. An explicit '0'value means no expiration time (if undefined the default value is 3600) + Added syntax control over SessionManagerInactivity directive + Removed dependency from Apache::Cookie. CGI::Cookie will be used instead of Apache::Cookie if libapreq aren't installed + Added Apache::SessionManager::cookpod HOWTO (it explains use of Apache::SessionManager with several application servers and toolkits available designed to run (also) under mod_perl like TT2, CGI::Application, PLP, Mason, ecc) + Added PLP.pm patch (patches/PLP-3.18.patch) to add direcly $session into PLP Perl embedder + Added patch (patches/Apache-Session-1.54-patch) for Apache::Session::Lock::File + Added authentication test handler t/lib/MyAuth.pm to show how Apache::SessionManager can work with authentication (see perldoc Apache::SessionManager::cookpod) ! Modified test handler t/lib/PrintEnv.pm to print $session dump ! Updated module docs, added sections ! Updated test and docs See perldoc Apache::SessionManager for module documentation and use See perldoc Apache::SessionManager::cookpod for more info about module use Any comment/criticism are welcome :-) by - Enrico
Re: [mp2] Apache::DBI
On Yesterday at 10:01pm, BEC=Beau E. Cox [EMAIL PROTECTED] wrote: BEC BECShould I use 'connect' in my startup.pl? BEC BEC Have any of you sucessfully installed and used ADBI under BEC mod_perl 2? Any advice on what I'm missing? BEC Hi Beau, I'm using apache 2.0.46, mod_perl 1.9909, perl v5.8.0, Apache::DBI 0.91 on a Gentoo kernel 2.4.20-ck6 without any problems in production. I have had no problems with using connect_on_init either. I have: use Apache::compat (); as my first use statement in my mod_perl startup.pl file. Further down the script, I have: use Apache::DBI; DBI-install_driver(mysql); Apache::DBI-connect_on_init(..fill in here..); If I set $Apache::DBI::DEBUG = 2 in my startup file I do see connects on init as the new apaches come up. Of course, I commented out that line when in production. Dunno about how to track your make test problems. Now that you know that someone has it working, you can retrace your steps and see if you missed something. I do however use this patch which is in cvs for Apache::DBI which skips use of uninitialized variable warnings upon server startup. --- DBI.pm 17 Feb 2003 13:04:19 - 1.6 +++ DBI.pm 4 Apr 2003 10:58:53 - 1.7 @@ -81,7 +81,7 @@ # won't be useful after ChildInit, since multiple processes trying to # work over the same database connection simultaneously will receive # unpredictable query results. -if ($Apache::ServerStarting == 1) { +if ($Apache::ServerStarting and $Apache::ServerStarting == 1) { print STDERR $prefix skipping connection during server startup, read the docu !!\n if $Apache::DBI::DEBUG 1; return $drh-connect(@args); } Good luck, -- Haroon Rafique [EMAIL PROTECTED]
Re: [MP2 - BUG ?] Issue handing Apache config. error messages
Right. Could you possibly clarify the difference between SetHandler perl-script and SetHandler modperl? I'm still not sure I've got the straight of it yet... Issac Stas Bekman wrote: Sreeji K Das wrote: [...] You need to use 'SetHandler perl-script' for that, see: http://perl.apache.org/docs/2.0/user/config/config.html#C_SetHandler_
Re: segmentation fault under mod_perl+XML::XPath
Hello, Ged and other. Thanks for long suggestion letter. I've solved my problem with mod_perl compiled staticaly. GH Hi there, GH Haven't seen any replies, so I thought you'd like to hear from someone. :) Thanks... GH On Wed, 2 Jul 2003, Ruslan U. Zakirov wrote: I've tried to use XML::XPath under mod_perl 1.27 and Apache 1.3.27, but got segmentation fault GH It's not uncommon to see XML and segfaults in the same post. :( GH Have you searched the archives? Looked at it. My problem was different. Under command line and CGI it's working fine and all tests during installation of XML::XPath were fine, but the same code crush apache+mod_perl. GH [snip] Apache - with so, unique_id, no expat mod_perl with everything as DSO GH Whenever I see segfaults in a DSO Apache I'd say try static linking if GH you don't know what else to try. :) Exactly this method is a solution. Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: GH Did you compile this Perl yourself? The standard advice is to compile GH mod_perl and Perl with the same compiler. usemymalloc=n, bincompat5005=undef GH Highly unlikely, but maybe a malloc problem? ccversion='', gccversion='2.95.3 20010315 (release) [FreeBSD]', gccosandvers='' GH You should be OK with that compiler, is that what you're using yourself? GH Hope you're not using gcc 3.x with that Perl... I don't want to try 3.x yet. Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-DPIC -fpic', lddlflags='-shared -L/usr/local/lib' GH Never heard of Perl (as opposed to mod_perl) dynamic linking causing a GH problem, so don't worry about that. (Until later.:) Backtrace: Program received signal SIGSEGV, Segmentation fault. 0x80711c5 in poolCopyString () (gdb) bt #0 0x80711c5 in poolCopyString () GH This is the code in xmlparse.c from my 1.3.27 source tree: GH -- GH static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s) GH { GH do { GH if (!poolAppendChar(pool, *s)) GH return 0; GH } while (*s++); GH s = pool-start; GH poolFinish(pool); GH return s; GH } GH -- GH Assuming you're using the same thing... GH As far as I can see this must mean that your pointer s is invalid, and GH either the dereference *s causes a memory bound error or else the s++ GH increment tries to increment it off the end of the stack or something. GH There's nothing else in that function that would be likely to cause the GH fault, if pool were invalid I'd expect it to happen in poolAppendChar(). GH I have no idea why these might be but it's a bit serious of course. GH You're into XS territory, the sort of thing that can easily be thrown GH by struct alignment problems such as you might get on the less well GH exercised configurations - which probably includes FreeBSD - and an GH unsuitable combination of compilers/dso/libraries/... GH You shouldn't have to be delving this deeply into these packages, but GH if a static link or a compiler change doesn't fix it and you don't GH mind cranking gdb a bit further you could find out what that pointer GH is pointing to and if it's a valid XML_Char pointer. GH Hope this gets you started in the right direction, but please don't GH take it as authoritative as I've never used FreeBSD nor XML::XPath. Big thanks for your reply. GH 73, GH Ged. Ruslan.
Re: module ported and doc addition...
Shannon Eric Peevey wrote: Shannon Eric Peevey wrote: Hi! Just wanted to let everyone know that I have just finished porting the Apache-AuthExpire module to work with both modperl1 and 2. It is a: # Small mod_perl handler to provide Authentication phase time outs for # sensitive areas, per realm. There are some issues with konqueror, mozilla and netscape, but should be a simple fix if someone is watching the headers Great, I've updated the online list of ported modules. Possible documentation inclusion...?: When using a ternary conditional in conjunction with a conditional operator, I needed to enclose the statement with parentheses to force the ternary conditional to be executed first. For example: my ($res, $sent_pw) = $r-get_basic_auth_pw; return $res if $res != (MP2 ? Apache::OK : Apache::Constants::OK); # return not OK status if not OK well, this is not a mod_perl issue. '=~' has a higher precedence than '?:' http://www.perldoc.com/perl5.8.0/pod/perlop.html#SYNOPSIS Also, you don't realy have to do that. The old ala mp1 style works just fine. use Apache::Const qw(OK DECLINED) sub handler { return OK; } Took me a while to catch that... :P speeves cws Is J. J. Horner on this list? (Are you out there...? :)) ) If so, can you contact me about getting permissions to upload the Apache-AuthExpire mod that I have ported? (So it can be indexed by PAUSE.) Also, Stas, is there a way that I can get around having to wait for an author to upload a ported module? I am not adding any functionality except making it work with both versions of modperl, and making additions that the CPAN testers have requested. I have a clear window for now, and would like to keep on porting mods while I have a little extra time... You can always upload a module, however it won't be indexed and then it's going to be a pain to reindex, since you will have to ask Andreas to do that. So I'd get the permissions resolved first. If you can't reach the original author you should email [EMAIL PROTECTED] explaining the situation and asking to give you the right perms (nowadays CPAN supports co-owners of namespaces). Meanwhile upload it somewhere online and post the link here, I'll link to it from: /http://perl.apache.org/products/apache-modules.html __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Socket-based porotocol module: how to re-use connection?
Jie Gao wrote: Hi All, I am playing with a socket-based protocol module based on Stas' MyApache::EchoSocket. I wonder what is needed to enable the function of re-using connections? As long as you don't quit the handler you keep the connection open. However I still have to investigate what are the issues with socket based protocol modules, there was a thread on the httpd-dev list saying that there some problems with it. So it's better to use bucket brigade based data manipulations. In perl we can use this: $server = IO::Socket::INET-new(LocalHost = my.host.com, LocalPort = 8899, ReuseAddr = 1, Proto = tcp, Listen= 200 ) How is this implemented http in mod_perl via Apache2 without using http? Any suggestions? it's not implemented in mod_perl, but in Apache 2 itself. You can look at the C source code and write similar in perl inside your handler. Most of the relevant logic resides in files starting with http_ in the apache source. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [ANNOUNCE] libapreq-1.2 release
Joe Schaefer wrote: libapreq-1.2.tar.gz (Apache::Request) is now on CPAN: file: $CPAN/authors/id/J/JO/JOESUF/libapreq-1.2.tar.gz size: 277549 bytes md5: ae08726f11ca25a215d4d854d675c3ff and at www.apache.org: file: http://www.apache.org/dist/httpd/libapreq-1.2.tar.gz sig: http://www.apache.org/dist/httpd/libapreq-1.2.tar.gz.asc key: http://www.apache.org/dist/httpd/KEYS Ah, shouldn't this be 1.20? I thought that 1.2 1.16. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [RELEASE CANDIDATE] Apache::Test 1.03-dev
Rob Bloodgood wrote: Tuesday, June 24, 2003, 1:51:51 PM, you wrote: JS Rob Bloodgood [EMAIL PROTECTED] writes: JS [...] *** root mode: changing the fs ownership to 'nobody' (99:99) /usr/sbin/httpd -X -d /root/.cpan/build/Apache-Test-1.03/t -f /root/.cpan/build/Apache-Test-1.03/t/conf/httpd JS Is the docroot (/root/.cpan/.../t/httpd.conf) inside JS a directory that nobody can read from? Probably JS not, from the looks of it. JS Try moving the Apache-Test-1.03 directory to /tmp and JS see if you have better luck there. Good spot! I changed permissions so 'nobody' could access the .cpan dir, and it immediately worked perfectly. Apache::Test and libapreq-1.2 now installed here! Yup, Philippe has mentioned this to me as well. When run as 'root', we do change the perms within the current distro dir, but we don't check whether the parent dirs have the read perms. I will add this check and make the program fail with an appropriate error if that's the case. e.g.: The directory /root/foo/Apache-Test-1.03 is not readable by user 'nobody', either make sure that all the dirs up to /root/foo/Apache-Test-1.03 are readable by that user, or move the whole tree to some other directory (e.g. /tmp) or run 'make test' as non-root! __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: informational notice in Makefile.PL
Shannon Eric Peevey wrote: Hi! In an attempt to simplify the install process for dependencies with my modules, I have been using the ExtUtils::AutoInstall module. (Great module, BTW :) ) But, with the current state of affairs with mod_perl and its availability from CPAN, I wanted to through an information notice to the effect of, if you are planning to use mod_perl2 and apache2, you will have to answer no here, and manually download it from perl.apache.org... I contacted Autrijus Tang, the maintainer of ExtUtils::AutoInstall, and asked him if it was possible, (I didn't see it documented), and he answered with this: # notify the user about mod_perl 2 BEGIN { print q{ NOTICE * If you are planning to use mod_perl2 and Apache2, please, do not answer yes when prompted to install mod_perl. You will need to download mod_perl2 manually from http://perl.apache.org/download/index.html * } } I placed it after the first BEGIN block and voila! I am communicating :) Are you talking about the dependencies list? by 'the current state of affairs with mod_perl 2.0', you mean that it's not indexed by PAUSE. It's available from CPAN. Actually, once it gets indexed by CPAN it'll break all the other modules which specify mod_perl (1.0) as a dependency and won't work with 2.0. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Books - was How practical is that Practical mod_perl?
Alex McLintock wrote: At 17:40 12/06/03 -0400, Perrin Harkins wrote: On Thu, 2003-06-12 at 17:31, Gedanken wrote: speaking of mod perl books, i have gotten lost somewhere. theres the eagle book, theres stas' book (practical mod_perl i learned today), and theres 'geoffs book'. what is the name of geoffs book please? It's mod_perl Developer's Cookbook. You can find info on all the known books linked from the front page of perl.apache.org: http://perl.apache.org/docs/offsite/books.html - Perrin By the way. My book reviews website http://news.diversebooks.com/ has reviews of several perl books. The system is being enhanced to make it easier to submit, find, and link to book reviews. (And yes - new development is being done in perl) Any feedback on how what sort of book reviews you like, and what you find uesful is welcome. This site seems to be offline. In any case if it's still alive, I'd suggest to ask perl.org webmasters to link to it. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: 6 months of labour
Clinton Gormley wrote: Hi all Well, my last 6 months of loving labour has finally drawn to a close with the launch of my site. http://www.traveljury.com is supposed to be an IMDB style travel site, which will contain the type of information you would find in Lonely Planet or Rough Guides, but contributed by a community. At the moment, it's pretty empty, but you've got to start somewhere :) Thanks to everybody who has pointed me in the right direction (and given their assurances about chosen directions!) I would appreciate any feedback, bug-reports and suggestions from all of you experienced webmasters out there, and any information or pictures you can contribute to traveljury would be greatly appreciated. I'm off to South America in a couple of weeks - laptop in hand - to start populating the database. We have a success stories collection, you may want submit a story for inclusion. See: http://perl.apache.org/outstanding/sites.html http://perl.apache.org/outstanding/success_stories/index.html __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] Having trouble setting params with CGI
Michael Maciag wrote: I'm trying to use CGI to get/set params within my mp2 PerlResponseHandler, at least until Apache::Request for mp2 is released. The get works just fine but my clients don't see the params I'm trying to set. Is it likely I just have an error somewhere or is there anything I have to do differently than just a simple: $q-param( -name = 'myparam', -value ='myvalue') in my handler? Do you have a simple example that reproduces the problem? Also make sure that you use the latest version of CGI.pm. 2.97 as of this writing. The best way to submit problems is to write a new test for the mod_perl 2.0 suite. You kill two birds at the same time when doing that, you learn how to write tests and save us a lot of time. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: ModPerl debugging
Christopher Knight wrote: Im getting an error with ModPerl::Registry and ModPerl::PerlRun (I tried both just in case)(that doesnt happen under CGI) that tells me I have an errror... (ya... that is about how usefull it is) ###SNIP### [Tue Jun 24 08:15:58 2003] [error] 16728: ModPerl::PerlRun: Not a CODE reference at /path/to/my/webserver/html/index.pl line 65. [Tue Jun 24 08:16:26 2003] [error] [client .] Deep recursion on subroutine ModPerl::RegistryCooker::default_handler at /usr/local/lib/perl/5.6.1/ModPerl/PerlRun.pm line 16. # the problem is, its not giving me any usefull information as to where the problem is... Considering I having about 10 custom modules that the script calls on, I dont have enough time to look at every line of code. Is there anyway to turn on super-debug mode... etc... so I can get more info? sure, set MOD_PERL_TRACE/PerlTrace to 'h' http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlTrace_ Also if you can submit a short example that reproduces the problem I can look at it. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] Apache::DBI
- Original Message - From: Haroon Rafique [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 14, 2003 3:23 AM Subject: Re: [mp2] Apache::DBI On Yesterday at 10:01pm, BEC=Beau E. Cox [EMAIL PROTECTED] wrote: BEC BECShould I use 'connect' in my startup.pl? BEC BEC Have any of you sucessfully installed and used ADBI under BEC mod_perl 2? Any advice on what I'm missing? BEC Hi Beau, I'm using apache 2.0.46, mod_perl 1.9909, perl v5.8.0, Apache::DBI 0.91 on a Gentoo kernel 2.4.20-ck6 without any problems in production. I have had no problems with using connect_on_init either. I have: [snip] Haroon Rafique [EMAIL PROTECTED] Haroon - What a great reply; wonderfully mapped out, all set to go! I will proceed to install and use ADBI. Aloha = Beau; == please visit == http://beaucox.com = main site http://howtos.beaucox.com = howtos http://PPM.beaucox.com = perl PPMs http://CPAN.beaucox.com = CPAN == thank you ==
Re: [mp2] Can't call method method on an undefined value ... TestRequest.pmline 411
Doug Wyatt wrote: Also, it appears that blib/lib/Bundle/ApacheTest.pm is missing a ';' at the end of the third line. thanks, committed. -- __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: mp2: some POST data is showing up as a hashref after I parseit
Carl Brewer wrote: Apache 2.0.46 modperl 1.99-10.dev (CVS snapshot from last night) perl 5.8.0 NetBSD 1.6.1 I've got a form that I'm posting to an MP2 script, and am parsing the output with the following subroutines : sub hash_post { # returns a hash of all the POST values my ($r) = shift; my $post_string = CB::read_post($r); my %rethash = {}; my @bits = split(//, $post_string); foreach my $bit (@bits) { $bit =~ /^(.*)=(.*)$/; my $key = CGI::Util::unescape($1); my $value = CGI::Util::unescape($2); $rethash{$key} = $value; } return %rethash; } CB::read_post() is : sub read_post { use Apache::Filter (); use APR::Bucket (); use APR::Brigade (); use constant IOBUFSIZE = 8192; use Apache::Const -compile = qw(MODE_READBYTES); use APR::Const-compile = qw(SUCCESS BLOCK_READ); use CGI::Util; my $r = shift; my $debug = shift || 0; my @data = (); my $seen_eos = 0; my $filters = $r-input_filters(); my $ba = $r-connection-bucket_alloc; my $bb = APR::Brigade-new($r-pool, $ba); do { my $rv = $filters-get_brigade($bb, Apache::MODE_READBYTES, APR::BLOCK_READ, IOBUFSIZE); if ($rv != APR::SUCCESS) { return $rv; } while (!$bb-empty) { my $buf; my $b = $bb-first; $b-remove; if ($b-is_eos) { warn EOS bucket:\n if $debug; $seen_eos++; last; } my $status = $b-read($buf); warn DATA bucket: [$buf]\n if $debug; if ($status != APR::SUCCESS) { return $status; } push @data, $buf; } $bb-destroy; } while (!$seen_eos); my $string = join '', @data; return $string; } The observant will notice that read_post() is pretty-much Stas's code from the mp test scripts, so I figure it's got to be good code (Stas wrote it :) ) This all seems to work quite nicely for the simple form I'm processing, like so : my %posted_data = CB::hash_post($r); foreach my $key (keys %posted_data) { $vars-{form}-{$key} = $posted_data{$key}; } The %vars gets thrown into template toolkit and as far as I can see, it looks fine, so I _think_ I'm parsing the POST data correctly at this point. But I then want to throw the data at a database insert : CB::submit_training_log($user_id, %posted_data); sub submit_training_log { my ($user_id,%values) = @_; # use DBI; #my $dbh = DBI-connect(DBI:mysql:.$db_name.:.$db_server, $db_user, $db_pass, { RaiseError = 1}) or return -1; my $fields = user_id; my $values = \'.$user_id.\'; foreach my $key (keys %values) { $fields .= ,$key; $values .= ,\'.$values{$key}.\'; } my $insert = INSERT into training_log ($fields) VALUES ($values); logit($log,$insert); # $dbh-disconnect; } (yes, I need to do lots of safety/sanity/taint checks etc ... ) What I see in the INSERT log message is this : INSERT into training_log ('user_id','av_hr','distance','time','percent_fat','max_speed','comments', 'time_e3','time_o2','max_power','weather','weight','resting_hr','day', 'mon','time_e1','motivation','fatigue','energy_burnt','max_hr','stress', 'time_e2','time_rec','location','planned_session','av_speed', 'actual_session','HASH(0x8d7be98)','av_power','time_se','soreness', 'sleep','year') VALUES ('1','','','','','','The session was great!','','','','funky','','','25','6','','1','1','','','1','','', '','','','As per planned session','','','','1','1','2003') There's a HASH(0x8d7be98) in there. That's a problem! Can anyone see where it might be coming from? All the form variables are accounted for, so it seems to be coming from nowhere? The onlyplace I can think of is the submit button? it definitely looks like a thing coming from the HTML page. Do you see it in the POSTed body? before you even parse it? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Question about Apache::Request and query strings
Tom Gazzini wrote: I have a perl function which, amongst other things, needs to redirect the request to another page. It also needs to pass all the query parameters of the original request (both GET and POST) to the redirected page, and also add one parameter of it's own (an error message). Sounds simple enough, but I'm having problems with the passing paramters bit. Here's what I have: sub show_error { my ($r, $error) = @_; # $r is an Apache:Request object passed by the caller my $uri = URI-new($url); foreach my $p (@params) { $uri-query_form($p = $r-param($p)); } $uri-query_form(error = $error); $r-internal_redirect($uri-canonical); } But this doesn't work. The '?error=' query string gets passed, but the orginal request query strings don't. What am I doing wrong? And is there an easier way? This example may help: http://perl.apache.org/docs/1.0/guide/snippets.html#Reusing_Data_from_POST_request __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: mod_perl Redirect Error
Rasoul Hajikhani wrote: Hello there, We have just upgraded to : Apache/1.3.27 Ben-SSL/1.48 (Unix) PHP/4.2.3 mod_perl/1.27 configured Running perl 5.6.1. I am getting 302 error message on my redirects. This comes as a complete surprise since the same piece of code works just fine on: Apache/1.3.14 Ben-SSL/1.42 (Unix) PHP/4.0.3pl1 mod_perl/1.24_01 configured Here is my code: $r-headers_in-unset(Content-length); $r-header_out(Location = $uri); $r-status(REDIRECT); $r-send_http_header; return REDIRECT; I am not sure where to begin debugging. I first wanted to check w/ you guys to see if there are any quick fixes. I appreciate any feed back. This is probably because Apache has changed the way it handles return codes. I believe you should return OK as in this example: http://perl.apache.org/docs/1.0/guide/snippets.html#mod_rewrite_in_Perl __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Apache dont run
Hi. I install the all in one package which contain the modperl 2.0 and de apache server 2.0.46. But after install when i write in command line apache to run the server appears The dynamic link library libxml2.dll could not be found. What do i do? thanks Jose Santos Jose Antonio Aroso Santos Enabler - Solutions for retailing Avenida da Boavista, 1223 4100 - 130 Porto, Portugal Email: [EMAIL PROTECTED] Web site: www.enabler.com
Re: Apache dont run
Hi! On Mon, Jul 14, 2003 at 04:59:17PM +0100, AROSO Jose Antonio wrote: I install the all in one package which contain the modperl 2.0 and de apache server 2.0.46. But after install when i write in command line apache to run the server appears The dynamic link library libxml2.dll could not be found. What do i do? Read this: http://perl.apache.org/maillist/email-etiquette.html -- #!/usr/bin/perl http://domm.zsi.at for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}
Re: [RFC] web-messaging application for mod_perl
Adi Fairbank wrote: On, or in the near vicinity of Tue, 1 Jul 2003 11:23:00 +0200 Enrico Sorcinelli [EMAIL PROTECTED] has thus spoken: On Mon, 30 Jun 2003 12:57:00 -0700 Adi Fairbank [EMAIL PROTECTED] wrote: Apache::WebMessaging I am about ready to release an intraserver web-messaging application for mod_perl. A brief description of the app follows; I'd like to hear some comments from the mod_perl/Perl/P5EE community on: You could look about Apache::* modules naming conventions: http://perl.apache.org/products/apache-modules.html#Module_Naming_Conventions Apache::App::WebMessaging namespace could be a right place :-) According to the asterisk note below Apache::App:: However, if you are planning a substantial framework with many inter-related modules, you should probably go with a top-level namespace outside of Apache::. This app already has 7-8 inter-related modules, though I would not call it a substantial framework. In fact it requires you to already have your own application framework setup in order to use it. It's basically a plug-in application for your existing mod_perl framework. I could rename it to just WebMessaging:: but it is specifically designed for mod_perl, which is why I think it should go in Apache::. Also, I noticed there are currently no Apache::App:: modules. Should this be the first?? Probably the best bet is to give it some cool unique name, like Apache::AdiChat and then you are all set, since you are not going to take over any future framework/namespaces... __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
[admin] please trim the quoted text in replies to a minimum
As I'm catching up with a big backlog of mod_perl emails I notice that some readers tend to either respond on top of a message with the original message quoted below it, and some readers nicely followup at the end of the message but keep the whole quoted original message on top. These approaches make the reading process harder, in addition to wasting network resources. You can certainly respond in any way you prefer, but if you can keep only the relevant paragraphs of the text you are responding to and trim the rest, it'll be easier for the rest of us to keep up with the threads. Remember that all posts are archived [1] and one can always retrieve the original message if it wasn't stored locally. Of course don't jump to the other exteme edge and overtrim. Use your common sense as a guide to how much is enough to keep the sufficient context. Thanks for your consideration! This issue is covered in our list's etiquette's guide: http://perl.apache.org/maillist/email-etiquette.html#Extracts_From_Other_Posts [1] http://perl.apache.org/maillist/modperl.html#Searchable_Archives __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Abusing apache auth phases [FWD: [Re: Combining authen-handler with mod_auth]]
Any thoughts on this stuff? I'd like to try my ideas on the list before going ahead and implementing it in practice. - Forwarded message from Martin Wickman [EMAIL PROTECTED] - From: Martin Wickman [EMAIL PROTECTED] Subject: Re: Combining authen-handler with mod_auth On Mon, Jul 07, 2003 at 10:06:59AM -0700, Geoffrey Young wrote: [...] I think a lot of interesting password policies could be implemented if it was possible to run perl-code before and after existing authentication modules. Is it feasible to add this to the current mod_perl as a runtime option? runtime is not likely to be possible. I'm considering a patch that would make the hook behavior configurable as a compile-time option, Instead of trying to cram multiple perl-script into the same Authen phase (which could not be done without patching Apache and/or mod_perl), I ended up using other phases but Authen. Other phases that should not really be used for authentication like this and breaks a few Apache rules. I specifically had to change mod_auth_ so it returns sets a apache note and returns DECLINED instead of stopping the whole request with a HTTP_UNAUTHORIZED. The change is simple and can be applied to any auth module without much effort. So, I thought I'd ask the list for opinions regarding this poor-mans-approach. Here is the setup: Location /secure/ AuthType Basic AuthName Secure Area Require valid-user # Find userinfo in cache. If user is banned, return # HTTP_UNAUTHORIZED else let him through to next handler PerlAccessHandler MyApache::Bouncer # The actual auth module. Patched so it creates an apache # request note if user is unauthorized + let request through # to next handler (DECLINED) _even tho_ user failed! AuthExternal wicauth # If apache note contains current user, update cache (nfailures # count) and return HTTP_UNAUTHORIZED or return OK PerlFixUpHandler MyApache::Ledger /Location Here is my tidied error_log log which shows how it works. [ User wic with wrong pwd below ] Bouncer: wic not in cache. Letting through. AuthExtern wicauth: Failed for user wic. Ledger: wic not in cache. Adding. Bouncer: wic in cache: 1 --- nfailures AuthExtern wicauth: Failed for user wic Ledger: wic in cache. Updating. [ ... 10 times or something like that ... ] Bouncer: wic in cache: 10 AuthExtern wicauth: Failed for user wic. Ledger: banning wic for 2 hours. Bouncer: wic in cache: banned Bouncer: wic is banned! Bouncer: wic in cache: banned Bouncer: wic is banned! [ The user wic is banned and have to wait for 2 hours until Bouncer will let him through. ] Bouncer: wic banning time has expired. Letting through. AuthExtern wicauth: OK accepted for user wic. Ledger: wic login ok. By keeping count like this (and assuming it works in a real situation), one can device lots of cool ways to add login and password policies. Just change relevant part in the Bouncer/Ledger. (Btw, I am using Cache::FileCache to keep track of number of failed retries.) - End forwarded message -
Re: errors installing libapreq [RESOLVED]
Chris Devers wrote: Well, I rebuilt Apache/mod_perl, and it seemed to work. For those that hit the same error, the fix -- which I've saved as a script for future reference :) -- is as follows: * Install Apache/mod_perl: #!/bin/sh # chd.build.apachemodperl.sh perl=/sw/bin/perl modperldir=/usr/src/mod_perl-1.27 apachedir=/usr/src/apache_1.3.27 builddir=/usr/local/apache pushd $modperldir $perl Makefile.PL \ APACHE_SRC=../apache_1.3.xx/src \ APACHE_PREFIX=${builddir} \ APACHE_USER=www \ APACHE_GROUP=www \ DO_HTTPD=1 \ USE_APACI=1 \ EVERYTHING=1 \ APACI_ARGS='--sbindir=${builddir}/sbin, \ --sysconfdir=${builddir}/etc, \ --localstatedir=${builddir}/var, \ --runtimedir=${builddir}/var/run, \ --logfiledir=${builddir}/var/logs, \ --proxycachedir=${builddir}/var/proxy, \ --enable-module=so' make make test sudo make install pushd $apachedir sudo make install echo Verifying that the build worked: ${builddir}/sbin/apachectl configtest \ echo congratulations, you may now reset apache by running \ echo ${builddir}/sbin/apachectl start * Installation may disrupt Perl modules. I had to rebuild Apache::Test % sudo /sw/bin/perl -MCPAN -e shell cpan install Apache::Test * Install libapreq: % perl Makefile.PL \ -httpd /usr/local/apache/sbin/httpd \ -apxs /usr/local/apache/sbin/apxs % make % make test % make install Everything went smoothly up to the `perl Makefile.PL [...]` step, where I got this error: skipping test setup...Undefined subroutine Apache::Test::config called at /sw/lib/perl5/site_perl/5.8.0/darwin/Apache/TestMM.pm line 90. Warning: prerequisite Apache::Test 1.03 not found. We have unknown version. And, as I say, rebuilding Apache::Test in the CPAN shell took care of that. Others may hit different problems that could be fixed similarly. All better now :) That's all because of the issue case-insensitive issues with Apache/test.pm vs. Apache/Test.pm, which are no longer a problem, since mod_perl 2.0, no longer carries Apache/test.pm (it has been renamed to Apache/testold.pm). __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Memoize.pm and mod_perl
Has anyone used the Memoize module extensively in a mod_perl environment? I am thinking of using it to cache queries from the database, particularly for lookups (somthing like $obj-get_name_from_id()). In many cases the data is static so I don't mind is staying over from one request to the next but I wanted to primarily use to limit the number of queries per http request. To keep the cache from growing (the website receives 20 hit/min on average w/ 20,000 users) I wanted to either implement a LRU/Expiration cache. The other alternative I was considering was to use a cleanup handler after every request. I would like to know any experiences/thoughts anyone has had of using Memoize in a mod_perl environment. Sidharth.
Re: Memoize.pm and mod_perl
On Mon, 2003-07-14 at 14:12, [EMAIL PROTECTED] wrote: Has anyone used the Memoize module extensively in a mod_perl environment? I'd suggest you use Cache::FileCache, MLDBM::Sync, or Cache::Mmap instead. Memoize is cool, but unnecessary if you are planning ahead like this. - Perrin
Re: must I use mod-perl
On Sun, 2003-07-13 at 16:53, Oskar wrote: Install it if you have a lot of time. It took me week to config it and month for rewritting scripts. Oskar, Is there something specific that would have helped you get going faster? Did you find the documentation you needed? - Perrin
Re: Memoize.pm and mod_perl
I don't know anything about Memoize, but perhap db-level caching would work for you? If you user MySQL, Mysql 4.0.1 and beyond has Query Caching capabilities built into it. http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Query_Cache -=bill
Re: make test fails when calling getaddrinfo() on 255.255.255.255
ColinB wrote: --- Stas Bekman [EMAIL PROTECTED] wrote: ColinB wrote: I am compiling mod_perl 2.0 on Solaris 9. When I run make test for mod_perl 2.0 it fails almost immediately with file vhost.c, line 232, assertion rv == APR_SUCCESS failed after it calls apr_sockaddr_info_get() with the hostname 255.255.255.255. I think this may have something to do with the test's http.conf containing _default_ virtual hostnames. apr_sockaddr_info_get() eventually calls getaddrinfo() with the nodename 255.255.255.255 which returns EAI_NONAME (no address associated with nodename). But if I call getaddrinfo() for 255.255.255.255 from another machine (which is running Solaris 8 although this may be unrelated), it returns 0. Is there something wrong with the configuration of my Solaris 9 machine - should getaddrinfo() always return 0 for 255.255.255.255 ? What happens if you add a simple vhost to your httpd.conf without even using mod_perl. I bet that this is an apache issue. I think I found a partial answer to this. I was searching the Apache bug database and I found a similar report (number 20063) by someone who was using SSL (I'm not) but had exactly the same assertion. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20063 It seems that a _default_ virtual host in httpd.conf which resolvs to 255.255.255.255 causes getaddrinfo to fail in Solaris unless the hosts: line in /etc/nsswitch.conf contained dns. I found that my hosts line did not contain dns, so I added it and sure enough, it solved the problem. It seems that only the presence of dns allows getaddrinfo to work correctly. The bug report was rejected as being an OS problem, so the solution is really a just a workaround. Do you think it's worth documenting here: http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html ? If so, can you rewrite the above description and the workaround as a pod/text section that can be added as is to this document, if possible with a title that pinpoints the problem. Also it seems to be an issue for Apache::Test, not really for mod_perl itself. So we should probably add a new top level group 'Testing'. Thanks. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Dynamically banning hosts
On Fri, 2003-07-11 at 22:33, Mustafa Tan wrote: Is it possible to dynamically ban IP addresses using mod_perl. [...] Also how can I cope with denial of service attacks? Randal has a column that shows a technique for dealing with this: http://www.stonehenge.com/merlyn/LinuxMag/col17.html You can adapt it to your needs. - Perrin
Bareword Apache::OK not allowed, Apache::PerlSection
Hello, I have installed mod_perl2 (http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz, mod_perl-1.99_09) with cd mod_perl-1.99_09 perl Makefile.PL MP_INST_APACHE2=1 MP_AP_PREFIX=/usr/local/apache2 and added LoadModule perl_module modules/mod_perl.so Perl $ServerName = `hostname`; /Perl to my httpd.conf When I try to start the server I get [Mon Jul 14 14:46:25 2003] [error] failed to resolve handler `Apache::PerlSection' Syntax error on line 321 of /etc/httpd/httpd.conf: Bareword Apache::OK not allowed while strict subs in use at /usr/lib/perl5/site_perl/5.8.0/i686-linux/Apache/PerlSection.pm line 47. BEGIN not safe after errors--compilation aborted at /usr/lib/perl5/site_perl/5.8.0/i686-linux/Apache/PerlSection.pm line 58. Compilation failed in require at (eval 2) line 3. It doesn't matter what I put between Perl /Perl Any hints? Thanks, Alexander Newald
Re: Flushing
Oskar wrote: Hi, I have script that is doing some time consuming operations hence have set $|=1 to disable buffering. It works correctly in command line but when I run it as cgi it does buffers everything and flushing does not work. After reaching timeout limit it displays server error. I have apache 1.3 Does anyone here has suggestion how to prevent it (other then increasing the timeout limit because it then returns 404 to client)? http://perl.apache.org/docs/1.0/guide/performance.html#Using1_Under_mod_perl_and_Better_print___Techniques_ __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
[DIGEST] mod_perl digest 2002/06/30
-- mod_perl digest June 30, 2003 - July 13, 2003 -- Recent happenings in the mod_perl world... Features o mod_perl status o module announcements o application announcements o mailing list highlights o mp2 porting tips / documentation o links o problem reporting guidelines mod_perl status o mod_perl - stable: 1.28 (released July 3, 2003) [1] - development: 1.28_01-dev [2] o Apache - stable: 1.3.27 (released October 3, 2002) [3] - development: 1.3.28-dev [4] o mod_perl 2.0 - beta: 1.99_09 (released April 28, 2003) [5] - development: 1.99_10-dev [6] o Apache 2.0 - stable: 2.0.47 (released July 7, 2003) [7] - developement: 2.0.48-dev - new-territories: 2.1.xx o Perl - stable: 5.8.0 (released July 18, 2002) [8] - development: ...towards 5.9.0 has started [9] 5.8.1 RC 2 (released July 11, 2003) - tarball [10] - perldelta [11] module announcements o Apache::SessionManager 0.05 - HTTP session manager wrapper around Apache::Session [12] application announcements o OpenInteract 1.99_01 (2.0 beta 2) - extensible web application server [13] mailing list highlights o mod_perl 1.28 released [14] o possible conflict between Apache::print and perl 5.8 behavior [15] o Apache 2.1 Authentication Provider article on perl.com [16] mp2 porting tips / documentation o Suggested application naming conventions [17] o Status of modules ported to mod_perl 2.0 [18] o perl.apache.org documents [19] o Apache::compat [20] links o The Apache/Perl Integration Project [21] o mod_perl documentation [22] o Apache modules on CPAN [23] o _Writing Apache Modules with Perl and C_ homepage [24] o _mod_perl Developer's Cookbook_ homepage [25] o Other mod_perl-related books [26] o mod_perl news and advocacy [27] o mod_perl list archives - modperl@ [28] - dev@ [29] - docs-dev@ [30] - advocacy@ [31] problem reporting guidelines Whenever you have a problem that you want to ask about on the modperl list, please be sure to read the instructions on how to report problems: For mod_perl 1.0 [32] For mod_perl 2.0 [33] For your convenience, these are located in the shortcuts menu on all pages at http://perl.apache.org/. You will save yourself and us a lot of time by following the instructions on these pages. Thank you! happy mod_perling... --James [EMAIL PROTECTED] -- [1] http://perl.apache.org/dist/ [2] http://cvs.apache.org/snapshots/modperl/ [3] http://www.apache.org/dist/httpd/ [4] http://cvs.apache.org/snapshots/apache-1.3/ [5] http://perl.apache.org/dist/mod_perl-1.99_04.tar.gz [6] http://cvs.apache.org/snapshots/modperl-2.0/ [7] http://www.apache.org/dist/httpd/ [8] http://www.cpan.org/src/stable.tar.gz [9] http://www.cpan.org/src/README.html [10] http://www.cpan.org/authors/id/J/JH/JHI/perl-5.8.1-RC2.tar.gz [11] http://search.cpan.org/src/JHI/perl-5.8.1-RC2/pod/perldelta.pod [12] http://mathforum.org/epigone/modperl/flerdspubloi [13] http://mathforum.org/epigone/modperl/khimgangnu [14] http://mathforum.org/epigone/modperl/tandspixrar [15] http://mathforum.org/epigone/modperl/goisheesmil [16] http://mathforum.org/epigone/modperl/winlultril [17] http://mathforum.org/epigone/modperl/blerstrenkung [18] http://perl.apache.org/products/apache-modules.html#Porting_CPAN_modules_to_mod_perl_2_0_Status [19] http://perl.apache.org/docs/2.0/devel/porting/porting.html [20] http://perl.apache.org/docs/2.0/api/Apache/compat.html [21] http://perl.apache.org/ [22] http://perl.apache.org/docs/ [23] http://www.cpan.org/modules/by-module/Apache/ [24] http://www.modperl.com/ [25] http://www.modperlcookbook.org/ [26] http://perl.apache.org/docs/offsite/books.html [27] http://www.take23.org/ [28] http://perl.apache.org/maillist/modperl.html#Searchable_Archives [29] http://perl.apache.org/maillist/dev.html#Searchable_Archives [30] http://perl.apache.org/maillist/docs-dev.html#Searchable_Archives [31] http://perl.apache.org/maillist/advocacy.html#Searchable_Archives [32] http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems [33] http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems
Re: module ported and doc addition...
Stas Bekman wrote: Shannon Eric Peevey wrote: Shannon Eric Peevey wrote: Hi! Just wanted to let everyone know that I have just finished porting the Apache-AuthExpire module to work with both modperl1 and 2. It is a: # Small mod_perl handler to provide Authentication phase time outs for # sensitive areas, per realm. There are some issues with konqueror, mozilla and netscape, but should be a simple fix if someone is watching the headers Great, I've updated the online list of ported modules. Thanks :) Possible documentation inclusion...?: When using a ternary conditional in conjunction with a conditional operator, I needed to enclose the statement with parentheses to force the ternary conditional to be executed first. For example: my ($res, $sent_pw) = $r-get_basic_auth_pw; return $res if $res != (MP2 ? Apache::OK : Apache::Constants::OK); # return not OK status if not OK well, this is not a mod_perl issue. '=~' has a higher precedence than '?:' http://www.perldoc.com/perl5.8.0/pod/perlop.html#SYNOPSIS Also, you don't realy have to do that. The old ala mp1 style works just fine. use Apache::Const qw(OK DECLINED) sub handler { return OK; } Well... I must have been smoking crack, 'cause I seem to remember a simple: return MP2 ? Apache::OK : OK throwing an error, hence, the change to: MP2 ? Apache::OK : Apache::Constants::OK Now that I test it, though, there doesn't seem to be a problem... :P Took me a while to catch that... :P speeves cws Is J. J. Horner on this list? (Are you out there...? :)) ) If so, can you contact me about getting permissions to upload the Apache-AuthExpire mod that I have ported? (So it can be indexed by PAUSE.) Also, Stas, is there a way that I can get around having to wait for an author to upload a ported module? I am not adding any functionality except making it work with both versions of modperl, and making additions that the CPAN testers have requested. I have a clear window for now, and would like to keep on porting mods while I have a little extra time... You can always upload a module, however it won't be indexed and then it's going to be a pain to reindex, since you will have to ask Andreas to do that. So I'd get the permissions resolved first. If you can't reach the original author you should email [EMAIL PROTECTED] explaining the situation and asking to give you the right perms (nowadays CPAN supports co-owners of namespaces). Meanwhile upload it somewhere online and post the link here, I'll link to it from: /http://perl.apache.org/products/apache-modules.html Thanks. I have received that permission from Mr. Horner since I have written this email. I have contacted the [EMAIL PROTECTED] gang, but they haven't responded yet. (No problems, as I am about to start on Apache-AuthNTLM.) I will upload another version to CPAN when they give me authorization. :) Also, I have ported: Apache-AuthenPasswd Apache-AuthzPasswd with notices as to the limitations of these modules. (I inherited these with the AuthenNIS mods... Haven't had a chance to port those yet, though.) They have been uploaded and indexed on CPAN. Also need to get excited about getting the authperlldap mod done as well... :) thanks, speeves cws
[ANNOUNCE] HTTP-WebTest 2.03
The URL http://martynov.org/tgz/HTTP-WebTest-2.03.tar.gz has entered CPAN as file: $CPAN/authors/id/I/IL/ILYAM/HTTP-WebTest-2.03.tar.gz size: 90135 bytes md5: cc49ade2d6955fa20dd30b1f88862943 NAME HTTP::WebTest - Testing static and dynamic web content DESCRIPTION This module runs tests on remote URLs containing Perl/JSP/HTML/JavaScript/etc. and generates a detailed test report. This module can be used as-is or its functionality can be extended using plugins. Plugins can define test types and provide additional report capabilities. This module comes with a set of default plugins but can be easily extended with third party plugins. CHANGES SINCE LAST STABLE VERSION 2.02: ENHANCEMENTS: * New test parameters 'mail_success_subject' and 'mail_failure_subject' to redefine default value of Subject field in test report emails. Based on patch by Amit Kaul. BUG FIXES: * HTTP::WebTest used to mangle test URLs like 'http://website.com?http://website2.com?var=val' by URL escaping everything after the first question mark. Now it does modify test URL unless it is doing GET request and test parameter 'params' is specified in a test specification. Thanks to Brian Webb for a bugreport. -- Ilya Martynov, [EMAIL PROTECTED] CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org
Re: Apache dont run
On Mon, 14 Jul 2003, AROSO Jose Antonio wrote: I install the all in one package which contain the modperl 2.0 and de apache server 2.0.46. But after install when i write in command line apache to run the server appears The dynamic link library libxml2.dll could not be found. What do i do? That's because some XML::* modules are being loaded in the example startup.pl supplied with the distribution, and it can't find the needed libxml2.dll. You have several options: - add C:/Perl/bin (or wherever you installed Perl) to your PATH environment variable; - put C:/Perl/bin/libxml2.dll somewhere in the PATH that Apache uses; - use a LoadFile directive in httpd.conf to load libxml2.dll; - if you don't need the XML::* modules, comment out the relevant lines in startup.pl. -- best regards, randy kobes
RE: [mod_perl] Re: Content compression FAQ
I like to be removed from this list but the un-scribe does not work for me. the problem is the mail address that I used way back when has been aliases. -Original Message- From: Jonathan M. Hollin [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 2003 2:37 AM To: Slava Bizyayev; mod_perl Mailing List Subject: Re: [mod_perl] Re: Content compression FAQ At 04/07/2003 17:29, Slava Bizyayev wrote: I've just updated the content at http://devl4.outlook.net/devdoc/FAQ/compression.html . It's very good Slava. Concise, informative and thorough. There is a small mistake in the section, Q: How hard is it to implement content compression on an existing site? Change no more that installing to no more than installing. Other than that, it looks great. Jonathan M. Hollin Digital-Word Ltd: http://digital-word.com/
AuthenNTLM - Help
Frank, please, i am trying to configure AuthenNTLM on a solaris 2.8 (SPARC) machine. But i did not find any sample about how to configure httpd.conf. May you help me? I had compiled apache 2 version 2.0.46 with ssl suport (i am configuring it with mod_jk and Tomcat too). Do i need to have mod_perl installed? Thanks. -- Francisco de Assis Tristão Analista de Suporte - Usina da Pedra Fone: 16-3987-9044
Re: must I use mod-perl
From: Oskar [EMAIL PROTECTED] Install it if you have a lot of time. It took me week to config it and month for rewritting scripts. A RedHat 7.3 install with current updates should run mod_perl nicely with only the changes to httpd.conf to load the dso and use it as a handler. However, as to whether you need it or not, performance is the main issue. As a rule of thumb, I'd plan to install it for anything where you expect 10 hits a second or more to a perl script or where the script is slow to start because it is large or needs a database connection. --- Les Mikesell [EMAIL PROTECTED]
Virtual Host Logging Perl Script
Hi, I've just written a short perl script to perform logging for our virtual hosts. The code has plenty of comments so I'll paste it below. My question is: would it be possible to use mod_perl in some way to perform the function of the script? In testing the speed of the script seems reasonable enough, is there a better way to do what I'm doing below? On a related note, I'd ideally like to be able to do similar for Apache Error logging - ie log apache error log entries once into a main errorlog file and once into a vhost errorlog file. Is this possible with ErrorLog lines? My initial understanding is this isn't possible using the framework outlined in the code below. Code follows: #!/usr/bin/perl # Script to pipe apache log entries to virtually hosted log files # Assumes httpd.conf has the following: # LogFormat %v %h %l %u %t \%r\ %s %b commonvhost # and that ONLY the following logging line is used in the httpd.conf: # CustomLog | /path/to/logger.pl commonvhost # DO NOT configure the CustomLog directive in the vhost stubs for vhosts # or this will not work. # Script logs commonvhost entries to a logfile with a template of: # /var/log/httpd/virtual.domain/$year/$month/$day use strict; my $logEntry = ; # get the vhost from this log entry: $logEntry=~/(.*?) /; my $vhost = $1; my ($year, $month, $day) = ( (localtime)[5]+1900, sprintf(%02d, (localtime)[4]+1), sprintf(%02d, (localtime)[3]) ); # Name of access logfiles: my $accessLogName = httpd-access.log; =comment $logdir: Location to put all logfiles This will log everything into: $logdir/all/$year/$month/$day/httpd-access.log and put individual vhost logfiles into: $logdir/$vhost/$year/$month/$day/httpd-access.log =cut my $logDir = /var/log/httpd; my $allLogDir = $logDir/all/$year/$month/$day; my $vhostLogDir = $logDir/$vhost/$year/$month/$day; writeLog($allLogDir, all); writeLog($vhostLogDir, vhost); # write a log entry to a file sub writeLog(){ my $logDir = shift @_; my $type = shift @_; if( ! -d $logDir ) { `mkdir -p $logDir`; } open(FD, $logDir/$accessLogName); # if type is vhost, strip off the vhost data: if($type eq vhost){ $logEntry =~s/.*? //; } print FD $logEntry; close FD; } -- Jez http://www.munk.nu/
Virtual Host Logging Perl Script
Hi, I've just written a short perl script to perform logging for our virtual hosts. The code has plenty of comments so I'll paste it below. My question is: would it be possible to use mod_perl in some way to perform the function of the script? In testing the speed of the script seems reasonable enough, is there a better way to do what I'm doing below? On a related note, I'd ideally like to be able to do similar for Apache Error logging - ie log apache error log entries once into a main errorlog file and once into a vhost errorlog file. Is this possible with ErrorLog lines? My initial understanding is this isn't possible using the framework outlined in the code below. Code follows: #!/usr/bin/perl # Script to pipe apache log entries to virtually hosted log files # Assumes httpd.conf has the following: # LogFormat %v %h %l %u %t \%r\ %s %b commonvhost # and that ONLY the following logging line is used in the httpd.conf: # CustomLog | /path/to/logger.pl commonvhost # DO NOT configure the CustomLog directive in the vhost stubs for vhosts # or this will not work. # Script logs commonvhost entries to a logfile with a template of: # /var/log/httpd/virtual.domain/$year/$month/$day use strict; my $logEntry = ; # get the vhost from this log entry: $logEntry=~/(.*?) /; my $vhost = $1; my ($year, $month, $day) = ( (localtime)[5]+1900, sprintf(%02d, (localtime)[4]+1), sprintf(%02d, (localtime)[3]) ); # Name of access logfiles: my $accessLogName = httpd-access.log; =comment $logdir: Location to put all logfiles This will log everything into: $logdir/all/$year/$month/$day/httpd-access.log and put individual vhost logfiles into: $logdir/$vhost/$year/$month/$day/httpd-access.log =cut my $logDir = /var/log/httpd; my $allLogDir = $logDir/all/$year/$month/$day; my $vhostLogDir = $logDir/$vhost/$year/$month/$day; writeLog($allLogDir, all); writeLog($vhostLogDir, vhost); # write a log entry to a file sub writeLog(){ my $logDir = shift @_; my $type = shift @_; if( ! -d $logDir ) { `mkdir -p $logDir`; } open(FD, $logDir/$accessLogName); # if type is vhost, strip off the vhost data: if($type eq vhost){ $logEntry =~s/.*? //; } print FD $logEntry; close FD; } -- Jez http://www.munk.nu/
mod-perl - read
I am totally a newbie to mod_perl. I could able to get the content length using $r-headers_in("Content-Length"). but I don't see anything in the $buf when I call the function $r-read($buf,$r-headers_in("Content-Length")). I am sure I am doing some thing wrong with the configuration or with mod_perl program. Please can some body give me an example and what I should do with the configuration to load the program. Thanks Si
ANNOUNCE: Mason 1.22
1.22 July 14, 2003 [ ENHANCEMENTS ] - Added $m-has_content to check for content without evaluating it. - Comments are now allowed on separate lines inside %attr and %flags blocks. Task id #475. - $m-subexec and $m-make_subrequest now accept relative paths which are interpreted relative to the current component directory, like $m-comp. - Documented potential problems if call to $m-redirect is trapped in an eval block, and then output is generated before the exception is rethrown. Task id #477. [ BUG FIXES ] - If a component with a filter section called abort, the filter was run twice. Task id #473. - If an exception was thrown when creating a request, memory was leaked. This can happen when the top-level component cannot be found (e.g. 404) or if there is an error in compiling the top-level component. Task id #478. Reported by Doug Treder. - Removed the use of alarm() and SIG{ALRM} to trap rare infinite loops inside the compilation of components. It interfered with Mason environments that use alarm() for their own purposes, and the associated test would crash in certain Perl environments. If you find that Mason sometimes enters an infinite loop, see the Hanging Processes: Detection and Diagnostics section of the mod_perl guide for hints on diagnosing the problem. Task id #472. - Mason allowed a component to define two subcomponents or methods with the same name. Task id #476. Reported by John Michael Mars. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: informational notice in Makefile.PL
Stas Bekman wrote: Shannon, can you please post this follow up to the list? Sorry, thought I got... Eric Peevey wrote: Stas Bekman wrote: Shannon Eric Peevey wrote: Hi! In an attempt to simplify the install process for dependencies with my modules, I have been using the ExtUtils::AutoInstall module. (Great module, BTW :) ) But, with the current state of affairs with mod_perl and its availability from CPAN, I wanted to through an information notice to the effect of, if you are planning to use mod_perl2 and apache2, you will have to answer no here, and manually download it from perl.apache.org... I contacted Autrijus Tang, the maintainer of ExtUtils::AutoInstall, and asked him if it was possible, (I didn't see it documented), and he answered with this: # notify the user about mod_perl 2 BEGIN { print q{ NOTICE * If you are planning to use mod_perl2 and Apache2, please, do not answer yes when prompted to install mod_perl. You will need to download mod_perl2 manually from http://perl.apache.org/download/index.html * } } I placed it after the first BEGIN block and voila! I am communicating :) Are you talking about the dependencies list? by 'the current state of affairs with mod_perl 2.0', you mean that it's not indexed by PAUSE. It's available from CPAN. Actually, once it gets indexed by CPAN it'll break all the other modules which specify mod_perl (1.0) as a dependency and won't work with 2.0. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com Hi! Since I am automating the download for the dependencies in the Makefile.PL, I need to let the people know that they cannot automatically download mod_perl 2 using my makefile. They will instead need to download it from the appropriate site and install it manually. That is why I am putting a notice in the Makefile.PL. speeves cws
Re: informational notice in Makefile.PL
On Mon, 14 Jul 2003, Stas Bekman wrote: [ ... ] Are you talking about the dependencies list? by 'the current state of affairs with mod_perl 2.0', you mean that it's not indexed by PAUSE. It's available from CPAN. Actually, once it gets indexed by CPAN it'll break all the other modules which specify mod_perl (1.0) as a dependency and won't work with 2.0. Perhaps it might be an idea, at this stage, to recommend to module authors that, if their package is for mod_perl 1 only, to use a module like Apache::Constants in their PREREQ_PM (ie, something available only within mod_perl 1), and if it's for mod_perl 2 only, use something like Apache::Const, or something available only with mod_perl 2. This won't help existing packages, but it would at least alert people that a problem is on the horizon. To help in this, perhaps it would be worthwhile to promote the use of Module::Install? A package (Module::Install::mod_perl?) could be made which would make available a function to test for the mod_perl version a user has, and then decide if this is appropriate for the package about to be installed. If the required mod_perl version isn't present, one could either offer to add the required version to PREREQ_PM, or else just die, as automated installs of mod_perl can be tricky. A lot of the code for this could be extracted from Apache::Test; Stas, you've also worked through this logic in making packages that include different versions for different mod_perl versions. Only the package author need have Module::Install::* when constructing the Makefile.PL - the necessary stuff for the added functionality is added to the distribution, making it transparent to the user. -- best regards, randy kobes
Re: [admin] please trim the quoted text in replies to a minimum
Of course don't jump to the other exteme edge and overtrim. Use your common sense as a guide to how much is enough to keep the sufficient context. I remember once upon a lot of bluemoons ago, in the days when FidoNet took place over phone line and 2400baud modems, when client readers would actually warn you about sending a message that contained more than x percent quoted material, and would automagically put your cursor underneath the original text instead of above it! *sigh* ... Good old days, 1:17/71 was me :D Dennis
Re: [RFC] web-messaging application for mod_perl
On, or in the near vicinity of Mon, 14 Jul 2003 18:49:58 +0300 Stas Bekman [EMAIL PROTECTED] has thus written: Probably the best bet is to give it some cool unique name, like Apache::AdiChat and then you are all set, since you are not going to take over any future framework/namespaces... Well, I don't like that name, but I do get what you mean. ( I wouldn't want to have any piece of software named after me... just my personal style. Software lives for too long, especially open source. It would still be called that long after I'm dead. ) What's wrong with WebMessaging ? Do you foresee that interfering with some future software in the Apache:: namespace, or is it just too generic? I thought it was a good name since it accurately describes what it is: not webmail, not instant messaging, but web messaging. (basically, it's like those message boxes you get on a stock trading website when you login to your account) Here are the possibilities: 1 Apache::WebMessaging 2 Apache::App::WebMessaging 3 Apache::SomeOtherUniqueName (e.g. ServerMessaging, or UserMessaging, or SystemMessaging) I personally prefer 1 or 2, so if there are no serious objections, I'll pick one of those. Let me know which you like the best. -Adi
Re: Combining authen-handler with mod_auth
Instead of trying to cram multiple perl-script into the same Authen phase, which btw could not be done without patching Apache and/or mod_perl, if by perl-script you mean mod_perl handlers, that's not really true. currently, mod_perl will run all configured PerlAuthenHandlers until one returns an Apache error (401, 500, etc). when I get back from vacation in a few weeks, the first item on my list is changing this so that mod_perl behaves exactly like Apache: namely, that the first OK passes control to the next phase and terminates the current phase. see http://marc.theaimsgroup.com/?l=apache-modperl-devm=105431735200617w=2 [stuff snipped] By keeping count like this (and assuming it works in a real situation), one can device lots of cool ways to add login and password policies. Just change relevant part in the Bouncer/Ledger. (Btw, I am using Cache::FileCache to keep track of number of failed retries.) I'll take a closer look at this in a few weeks when I'm back full time, but right now I think I would have coded it all in the PerlAuthenHandler - I think that basic housekeeping like last-auth, etc all are ok things to put into that phase, so it makes a certain amount of sense to add your denial rules to that phase as well. anyway, I'm essentially offline for the next two weeks, but if you ping me after that we can talk more. good luck --Geoff