Apache::Session problems, film at 11:00 ...
All: I'm getting very odd behavior out of Apache::Session, with serious problems using both the MySQL and File variants. Yes, I know I've come here with this problem before. Sigh. I even fixed it, although it was one of those things where I didn't quite know why it started working. Anyway, it stopped working about a week ago, and, as usual, I have no clue. Hence this plea for help: With Apache::Session::File, this code creates a new session id with every request. The lock file for each session remains in the lock directory. I ran a 'chmod -R 777 dirname' on both the session store and lock directories. With Apache::Session::MySQL, this code behaves more normally: it reuses the session id, the way [I believe] it should, except $session{state} never seems to make it into the database. I say that because I look at the contents of the sessions table between transactions, and it looks like this: mysql select * from sessions; +--+---+ | id | a_session | +--+---+ | 4def39f4e8144aede90532951232c040 | | +--+---+ 1 row in set (0.00 sec) I did make sure that the right privileges existed for the database user accessing the sessions table. I tried uninstalling Apache::Session ('rm -rf /usr/local/lib/perl5/site_perl/5.6.0/Apache/Session*'), and reinstalled it using CPAN, on the theory that I may have diddled it while checking out its code. But that didn't help. Here's the (relevant) code, with short, annotated, log extract following: ## ## Physemp::Search ## package Physemp::Search; use strict; use Apache; use Apache::Request; use Apache::Constants qw( :common ); use CGI::Cookie; use Apache::Session::MySQL; use DBI; use Data::Dumper; my (%states, %_CACHE); sub handler ($$) { my ($class, $q) = @_; my $self = $class-new(my $r = Apache::Request-new($q)); my $html = ''; $self-get_session($r); my $coderef = $self-{make}-{$self-frame}-{$self-page}-{$self-command} || \unimplemented; $html = $self-$coderef($r); $r-content_type('text/html'); $self-put_or_del_session($r); $r-send_http_header; print $html; return OK; } sub get_session { my ($self, $r) = @_; my %session; my $cookie_str = $r-header_in('Cookie'); my %cookies = $cookie_str eq '' ? ( ) : CGI::Cookie-parse($cookie_str); if (exists $cookies{SessionID}) { (my $session_id = $cookies{SessionID}-value) =~ s/([0-9a-f]+)/$1/; eval { tie %session, $self-{tieclass}, $session_id, $self-{tieattrs}; }; if ($@) { $r-log_error($@); $r-log_error(get_session: No session data found.); $self-{state} = { }; $self-{session_id} = ''; } else { $r-log_error(get_session: Session data found.); $r-log_error(get_session: \$session{state} is \n, Dumper $session{state}); $session{state} = { account = {} } unless exists $session{state}; $self-{session_id} = $session{_session_id}; $self-{state} = $session{state}; } undef %session; } else { $r-log_error(get_session: No Session ID cookie.); $self-{state} = { }; $self-{session_id} = ''; } $r-log_error(get_session: Session ID is '$self-{session_id}'.); $r-log_error(get_session: State is \n, Dumper $self-{state}); } sub put_or_del_session { my ($self, $r) = @_; my (%session, $cookie); if ($self-command eq 'make' or $self-page eq 'action') { eval { tie %session, $self-{tieclass}, ($self-{session_id} eq '' ? undef : $self-{session_id}), $self-{tieattrs}; }; if ($@) { $r-log_error(put_or_del_session: $@); eval { tie %session, $self-{tieclass}, undef, $self-{tieattrs}; }; if ($@) { $r-log_error(put_or_del_session: $@); return; # WTH, we can't do any good here } } if ($self-command eq 'logout') { $r-log_error(put_or_del_session: deleting session.); $cookie = CGI::Cookie-new( -name= 'SessionID', -path= $self-{uri}, -domain = '.physemp.com', -expires = '-10m', -value = '' ); tied(%session)-delete; } else { $r-log_error(put_or_del_session: updating session.); $session{state} = $self-{state}; $session{changes}++; $r-log_error(put_or_del_session: Session ID is '$session{_session_id}'.); $r-log_error(put_or_del_session: State is \n, Dumper $session{state}); $cookie = CGI::Cookie-new( -name= 'SessionID',
[OT] How to write this perl sub w/o variables?
Is it possible to rewrite this perl subroutine without using variables? sub XMLEncode { my ($line) = @_; $line =~ s//amp;/g; $line =~ s//lt;/g; $line =~ s//gt;/g; return $line; } I was thinking something like sub XMLEncode { s//amp;/g; s//lt;/g; s//gt;/g; return $_; } but I can't get it to work like that. -Philip Mak ([EMAIL PROTECTED])
Re: [OT] How to write this perl sub w/o variables?
On Sun, Apr 29, 2001 at 04:34:40AM -0400, Philip Mak wrote: I was thinking something like sub XMLEncode { local $_ = shift; s//amp;/g; s//lt;/g; s//gt;/g; return $_; } -- Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/ .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, DBD::XBase.
Re: CORE::format() and CORE::write() under 5.6.x
On Sun, 22 Apr 2001, Stas Bekman wrote: There is this entry in the guide: The interface to file handles which are linked to variables with Perl's tie() function is not yet complete. The format() and write() functions are missing. If you configure Perl with Csfio, write() and format() should work just fine. Is this still true under 5.6.x? if I rely on the perltie man page, these two aren't implemented in 5.6.x. _ 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: an unusual [job request] + taking mod_perl to the commercialworld
On Sun, 29 Apr 2001, Gunther Birznieks wrote: At 09:14 AM 4/28/01 +0100, Matt Sergeant wrote: On Sat, 28 Apr 2001, Gunther Birznieks wrote: As I think I mentioned, it's great that the people like you on this list have a passion for delivering cool software. [snipped] People rarely look at toolkits like payment gateways and messaging servers unless there is an application that fits their needs that they can use which happens to use these backend components. Actually there's an exception to this rule. Look at Zope. But Zope has an application? -- content management. A template engine is not an application, but a content management tool built upon templates surely is? I thought you would recognize this as you are building something to allow this on AxKit? I don't disagree with you, I just think it's a very fine line. Content management is a kind of meta-application, because like the core mod_perl - you still use it to build other applications. It just happens to have a bit of a friendlier interface to it. And that's what it's really all about - friendly interfaces. Case in point. AxKit wasn't an immediate success (in mod_perl scale terms) because it's a cool project, or because I spammed the list over and over about it. It was an immediate success only after I changed the web site from a drab and dreary look to the new design (even though everyone hates the purple!). I know most developers find that hard to fathom, and it still irks me a bit, but that's the reality of it. Of course, I guess you could consider AxKit an application because presumably it comes with scripts to allow aggregration of news content in RSS format? I consider this a really nice application. But it's also a bit difficult to tell that this is what AxKit does. You might consider separating AxKit the engine from AxKit the applications to allow people to find your site looking for applications (eg news, content management) so that they want to use AxKit. And then when they want to use AxKit, they will want to use mod_perl. Thats the intention, and the RSS NewsMaker module (the news content management system that Take23 uses) is separate, but I haven't really had time to make it easy to use and install yet, typically. Interestingly though there is very little interest in it, which is strange, but then I don't have a link to it from anywhere. -- 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: [OT] How to write this perl sub w/o variables?
On Sun, 29 Apr 2001, Philip Mak wrote: Is it possible to rewrite this perl subroutine without using variables? sub XMLEncode { my ($line) = @_; $line =~ s//amp;/g; $line =~ s//lt;/g; $line =~ s//gt;/g; return $line; } I was thinking something like sub XMLEncode { s//amp;/g; s//lt;/g; s//gt;/g; return $_; } but I can't get it to work like that. don't reinvent the wheel, use CPAN: # get the encoding sub right if ($ENV{MOD_PERL}) { require Apache::Util; # much faster! XS/C code! *encode = \Apache::Util::escape_html; } else { require HTML::Entities; *encode = \HTML::Entities::encode; } then call encode($mytext); not talking about the fact that your code is highly inefficient (you run s/// 3 times!!!), at least use a hash: %map = ( '' = 'amp', '' = 'lt', '' = 'gt', ); sub encode { $_[0] =~ s/(||)/$map{$1}/g; } note that this will fail: encode(hello), because you will try to modify a constant string (versus, $a = 'hello'; encode($a)). hope this helps... _ 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: CORE::format() and CORE::write() under 5.6.x
On Sun, 29 Apr 2001, Stas Bekman wrote: On Sun, 22 Apr 2001, Stas Bekman wrote: There is this entry in the guide: The interface to file handles which are linked to variables with Perl's tie() function is not yet complete. The format() and write() functions are missing. If you configure Perl with Csfio, write() and format() should work just fine. Is this still true under 5.6.x? if I rely on the perltie man page, these two aren't implemented in 5.6.x. Note that Damian Conway has released a replacement for format as a module. I forget what it's called now, but it's in his directory on CPAN (not Text::Autoformat, btw). -- 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: an unusual [job request] + taking mod_perl to the commercial world
On Sun, Apr 29, 2001 at 01:37:52PM +0800, Gunther Birznieks wrote: At 09:06 AM 4/28/01 -0400, barries wrote: Not sure either, except that this would be more targeted towards specific research projects, as opposed to the build a venue and they will come SourceXchange model. I guess my understanding of SourceXChange is that it was also for research projects and additions to existing open source projects. I meant that SourceXchange wasn't promoting a particular RD effort, they were trying to be a clearinghouse (not a bad thing, but a different thing). Stas (co.) has the advantage that advocacy is part of the intent, so by promoting mod_perl, he raises interest in his own availability, and by promoting his availability, he promotes mod_perl. He doesn't need to get bogged down in structuring a market and attracting business to a marketplace, he can focus on selling himself, his cohorts, and mod_perl. I think what Stas may want to do is write up a list of things that he wants to do with mod_perl if he were given 6 months or a year of salary to do whatever he wanted. *nod* - Barrie
Re: cookies work for some browsers, not for others... ?
- Original Message - From: will trillich [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 28, 2001 9:44 PM Subject: cookies work for some browsers, not for others... ? [snip] cf !DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN HTMLHEAD TITLE302 Found/TITLE /HEADBODY H1Found/H1 The document has moved A HREF=http://www.sample-from-modperl-book.com/login;here/A.P /BODY/HTML 0 Connection closed by foreign host. ??? what's that trailing zero for (or from), by the way? and that cf that preceeds !DOCTYPE... ? ??? That's the formatting done for the chunked content-type. I really don't recall exactly how it works. All I remember is that each set of hexadecimal digits [that's what they are] somehow must represent the next chunk to be transferred - it might be a byte count. In any case, if you're REALLY interested, go look it up in the RFC for HTTP/1.1 - it's explained in better detail there. [snip] HTTP/1.1 200 OK Date: Sat, 28 Apr 2001 19:27:34 GMT Server: Apache/1.3.9 Transfer-Encoding: chunked Content-Type: text/html 294 !DOCTYPE HTML PUBLIC -//IETF//DTD HTML//EN HTMLHEADTITLELog In/TITLE /HEADBODY BGCOLOR=whiteH1Please Log In/H1FORM METHOD=POST ACTION=/login ENCTYPE=application/x-www-form-urlencoded TABLETRTDName/TD TDINPUT TYPE=text NAME=user /TD/TR TRTDPassword/TD TDINPUT TYPE=password NAME=password /TD/TR/TABLEINPUT TYPE=hidden NAME=request_uri VALUE=http://sample-from-modperl-book.com/try?;INPUT TYPE=submit NAME=Log In VALUE=Log InP/FORMEMNote: /EMYou must set your browser to accept cookies in order for login to succeed.You will be asked to log in again after some period of time has elapsed. 0 Connection closed by foreign host. ??? and here it's bracketed with 294 in front, and 0 again taking up the rear. what's up with that? ??? See above. 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: cookies work for some browsers, not for others... ?
- Original Message - From: will trillich [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 28, 2001 9:44 PM Subject: cookies work for some browsers, not for others... ? [snip] cf !DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN HTMLHEAD TITLE302 Found/TITLE /HEADBODY H1Found/H1 The document has moved A HREF=http://www.sample-from-modperl-book.com/login;here/A.P /BODY/HTML 0 Connection closed by foreign host. ??? what's that trailing zero for (or from), by the way? and that cf that preceeds !DOCTYPE... ? ??? That's the formatting done for the chunked content-type. I really don't recall exactly how it works. All I remember is that each set of hexadecimal digits [that's what they are] somehow must represent the next chunk to be transferred - it might be a byte count. In any case, if you're REALLY interested, go look it up in the RFC for HTTP/1.1 - it's explained in better detail there. [snip] HTTP/1.1 200 OK Date: Sat, 28 Apr 2001 19:27:34 GMT Server: Apache/1.3.9 Transfer-Encoding: chunked Content-Type: text/html 294 !DOCTYPE HTML PUBLIC -//IETF//DTD HTML//EN HTMLHEADTITLELog In/TITLE /HEADBODY BGCOLOR=whiteH1Please Log In/H1FORM METHOD=POST ACTION=/login ENCTYPE=application/x-www-form-urlencoded TABLETRTDName/TD TDINPUT TYPE=text NAME=user /TD/TR TRTDPassword/TD TDINPUT TYPE=password NAME=password /TD/TR/TABLEINPUT TYPE=hidden NAME=request_uri VALUE=http://sample-from-modperl-book.com/try?;INPUT TYPE=submit NAME=Log In VALUE=Log InP/FORMEMNote: /EMYou must set your browser to accept cookies in order for login to succeed.You will be asked to log in again after some period of time has elapsed. 0 Connection closed by foreign host. ??? and here it's bracketed with 294 in front, and 0 again taking up the rear. what's up with that? ??? See above. 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: HELP??? Installation on MAC OS X
Tenon Systems has a current version of Apache with complete GUI administration engine at http://www.tenon.com/products/itools-osx/ This is a commercial product... On Friday, April 27, 2001, at 10:16 PM, Charlie Garrison wrote: G'day, I am trying to install mod perl on the Apple OS X Server platform. I can compile the code OK, both as static and as a DSO but when I try to restart the apache server, I get all sorts of errors. I found that it was already compiled, but the needed lines in httpd.conf were missing. Add the following two lines (at the end of the appropriate lists): LoadModule perl_module libexec/httpd/libperl.so AddModule mod_perl.c And then add some mod_per directives (I've used the perl/perl syntax): perl require /etc/httpd/startup.pl; # contains 'use' statements, etc. $Location{'/perl-status'}-{SetHandler} = 'perl-script'; $Location{'/perl-status'}-{PerlHandler} = 'Apache::Status'; $Location{'/perl-status'}-{order} = 'deny,allow'; $Location{'/perl-status'}-{'deny from'} = 'all'; $Location{'/perl-status'}-{'allow from'} = '.your.domain.com'; $Files{'~ \.pl$'}-{SetHandler} = 'perl-script'; $Files{'~ \.pl$'}-{PerlHandler} = 'Apache::Registry'; $Files{'~ \.pl$'}-{Options} = 'ExecCGI'; /perl I'm now able to do all development/testing on my box. I was able to install all needed modules via CPAN without any trouble. This was one of the reasons I wanted this OS, so I'm very happy. Charlie -- +--+ | Charlie Garrison [EMAIL PROTECTED] | | Garrison Computer Services http://www.garrison.com.au | | PO Box 141 | | Windsor NSW 2756 Australia Ph: +61 2 4575-5247 | +--+
Need help installing on Win32...
Hi... I have been using Apache along with Perl for a while now (and have been writing Perl/CGI scripts for even longer), but I am having much difficulty when it comes to installing this module. (I've never installed any modules before, so I'm ALL new to this.) I've found instructions for installing it on a UNIX box, but can't seem to find any for a Winders box. For the time being, I have only to use Win98 (I hate not having a *NIX box!), so bear with me on this. Perhaps I should wait until 2.0 comes out, but I'd love it if I was able to get it going before then. If you could possibly help me out here, please do. If you might know of anyone that has installed it on a Windows machine, please point me in their direction. If you know of any sites that might be of assistance to me, please let me know. Thank you in advance for any help you can provide to me! Carey BTW, I already have 2 different versions downloaded (though both are named mod_perl-1.25.tar.gz) so just let me know what I need to do with them. Thanks! _ Get your FREE download of MSN Explorer at http://explorer.msn.com
Re: Need help installing on Win32...
Yeah, I have ActivePerl. So... I tried installing it using PPM... Well, here's a snippet of what happened: PPM interactive shell (2.1.2) - type 'help' for available commands. PPM install http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-1.25_1.3.19.ppd Install package 'http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-1.25_1.3.19.ppd?' (y/N): y Installing package 'http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-1.25_1.3.19.ppd'... Writing D:\serv\lang\site\lib\auto\mod_perl\.packlist Cannot find file 'perl' (or one of its components). Check to ensure the path and filename are correct and that all required libraries are available. Cannot find file 'perl' (or one of its components). Check to ensure the path and filename are correct and that all required libraries are available. PPM (BTW, I have Perl 5.6.0.623 installed under 'D:\serv\lang' and Apache 1.3.19 installed under 'D:\serv') What actually happened? It just stopped a little over a minute after it had started just like this. Any ideas? Thanks for all your help! Carey Original Message Follows From: Randy Kobes [EMAIL PROTECTED] To: Carey Burgess [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: Need help installing on Win32... Date: Sun, 29 Apr 2001 15:43:56 -0500 (CDT) On Sun, 29 Apr 2001, Carey Burgess wrote: I have been using Apache along with Perl for a while now (and have been writing Perl/CGI scripts for even longer), but I am having much difficulty when it comes to installing this module. (I've never installed any modules before, so I'm ALL new to this.) Are you using ActivePerl? If so, there's a ppm mod_perl package available which you can install with ActivePerl's ppm utility; see http://perl.apache.org/distributions.html for details. If you don't have ActivePerl, or just want to compile it yourself, see the file INSTALL.win32 in the mod_perl sources for instructions. best regards, randy kobes _ Get your FREE download of MSN Explorer at http://explorer.msn.com
Re: Need help installing on Win32...
On Sun, 29 Apr 2001, Carey Burgess wrote: Yeah, I have ActivePerl. So... I tried installing it using PPM... Well, here's a snippet of what happened: PPM interactive shell (2.1.2) - type 'help' for available commands. PPM install http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-1.25_1.3.19.ppd Install package 'http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-1.25_1.3.19.ppd?' (y/N): y Installing package 'http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-1.25_1.3.19.ppd'... Writing D:\serv\lang\site\lib\auto\mod_perl\.packlist If it reaches this point, it means that the necessary files are installed in the perl tree - if you do at a DOS prompt perl -Mmod_perl -e print 1 and not get an error, it means that this part is OK. Cannot find file 'perl' (or one of its components). Check to ensure the path and filename are correct and that all required libraries are available. Cannot find file 'perl' (or one of its components). Check to ensure the path and filename are correct and that all required libraries are available. Here it's trying to run a post-install script to install the mod_perl dll (mod_perl.so) into your Apache modules/ directory. For some reason it can't find your perl binary to run the script - I assume perl is in your PATH? If so, you can do this manually - get x86/mod_perl-1.25_1.3.19.tar.gz from the site you got the ppd file, unpack it, and manually copy mod_perl.so to your Apache modules/ directory. best regards, randy
Re: an unusual [job request] + taking mod_perl to the commercialworld
On Sat, 28 Apr 2001, Gunther Birznieks wrote: [text cut] So for Adi -- I think the messaging server is great and I am sure it is cool and works well. And I am sure there are people on this list who will benefit. But unless your company makes the healthcare system itself open source, then it's another application that we don't have to make people interested in using mod_perl from the application side. [text cut] The problem is that most company's that spend the time to write an app based on Java close-source that app. The same thing is true of the mod_perl world if things like Adi's healthcare system or SmartWorker's OpenDesk remain closed systems. I know that they consider it their business model to have to keep these closed source. But it also means less applications on top of mod_perl to entice the masses to it. Thanks Gunther, We actually have discussed releasing our entire application open source. I personally would love to release it, being the chief architect, but there are other people involved who have put in a lot of work (directional/advisement/guidance... not coding) who would not benefit nearly as much as I would from it being open source. Also, as a company we have to evaluate what the best option is financially. We are currently a pretty low-budget operation, and if we release it what will prevent someone with deep pockets to come along, take it, and then dump tons of money into marketing it under a different brand name? I'm sure we could devise a license that would prevent such an occurrence, but it would have to be a pretty restrictive license, which would in itself limit the interest in the software. I know releasing it open source would get plenty of interest from developers, but would it generate interest from potential customers? We concluded that it probably wouldn't make much difference since healthcare is in general way behind the technology curve. Most people in healthcare haven't even heard of Linux yet. (that may be a bit of an exaggeration, but not too much) In any case, we are still planning on releasing it eventually - to allow it to grow beyond what our in-house development crew is capable of. We really are just waiting to gain some significant market share and brand recognition in order to make it more difficult for someone to take our software and compete with us directly. We also need to rewrite parts of it and document it. I personally would be embarassed if the open source community saw certain parts of it. :-) Any comments are much appreciated. Cheers, -Adi
Re: an unusual [job request] + taking mod_perl to the commercialworld
On Sun, 29 Apr 2001, Adi Fairbank wrote: Thanks Gunther, We actually have discussed releasing our entire application open source. I personally would love to release it, being the chief architect, but there are other people involved who have put in a lot of work (directional/advisement/guidance... not coding) who would not benefit nearly as much as I would from it being open source. Also, as a company we have to evaluate what the best option is financially. We are currently a pretty low-budget operation, and if we release it what will prevent someone with deep pockets to come along, take it, and then dump tons of money into marketing it under a different brand name? I'm sure we could devise a license that would prevent such an occurrence, but it would have to be a pretty restrictive license, which would in itself limit the interest in the software. I am in a similar situation with my company. Our main business is building small to medium scale web sites for small businesses. Our customers can build and maintain their websites and email accounts through a web frontend (ie choosing a template, WYSIWYG editor, menu builder, etc...). Everything we do is written in perl with a MySQL or PostgreSQL backend, and I am in the process of mod_perl'ifying most of it. Any new custom jobs that we do are also done in mod_perl. To simplify our development, and to keep our development and design teams separate we have developed a bunch of modules that simplify life in general (a template engine, a DBI wrapper, a form handler, etc...). We have talked about throwing our modules and apps out to the masses, but like most other companies, we are faced with competition. A big part of our marketing push is the easy-to-use tools for managing your website. If we give these tools away to our compeditors, then we loose our advantage in the marketplace. Perhaps once our position is more stable in the market we will be able to contribute back to the community with the work we have done... -- Cees Hek SiteSuite Corporation [EMAIL PROTECTED]
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
dougm 01/04/29 10:53:42 Modified:t/response/TestAPI uri.pm xs/Apache/URI Apache__URI.h xs/maps apache_functions.map apache_structures.map xs/tables/current/ModPerl FunctionTable.pm Log: special case Apache::URI-port Revision ChangesPath 1.3 +14 -3 modperl-2.0/t/response/TestAPI/uri.pm Index: uri.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/uri.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- uri.pm2001/04/28 22:42:06 1.2 +++ uri.pm2001/04/29 17:53:41 1.3 @@ -12,7 +12,7 @@ sub handler { my $r = shift; -plan $r, tests = 12; +plan $r, tests = 14; $r-args('query'); @@ -50,16 +50,27 @@ ok $newr-args eq 'query'; -ok $newr-parsed_uri-path eq $path; +my $puri = $newr-parsed_uri; -ok $newr-parsed_uri-query eq 'query'; +ok $puri-path eq $path; +ok $puri-query eq 'query'; + my @c = qw(one two three); $url_string = join '%20', @c; Apache::unescape_url($url_string); ok $url_string eq @c; + +my $port = 6767; +$puri-port($port); +$puri-scheme('ftp'); +$puri-hostname('perl.apache.org'); + +ok $puri-port == $port; + +ok $puri-unparse eq ftp://perl.apache.org:$port$path?query;; Apache::OK; } 1.2 +17 -0 modperl-2.0/xs/Apache/URI/Apache__URI.h Index: Apache__URI.h === RCS file: /home/cvs/modperl-2.0/xs/Apache/URI/Apache__URI.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Apache__URI.h 2001/04/28 22:35:22 1.1 +++ Apache__URI.h 2001/04/29 17:53:41 1.2 @@ -74,3 +74,20 @@ return status; } + +static MP_INLINE +char *mpxs_Apache__URI_port(uri_components *uri, SV *portsv) +{ +dTHX; /*XXX*/ +char *port_str = uri-port_str; + +if (portsv) { +STRLEN len; +char *port = SvPV(portsv, len); +uri-port_str = apr_pstrndup(((modperl_uri_t *)uri)-pool, + port, len); +uri-port = (int)SvIV(portsv); +} + +return port_str; +} 1.16 +2 -0 modperl-2.0/xs/maps/apache_functions.map Index: apache_functions.map === RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- apache_functions.map 2001/04/28 22:35:23 1.15 +++ apache_functions.map 2001/04/29 17:53:42 1.16 @@ -250,6 +250,8 @@ SV *:classname, SV *:p, uri=NULL | parse ap_unparse_uri_components | mpxs_ | \ uptr, flags=UNP_OMITPASSWORD | unparse + #special case to set both uri-port and uri-port_str + mpxs_Apache__URI_port | | uri, portsv=Nullsv PACKAGE=Apache::RequestRec mpxs_Apache__RequestRec_parsed_uri 1.6 +2 -2 modperl-2.0/xs/maps/apache_structures.map Index: apache_structures.map === RCS file: /home/cvs/modperl-2.0/xs/maps/apache_structures.map,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- apache_structures.map 2001/04/18 16:52:49 1.5 +++ apache_structures.map 2001/04/29 17:53:42 1.6 @@ -223,12 +223,12 @@ user password hostname - port_str +- port_str path query fragment hostent - port +~ port is_initialized dns_looked_up dns_resolved 1.12 +15 -1 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm Index: FunctionTable.pm === RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- FunctionTable.pm 2001/04/28 22:42:56 1.11 +++ FunctionTable.pm 2001/04/29 17:53:42 1.12 @@ -2,7 +2,7 @@ # !! # ! WARNING: generated by ModPerl::ParseSource/0.01 -# ! Sat Apr 28 15:36:08 2001 +# ! Sun Apr 29 10:27:28 2001 # ! do NOT edit, any changes will be lost ! # !! @@ -2979,6 +2979,20 @@ } ], 'name' = 'mpxs_ap_unescape_url' + }, + { +'return_type' = 'char *', +'args' = [ + { +'name' = 'uri', +'type' = 'uri_components *' + }, + { +'name' = 'portsv', +'type' = 'SV *' + } +
cvs commit: modperl-2.0/lib/ModPerl Code.pm
dougm 01/04/29 21:37:01 Modified:lib/ModPerl Code.pm Log: integrate modperl_global module Revision ChangesPath 1.60 +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.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- Code.pm 2001/04/19 17:42:16 1.59 +++ Code.pm 2001/04/30 04:37:00 1.60 @@ -93,7 +93,8 @@ my %flags = ( Srv = ['NONE', @ithread_opts, qw(ENABLED AUTOLOAD MERGE_HANDLERS), @hook_flags, 'UNSET'], -Dir = [qw(NONE SEND_HEADER SETUP_ENV MERGE_HANDLERS UNSET)], +Dir = [qw(NONE SEND_HEADER SETUP_ENV MERGE_HANDLERS GLOBAL_REQUEST UNSET)], +Req = [qw(NONE SET_GLOBAL_REQUEST)], Interp = [qw(NONE IN_USE PUTBACK CLONED BASE)], Handler = [qw(NONE PARSED METHOD OBJECT ANON AUTOLOAD DYNAMIC)], ); @@ -521,7 +522,7 @@ ); my @c_src_names = qw(interp tipool log config cmd options callback handler - gtop util filter bucket mgv pcw); + gtop util filter bucket mgv pcw global); 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/29 21:37:32 Modified:xs/tables/current/ModPerl FunctionTable.pm Log: sync Revision ChangesPath 1.13 +224 -1modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm Index: FunctionTable.pm === RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- FunctionTable.pm 2001/04/29 17:53:42 1.12 +++ FunctionTable.pm 2001/04/30 04:37:31 1.13 @@ -2,7 +2,7 @@ # !! # ! WARNING: generated by ModPerl::ParseSource/0.01 -# ! Sun Apr 29 10:27:28 2001 +# ! Sun Apr 29 20:13:39 2001 # ! do NOT edit, any changes will be lost ! # !! @@ -2298,6 +2298,215 @@ 'return_type' = 'void', 'args' = [ { +'name' = 'global', +'type' = 'modperl_global_t *' + }, + { +'name' = 'p', +'type' = 'apr_pool_t *' + }, + { +'name' = 'data', +'type' = 'void *' + }, + { +'name' = 'name', +'type' = 'const char *' + } +], +'name' = 'modperl_global_init' + }, + { +'return_type' = 'void', +'args' = [ + { +'name' = 'global', +'type' = 'modperl_global_t *' + } +], +'name' = 'modperl_global_lock' + }, + { +'return_type' = 'void', +'args' = [ + { +'name' = 'global', +'type' = 'modperl_global_t *' + } +], +'name' = 'modperl_global_unlock' + }, + { +'return_type' = 'void *', +'args' = [ + { +'name' = 'global', +'type' = 'modperl_global_t *' + } +], +'name' = 'modperl_global_get' + }, + { +'return_type' = 'void', +'args' = [ + { +'name' = 'global', +'type' = 'modperl_global_t *' + }, + { +'name' = 'data', +'type' = 'void *' + } +], +'name' = 'modperl_global_set' + }, + { +'return_type' = 'void', +'args' = [ + { +'name' = 'p', +'type' = 'apr_pool_t *' + }, + { +'name' = 'pconf', +'type' = 'apr_pool_t *' + } +], +'name' = 'modperl_global_init_pconf' + }, + { +'return_type' = 'void', +'args' = [], +'name' = 'modperl_global_lock_pconf' + }, + { +'return_type' = 'void', +'args' = [], +'name' = 'modperl_global_unlock_pconf' + }, + { +'return_type' = 'apr_pool_t *', +'args' = [], +'name' = 'modperl_global_get_pconf' + }, + { +'return_type' = 'void', +'args' = [ + { +'name' = 'arg0', +'type' = 'void *' + } +], +'name' = 'modperl_global_set_pconf' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { +'name' = 'p', +'type' = 'apr_pool_t *' + }, + { +'name' = 'key', +'type' = 'modperl_tls_t **' + } +], +'name' = 'modperl_tls_create' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { +'name' = 'key', +'type' = 'modperl_tls_t *' + }, + { +'name' = 'data', +'type' = 'void **' + } +], +'name' = 'modperl_tls_get' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { +'name' = 'key', +'type' = 'modperl_tls_t *' + }, + { +'name' = 'data', +'type' = 'void *' + } +], +'name' = 'modperl_tls_set' + }, + { +'return_type' = 'void', +'args' = [ + { +'name' = 'p', +'type' = 'apr_pool_t *' + }, + { +'name' = 'key', +'type' = 'modperl_tls_t *' + }, + { +'name' = 'data', +'type' = 'void *' + } +], +'name' = 'modperl_tls_reset_cleanup' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { +'name' = 'p', +'type' = 'apr_pool_t *' + } +], +'name' = 'modperl_tls_create_request_rec' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { +'name' = 'data', +'type' = 'request_rec * *' + } +], +'name' = 'modperl_tls_get_request_rec' + }, + { +'return_type' = 'apr_status_t', +'args' = [ + { +'name' = 'data', +'type' = 'void *' + } +], +'name' = 'modperl_tls_set_request_rec' + }, + { +'return_type' =
cvs commit: modperl-2.0/src/modules/perl mod_perl.c mod_perl.h modperl_types.h
dougm 01/04/29 21:38:37 Modified:src/modules/perl mod_perl.c mod_perl.h modperl_types.h Log: integrate modperl_global module and initialize pconf/request_rec globals Revision ChangesPath 1.51 +13 -0 modperl-2.0/src/modules/perl/mod_perl.c Index: mod_perl.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- mod_perl.c2001/04/25 16:19:44 1.50 +++ mod_perl.c2001/04/30 04:38:34 1.51 @@ -207,6 +207,12 @@ } #endif /* USE_ITHREADS */ +static void modperl_init_globals(apr_pool_t *pconf) +{ +modperl_global_init_pconf(pconf, (void *)pconf); +modperl_tls_create_request_rec(pconf); +} + void modperl_hook_init(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { @@ -237,6 +243,7 @@ ap_add_version_component(pconf, Perl_form(aTHX_ Perl/v%vd, PL_patchlevel)); modperl_mgv_hash_handlers(pconf, s); +modperl_init_globals(pconf); #ifdef USE_ITHREADS modperl_init_clones(s, pconf); #endif @@ -253,11 +260,17 @@ static int modperl_hook_post_read_request(request_rec *r) { +/* if 'PerlOptions +GlobalRequest' is outside a container */ +modperl_global_request_cfg_set(r); + return modperl_input_filter_register_request(r); } static int modperl_hook_header_parser(request_rec *r) { +/* if 'PerlOptions +GlobalRequest' is inside a container */ +modperl_global_request_cfg_set(r); + return modperl_input_filter_register_request(r); } 1.30 +3 -0 modperl-2.0/src/modules/perl/mod_perl.h Index: mod_perl.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- mod_perl.h2001/04/19 21:26:34 1.29 +++ mod_perl.h2001/04/30 04:38:35 1.30 @@ -4,6 +4,8 @@ #include modperl_apache_includes.h #include modperl_perl_includes.h +#define MP_THREADED (defined(USE_ITHREADS) APR_HAS_THREADS) + extern module AP_MODULE_DECLARE_DATA perl_module; #include modperl_flags.h @@ -27,6 +29,7 @@ #include modperl_filter.h #include modperl_pcw.h #include modperl_mgv.h +#include modperl_global.h void modperl_init(server_rec *s, apr_pool_t *p); void modperl_hook_init(apr_pool_t *pconf, apr_pool_t *plog, 1.39 +2 -0 modperl-2.0/src/modules/perl/modperl_types.h Index: modperl_types.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- modperl_types.h 2001/04/28 23:03:08 1.38 +++ modperl_types.h 2001/04/30 04:38:35 1.39 @@ -197,6 +197,8 @@ typedef struct { HV *pnotes; +SV *global_request_obj; +U8 flags; modperl_wbucket_t wbucket; MpAV *handlers_per_dir[MP_HANDLER_NUM_PER_DIR]; MpAV *handlers_per_srv[MP_HANDLER_NUM_PER_SRV];