Re: from the quick hacks department... x-bit controls mod_cgi
On Thu, 12 Apr 2001, Tim Bunce wrote: On Wed, Apr 11, 2001 at 08:22:38PM -0700, Randal L. Schwartz wrote: In an .htaccess, I place: Options +ExecCGI PerlFixupHandler "sub { -f $_[0]-filename and -x _ and $_[0]-handler(q{cgi-script}) }" Now any executable file in this directory (or below) is processed with mod_cgi. Any non-executable file is processed with whatever the MIME engine came up with before. OK, too cool to not pass on. :) Except that I think you'll find that string is being recompiled for each request - slow and leaks memory. The principle is good though :) Can you briefly explain why it leaks memory? I have been playing with Apache::Leak and Devel::Leak trying to figure out what is happening when Perl code leaks memory, but I haven't got my head around it yet... Also, a more general question to the list. How reasonable is it to assume that most of the more standard modules on CPAN don't leak memory when used in a mod_perl environment? For example DBI (not to pick on you Tim), Data::Dumper, HTML::Parser or MD5 just to name some of the more common modules. Are there any modules that I should stay away from when using mod_perl? - Cees Hek
Apache::AutoIndex - problem with special symbols in filenames (patch applied)
Dear colleagues! I have found that Apache::AutoIndex does not handle correctly filenames with special symbols - whitespaces, , and so on. The following patch solves the problem: bash$ diff -U1 `pwd`/AutoIndex.pm /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/AutoIndex.pm --- /usr/src/cpan/build/Apache-AutoIndex-0.08/AutoIndex.pm Tue Jun 29 21:10:35 1999 +++ /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/AutoIndex.pm Thu May 11 12:05:39 2000 @@ -6,3 +6,3 @@ use DynaLoader (); -use Apache::Util qw(ht_time size_string); +use Apache::Util qw(ht_time size_string escape_uri); use Apache::ModuleConfig; @@ -151,3 +151,3 @@ foreach my $file ( readdir DH ){ -print "\tLIA HREF=\"$file\"$file/A/LI\n"; +print "\tLIA HREF=\"".escape_uri($file)."\"$file/A/LI\n"; } @@ -223,3 +223,3 @@ if ($cfg-{options} ICONS_ARE_LINKS) { -print "TDa href=\"$entry"; +print "TDa href=\"".escape_uri($entry); print "/" if $list-{$entry}{sizenice} eq '-'; @@ -232,3 +232,3 @@ #Name -print "TDa href=\"$entry"; +print "TDa href=\"".escape_uri($entry); print "/" if $list-{$entry}{sizenice} eq '-'; Thank you! Sincerely, Alexei -- Alexei Barantsev, ISP RAS E-mail: [EMAIL PROTECTED] Phone : 912-53-17 (ex.4428) ICQ : 3959207
Re: from the quick hacks department... x-bit controls mod_cgi
Can you briefly explain why it leaks memory? I haven't tried it, but I'm guessing it's creating a new anonymous sub on every request. I have been playing with Apache::Leak and Devel::Leak trying to figure out what is happening when Perl code leaks memory, but I haven't got my head around it yet... Most people don't get much useful information out of those modules. The things people think of as leaks are often not really leaks, so they don't show up with these (see below). Also, a more general question to the list. How reasonable is it to assume that most of the more standard modules on CPAN don't leak memory when used in a mod_perl environment? Totally unreasonable. Most module authors have not attempted to look for process growth over long periods of use. They may have tried to get rid of any circular references, but that's usually about it. Let's be clear about terminology: a real memory leak is a situation where a program discards some memory and fails to free it or reuse it. Perl has some of these, a few of which are documented here: http://language.perl.com/faq/v2/Q4.19.html Usually though, growth in size is not from a leak; it's just perl using more memory. There are some things to be careful of that are listed in the guide (passing large strings by value, slurping whole files into a single scalar, etc.). Note that lexical variables do not relinquish memory when they go out of scope, unless you manually undef them. Some growth will happen when the child processes use variables that were in copy-on-write memory from the parent process. How can you tell what's going on? If you hit your module 100 times, and then you hit it another 100 and it continues to grow, you may have an actual leak. If it stabilizes after the first 100, you just have normal growth. Don't expect to see growth on every hit; perl allocates memory in chunks and only grabs another chunk when it needs one. You can read some interesting stuff from Matt about finding memory leaks here: http://groups.yahoo.com/group/modperl/message/27908 http://groups.yahoo.com/group/modperl/message/27943 - Perrin
Re: modperl security model question
darren chamberlain wrote: Be sure to check that $line is defined: Even better: perl use IO::File; my $input = IO::File-new("/tmp/tmppswd") || die "Couldn't open /tmp/foo.pl"; my $line = $input-getline() || 'some safe default value, like ""'; die "\$line is not defined" unless (defined $line); # -- Now not really needed print STDERR $line; $input-close(); # $line = 'bar'; $Location{'/areaj'} = { PerlSetVar = [ [foo = $line] ], SetHandler = 'perl-script', PerlHandler = 'AreaJ::AreaJ' } #push @{ $Location{'/areaj'}-{PerlSetVar} }, [foo = $line]; /perl Issac -- Internet is a wonderful mechanism for making a fool of yourself in front of a very large audience. --Anonymous Moving the mouse won't get you into trouble... Clicking it might. --Anonymous PGP Key 0xE0FA561B - Fingerprint: 7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B
Re: Dynamic httpd.conf file using mod_perl...
On Mon, 16 Apr 2001, Jim Winstead wrote: [...] you would have to do a "run config template expander HUP" instead of just doing a HUP of the apache parent process, but that doesn't seem like a big deal to me. And it has the big advantage of also working with httpd's without mod_perl. - ask -- ask bjoern hansen, http://ask.netcetera.dk/ !try; do(); more than 70M impressions per day, http://valueclick.com
Re: modperl security model question
Hi all, On Mon, 16 Apr 2001, darren chamberlain wrote: Thomas K. Burkholder ([EMAIL PROTECTED]) said [snip] my $input = IO::File-new("/tmp/tmppswd") || die "Couldn't open /tmp/foo.pl"; Probably doesn't matter in this case, but I'd try to get used to using the "or" operator instead of the C-style double pipe in this kind of construct. It has a much lower precedence so it can cause you less pain. (Camel book, p94). Also I'd use Symbol::gensym (Camel Book, p502 and the Guide at http://perl.apache.org/guide). It can help to include the system error string (from the Perl special variable $!) in the error message which you print after a failed system call so in this case you'd be a lot wiser after the event (permissions, disc full...:). 73, Ged.
Re: Apache::AutoIndex - problem with special symbols in filenames (patch applied)
Hi there, On Tue, 17 Apr 2001, Alexei Barantsev wrote: I have found that Apache::AutoIndex does not handle correctly filenames with special symbols - whitespaces, , and so on. Are you *sure* you want to have those symbols in your filenames?? 73, Ged.
What the heck actually happens in a perl section?
Hi again, I'm still beating my head against perl sections. Using PerlSetVar inside $Location seems really flaky - constants work, variables vanish. And using $Location{$key} = {...} causes odd spurious multiple-matching behaviour from a single matching hit. Frankly, I'm at a loss. I'm about ready to give up. Anyone have any clue what the heck really goes on inside perl sections? I will personally overnight-fedex a case of fine microbrewery beer with my compliments to anyone who can show me how to make this work. Really. IfModule mod_perl.c PerlSetEnv PERL5LIB /home/burkhold/perl/local/share/perl/5.6.0 PerlInitHandler Apache::StatINC PerlModule Apache::DBI # this should be put in a LocationMatch perl use IO::File; use Data::Dump; # convert this to per-user match later my $filename = "/home/burkhold/perl/PerlSetVar"; my $file = IO::File-new(" $filename"); my @kv = (); if ($file) { while ($file) { s/(\w+)\s*=\s*(.*)\s*$/push @kv, "$1 $2"/e; } $file-close(); } my $mapping = getMapping(); my ($key, $value); # The following works # $Location{'/areaj'} = { # PerlSetVar = \@kv, # SetHandler = 'perl-script', # PerlHandler = 'AreaJ::AreaJ' #} # But this doesn't - I get strange, multiple-retry behaviour # each location match seemingly generating many others while (($key, $value) = each(%$mapping)) { $Location{$key} = { # This works: # PerlSetVar = [[ areajpassword = areaj ]], # This doesn't, even though \@kv is *identical* to above constant defn. #PerlSetVar = \@kv, SetHandler = 'perl-script', PerlHandler = $value } } sub getMapping { my $filename = "/home/burkhold/perl/mod_perl_mapping"; my $file = IO::File-new(" $filename"); my %result = {}; if ($file) { while ($file) { my ($key, $value); s/(.*)\s*=\s*(.*)\s*$/($key, $value) = ($1,$2)/e; print STDERR "mapping $key to $value\n"; $result{$key} = $value; } $file-close(); } return \%result; } /perl mod_perl_mapping: /areaj=AreaJ::AreaJ /areaj-genpage=AreaJ::GenPage /areaj-search=AreaJ::Search /areaj-genimg=AreaJ::GenImage /areaj-genfooter=AreaJ::GenFooter /areaj-login=AreaJ::Login /areaj-genlogin=AreaJ::GenLogin /areaj-logout=AreaJ::Logout /areaj-gensearch=AreaJ::GenSearch /areaj-modmany=AreaJ::ModMany /areaj-getpage=AreaJ::GetPage /areaj-mark=AreaJ::Mark /areaj-genpasswd=AreaJ::GenPasswd /areaj-passwd=AreaJ::Passwd /areaj-genmanageuser=AreaJ::GenManageUser /areaj-selandredir=AreaJ::SelectAndRedirect /areaj-genusertagtree=AreaJ::GenUserTagTree /areaj-edit=AreaJ::EditImage /areaj-gendelete=AreaJ::GenDelete /areaj-delete=AreaJ::Delete /areaj-genupload=AreaJ::GenUpload /areaj-upload=AreaJ::Upload /areaj-ensure=AreaJ::Ensure /areaj-genheader=AreaJ::GenHeader /areaj-gennewuser=AreaJ::GenNewUser /areaj-newuser=AreaJ::NewUser /home/burkhold/perl/PerlSetVar: areajpassword=areaj
Undefined subroutine - what to try next?
OK. This starts with what looks to be a FAQ: Undefined subroutine PicLib::handler called. I've found the entry in the FAQ that answers "What can cause a subroutine or variable to be sporadically undefined?" and so I've tried to check that all my code is packaged correctly. All the code runs under strict and with warnings. All files are in a directory tree /users/lib I have tried three methods of setting this into @INC PerlSetEnv PERL5LIB /users/lib in the apache config file PerlRequire on a startup script with use lib '/users/lib'; setting PERL5LIB before starting httpd. All three show the same symptoms - that about 60-70% of the time I get the undefined sub error and the rest of the time it works fine. As said above, I've tried to ensure that all modules are packaged, and that all uses are correct. All calls to subroutines are explicitly labelled with their package too. When the error is logged into the apache error log there is no other warnings or errors. I'm after some suggestions on how and where to look next - or any other suggestions on how to figure out what's causing the problem. I do have several other mod_perl scripts on the same server that work fine - it's just (of course) the largest that has this problem. Thanks in advance -- Chris Searle [EMAIL PROTECTED]
RE: Problem with ASP Pages
"Bridges, Jon" wrote: I'm working on Windows 2000 and have finally managed to get the mod_perl and Apache::ASP extensions working. I can confirm this as when I open up .htm files with embedded asp everything works fine. However I come across a problem when trying to view .asp files as my web browser IE5.5 will try and download them. Has anyone got any ideas on why this is happening Are you sure the .asp files are being executed? If they are, then they send a Content-Type: text/html header by default, so IE 5.5 should handle it. Did you get the examples to work in the ./site/eg directory? They have .asp files there. You can see the headers that are being sent by lwp-request -ed $URL if content-type is being set and IE still doesn't get it, I'm not sure what to say? --Josh I have figured out why the .asp files were being downloaded instead of executed. This was because I had not declared .asp in the mime.types file. I couldn't do the lwp-request as I am running Apache on Windows 2000, is this a Linux command? Now all that happening is an error in the error log saying "No such file or directory: couldn't spawn child process" I think this is due to a directory setting in the asp file. If anyone knows of any other problems that can cause this can you let me know Thanks guys Jonathan Bridges
Fast DB access
Hi, A few months back we asked modperl mailing list on alternate methods of DB access to postgres (with the same subject). We got some decent alternatives. We are putting back some of the work we have done on this issue. We had a project to program an ad server. This is not really an OLTP application, i.e., we hada few screens where some data is captured. Based on this data we had to pick up an advertisement to serve it. Essence of the application is to have a highly scaleable program to deliver ads... which means we wanted a method to be able to pickads given a criteria and choose one among them. We had written a benchmark program, after which we decided to go for MLDBM for our purposes. Though this is not directly related to modperl, we are taking the liberty of posting this message. We hope you find it useful. Specification and results of the benchmark is as follows Objective : To choose one of the alternate access methods for an read-only DB program Program logic : Choose row from a table which has a composite key containing4 attributes. The4attributes which we used are publishers, size, type and ip number Given values of these4 attributes, we get a list ofadvertisements for these attributes. In the live application we will choose one these ads based on a weighted random number. For the purpose of benchmark we want to create a hash or hash reference of the ads given these 4 criteria Benchmark Data : Our benchmark data consists of 100 publishers,3 sizes, 4 types and 20 ip numbers which makes it a data structure containing 24,000 combination of attributes. Each combination in turn contains 10 advertisements Benchmark alternatives : We have populated this data into a) A pure in memory multi-level hash : Before starting the actual benchmark the program populates a multi-level hash... each of which finally points to the advertisements. Objective is to pick the last level hash of advertisements b) Flat file : Create a Linux directory structure with the same hierarchy as the attributesi.e., directory structure has publishers/sizes/types/ip numbers. ip numbers is the file name which contains a list of ads. Objective is to pick the right file, open this file and create a hash with the contents of the file. c) Postgres : Create a table with composite primary keypublisher,sizes,types,ip numbers. Objective is to pick an hash reference of all rows given an attribute combination d) Storable : Store the multi-level hash into disk file using Storable.pm. Objective :Read the storable file into memory and pick last level hash of ads. e) MLDBM : Populate an MLDBM data structure using MLDBM. Identical to Storable except we are using MLDBM.pm H/W : Celeron 433 with 64 MB RAM, IDE HDD using RH 6.1, perl 5.005, Postgres 6.5.3 Benchmark run : A benchmark run consists of accessing each of the Benchmark alternatives 40 times. i.e., we generate a random combination of the 4 selection attributes 40 times, access a particular data structure and pick up the ads. We repeat this process twice to ensure that we are getting consistent results Benchmark results : hash: 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)flatfile:5 wallclock secs ( 0.08 usr + 0.11 sys = 0.19 CPU)postgres: 36 wallclock secs ( 0.04 usr + 0.01 sys = 0.05 CPU)storable: 17 wallclock secs (16.24 usr + 0.61 sys = 16.85 CPU)mldbm: 0 wallclock secs ( 0.08 usr + 0.08 sys = 0.16 CPU) Benchmark interpretation : We did not want to write this section... but we have interpreted these results and chosen mldbm. the firstoptionis not viable for us... we want to carry forward the values between 2 runs of the program and can't recreate the hash everytime in the live app. We had experimented with postgres earlier with disastrous results. In fact, postgres motivated us to seek alternatives. We had a choice between flatfile and MLDBM (from the results). It was a close one... but we found MLDBM far more compact. Users were more comfortable maintaining a system with single file rather than multitude of files on the file system. We also suspect the if we add more rows, flatfile won't scale though we've not tested it fully. At the end we have chosen MLDBM. We have developed the software called opticlik (www.opticlik.com). It's doing just great. Serving around 1.2 million ads a day. In short bursts it serves upto 100 ads a second. We've attached our benchmark program and sql along with this mail. If any of you have time to run through the program and give us feedback it would be great. We also welcome and clarifications that may be required. Regards, S Muthu Ganesh V Murali Differentiated Software Solutions Pvt. Ltd.,90, 3rd Cross,2nd Main, Ganga Nagar,Bangalore - 560 032Phone : 91 80 3631445, 3431470Visit us at www.diffsoft.com fast_db.pl benchmark.sql
Re: Fast DB access
On Tue, 17 Apr 2001, Differentiated Software Solutions Pvt. Ltd., wrote: H/W : Celeron 433 with 64 MB RAM, IDE HDD using RH 6.1, perl 5.005, Postgres 6.5.3 This is a very very old version of postgresql. Try it again with 7.1 for more respectable results. -- Matt/ /||** Founder and CTO ** ** http://axkit.com/ ** //||** AxKit.com Ltd ** ** XML Application Serving ** // ||** http://axkit.org ** ** XSLT, XPathScript, XSP ** // \\| // ** mod_perl news and resources: http://take23.org ** \\// //\\ // \\
RE: What the heck actually happens in a perl section?
-Original Message- From: Thomas K. Burkholder [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 6:40 AM To: [EMAIL PROTECTED] Subject: What the heck actually happens in a perl section? Hi again, I'm still beating my head against perl sections. Using PerlSetVar inside $Location seems really flaky - constants work, variables vanish. And using $Location{$key} = {...} causes odd spurious multiple-matching behaviour from a single matching hit. Frankly, I'm at a loss. I'm about ready to give up. Anyone have any clue what the heck really goes on inside perl sections? I will personally overnight-fedex a case of fine microbrewery beer with my compliments to anyone who can show me how to make this work. Really. what is basically going on is that the contents of the Perl section are being read into the Apache::ReadConfig namespace which then inserts Apache::ReadConfig globals into the Apache configuration. IfModule mod_perl.c PerlSetEnv PERL5LIB /home/burkhold/perl/local/share/perl/5.6.0 PerlInitHandler Apache::StatINC PerlModule Apache::DBI # this should be put in a LocationMatch perl use IO::File; use Data::Dump; # convert this to per-user match later my $filename = "/home/burkhold/perl/PerlSetVar"; my $file = IO::File-new(" $filename"); my @kv = (); if ($file) { while ($file) { s/(\w+)\s*=\s*(.*)\s*$/push @kv, "$1 $2"/e; } $file-close(); } my $mapping = getMapping(); my ($key, $value); # The following works # $Location{'/areaj'} = { # PerlSetVar = \@kv, I'm surprised that this works at all... what's in @kv at this point? if it's only two values then it might work if there is some magic behind the scenes, but generally you can't store references in PerlSetVars without having them stringified. Maybe PerlAddVar would work for you, though... maybe something like Apache::Storage would help as well... for general debugging see man Apache::PerlSections and the Apache::PerlSections-dump method. There's also an entire section on debugging Perl sections in the Eagle book. HTH --Geoff [snip]
Re: Strange mod_perl error. Help needed!
On Tue, 17 Apr 2001, Vladislav Safronov wrote: Hi, That is all server says on http://my.server.ru/kubok?aa=bb and http://my.server.ru/testmod1? [Tue Apr 17 15:44:16 2001] [error] Undefined subroutine main:: called. [Tue Apr 17 15:44:18 2001] [error] Undefined subroutine main:: called. Try to install the AUTOLOAD sub and trace the calls: use Carp; sub AUTOLOAD{ Carp::cluck("trying to load $AUTOLOAD"); } at least you will figure out where the sub is called from. It looks _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://logilune.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
RE: umable to run cgi scripts under mod_perl
you need to close your script with a END. -Original Message- From: Ratan Jha [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 13, 2001 06:33 To: [EMAIL PROTECTED] Subject: umable to run cgi scripts under mod_perl Running mod_perl-1.22 apache-1.3.11 I want to run plain perl scripts under mod_perl using Apache:Registry. I amke a change to my httpd.conf file Alias /perl/ /usr/local/apache/perl/ Location /perl SetHandlerperl-script PerlHandlerApache::Registry Options +ExecCGI PerlSendHeader On /Location I've stored my perl script in the perl directory under ~www/perl The perl script is: #!/usr/bin/perl print END; html body h1This is a test/h1 /body /html The file is being returned as a plain html file The output is: #!/usr/bin/perl print This is Test END Do you have any idea why is this happening? I'll appreciate your response. Thanks Ratan Ratan M. Jha Patni Computer Systems Ltd.(PCS) Unit 55, SDF2, SEEPZ, Andheri(E), Mumbai. Call - 8291454/0479 x 5178. E- mail - [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Re: Problem with ASP Pages
"Bridges, Jon" wrote: I have figured out why the .asp files were being downloaded instead of executed. This was because I had not declared .asp in the mime.types file. I couldn't do the lwp-request as I am running Apache on Windows 2000, is this a Linux command? In all my years (almost 3) working with Apache::ASP, I never had to tweak the mime.types to make things work. If this is really what did it for you, that's great! The lwp-request command is one that ships with perl, and you will likely find it as lwp-request in the perl/bin directory on your system. You can run it like perl $perl_dir/bin/lwp-request ... Now all that happening is an error in the error log saying "No such file or directory: couldn't spawn child process" I personally have no idea about this, maybe someone else might? If you think this is an Apache::ASP error, then set Debug to -2, restart apache, and get me an error log bit for a request. -- Josh _ Joshua Chamas Chamas Enterprises Inc. NodeWorks free web link monitoring Huntington Beach, CA USA http://www.nodeworks.com1-714-625-4051
debug info to log file
Hi ALl, I am trying to send debug info from an FTP session to a log file, I don't seem to redirect output to that log file. If somebody can hgelp I'd really appreciate. Thanks Here is my code: +++ use Net::FTP; $logfile = "mylog.log"; open (LOG, " $logfile " ); print LOG "\n"; $file = "file.pl"; if (-e $file){ $ftp = Net::FTP-new("hostname", Debug=1); $ftp-login("user",'passwd'); $ftp-cwd("/usr/users/user/"); $ftp-binary; $ftp-put($file); $ftp-quit; } close(LOG); +++end of code __ Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/
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: Dynamic httpd.conf file using mod_perl...
At 04:16 AM 4/17/01, Ask Bjoern Hansen wrote: On Mon, 16 Apr 2001, Jim Winstead wrote: [...] you would have to do a "run config template expander HUP" instead of just doing a HUP of the apache parent process, but that doesn't seem like a big deal to me. And it has the big advantage of also working with httpd's without mod_perl. like proxy servers ... Going off on a slight tangent from the orginal topic - the template-based approach would also work well for subsystems that have separate configuration files - we put quite a bit of application configuration info into files other than httpd.conf, so that we can modify it without requiring a server restart. -Simon - ask -- ask bjoern hansen, http://ask.netcetera.dk/ !try; do(); more than 70M impressions per day, http://valueclick.com
RE: Strange mod_perl error. Help needed!
Ok! Thanx! I found the bug :-) Try to install the AUTOLOAD sub and trace the calls: use Carp; sub AUTOLOAD{ Carp::cluck("trying to load $AUTOLOAD"); } at least you will figure out where the sub is called from. It looks _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://logilune.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: What the heck actually happens in a perl section?
Geoffrey Young wrote I'm surprised that this works at all... what's in @kv at this point? if it's only two values then it might work if there is some magic behind the scenes, but generally you can't store references in PerlSetVars without having them stringified. Maybe PerlAddVar would work for you, though... I found an example that did this almost exactly the way I did... then lost the URL to the example. Anyway, replacing it with a string (so you only ever get the last key-value pair in the file) works for defining the variable (See new source appended). maybe something like Apache::Storage would help as well... Looked at it, seemed too heavyweight for something that was just key=value. for general debugging see man Apache::PerlSections and the Apache::PerlSections-dump method. There's also an entire section on debugging Perl sections in the Eagle book. Don't have the Eagle book yet (buying it today). The PerlSections-dump looks right according to the documentation on Apache::PerlSections - but I still get the confused multiple loading problem - it's like a bunch of the locations are all matching to the one location that generates mutliple sub-frames. Ok, the problem seemed to be that I had a bunch of keys '/areaj-foo' and one key '/areaj' - and somehow, the Location match on just '/areaj' was capturing all of them. I had a hunch and changed the key to 'areaj-areaj' so that there wouldn't be any spurious matches, and it worked! This *is* a bug, right? Location is supposed to be an exact match, isn't it? Geoff- thanks for the help. It wasn't quite 'full-case-of-beer' help, but I definitely owe you one. //Thomas Thomas K. Burkholder [EMAIL PROTECTED] The code: perl use IO::File; use Data::Dump; use Apache::PerlSections (); # convert this to per-user match later my $filename = "/home/burkhold/perl/PerlSetVar"; my $file = IO::File-new(" $filename"); my $str = ''; if ($file) { my $ref; while ($file) { $ref=undef; s/(\w+)\s*=\s*(.*)\s*$/$str = "$1 $2"/e; } $file-close(); } my $mapping = getMapping(); my ($key, $value); while (($key, $value) = each(%$mapping)) { print "got $key = $value\n"; my %loc = ( PerlSetVar = $str, SetHandler = 'perl-script', PerlHandler = $value ); $Location{$key} = \%loc; } print Apache::PerlSections-dump; sub getMapping { my $filename = "/home/burkhold/perl/mod_perl_mapping"; my $file = IO::File-new(" $filename"); my %result = (); if ($file) { while ($file) { my ($key, $value); s/(.*)\s*=\s*(.*)\s*$/($key, $value) = ($1,$2)/e; print "mapping $key to $value\n"; $result{$key} = $value; } $file-close(); } return \%result; } /perl The data: /home/burkhold/perl/mod_perl_mapping: /areaj-areaj=AreaJ::AreaJ /areaj-genpage=AreaJ::GenPage /areaj-search=AreaJ::Search /areaj-genimg=AreaJ::GenImage /areaj-genfooter=AreaJ::GenFooter /areaj-login=AreaJ::Login /areaj-genlogin=AreaJ::GenLogin /areaj-logout=AreaJ::Logout /areaj-gensearch=AreaJ::GenSearch /areaj-modmany=AreaJ::ModMany /areaj-getpage=AreaJ::GetPage /areaj-mark=AreaJ::Mark /areaj-genpasswd=AreaJ::GenPasswd /areaj-passwd=AreaJ::Passwd /areaj-genmanageuser=AreaJ::GenManageUser /areaj-selandredir=AreaJ::SelectAndRedirect /areaj-genusertagtree=AreaJ::GenUserTagTree /areaj-edit=AreaJ::EditImage /areaj-gendelete=AreaJ::GenDelete /areaj-delete=AreaJ::Delete /areaj-genupload=AreaJ::GenUpload /areaj-upload=AreaJ::Upload /areaj-ensure=AreaJ::Ensure /areaj-genheader=AreaJ::GenHeader /areaj-gennewuser=AreaJ::GenNewUser /areaj-newuser=AreaJ::NewUser /home/burkhold/perl/PerlSetVar: areajpassword=areaj
Re: Problem with ASP Pages
On Tue, 17 Apr 2001, Joshua Chamas wrote: "Bridges, Jon" wrote: [ ... ] Now all that happening is an error in the error log saying "No such file or directory: couldn't spawn child process" I personally have no idea about this, maybe someone else might? If you think this is an Apache::ASP error, then set Debug to -2, restart apache, and get me an error log bit for a request. This error, or some variation of it, arises in Win32 if you invoke a cgi script with an incorrect shebang line: #!/Path/To/Perl.exe Perhaps some script is being called that needs this adjusted? best regards, randy kobes
Apache::ASP and no global.asa
I am trying to setup Apache::ASP to handle asp pages for one of my virtual domains in Apache but I am getting an 'Internal Server Error' on the browser and an error in the Apache log files that goes something like [error] Undefined subroutine Apache::ASP::Compiles::_usr_local_apache_htdocs_www_aspdomain___global_asa: :Form called at (eval 24) line 1. -- , /usr/local/lib/perl5/site_perl/5.005/Apache/ASP.pm line 1506. The site/eg asp test files all work on my server. And I have the following directives included in this virtual domain: Files ~ (\.asp) SetHandler perl-script PerlSetVar NoState 1 PerlHandler Apache::ASP /Files What could the problem be? The site admin tells me they do not need a global.asa and since I do not know ASP I cannot dispute that. Thanks, Rick
seeking lead programmer
Hello, Small but growing webdev firm (2 employees when I started 1.5 years ago and now at 7) seeking lead programmer (Perl/mod_perl OO Perl is primary) and what might be known as technical lead. Location is Englewood, CO. Current employee breakdown: Project Manger : 1 Junior Perl programmer: 1 Html/javascript developer: 1 Sales: 1 Graphic designer: 1 Owners: 2 (they do a lot of account development/sales/bookeeping). The company has lots of work, good base of established clients who frequently ask for new updates/applications. The future looks good, in fact I just got my 2nd raise ... most of the clients are mid range click mortar companies who have plans for new shopping carts, new sites etc. instead of what we hear in the media from the pure dot coms. I am leaving this company because a friend bought an ISP and is giving me a piece of the company etc. If interested Please contact me. The company does not want the other employees to know I am leaving yet. Peter --- "Reality is that which, when you stop believing in it, doesn't go away". -- Philip K. Dick
Re: Apache::AutoIndex - problem with special symbols in filenames (patch applied)
On Tue, Apr 17, 2001 at 09:29:22AM +0100, G.W. Haywood wrote: Hi there, On Tue, 17 Apr 2001, Alexei Barantsev wrote: I have found that Apache::AutoIndex does not handle correctly filenames with special symbols - whitespaces, , and so on. Are you *sure* you want to have those symbols in your filenames?? Well, if it's generating links to actual files, it should make sure the links are always valid ones, not escaping there characters would possibly break HTML specs in the output and generate links you can't click on. So I will apply this patch. Thanks. 73, Ged. -- +---+ | Philippe M. Chiasson [EMAIL PROTECTED]| | SmartWorker http://www.smartworker.org| | IM : gozerhbe ICQ : gozer/18279998 | | 64.8% computer corrupt according to | | http://www.freespeech.org/ljk/purity.html | +---+ Those who learn from history are doomed to have it repeated to them anyway. -- Larry Wall perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl Hacker!\n$/print||$$++redo}' PGP signature
Re: Fast DB access
Matt Sergeant writes: On Tue, 17 Apr 2001, Differentiated Software Solutions Pvt. Ltd., wrote: H/W : Celeron 433 with 64 MB RAM, IDE HDD using RH 6.1, perl 5.005, Postgres 6.5.3 This is a very very old version of postgresql. Try it again with 7.1 for more respectable results. It's more likely you are seeing hardware bottlenecks with this configuration. For example, the Intel Celeron has half the L2 cache of a Pentium 3, or one-fourth the cache of a Pentium Xeon. Also, your Celeron has a 66 Mhz bus, compared to 100 MHz for the P3, at least with the 466 MHz Celeron. With a 600 MHz Celeron going for US $60 and a 600 MHz P3 going for US $110 (approx. lowest prices at Pricewatch.com), a faster CPU might help, and probably not break the budget. Second, 64 MB is probably not enough memory for a multitasking OS with a web server and relational database. I suspect that you are doing a lot of swapping when running all this in 64 MB. If you ran some tool to analyze disk and memory usage, you would probably find that this configuration with postgresql was thrashing, whereas the MLDBM solution might not even hit swap at all. With the recent drop in memory prices, 256MB can be found for less than US $50 (hmm, maybe I should get more), and would likely improve your webserver performance regardless of the solution you use. There's more to benchmarking than just running some wall-clock timings. While MLDBM may be the best solution for you, someone else might find that with slightly more powerful server, running an up-to-date version of Postgres accomplishes their requirements just as well.
How does one report a perl versioning problem
Recently, I got the following: Script started on Sat Apr 14 13:18:31 2001 root@doctor$ /usr/contrib/bin/perl5.6.1 -v This is perl, v5.6.0 built for i386-bsdos Copyright 1987-2000, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5.0 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. root@doctor$ exit exit Script done on Sat Apr 14 13:18:44 2001 FUN!! How can one report this and how can one tell perl that great the version correct??
Re: Fast DB access
b) Flat file : Create a Linux directory structure with the same hierarchy as the attributesi.e., directory structure has publishers/sizes/types/ip numbers. ip numbers is the file name which contains a list of ads. Objective is to pick the right file, open this file and create a hash with the contents of the file. You might get better performance by using a combined key, hashing it, and splitting into directories after the first 2 characters in the key. This would mean 2 directories to traverse for each lookup, rather than 4. I believe the File::Cache module works this way, so you could steal code from there. However, dbm is a good choice for this. You may find SDBM_File faster than DB_File if your records are small enough for it (I think the limit is 2K per record). - Perrin
Re: Fast DB access
Matt Sergeant wrote: On Tue, 17 Apr 2001, Differentiated Software Solutions Pvt. Ltd., wrote: H/W : Celeron 433 with 64 MB RAM, IDE HDD using RH 6.1, perl 5.005, Postgres 6.5.3 This is a very very old version of postgresql. Try it again with 7.1 for more respectable results. im very glad to see this thread i wanted a good benchmark for postgres and mysql {i hope to transpose the sql properly!} i do have 7.1 installed and it is very sweet ill report back when i rerun under postgresql at the very least
Re: Simple password method?
Sorry if this wasn't exactly clear, it's the _database_ password we are trying to pass in manually. We did try exactly the following, and it did not work. This was a bit suprising and I was wondering why this was the case... - Mike H. Date: Tue, 17 Apr 2001 09:44:48 -0700 (PDT) From: Andrew Ho [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Content-Type: TEXT/PLAIN; charset=US-ASCII X-SpamBouncer: 1.3 (1/18/00) X-SBClass: OK 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 --
cvs commit: modperl Changes
dougm 01/04/17 14:30:09 Modified:src/modules/perl perl_util.c .Changes Log: make sure global for Apache-request is reset after configuring %ENV Revision ChangesPath 1.46 +2 -0 modperl/src/modules/perl/perl_util.c Index: perl_util.c === RCS file: /home/cvs/modperl/src/modules/perl/perl_util.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- perl_util.c 2001/02/16 23:30:28 1.45 +++ perl_util.c 2001/04/17 21:30:02 1.46 @@ -610,6 +610,8 @@ add_common_vars(r); add_cgi_vars(r); +/* resetup global request rec, because it may set to an (invalid) subrequest by ap_add_cgi_vars */ +perl_request_rec(r); if (!table_get(envtab, "TZ")) { if ((tz = getenv("TZ")) != NULL) { 1.582 +3 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.581 retrieving revision 1.582 diff -u -r1.581 -r1.582 --- Changes 2001/02/16 23:30:23 1.581 +++ Changes 2001/04/17 21:30:06 1.582 @@ -10,6 +10,9 @@ =item 1.25_01-dev +make sure global for Apache-request is reset after configuring %ENV +[Gerald Richter [EMAIL PROTECTED]] + adjust 'U' magic functions to Perl 5.7.x-dev prototype change Put Apache's CFLAGS into AP_CFLAGS instead of CFLAGS, so that
cvs commit: modperl/src/modules/perl mod_perl.c
dougm 01/04/17 15:01:20 Modified:.Changes src/modules/perl mod_perl.c Log: back out 'stop win32 crash when bringing down service' change, no longer needed with 1.3.19 Revision ChangesPath 1.586 +4 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.585 retrieving revision 1.586 diff -u -r1.585 -r1.586 --- Changes 2001/04/17 21:57:17 1.585 +++ Changes 2001/04/17 22:01:13 1.586 @@ -10,6 +10,10 @@ =item 1.25_01-dev +back out 'stop win32 crash when bringing down service' change, no +longer needed with 1.3.19 +[John Sterling, Will Rowe] + $r-no_cache(0) will unset cache headers [Geoffrey Young [EMAIL PROTECTED]] 1.136 +0 -12 modperl/src/modules/perl/mod_perl.c Index: mod_perl.c === RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v retrieving revision 1.135 retrieving revision 1.136 diff -u -r1.135 -r1.136 --- mod_perl.c2001/02/16 23:30:27 1.135 +++ mod_perl.c2001/04/17 22:01:18 1.136 @@ -509,18 +509,6 @@ { array_header *librefs; -#ifdef WIN32 -// This is here to stop a crash when bringing down -// a service. Apparently the dso is unloaded too early. -// This if statement tests to see if we are running as a -// service. apache does the same -// see apache's isProcessService() in service.c -if (AllocConsole()) { -FreeConsole(); -return; -} -#endif - librefs = xs_dl_librefs((pool *)data); perl_shutdown(NULL, NULL); unload_xs_so(librefs);
cvs commit: modperl Changes Makefile.PL
dougm 01/04/17 15:39:09 Modified:.Changes Makefile.PL Log: improve Apache::MyConfig Revision ChangesPath 1.587 +2 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.586 retrieving revision 1.587 diff -u -r1.586 -r1.587 --- Changes 2001/04/17 22:01:13 1.586 +++ Changes 2001/04/17 22:39:06 1.587 @@ -10,6 +10,8 @@ =item 1.25_01-dev +improve Apache::MyConfig [Stas Bekman [EMAIL PROTECTED]] + back out 'stop win32 crash when bringing down service' change, no longer needed with 1.3.19 [John Sterling, Will Rowe] 1.180 +18 -15modperl/Makefile.PL Index: Makefile.PL === RCS file: /home/cvs/modperl/Makefile.PL,v retrieving revision 1.179 retrieving revision 1.180 diff -u -r1.179 -r1.180 --- Makefile.PL 2001/04/17 21:38:52 1.179 +++ Makefile.PL 2001/04/17 22:39:07 1.180 @@ -95,6 +95,7 @@ $Apache::MyConfig::Setup{Apache_Src} ; my $PWD = cwd; +$ENV{APACHE_CWD} = $PWD; $ENV{PERL5LIB} = "$PWD/lib"; my %SSL = ( @@ -1977,9 +1978,23 @@ EOS } -local *FH; -# writing Configuration to Apache::MyConfig +# preparing and writing Configuration to Apache::MyConfig +my %my_config = %callback_hooks; +my @other_hooks = qw(APACHE_SRC SSL_BASE APXS PERL_USELARGEFILES + PERL_TRACE PERL_DEBUG APACI_ARGS APACHE_PREFIX + DO_HTTPD NO_HTTPD PREP_HTTPD USE_APACI + APACHE_HEADER_INSTALL PERL_STATIC_EXTS ); +{ +no strict 'refs'; +$my_config{$_} = ${$_} for @other_hooks; +} +my $my_config_dump = join ",\n", +map { qq{'$_' = } . + ($my_config{$_} =~ /^\d+$/ ? $my_config{$_} : qq{'$my_config{$_}'}) +} sort keys %my_config; + +local *FH; open FH, 'lib/Apache/MyConfig.pm' || die "Can't open lib/Apache/MyConfig.pm: $!"; print FH EOT; @@ -1989,20 +2004,8 @@ package Apache::MyConfig; %Setup = ( - 'Apache_Src' = \'$APACHE_SRC\', - 'SSL_BASE' = \'$SSL_BASE\', - 'APXS' = \'$WITH_APXS\', - 'PERL_USELARGEFILES' = \'$PERL_USELARGEFILES\', -EOT - - foreach my $key (sort @callback_hooks) { -print FH " \'$key\' = \'$callback_hooks{$key}\',\n"; - } - - print FH EOT; - $string +$my_config_dump ); - 1; __END__
cvs commit: modperl Makefile.PL
dougm 01/04/17 15:42:05 Modified:.Makefile.PL Log: need this alias for Apache::src backwards compat Revision ChangesPath 1.181 +3 -0 modperl/Makefile.PL Index: Makefile.PL === RCS file: /home/cvs/modperl/Makefile.PL,v retrieving revision 1.180 retrieving revision 1.181 diff -u -r1.180 -r1.181 --- Makefile.PL 2001/04/17 22:39:07 1.180 +++ Makefile.PL 2001/04/17 22:42:03 1.181 @@ -1989,6 +1989,9 @@ $my_config{$_} = ${$_} for @other_hooks; } +#need this alias for Apache::src backwards compat +$my_config{'Apache_Src'} = $my_config{'APACHE_SRC'}; + my $my_config_dump = join ",\n", map { qq{'$_' = } . ($my_config{$_} =~ /^\d+$/ ? $my_config{$_} : qq{'$my_config{$_}'})
cvs commit: modperl Makefile.PL Changes
dougm 01/04/17 14:38:55 Modified:.Makefile.PL Changes Log: fix 'make tar_Apache' Revision ChangesPath 1.179 +1 -1 modperl/Makefile.PL Index: Makefile.PL === RCS file: /home/cvs/modperl/Makefile.PL,v retrieving revision 1.178 retrieving revision 1.179 diff -u -r1.178 -r1.179 --- Makefile.PL 2001/01/29 17:43:21 1.178 +++ Makefile.PL 2001/04/17 21:38:52 1.179 @@ -1385,7 +1385,7 @@ tar_Apache: (cd $(INSTALLSITELIB)/$(ARCHNAME); \ - $(TAR) -cf $(PWD)/Apache.tar mod_perl.pm Apache.pm Apache $(ARCHNAME)/auto/Apache; ) +$(TAR) -cf $(PWD)/Apache.tar mod_perl.pm Apache.pm Apache auto/Apache; ) offsite-tar: $(CP) MANIFEST MANIFEST.orig 1.583 +2 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.582 retrieving revision 1.583 diff -u -r1.582 -r1.583 --- Changes 2001/04/17 21:30:06 1.582 +++ Changes 2001/04/17 21:38:52 1.583 @@ -10,6 +10,8 @@ =item 1.25_01-dev +fix 'make tar_Apache' [Geoffrey Young [EMAIL PROTECTED]] + make sure global for Apache-request is reset after configuring %ENV [Gerald Richter [EMAIL PROTECTED]]
Re: cvs commit: modperl/src/modules/perl mod_perl.c
On Wed, 7 Mar 2001, Ask Bjoern Hansen wrote: On 6 Oct 2000 [EMAIL PROTECTED] wrote: dougm 00/10/06 13:18:29 Modified:t/internal error.t src/modules/perl mod_perl.c Log: more for the "Apache::send_http_header was resetting r-status = 200" fix Doug, do you remember what this was about? just that sent_http_header should not modify r-status (I just had a problem with only being able to get redirects from a subrequest to work if I set status == 302 but returned 200 from the handler). you should not modify $r-status and return 302 from the handler.
cvs commit: modperl/apaci mod_perl.exp
dougm 01/04/17 14:48:57 Modified:.Changes src/modules/win32 mod_perl.def apacimod_perl.exp Log: export hvrv2table (needed by Apache::Request) for aix and win32 Revision ChangesPath 1.584 +3 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.583 retrieving revision 1.584 diff -u -r1.583 -r1.584 --- Changes 2001/04/17 21:38:52 1.583 +++ Changes 2001/04/17 21:48:49 1.584 @@ -10,6 +10,9 @@ =item 1.25_01-dev +export hvrv2table (needed by Apache::Request) for aix and win32 +[Jens-Uwe Mager [EMAIL PROTECTED], Randy Kobes [EMAIL PROTECTED]] + fix 'make tar_Apache' [Geoffrey Young [EMAIL PROTECTED]] make sure global for Apache-request is reset after configuring %ENV 1.2 +1 -0 modperl/src/modules/win32/mod_perl.def Index: mod_perl.def === RCS file: /home/cvs/modperl/src/modules/win32/mod_perl.def,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- mod_perl.def 2000/12/31 19:34:16 1.1 +++ mod_perl.def 2001/04/17 21:48:52 1.2 @@ -10,5 +10,6 @@ perl_cmd_perl_TAKE1 perl_cmd_perl_TAKE123 perl_perl_cmd_cleanup + hvrv2table 1.3 +1 -0 modperl/apaci/mod_perl.exp Index: mod_perl.exp === RCS file: /home/cvs/modperl/apaci/mod_perl.exp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- mod_perl.exp 2000/03/03 22:20:18 1.2 +++ mod_perl.exp 2001/04/17 21:48:55 1.3 @@ -4,3 +4,4 @@ mod_perl_tie_table sv2request_rec perl_request_rec +hvrv2table
cvs commit: modperl-2.0/Apache-Test/lib/Apache Test.pm
dougm 01/04/17 21:36:58 Modified:Apache-Test/lib/Apache Test.pm Log: add Apache::TestToString class for feeding Test.pm output into a string Revision ChangesPath 1.3 +34 -3 modperl-2.0/Apache-Test/lib/Apache/Test.pm Index: Test.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/Test.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Test.pm 2001/04/04 04:36:57 1.2 +++ Test.pm 2001/04/18 04:36:56 1.3 @@ -11,6 +11,12 @@ our $VERSION = '0.01'; #so Perl's Test.pm can be run inside mod_perl +sub test_pm_refresh { +$Test::TESTOUT = \*STDOUT; +$Test::planned = 0; +$Test::ntest = 1; +} + sub init_test_pm { my $r = shift; @@ -27,9 +33,7 @@ $r-content_type('text/plain'); -$Test::TESTOUT = \*STDOUT; -$Test::planned = 0; -$Test::ntest = 1; +test_pm_refresh(); } sub plan { @@ -51,6 +55,33 @@ } Test::plan(@_); +} + +package Apache::TestToString; + +sub TIEHANDLE { +my $string = ""; +bless \$string; +} + +sub PRINT { +my $string = shift; +$$string .= join '', @_; +} + +sub start { +tie *STDOUT, __PACKAGE__; +Apache::Test::test_pm_refresh(); +} + +sub finish { +my $s; +{ +my $o = tied *STDOUT; +$s = $$o; +} +untie *STDOUT; +$s; } 1;
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c
dougm 01/04/17 21:37:47 Modified:src/modules/perl modperl_filter.c Log: pass the APR::Brigade to filter handlers Revision ChangesPath 1.11 +1 -0 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- modperl_filter.c 2001/03/16 07:30:22 1.10 +++ modperl_filter.c 2001/04/18 04:37:46 1.11 @@ -95,6 +95,7 @@ modperl_handler_make_args(aTHX_ args, filter_classes[filter-mode], filter, + "APR::Brigade", filter-bb, NULL); if ((status = modperl_callback(aTHX_ handler, p, s, args)) != OK) {
cvs commit: modperl-2.0/lib/ModPerl Code.pm
dougm 01/04/17 21:40:02 Modified:lib/ModPerl Code.pm Log: include modperl_bucket Revision ChangesPath 1.57 +1 -1 modperl-2.0/lib/ModPerl/Code.pm Index: Code.pm === RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- Code.pm 2001/04/11 23:00:59 1.56 +++ Code.pm 2001/04/18 04:40:00 1.57 @@ -520,7 +520,7 @@ ); my @c_src_names = qw(interp tipool log config cmd options callback handler - gtop util filter mgv pcw); + gtop util filter bucket mgv pcw); my @g_c_names = map { "modperl_$_" } qw(hooks directives flags xsinit); my @c_names = ('mod_perl', (map "modperl_$_", @c_src_names)); sub c_files { [map { "$_.c" } @c_names, @g_c_names] }
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
dougm 01/04/17 21:42:54 Modified:xs/tables/current/Apache ConstantsTable.pm FunctionTable.pm StructureTable.pm xs/tables/current/ModPerl FunctionTable.pm Log: sync generated tables Revision ChangesPath 1.4 +1 -1 modperl-2.0/xs/tables/current/Apache/ConstantsTable.pm Index: ConstantsTable.pm === RCS file: /home/cvs/modperl-2.0/xs/tables/current/Apache/ConstantsTable.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ConstantsTable.pm 2001/04/12 00:59:21 1.3 +++ ConstantsTable.pm 2001/04/18 04:42:50 1.4 @@ -2,7 +2,7 @@ # !! # ! WARNING: generated by Apache::ParseSource/0.02 -# ! Wed Apr 11 17:57:08 2001 +# ! Mon Apr 16 18:17:25 2001 # ! do NOT edit, any changes will be lost ! # !! 1.2 +117 -300 modperl-2.0/xs/tables/current/Apache/FunctionTable.pm Index: FunctionTable.pm === RCS file: /home/cvs/modperl-2.0/xs/tables/current/Apache/FunctionTable.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FunctionTable.pm 2001/03/26 16:05:47 1.1 +++ FunctionTable.pm 2001/04/18 04:42:50 1.2 @@ -2,7 +2,7 @@ # !! # ! WARNING: generated by Apache::ParseSource/0.02 -# ! Mon Mar 26 07:44:02 2001 +# ! Tue Apr 17 21:37:29 2001 # ! do NOT edit, any changes will be lost ! # !! @@ -436,6 +436,24 @@ { 'name' = 'input', 'type' = 'apr_time_t' + }, + { +'name' = 'offs', +'type' = 'apr_int32_t' + } +], +'name' = 'apr_explode_time' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { +'name' = 'result', +'type' = 'apr_exploded_time_t *' + }, + { +'name' = 'input', +'type' = 'apr_time_t' } ], 'name' = 'apr_explode_gmt' @@ -636,6 +654,24 @@ 'return_type' = 'apr_status_t', 'args' = [ { +'name' = 'rootpath', +'type' = 'const char **' + }, + { +'name' = 'filepath', +'type' = 'const char **' + }, + { +'name' = 'p', +'type' = 'apr_pool_t *' + } +], +'name' = 'apr_filepath_root' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { 'name' = 'newpath', 'type' = 'char **' }, @@ -662,6 +698,34 @@ 'return_type' = 'apr_status_t', 'args' = [ { +'name' = 'path', +'type' = 'char **' + }, + { +'name' = 'p', +'type' = 'apr_pool_t *' + } +], +'name' = 'apr_filepath_get' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { +'name' = 'path', +'type' = 'const char *' + }, + { +'name' = 'p', +'type' = 'apr_pool_t *' + } +], +'name' = 'apr_filepath_set' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { 'name' = 'new_file', 'type' = 'apr_file_t **' }, @@ -740,16 +804,6 @@ 'return_type' = 'apr_status_t', 'args' = [ { -'name' = 'fptr', -'type' = 'apr_file_t *' - } -], -'name' = 'apr_file_error' - }, - { -'return_type' = 'apr_status_t', -'args' = [ - { 'name' = 'thefile', 'type' = 'apr_file_t **' }, @@ -2600,7 +2654,7 @@ 'type' = 'apr_int32_t' } ], -'name' = 'apr_threadattr_detach_get' +'name' = 'apr_threadattr_detach_set' }, { 'return_type' = 'apr_status_t', @@ -2610,7 +2664,7 @@ 'type' = 'apr_threadattr_t *' } ], -'name' = 'apr_threadattr_detach_set' +'name' = 'apr_threadattr_detach_get' }, { 'return_type' = 'apr_status_t', @@ -3149,24 +3203,12 @@ { 'return_type' = 'apr_status_t', 'args' = [ - { -'name' = 'td', -'type' = 'apr_thread_t **' - }, - { -'name' = 'tattr', -'type' = 'apr_threadattr_t *' - }, { -'name' = 'arg2', -'type' = 'int (*signal_handler)(int signum)' - }, - { -'name' = 'p', -'type' = 'apr_pool_t *' +'name' = 'arg0', +'type' = 'int(*signal_handler)(int signum)' } ], -
cvs commit: modperl-2.0/xs/APR/Brigade APR__Brigade.h
dougm 01/04/17 22:09:56 Modified:xs/APR/Brigade APR__Brigade.h Log: add some APR::Brigade methods Revision ChangesPath 1.2 +59 -2 modperl-2.0/xs/APR/Brigade/APR__Brigade.h Index: APR__Brigade.h === RCS file: /home/cvs/modperl-2.0/xs/APR/Brigade/APR__Brigade.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- APR__Brigade.h2001/03/05 03:53:28 1.1 +++ APR__Brigade.h2001/04/18 05:09:56 1.2 @@ -1,5 +1,62 @@ -static MP_INLINE apr_bucket_brigade *mpxs_apr_brigade_create(pTHX_ SV *CLASS, - apr_pool_t *p) +static MP_INLINE +apr_bucket_brigade *mpxs_apr_brigade_create(pTHX_ SV *CLASS, +apr_pool_t *p) { return apr_brigade_create(p); } + +#define get_brigade(brigade, fetch) \ +(fetch(brigade) == APR_BRIGADE_SENTINEL(brigade) ? \ + NULL : fetch(brigade)) + +static MP_INLINE +apr_bucket *mpxs_APR__Brigade_first(apr_bucket_brigade *brigade) +{ +return get_brigade(brigade, APR_BRIGADE_FIRST); +} + +static MP_INLINE +apr_bucket *mpxs_APR__Brigade_last(apr_bucket_brigade *brigade) +{ +return get_brigade(brigade, APR_BRIGADE_LAST); +} + +#define get_bucket(brigade, bucket, fetch) \ +(fetch(bucket) == APR_BRIGADE_SENTINEL(brigade) ? \ + NULL : fetch(bucket)) + +static MP_INLINE +apr_bucket *mpxs_APR__Brigade_next(apr_bucket_brigade *brigade, +apr_bucket *bucket) +{ +return get_bucket(brigade, bucket, APR_BUCKET_NEXT); +} + +static MP_INLINE +apr_bucket *mpxs_APR__Brigade_prev(apr_bucket_brigade *brigade, + apr_bucket *bucket) +{ +return get_bucket(brigade, bucket, APR_BUCKET_PREV); +} + +static MP_INLINE +void mpxs_APR__Brigade_insert_tail(apr_bucket_brigade *brigade, + apr_bucket *bucket) +{ +APR_BRIGADE_INSERT_TAIL(brigade, bucket); +} + +static MP_INLINE +void mpxs_APR__Brigade_insert_head(apr_bucket_brigade *brigade, + apr_bucket *bucket) +{ +APR_BRIGADE_INSERT_HEAD(brigade, bucket); +} + +static MP_INLINE +void mpxs_APR__Brigade_concat(apr_bucket_brigade *a, + apr_bucket_brigade *b) +{ +APR_BRIGADE_CONCAT(a, b); +} +
cvs commit: modperl-2.0/xs/maps apr_functions.map apr_structures.map apr_types.map
dougm 01/04/17 22:10:44 Modified:xs/maps apr_functions.map apr_structures.map apr_types.map Log: enable APR::Bucket module, add some APR::Brigade methods Revision ChangesPath 1.7 +46 -31modperl-2.0/xs/maps/apr_functions.map Index: apr_functions.map === RCS file: /home/cvs/modperl-2.0/xs/maps/apr_functions.map,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- apr_functions.map 2001/04/12 05:38:25 1.6 +++ apr_functions.map 2001/04/18 05:10:43 1.7 @@ -75,38 +75,53 @@ apr_brigade_write apr_brigade_puts apr_brigade_putc + mpxs_APR__Brigade_first#APR_BRIGADE_FIRST + mpxs_APR__Brigade_last #APR_BRIGADE_LAST + mpxs_APR__Brigade_prev #APR_BUCKET_PREV + mpxs_APR__Brigade_next #APR_BUCKET_NEXT + mpxs_APR__Brigade_insert_tail #APR_BRIGADE_INSERT_TAIL + mpxs_APR__Brigade_insert_head #APR_BRIGADE_INSERT_HEAD + mpxs_APR__Brigade_concat #APR_BRIGADE_CONCAT -!MODULE=APR::Bucket - apr_bucket_copy_notimpl - apr_bucket_shared_copy - apr_bucket_eos_create - apr_bucket_file_create - apr_bucket_flush_create - apr_bucket_heap_create - apr_bucket_immortal_create - apr_bucket_mmap_create - apr_bucket_pipe_create - apr_bucket_pool_create - apr_bucket_socket_create - apr_bucket_transient_create - apr_bucket_destroy_notimpl - apr_bucket_shared_destroy - apr_bucket_eos_make - apr_bucket_file_make - apr_bucket_flush_make - apr_bucket_heap_make - apr_bucket_immortal_make - apr_bucket_mmap_make - apr_bucket_pipe_make - apr_bucket_pool_make - apr_bucket_shared_make - apr_bucket_socket_make - apr_bucket_transient_make - apr_bucket_setaside_notimpl - apr_bucket_split_notimpl - apr_bucket_shared_split - apr_bucket_simple_split - apr_bucket_simple_copy +MODULE=APR::Bucket + mpxs_APR__Bucket_is_eos #APR_BUCKET_IS_EOS + mpxs_APR__Bucket_insert_after #APR_BUCKET_INSERT_AFTER + mpxs_APR__Bucket_insert_before #APR_BUCKET_INSERT_AFTER + mpxs_APR__Bucket_remove #APR_BUCKET_REMOVE + #apr_bucket_read + mpxs_APR__Bucket_read | | bucket, wanted=0 + #modperl_bucket_sv_create + mpxs_APR__Bucket_new | | classname, sv, offset=0, len=0 + !apr_bucket_copy_notimpl + !apr_bucket_shared_copy + !apr_bucket_eos_create + !apr_bucket_file_create + !apr_bucket_flush_create + !apr_bucket_heap_create + !apr_bucket_immortal_create + !apr_bucket_mmap_create + !apr_bucket_pipe_create + !apr_bucket_pool_create + !apr_bucket_socket_create + !apr_bucket_transient_create + !apr_bucket_destroy_notimpl + !apr_bucket_shared_destroy + !apr_bucket_eos_make + !apr_bucket_file_make + !apr_bucket_flush_make + !apr_bucket_heap_make + !apr_bucket_immortal_make + !apr_bucket_mmap_make + !apr_bucket_pipe_make + !apr_bucket_pool_make + !apr_bucket_shared_make + !apr_bucket_socket_make + !apr_bucket_transient_make + !apr_bucket_setaside_notimpl + !apr_bucket_split_notimpl + !apr_bucket_shared_split + !apr_bucket_simple_split + !apr_bucket_simple_copy MODULE=APR::Pool apr_pool_free_blocks_num_bytes 1.3 +2 -2 modperl-2.0/xs/maps/apr_structures.map Index: apr_structures.map === RCS file: /home/cvs/modperl-2.0/xs/maps/apr_structures.map,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- apr_structures.map2001/03/16 00:01:37 1.2 +++ apr_structures.map2001/04/18 05:10:43 1.3 @@ -6,7 +6,7 @@ #buckets -!apr_bucket_type_t +apr_bucket_type_t MODULE=APR::Bucket name - num_func - destroy @@ -16,7 +16,7 @@ - copy /apr_bucket_type_t -!apr_bucket +apr_bucket link type length 1.3 +1 -1 modperl-2.0/xs/maps/apr_types.map Index: apr_types.map === RCS file: /home/cvs/modperl-2.0/xs/maps/apr_types.map,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- apr_types.map 2001/03/16 00:01:37 1.2 +++ apr_types.map 2001/04/18 05:10:43 1.3 @@ -22,7 +22,7 @@ struct apr_bucket | APR::Bucket struct apr_bucket_brigade | APR::Brigade apr_brigade_flush | UNDEFINED -apr_bucket_type_t | APR::BucketType +struct apr_bucket_type_t| APR::BucketType apr_read_type_e | UNDEFINED apr_bucket_file | UNDEFINED apr_bucket_pool | UNDEFINED
cvs commit: modperl-2.0/t/filter/TestFilter buckets.pm
dougm 01/04/17 22:11:14 Added: t/filter/TestFilter buckets.pm Log: add a test for the brigade/buckets api Revision ChangesPath 1.1 modperl-2.0/t/filter/TestFilter/buckets.pm Index: buckets.pm === package TestFilter::buckets; use strict; use warnings FATAL = 'all'; use Test; use Apache::Test (); use Apache::Filter (); use APR::Brigade (); use APR::Bucket (); sub handler { my($filter, $bb) = @_; Apache::TestToString-start; plan tests = 4; #should only have 1 bucket from the response() below for (my $bucket = $bb-first; $bucket; $bucket = $bb-next($bucket)) { ok $bucket-type-name; ok $bucket-length == 2; ok $bucket-read eq 'ok'; } my $tests = Apache::TestToString-finish; my $brigade = APR::Brigade-new($filter-f-r-pool); my $bucket = APR::Bucket-new($tests); $brigade-insert_tail($bucket); my $ok = $brigade-first-type-name =~ /mod_perl/ ? 4 : 0; $brigade-insert_tail(APR::Bucket-new("ok $ok\n")); $filter-f-next-pass_brigade($brigade); Apache::OK; } sub response { my $r = shift; $r-content_type('text/plain'); $r-puts("ok"); 0; } 1; __DATA__ SetHandler modperl PerlResponseHandler TestFilter::buckets::response
cvs commit: modperl-2.0/lib/ModPerl Code.pm
dougm 01/04/17 22:25:01 Modified:lib/ModPerl Code.pm Log: strip APR_ and AP_ prefixes from constant names Revision ChangesPath 1.58 +3 -2 modperl-2.0/lib/ModPerl/Code.pm Index: Code.pm === RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- Code.pm 2001/04/18 04:40:00 1.57 +++ Code.pm 2001/04/18 05:25:01 1.58 @@ -680,7 +680,7 @@ $file; } -my $constant_prefixes = join '|', qw{APR}; +my $constant_prefixes = join '|', qw{APR?}; sub generate_constants { my($self, $h_fh, $c_fh) = @_; @@ -789,7 +789,8 @@ push @tags, $group; my $name = join '_', 'MP_constants', $class, $group; print $c_fh "\nstatic const char *$name [] = { \n", - (map { s/^APR_//; qq( "$_",\n) } @$constants), " NULL,\n};\n"; + (map { s/^($constant_prefixes)_//o; + qq( "$_",\n) } @$constants), " NULL,\n};\n"; } my %switch;
cvs commit: modperl-2.0/lib/Apache ParseSource.pm
dougm 01/04/17 22:27:39 Modified:lib/Apache ParseSource.pm Log: pickup apache_filter and input_mode constants Revision ChangesPath 1.15 +3 -2 modperl-2.0/lib/Apache/ParseSource.pm Index: ParseSource.pm === RCS file: /home/cvs/modperl-2.0/lib/Apache/ParseSource.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ParseSource.pm2001/04/12 00:48:02 1.14 +++ ParseSource.pm2001/04/18 05:27:39 1.15 @@ -164,7 +164,7 @@ } my %enums_wanted = ( -Apache = { map { $_, 1 } qw(cmd_how) }, +Apache = { map { $_, 1 } qw(cmd_how input_mode filter_type) }, APR = { map { $_, 1 } qw(apr_shutdown_how) }, ); @@ -225,7 +225,8 @@ my($name, $e) = $self-parse_enum($fh); return unless $name; -$name =~ s/_e$//; +$name =~ s/^ap_//; +$name =~ s/_(e|t)$//; my $class; for (keys %enums_wanted) {
cvs commit: modperl-2.0/xs/tables/current/Apache ConstantsTable.pm
dougm 01/04/17 22:28:18 Modified:xs/tables/current/Apache ConstantsTable.pm Log: sync Revision ChangesPath 1.5 +53 -41modperl-2.0/xs/tables/current/Apache/ConstantsTable.pm Index: ConstantsTable.pm === RCS file: /home/cvs/modperl-2.0/xs/tables/current/Apache/ConstantsTable.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ConstantsTable.pm 2001/04/18 04:42:50 1.4 +++ ConstantsTable.pm 2001/04/18 05:28:18 1.5 @@ -2,12 +2,57 @@ # !! # ! WARNING: generated by Apache::ParseSource/0.02 -# ! Mon Apr 16 18:17:25 2001 +# ! Tue Apr 17 22:15:55 2001 # ! do NOT edit, any changes will be lost ! # !! $Apache::ConstantsTable = { 'Apache' = { +'options' = [ + 'OPT_NONE', + 'OPT_INDEXES', + 'OPT_INCLUDES', + 'OPT_SYM_LINKS', + 'OPT_EXECCGI', + 'OPT_UNSET', + 'OPT_INCNOEXEC', + 'OPT_SYM_OWNER', + 'OPT_MULTI', + 'OPT_ALL' +], +'satisfy' = [ + 'SATISFY_ALL', + 'SATISFY_ANY', + 'SATISFY_NOSPEC' +], +'common' = [ + 'DECLINED', + 'DONE', + 'OK', + 'NOT_FOUND', + 'FORBIDDEN', + 'AUTH_REQUIRED', + 'SERVER_ERROR' +], +'cmd_how' = [ + 'RAW_ARGS', + 'TAKE1', + 'TAKE2', + 'ITERATE', + 'ITERATE2', + 'FLAG', + 'NO_ARGS', + 'TAKE12', + 'TAKE3', + 'TAKE23', + 'TAKE123', + 'TAKE13' +], +'input_mode' = [ + 'AP_MODE_BLOCKING', + 'AP_MODE_NONBLOCKING', + 'AP_MODE_PEEK' +], 'http' = [ 'HTTP_CONTINUE', 'HTTP_SWITCHING_PROTOCOLS', @@ -57,18 +102,6 @@ 'HTTP_INSUFFICIENT_STORAGE', 'HTTP_NOT_EXTENDED' ], -'options' = [ - 'OPT_NONE', - 'OPT_INDEXES', - 'OPT_INCLUDES', - 'OPT_SYM_LINKS', - 'OPT_EXECCGI', - 'OPT_UNSET', - 'OPT_INCNOEXEC', - 'OPT_SYM_OWNER', - 'OPT_MULTI', - 'OPT_ALL' -], 'methods' = [ 'M_GET', 'M_PUT', @@ -88,20 +121,6 @@ 'M_INVALID', 'METHODS' ], -'satisfy' = [ - 'SATISFY_ALL', - 'SATISFY_ANY', - 'SATISFY_NOSPEC' -], -'common' = [ - 'DECLINED', - 'DONE', - 'OK', - 'NOT_FOUND', - 'FORBIDDEN', - 'AUTH_REQUIRED', - 'SERVER_ERROR' -], 'override' = [ 'OR_NONE', 'OR_LIMIT', @@ -114,25 +133,18 @@ 'RSRC_CONF', 'OR_ALL' ], -'cmd_how' = [ - 'RAW_ARGS', - 'TAKE1', - 'TAKE2', - 'ITERATE', - 'ITERATE2', - 'FLAG', - 'NO_ARGS', - 'TAKE12', - 'TAKE3', - 'TAKE23', - 'TAKE123', - 'TAKE13' -], 'remotehost' = [ 'REMOTE_HOST', 'REMOTE_NAME', 'REMOTE_NOLOOKUP', 'REMOTE_DOUBLE_REV' +], +'filter_type' = [ + 'AP_FTYPE_CONTENT', + 'AP_FTYPE_HTTP_HEADER', + 'AP_FTYPE_TRANSCODE', + 'AP_FTYPE_CONNECTION', + 'AP_FTYPE_NETWORK' ] }, 'APR' = {