xml parsing under mod_perl segfaults
Hello mod_perl gurus, I am trying to do some xml parsing under mod_perl. My script basically looks like this: #!/usr/bin/perl -w use strict; use CGI qw(:standard); use XML::Parser; use XML::SimpleObject; my $file=test.xml; my $parser = XML::Parser-new(ErrorContext = 2, Style = Tree); my $xml = XML::SimpleObject-new($parser-parsefile($file)); # mod_perl killer print header(); ... When executed at command line and under handler cgi-script the script works fine. However, when run under mod_perl the Apache child segfaults with: [notice] child pid 16608 exit signal Segmentation fault (11) The problem occurs at line marked as the mod_perl killer when parser tries to parse $file. I have observed identical behavior under the following setups: [freeBSD] Apache/1.3.12 mod_perl/1.21 Perl 5.005_03 built for i386-freebsd [linux] Apache/1.3.19 mod_perl/1.24_01 Perl v5.6.0 built for i386-linux Searching through various mailing lists revealed there maybe conflicts w/ Apache's expat, with a solution being to recompile without it. Postings with this same problem date back to almost one year ago. Since my freeBSD setup is a virtual private server from verio I cannot easily recompile+reinstall apache. Please reply if you are aware of a fix for this problem or a workaround for parsing XML under mod_perl. (a fix that does not require apache recompilation would be ideal) Thanks, //Artem
RE: xml parsing under mod_perl segfaults
-Original Message- From: Artem Litvinovich [mailto:[EMAIL PROTECTED]] Please reply if you are aware of a fix for this problem or a workaround for parsing XML under mod_perl. (a fix that does not require apache recompilation would be ideal) 1) Use XML::LibXML 2) Use XML::SAX::PurePerl (which is slower, but still works) 3) Upgrade Apache to 1.3.22 and use XML::Parser 2.30 Unfortunately none of those yet support your SimpleObject, but I've sent a patch/update of XML::Handler::Trees to Eric Bohlman, which will allow you to use that. Email me if you want a copy that'll allow you to work with XML::SAX::PurePerl. Matt. _ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service.
[OT] AxKit: Back online
This post doesn't seem to have hit the list: -- Forwarded message -- Date: Mon, 12 Nov 2001 07:12:00 + (GMT) From: Matt Sergeant [EMAIL PROTECTED] To: AxKit Users Mailing List [EMAIL PROTECTED] Subject: [OT] AxKit: We're Back! Well, after around 12 or 13 weeks outage, axkit.org, axkit.com, and (less disconcerting) sergeant.org are now back, and alive and well. This means the axkit mailing lists are back. http://axkit.org/ PS: If you can't get there just yet, your DNS may not have propogated yet. It works from some places I've confirmed though, so it should be with you in 24 hours. To see the tale of what happened in all its glory, visit: http://axkit.org/cgi-bin/ezmlm-cgi?3:mss:2585:200111:oklpechdncnncgcbigoh Matt. -- :-Get a smart net/:- _ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service.
Can't install Apache::Request on Linux
I suspect all this is is a path problem, but I'm not sure where to stuff the appropriate line With: Linux 2.2.17 on x86 Apache 1.3.19 Perl 5.6.1 mod_perl 1.26 I can't install Apache::Request using either CPAN.pm or manually. Both give the error: Request.xs:40 mod_perl.h: No such file or directory just after attempting to compile Request.c mod_perl.h is present in /usr/local/apache/src/modules/perl/ Where do I need to stick the option to make the makefile include the correct paths? Thanks in advance.
Re: dont understand mem-mapping
Peter Pilsl wrote: I just cant get the following in my brain. I have a modules that is started with apache using the PerlModule-directive in httpd.conf. This module defines a global pointer on startup that should be the same in all sub-instances of httpd and really in the current apache-session all instances print out : $g_ptr : HASH(0x8458a30) This hashpointer is later filled with different values (dbhandles, filehandles ...) that should kept open over more calls. Now each session has the same pointer, but the content of the anonymous hash its pointing too is different in each instance !! thread 1: $g_ptr : HASH(0x8458a30) $g_ptr-{counter} : SCALAR(0x85aa62c) thread 2: $g_ptr : HASH(0x8458a30) $g_ptr-{counter} : SCALAR(0x85f5e2c) A even more strange example is an anonmous array that has the same adress, but different content too. The only explanation is that there is some mem-mapping for each httpd-instance, but I dont know much about this. My problem now is, that each httpd-instance opens a lot of db-handles and connections and I end up with system-errors 'to many files opened' or such things. Is there any way to share handles between all instances (I guess not, and I'm sure this mem-mapping has a deeper meaning too: if more than one instance access the same adress at the same time there would be lot of troubles and I'm even more sure that this has something to do with the copy-on-write feature of fork(), but I'm just not good in this things, so I'd like to have some comment to be sure that this is a principal problem and not a problem of my module) Peter, in the future posts please consider the following: 1. in perl we don't have pointers, but references. I think you'll be more understood if you talk using the Perl terminology, rather than C. 2. it helps to diagnose a problem when a *short* (a few lines) code example is shown, rather than just describing the symptoms. This should give you directions to understanding your problem and solving it: 1. forked children share the same datastructure with a parent until they get modified. When this happens a copy on write occurs and the child process doesn't share the datastructure anymore. See: http://perl.apache.org/guide/performance.html#Know_Your_Operating_System 2. apparently you have the same problem as 'too many connections' problem, and therefore want to look at Apache::DBI for understanding the problem and coming up with a similar solution for your problem. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Apache::OutputChain vs. Apache::Filter
Just out of curiosity, which of these two modules are more popularly used? I have to make some sort of inline SSI processing in one of my modules, and am curious to know how other people do it... I know that different people will do different things depending on the situation, and that there's really no "Generic" answer, but am still curious to hear how others do this kind of thing... Issac Internet is a wonderful mechanism for making a fool ofyourself 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
asp perl problem
Hi I am new to perl and would like to make a asp page with a script that will find all files in a given directory and create links to different files in another directory. The two sets of files are images (thumbnails and big pics) so I would also like to show the thumbnails on the page and have the links to the bigger pics. I already have all the images and do not need a thumbnail generator. I just want it so that when I add new images thats it. I am not asking for a complete answer only a pointer towards which functions would best do this job etc. Any help you can give would be great. Ju. This e-mail, and any attachment, is confidential. If you have received it in error, please delete it from your system, do not use or disclose the information in any way, and notify me immediately.
[OT] AxKit: We're Back!
-- Forwarded message -- Date: Mon, 12 Nov 2001 07:12:00 + (GMT) From: Matt Sergeant [EMAIL PROTECTED] To: AxKit Users Mailing List [EMAIL PROTECTED] Subject: [OT] AxKit: We're Back! Well, after around 12 or 13 weeks outage, axkit.org, axkit.com, and (less disconcerting) sergeant.org are now back, and alive and well. This means the axkit mailing lists are back. http://axkit.org/ PS: If you can't get there just yet, your DNS may not have propogated yet. It works from some places I've confirmed though, so it should be with you in 24 hours. To see the tale of what happened in all its glory, visit: http://axkit.org/cgi-bin/ezmlm-cgi?3:mss:2585:200111:oklpechdncnncgcbigoh -- 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: open-source suggestion for a knowledge-base/search engine?
Grant Babb [EMAIL PROTECTED] wrote: --=_3114418==_.ALT Content-Type: text/plain; charset=us-ascii; format=flowed all- In our migration to open-source solutions, I have been asked to suggest a solution for our knowledge base. We have found that a well-indexed text search is really a more effective way to go, but I was hoping for some suggestions from this list on some mod_perl based projects or apache modules that might do the the trick. PHP is OK too i guess, but when it comes to both fast lookups and text manipulation, mod_perl/mySQL seemed like the obvious way to go. You're welcome to look at (and contribute to :) the PerlKB project: http://sourceforge.net/projects/perlkb/ It's still in the fairly early stages right now - most work is on the data store/management than on a web interface. If you are interested, you might also want to look at the template toolkit documentation list - some of the discussion there may affect the PerlKB implementation. My current work on the PerlKB involves categorization of documents and presenting that to the user - should have more on that after next week (deadline for Usenix tech. conference submissions :). Neither of these are ready for production at this point. If you need something *now*, then I'd look elsewhere (not necessarily for non-mod_perl solutions, just not this one). -- James Smith [EMAIL PROTECTED], 979-862-3725 Texas AM CIS Operating Systems Group, Unix
Silly Newbie Question: cookies and such
Unfortunatly, I find myself with a silly newbie question: I need to make an Apache module (not a Registry script) which will: 1. Check for a cookie, and if not there, pushhandler to a module for logging in (keeping the original request at hand for use after they succeed in logging in). 2. Extract data from the cookie (encrypted for security?) 3. Based on data from both the query string ($r-args?) and from data in the cookie, pushhandler to another module. I have looked at Apache::AuthCookie - it didn't seem to make much sense to me. Apache::Session looks promising, but the instructions don't say how to set up the mysql tables, etc. My worst problem is that I haven't had occasion to deal with cookies much (setting, checking,etc.) in the past and I know this is hampering my understanding. Can anyone give me a general overview (use this module, this way, etc.)? I'm not totally new to Apache Modules, but my experience is gleaned from writing modules already pushed into the handler stack by PerlTransHandlers written by someone else. I don't want to use PerlTransHandler, just PerlHandler, so I can use Location in perl.conf. In conclusion: I'm making a system/site where no .html files even exist. I need to handle security via a mysql db, and to push handlers based on a part of the url and a piece of the cookie which identifies the user as either a teacher, student, or parent (oops... I gave it away ;-) Jonathon Robison
Re: Silly Newbie Question: cookies and such
On Tue, 13 Nov 2001 04:28, you wrote: I need to make an Apache module (not a Registry script) which will: 1. Check for a cookie, and if not there, pushhandler to a module for logging in (keeping the original request at hand for use after they succeed in logging in). 2. Extract data from the cookie (encrypted for security?) 3. Based on data from both the query string ($r-args?) and from data in the cookie, pushhandler to another module. I have looked at Apache::AuthCookie - it didn't seem to make much sense to me. Apache::Session looks promising, but the instructions don't say how to set up the mysql tables, etc. My worst problem is that I haven't had occasion to deal with cookies much (setting, checking,etc.) in the past and I know this is hampering my understanding. You should definately be using Auth::Cookie for this. I would give the docs another read. It took me a couple of tries to get it working successfully, but I have implemented it in about 4 or 5 applications, and it works flawlessly. With Auth::Cookie it will handle the cookies for you, it will do the redirection to your login page for you, and it can handle logouts as well (by expiring the cookie). As for Apache::Session, it is really just a keyed data store with expiry times. You give it some data, and it gives you a key. If you come back later and give it the same key, it gives you back your data. A lot of people use Auth::Cookie and Apache::Session together to build a session management system, but I prefer just using a ticket based system with Auth::Cookie alone (See the Eagle book on how to do ticket based authentication). I have included a sample Auth::Cookie implementation that might give you some ideas. It is not complete, but it might get you going (I have stripped out some of the irrelevant code, so it probably won't work out of the box). Also you will have to provide your own login.pl and logout.pl scripts (I would use the examples that come with Auth::Cookie until you get a working system, then you can look at building your own. In conclusion: I'm making a system/site where no .html files even exist. I need to handle security via a mysql db, and to push handlers based on a part of the url and a piece of the cookie which identifies the user as either a teacher, student, or parent (oops... I gave it away ;-) After Auth::Cookie has finished it's phase, it will set the REMOTE_USER environment variable to the user that logged in. You could just as easily set this to 'teacher' or whatever. Then your content handler can look at this variable and decide what to do. HTH Cees package My::Auth::AuthCookie; require 5.000; use strict; use Apache::AuthCookie; use My::Crypt; @My::Auth::AuthCookie::ISA = qw(Apache::AuthCookie); # ## # There are far more secure ways of handling the passphrase then keeping it in # the actual code, but this is by far the easiest... sub SECRET () { 'No one will ever guess this passphrase :)'; } my $CRYPTER ||= new My::Crypt; # This utility just uses the Crypt::CBC and # Storable modules to encrypt and decrypt perl # data structures. It also does an MD5 checksum sub authen_cred ($$\@) { my $self = shift; my $r = shift; my @creds = @_; # # get the entered details # my $email= $creds[0]; my $password = $creds[1]; # # ensure that the user is valid and authorized... # right now it accepts any email and password combo, # so obviously you would check this in a database or # something # if ($email $password) { return $self-makeTicket($r, $email); } else { return; } } sub authen_ses_key ($$$) { my $self = shift; my $r = shift; my $ticket = shift; # # verify the ticket (to make sure no-one has tampered with it and it hasn't expired etc...) # my ($result, $message) = $self-verifyTicket($r, $ticket); # # Check the result and act appropriately... # if (!$result) { # $r-log-error(Browser returned bad cookie ($message)); return undef; } else { # # Make and set a new cookie (so that the 'time' in the cookie is updated and expires # works as expected - since last access etc...) # my $new_ticket = $self-makeTicket($r, $message); $self-send_cookie($new_ticket); # # Return the 'message/string' which will be set in the environment # under REMOTE_USER (aka.. $ENV{REMOTE_USER}). In our case that is # the users email
Re: Internal server error on Refreshing mod_perl page ( Apache::ASP )
Thanks alot Joshua, You ar right, by turning off the PerlTaintCheck , PerlTaintCheck Off in my httpd.conf. It's fixed. My dev versions of Apache::ASP ( 2.29 ) MLDBM::Sync ( .25 ) will be able to run under PerlTaintCheck On, let me know if you would like these pre release. And I would like to have the Apache::ASSP(2.29) MLDBM::Sync(.25). because I want to work with Apache::ASP, by having the PerlTaintCheck On. Please give me guidance. Once again thanks. -SubbaReddy - Original Message - From: Joshua Chamas [EMAIL PROTECTED] To: SubbaReddy M [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, November 10, 2001 2:24 PM Subject: Re: Internal server error on Refreshing mod_perl page ( Apache::ASP ) SubbaReddy M wrote: Hello Gurus, [Sat Nov 10 11:54:32 2001] [error] Insecure dependency in eval while running with -T switch at /usr/lib/perl5/site_perl/5.6.1/MLDBM/Serializer/Data/Dumper.pm line 51. MLDBM::Serializer::Data::Dumper::deserialize('MLDBM::Serializer::Data::Dumpe r=HASH(0x843bd20)', '$MlDbM{\'timeout\' = \'1005374203\'}') called at /usr/lib/perl5/site_perl/5.6.1/MLDBM.pm line 155 MLDBM::FETCH('MLDBM=HASH(0x843bd08)', '07abbd5f03d200c6bac27a861f47e35e') called at /usr/lib/perl5/site_perl/5.6.1/MLDBM/Sync.pm line 85 MLDBM::Sync::AUTOLOAD('MLDBM::Sync=HASH(0x843a838)', '07abbd5f03d200c6bac27a861f47e35e') called at This error comes from the mod_perl config: PerlTaintCheck On You can see more on this error at: http://www.apache-asp.org/faq.html#Insecure%20depec6cd400 I would not recommend trying to get Apache::ASP to run under PerlTaintCheck as its been a while since the author ( me ) has done so, so there will likely be other errors in doing so than what's listed in the above FAQ item. So find the config in your system *.conf files and turn it off for now. Future Apache::ASP support queries should be emailed to the email list specific to it. You can subscribe to it at [EMAIL PROTECTED] --Josh _ Joshua Chamas Chamas Enterprises Inc. NodeWorks Founder Huntington Beach, CA USA http://www.nodeworks.com1-714-625-4051
Re: open-source suggestion for a knowledge-base/search engine?
If you may use PostgreSQL as a database engine, there is an OpenFTS (openfts.sourceforge.net). I'm one of the author, so I'm biased a little bit, but we have successfully use it in many projects with close integration with mod_perl (Mason). regards, Oleg On Mon, 12 Nov 2001, Grant Babb wrote: all- In our migration to open-source solutions, I have been asked to suggest a solution for our knowledge base. We have found that a well-indexed text search is really a more effective way to go, but I was hoping for some suggestions from this list on some mod_perl based projects or apache modules that might do the the trick. PHP is OK too i guess, but when it comes to both fast lookups and text manipulation, mod_perl/mySQL seemed like the obvious way to go. thanks in advance for the input, grant Grant Babb Email: [EMAIL PROTECTED] Data Junction Corporation Phone: (512) 459-1308 2201 Northland Dr. Fax: (512) 459-1309 Austin, TX 78756-1117 Web: http://www.datajunction.com Grant Babb Email: [EMAIL PROTECTED] Data Junction Corporation Phone: (512) 459-1308 2201 Northland Dr. Fax: (512) 459-1309 Austin, TX 78756-1117 Web: http://www.datajunction.com Regards, Oleg _ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83
Re: Apache::Sandwich, etc
JG == Jie Gao [EMAIL PROTECTED] writes: JG I am wondering if it is possible to add a footer to dynamic pages, JG server-wide, like the subject module does to static pages. Apache::Sandwich will work with whatever content handler you want, including dynamic ones. See the docs. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D.Khera Communications, Inc. Internet: [EMAIL PROTECTED] Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/
cvs commit: modperl-2.0/xs/APR/Table APR__Table.h
dougm 01/11/12 14:14:36 Modified:src/modules/perl modperl_config.c modperl_env.c xs/APR/Table APR__Table.h Log: adjust to const-ness changes Submitted by: Philippe M. Chiasson [EMAIL PROTECTED] Reviewed by: dougm Revision ChangesPath 1.47 +1 -1 modperl-2.0/src/modules/perl/modperl_config.c Index: modperl_config.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- modperl_config.c 2001/11/05 05:19:01 1.46 +++ modperl_config.c 2001/11/12 22:14:36 1.47 @@ -20,7 +20,7 @@ /* take the 'base' values, and override with 'add' values if any */ #define merge_table_overlap_item(item) \ { \ -apr_array_header_t *arr = apr_table_elts(base-item); \ +const apr_array_header_t *arr = apr_table_elts(base-item); \ apr_table_entry_t *entries = (apr_table_entry_t *)arr-elts; \ int i; \ mrg-item = apr_table_copy(p, add-item); \ 1.18 +1 -1 modperl-2.0/src/modules/perl/modperl_env.c Index: modperl_env.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_env.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- modperl_env.c 2001/10/20 17:38:16 1.17 +++ modperl_env.c 2001/11/12 22:14:36 1.18 @@ -84,7 +84,7 @@ HV *hv = ENVHV; U32 mg_flags; int i; -apr_array_header_t *array; +const apr_array_header_t *array; apr_table_entry_t *elts; 1.7 +1 -1 modperl-2.0/xs/APR/Table/APR__Table.h Index: APR__Table.h === RCS file: /home/cvs/modperl-2.0/xs/APR/Table/APR__Table.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- APR__Table.h 2001/11/07 03:39:08 1.6 +++ APR__Table.h 2001/11/12 22:14:36 1.7 @@ -150,7 +150,7 @@ } } else { -apr_array_header_t *arr = apr_table_elts(t); +const apr_array_header_t *arr = apr_table_elts(t); apr_table_entry_t *elts = (apr_table_entry_t *)arr-elts; int i;
cvs commit: modperl-2.0/todo deprecated_features.txt missing_old_features.txt
stas01/11/12 22:52:27 Modified:todo deprecated_features.txt missing_old_features.txt Log: correct names/paths Revision ChangesPath 1.4 +1 -1 modperl-2.0/todo/deprecated_features.txt Index: deprecated_features.txt === RCS file: /home/cvs/modperl-2.0/todo/deprecated_features.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- deprecated_features.txt 2001/09/27 20:03:37 1.3 +++ deprecated_features.txt 2001/11/13 06:52:27 1.4 @@ -1,7 +1,7 @@ these features with either: a) never be in 2.0 b) only be in #ifdef MP_DEPRECATED -c) be a form that was nothing like 1.xx (e.g. Apache::Leek) +c) be a form that was nothing like 1.xx (e.g. Apache::Leak) d) split off into something standalone on cpan - MaxModPerlRequestsPerChild 1.14 +2 -2 modperl-2.0/todo/missing_old_features.txt Index: missing_old_features.txt === RCS file: /home/cvs/modperl-2.0/todo/missing_old_features.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- missing_old_features.txt 2001/11/13 04:37:55 1.13 +++ missing_old_features.txt 2001/11/13 06:52:27 1.14 @@ -8,7 +8,7 @@ - PerlSetEnv, PerlPassEnv -- PerlModule, PerlRequire, Perl{Set,Add}Var in .htacess is missing +- PerlModule, PerlRequire, Perl{Set,Add}Var in .htaccess is missing - pod directives (=pod,=back,=cut) and __END__ @@ -42,7 +42,7 @@ - Apache::File, Apache::Util -- see also: xs/maps/apache_function.map +- see also: xs/maps/apache_functions.map addon modules: -
cvs commit: modperl-2.0/ModPerl-Registry/lib/ModPerl RegistryLoader.pm
stas01/11/12 20:33:06 Modified:ModPerl-Registry/t/conf extra.conf.in Added: ModPerl-Registry/t/conf modperl_extra_startup.pl ModPerl-Registry/lib/ModPerl RegistryLoader.pm Log: - implement RegistryLoader and test it in the startup file Revision ChangesPath 1.3 +3 -0 modperl-2.0/ModPerl-Registry/t/conf/extra.conf.in Index: extra.conf.in === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/conf/extra.conf.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- extra.conf.in 2001/10/19 06:46:25 1.2 +++ extra.conf.in 2001/11/13 04:33:06 1.3 @@ -3,6 +3,9 @@ # make sure that we test under Taint mode PerlSwitches -T +# run on startup +PerlRequire @ServerRoot@/conf/modperl_extra_startup.pl + PerlSwitches -Mlib=@ServerRoot@/../lib PerlSwitches -Mlib=@ServerRoot@/../../Apache-Test/lib PerlSwitches -Mlib=@ServerRoot@/../../lib 1.1 modperl-2.0/ModPerl-Registry/t/conf/modperl_extra_startup.pl Index: modperl_extra_startup.pl === # use strict; use warnings; # test the scripts pre-loading by explicitly specifying uri = filename use ModPerl::RegistryLoader (); my $rl = ModPerl::RegistryLoader-new(package = ModPerl::Registry); my $base_dir = Apache::server_root_relative(cgi-bin); my $base_uri = /cgi-bin; for my $file (qw(basic.pl env.pl)) { my $file_path = $base_dir/$file; my $info_path = $base_uri/$file; $rl-handler($info_path, $file_path); } { # test the scripts pre-loading by using trans sub use ModPerl::RegistryLoader (); use DirHandle (); use strict; my $dir = Apache::server_root_relative(cgi-bin); sub trans { my $uri = shift; $uri =~ s|^/registry_bb/|cgi-bin/|; return Apache::server_root_relative($uri); } my $rl = ModPerl::RegistryLoader-new(package = ModPerl::RegistryBB, trans = \trans); my $dh = DirHandle-new($dir) or die $!; for my $file ($dh-read) { next unless $file =~ /\.pl$/; $rl-handler(/registry_bb/$file); } } 1; 1.1 modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryLoader.pm Index: RegistryLoader.pm === package ModPerl::RegistryLoader; use Apache::Const -compile = qw(OPT_EXECCGI); use Carp; our @ISA = (); sub new { my $class = shift; my $self = bless {@_} = ref($class)||$class; $self-load_package($self-{package}); return $self; } sub handler { my($self, $uri, $filename) = @_; # set the inheritance rules at run time @ISA = $self-{package}; unless (defined $uri) { $self-warn(uri is a required argument); return; } if (defined $filename) { unless (-e $filename) { $self-warn(Cannot find: $filename); return; } } else { # try to translate URI-filename if (my $func = $self-{trans}) { no strict 'refs'; $filename = $func-($uri); unless (-e $filename) { $self-warn(Cannot find a translated from uri: $filename); return; } } else { # try to guess (my $guess = $uri) =~ s|^/||; $filename = Apache::server_root_relative($guess); $self-warn(Trying to guess filename based on uri); unless (-e $filename) { $self-warn(Cannot find guessed file: $filename, provide \$filename or 'trans' sub); return; } } } if ($self-{debug}) { $self-warn(*** uri=$uri, filename=$filename); } my $r = bless { uri = $uri, filename = $filename, } = ref($self) || $self; $r-SUPER::handler; } sub filename { shift-{filename} } sub finfo{ shift-{filename} } sub uri { shift-{uri} } sub path_info {} sub allow_options { Apache::OPT_EXECCGI } #will be checked again at run-time sub log_error { shift; die @_ if $@; warn @_; } *log_reason = \log_error; sub run {} # don't run the script sub server { shift } # override Apache class methods called by Modperl::Registry*. normally # only available at request-time via blessed request_rec pointer sub slurp_filename { my $r = shift; my $filename = $r-filename; open my $fh, $filename; local $/; my $code = $fh; return \$code; } sub load_package {
cvs commit: modperl-2.0/ModPerl-Registry/lib/ModPerl RegistryCooker.pm
stas01/11/12 20:34:31 Modified:ModPerl-Registry/lib/ModPerl RegistryCooker.pm Log: - style tweaks Revision ChangesPath 1.5 +3 -3 modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm Index: RegistryCooker.pm === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- RegistryCooker.pm 2001/10/19 10:37:20 1.4 +++ RegistryCooker.pm 2001/11/13 04:34:31 1.5 @@ -168,7 +168,7 @@ my $rc = Apache::OK; my $cv = \{$package\::handler}; -{ # run the code, preserve warnings setup when it's done +{ # run the code if $r-seqno, preserve warnings setup when it's done no warnings; eval { $rc = {$cv}($r, @_) } if $r-seqno; $o-[STATUS] = $rc; @@ -662,7 +662,7 @@ # sub install_aliases { -my ($class, $rh_aliases) = @_; +my($class, $rh_aliases) = @_; no strict 'refs'; while (my($k,$v) = each %$rh_aliases) { @@ -677,7 +677,7 @@ ### helper methods -sub debug{ +sub debug { my $o = shift; $o-[REQ]-log_error($$: $o-[CLASS]: . join '', @_); }
cvs commit: modperl-2.0/ModPerl-Registry/t TEST.PL
stas01/11/12 20:35:26 Modified:ModPerl-Registry/t TEST.PL Log: - enable testing with the live sources, and not blib Revision ChangesPath 1.3 +1 -0 modperl-2.0/ModPerl-Registry/t/TEST.PL Index: TEST.PL === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/TEST.PL,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TEST.PL 2001/10/19 02:40:41 1.2 +++ TEST.PL 2001/11/13 04:35:26 1.3 @@ -3,6 +3,7 @@ use strict; use warnings FATAL = 'all'; +use lib ../lib; # test against the source lib for easier dev use lib map {(../blib/$_, ../../blib/$_)} qw(lib arch); use Apache::TestRunPerl ();
cvs commit: modperl-2.0/todo missing_old_features.txt
stas01/11/12 20:37:55 Modified:todo missing_old_features.txt Log: - all these are implemented now: Apache::PerlRun, Apache::{Registry, RegistryNG}, Apache::RegistryLoader Revision ChangesPath 1.13 +0 -2 modperl-2.0/todo/missing_old_features.txt Index: missing_old_features.txt === RCS file: /home/cvs/modperl-2.0/todo/missing_old_features.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- missing_old_features.txt 2001/10/09 00:14:10 1.12 +++ missing_old_features.txt 2001/11/13 04:37:55 1.13 @@ -49,8 +49,6 @@ - mod_perl.pm::import -- Apache::PerlRun, Apache::{Registry, RegistryNG}, Apache::RegistryLoader - - Apache::Status - Apache::test: tobe a compat stub around new test framework