Re: Apache::DBI on mp2
Ask Bjoern Hansen wrote: On Fri, 7 Mar 2003, Stas Bekman wrote: If the physical connection is still there, would the database server do a rollback? If earlier the rollback worked correctly with $dbh ||= connect();, this will work the same, since it performs the same operation, but rips off only parts of $dbh, because of the constraints of sharing Perl datastructures and underlying C structs. Apache::DBI explicitly calls $dbh-rollback (when things are configured so it makes sense). Or maybe I am completely misunderstanding you. All I was saying is, that whatever worked for Apache::DBI will work for internal pooling. ps. yes, your DBI::Pool work is great. Thank you. :-) My pleasure. Thanks for the kind words. It's quite challenging, though you stop getting excited about segfaults and ddd (gdb frontend) is nowadays my best friend ;) :-) You are quite the masochist if you ever got excited about segfaults. I only recall segfaults making me slam my head into the wall to conceal the pain. I meant in the way that when something is repeated too many times it's not the same anymore ;) so s/excited/annoyed/ will do ;) __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: DECLINE, ERRORs in the middle of hanlers stack
Ruslan U. Zakirov wrote: Hello All! Stacked handlers is a very useful technology, but as I think incomplete. I need some suggestions. My project split content handler in the few parts. And each handler send part of the requested page to user, but sometimes I must stop proccessing and return DECLINE, redirect user or return some ERROR. Error appear in the middle of the page. I want Apache to buffer content and send it after last handler in chain return OK. Is it possible? Sure, you can buffer the data using $r-notes or $r-pnotes and have the last handler send it out. But instead of stuffing the content there, you are probably better off (more efficient?) to create a buffering class, instantiate an instance, and store it in $r-pnotes between invocations. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] What happened to $r-connection-remote_addr?
Rob Brown wrote: I'm getting complaints about Apache::DNAT not working with Apache 2 because mod_perl 1.99 suddenly can't handle the things it used to. I'm getting this spewage: [Fri Mar 07 11:22:21 2003] [error] [client 166.70.29.72] Can't locate object method connection via package Apache::RequestRec at /usr/lib/perl5/site_perl/5.8.0/Apache/DNAT.pm line 8. Here is the offending code: my $c = $r-connection; # line 8 my $old_remote_addr = $c-remote_addr; my ($old_port, $old_addr) = sockaddr_in($old_remote_addr); $old_addr = inet_ntoa $old_addr; # munge and compute $new_port and $new_addr . $c-remote_addr(scalar sockaddr_in($new_port, inet_aton($new_addr))); $c-remote_ip($new_addr); This all used to work just fine under mod_perl 1.27 but now fails miserably. I tried using Apache::compat also. This seemed to pick up the $r-connection slightly better. But $c-remote_addr is really wacked. Now it crashes with this spewage: [Fri Mar 07 12:20:32 2003] [error] [client 166.70.29.72] Bad arg length for Socket::unpack_sockaddr_in, length is 31, should be 16 at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/Socket.pm line 370. I did a Data::Dumper on it and it's a ref??!! $old_remote_addr = bless( do{\(my $o = 135384736)}, 'APR::SockAddr' ); How am I supposed to pull the port and addr out of that nasty beast? $c-ip_get or $c-addr ? NOPE! [Fri Mar 07 12:22:12 2003] [error] [client 166.70.29.72] Can't locate object method ip_get via package APR::SockAddr at /usr/lib/perl5/site_perl/5.8.0/Apache/DNAT.pm line 13. [Fri Mar 07 12:24:58 2003] [error] [client 166.70.29.72] Can't locate object method addr via package APR::SockAddr at /usr/lib/perl5/site_perl/5.8.0/Apache/DNAT.pm line 13. I've tried searching all the documentation for clues, but I must be looking in the wrong place. I've even tried dereferencing the SCALAR ref and sending that through sockaddr_in or inet_ntoa, but that totally doesn't work either. I'm running out of possibilities to try. Also, once I GET the connection information, I need to be able to SET it again to spoof the request into thinking the request is coming from the more correct peer instead of what the actual socket reports. This should be reflected in the logs and in the environment REMOTE_ADDR and REMOTE_PORT for mod_cgi running CGI scripts. $r-SET_remote_addr($new_remote_addr); # ?? I just need to port my module from mp1 to mp2. Any ideas would be appreciated. -- Rob DETAILS: Apache::DNAT is freely available from CPAN: http://search.cpan.org/src/BBB/Net-DNAT-0.10/lib/Apache/DNAT.pm $ uname -a Linux box 2.4.18-14 #1 Wed Sep 4 12:13:11 EDT 2002 i686 athlon i386 GNU/Linux I'm using the mod_perl rpm that comes stock with RedHat 8.0 linux: mod_perl-1.99_05-3 1.99_05 is one 7 months old. Please test it again with the released 1.99_08 or even better with the current cvs: http://perl.apache.org/download/source.html#2_0_Development_Source_Distribution As for missing methods reports, see: http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html e.g. you need to load 'Apache::Connection' to get remote_addr Also, in the future please add some new lines in your reports, it's extremely hard to parse when everything is piled in one para. Thanks. I'm using the apache 2.0 rpm that comes stock with RedHat 8.0 linux: httpd-2.0.40-11 I'm using the perl 5.8.0 rpm that comes stock with RedHat 8.0 linux: perl-5.8.0-55 -- __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] $r-document root(/my/hacked/path);
Rob Brown wrote: I need to be able to at least temporarily change the document_root on the fly. Something like the following: $r-document_root(/my/hacked/path); But it crashes with a prototype mismatch. The docs say: $r-document_root:cannot currently be modified. requires locking since it is part ofthe per-server config structure which is shared between threads its in todo/api.txt: $r-document_root: cannot currently be modified. requires locking since it is part of the per-server config structure which is shared between threads Well, I could care less about actually modifying the server record. Isn't there a way to point it to a temporary string just for the request? In Apache1, it worked fine to copy the entire server record into a malloc and hack the document_root setting in the copy and point the server record pointer there just for the request. Then free this temporary server record. Or in mod_perl, just set the document_root to the real path just long enough for the Translation phase and then fix it back to the original value in the Cleanup phase. What do you recommend in order to accomplish this under mod_perl 1.99 for Apache 2.0? It needs to be implemented. Patches are welcome. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
[mp2] automatic Apache::compat preloading in CPAN modules is a no-no
Apache::compat is useful during the mp1 code porting. Though remember that it's implemented in pure Perl. In certain cases it overrides mp2 methods, because their API is very different and doesn't map 1:1 to mp1. So if anything, not under my control, loads Apache::compat my code is forced to use the potentially slower method. Which is quite bad. Some users may choose to keep using Apache::compat in production and it may perform just fine. Other users will choose not to use that module. It should be users' choice. Therefore CPAN modules should *not* preload Apache::compat, but use the mp2 API or copy the relevant parts from Apache::compat. Of course one can add an ugly workaround in startup.pl: $INC{'Apache/compat.pm'} = __FILE__; but I'd rather not have to remember doing that. I'll update the manpage to have this warning. I haven't scanned the CPAN modules yet, but I've noticed that CGI.pm's latest version does: require mod_perl; if ($mod_perl::VERSION = 1.99) { eval require Apache::compat; } else { eval require Apache; } Lincoln, any chance we can kill that preloading? If you need help with porting the API please let us know. Thanks. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] integration with apache threads
I'm solving following problem: generally may happen, that somebody has an instance of XML::Sablotron (and of few more packages) allocated in the interperter at the time, the perl is cloned. Sablotron objects are just wrappers around internal c++ structures, and the only data, they keep, are handles. Some of internal objects are thread safe and may be shared, some must be instantiated per thread. Any Perl data will be copied for you. Things at the C++ level will have to be taken care of by you. There may be a hook that you can use to do some work whenever a new interpreter is cloned. I already introduced threadsafe refcounting for all wrapped internals (bot of safe and unsafe) to prevent crashing in destructors (while disposing internal structure from several cloned instances), but currently I do need understand all scenarios, which may happen when handling non-thread safe internals. I need rather to write a documenation, about what the user is allowed, then develop a different model. In other words: I can keep all object happy when cloned to another threads due the refcounting, but I (user) must grant, that non-threadsafe instances are used across different threads. My original question was aimed right to this point: whether is such a situation even possible. It seems, it is. It it clear? have you got some more comments for me? There's no chance that the same Perl object will be used in multiple threads, but obviously multiple Perl objects could end up pointing to the same C++ data. Since cloned Perl interpreters will all point to the same non-perl datastructures, you must make the access to them thread-safe. Since you have already figured out the issue with DESTROY (must have had lots of segfaults before you did ;) you are all set. I've done something very similar in DBI::Pool prototype, where all access to the shared between threads C struct are mutex locked when accessed. http://archive.develooper.com/[EMAIL PROTECTED]/msg02134.html Notice that you it should be possible to do the locking from perl (using the threads.pm package, however if you read my bug report it has problems when a thread that didn't load the package tries to access the ithreads env. http://archive.develooper.com/[EMAIL PROTECTED]/msg00649.html I'd suggest asking how others are handling making their XS libraries safe across clone calls in a place like comp.lang.perl.misc where more XS wizards tend to hang out. There are some here too though. Anyone have a better answer for Pavel about how to deal with this? probably you are better off at the [EMAIL PROTECTED] and [EMAIL PROTECTED] lists (however the latter is for ithreads issues). __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] apache/mod_perl starup failure using cvs 09
Beau E. Cox wrote: Yea, Stas, I clearly see your reasoning. However, this is not a change of behaviour between mp1 and mp2, but rather between mp2-08 and the current cvs (09). since 09 08, it *is* a change in behaviour between mp1 and mp2 ;) though potentially not the final one. I will continue using mp2-08 and talk to the mason meanwhile you can continue using the lates cvs, but add to the beginning of your startup to cheat on the latest change: require Apache::RequestUtil; no warnings 'redefine'; my $sub = *Apache::request{CODE}; *Apache::request = sub { my $r; eval { $r = $sub-('Apache'); }; # warn $@ if $@; return $r; }; list - but it seems that folks over there are not too anxious to do much in the line of mp2 development until the 'request' is converted. You mean Apache::Request? My only concern is that mp2 and mason will eventually work well together - I feel a little like I am caught in the middle ;) if you don't mind to get frustrated here and there, that's the best position to learn things ;) Please don't spend any more time on this until I get a mason answer. ;) __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::DBI on mp2
Ask Bjoern Hansen wrote: On Wed, 5 Mar 2003, Stas Bekman wrote: Great. I've already committed that patch. Perhaps Ask could load 'Apache::compat' inside Apache::DBI if mp2 is used. Or to use the mp2 API if mp2 is used. That seems like it'll be an easy solution. I thought loading Apache::compat would have global side effects though? (i.e. for people trying to make their system run without Apache::compat). Please scratch that idea than ;) Though it can be documented, including the Apache::compat warning ;) And instead simply add the code to handle it differently if $mod_perl::VERSION = 1.99, using the 2.0 API. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Reading an array from perl script
Devi .M wrote: Hello All, I have a perl script that would be running infinitely and updating an array by processing some data. Now I would like to read the array values that should not disturb this perl script. I thought to use the concept of shared variable and write a method in perl module which contains the array sharring with the infinitely running perl script and return me the updated array values. But don't know how to proceed with this. Could anyone help me out? I'm assuming that you need to connect to it from mod_perl, otherwise this question is quite offtopic here ;) As suggested by Mark, IPC::Shareable might work if the data set is small. If it's big you can use a simple dbm to store the data in and with proper locking read/write to/from it without disturbing each other. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] CGI redirects incorrectly handled?
Mark James wrote: I'm having CGI redirect problems mp2 (cvs). Instead of being redirected to the proper web page, I'm sometimes getting a 302 Moved page containing a link to the correct URL. Seems to be related to the following code in modperl_cgi.c: if (location (location[0] == '/') (r-status == 200)) { r-method = apr_pstrdup(r-pool, GET); r-method_number = M_GET; The Location field I'm redirecting to is a fully-qualified URL, starting with http://, but still at the local server. A debug put in above this code confirms that location is set to a string starting with http. Why is the test for location[0] == '/' there? Which section of code is usually responsible for stripping off the server part of the address if it is local? as the comment just above this line says, that code was copy-n-pasted from mod_cgi. Can you reproduce the same problem while running a cgi script? Also could it be that it has to do with the recent change, I've applied which was already reported by Beau as broken. May be your headers don't get parsed What happens if you do: Index: src/modules/perl/modperl_filter.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.54 diff -u -r1.54 modperl_filter.c --- src/modules/perl/modperl_filter.c 3 Mar 2003 03:39:06 - 1.54 +++ src/modules/perl/modperl_filter.c 5 Mar 2003 23:15:44 - @@ -55,7 +55,7 @@ apr_bucket *bucket; const char *work_buf = buf; -if (wb-header_parse !wb-r-content_type) { +if (wb-header_parse) { request_rec *r = wb-r; const char *bodytext = NULL; int status; __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Can anyone Rcommend a good Apache mailing list
Martin Moss wrote: All, I'm having issues with conflicts between using Port and Listen directives for access via LAN and ssh tunnel (or proxy). Can anyone recommend a mailing list I can post my problem to? http://httpd.apache.org/lists.html#http-users __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: register_cleanup on mod_perl 2.0
Denis Banovic wrote: Hi! I've a script that looks like this: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } Under mod_perl 1.0 works fine with Apache::Registry. Can someone give me an Example how to make a register_cleanup with mod_perl 2? A copy-n-paste from Apache/compat.pm: sub register_cleanup { shift-pool-cleanup_register(@_); } if you use Apache::compat, your mp1 code will work under mp2 unmodified. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Tracing double accesshandler invocation
Nick Tonkin wrote: On Wed, 5 Mar 2003, Richard Clarke wrote: Hi, I'm trying to figure out why my accesshandler is getting triggered twice for each request that I make. I'm 100% sure that I'm doing no explicit lookups/redirects anywhere in my code. The particular uri I am fetching should only invocate an accesshandler followed by a contenthandler. After watching the request with MOD_PERL_TRACE=h and MOD_PERL_TRACE=all I think I'm still non the wiser. Testing for $r-is_initial_req solves the problem but I'm more interested in finding out exactly why it's being called twice. Any tips for tracing this easier? Nope, but FWIW I see the same behavior. I'm using mp2, but IIRC the same thing used to happen on mp1 too. I too would very much like to figure this out. I sort of suspect it is in how the httpd.conf auth* directives are specified, but I've never had the time to really muck around with them. If you provide me a simple mp2 setup where this happens, I can debug it. However if I run with mp2: t/TEST -v hooks/access and log from TestHooks/access.pm every time an access handler is called, I can see it called only once per request. So may be play with this test's config until you break it. if you succeed to break it, that would be the easiest for me to reproduce your problem. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: register_cleanup on mod_perl 2.0
Stas Bekman wrote: Denis Banovic wrote: Hi! I've a script that looks like this: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } Under mod_perl 1.0 works fine with Apache::Registry. Can someone give me an Example how to make a register_cleanup with mod_perl 2? A copy-n-paste from Apache/compat.pm: sub register_cleanup { shift-pool-cleanup_register(@_); } if you use Apache::compat, your mp1 code will work under mp2 unmodified. And it is documented here: http://perl.apache.org/docs/2.0/user/compat/compat.html#C__r_E_gt_register_cleanup_ http://perl.apache.org/docs/2.0/user/compat/compat.html#C__s_E_gt_register_cleanup_ In the future please refer to the docs first, before asking on the list. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::DBI on mp2
Perrin Harkins wrote: Stas Bekman wrote: FWIW, we are discussing the internal DBI pooling mechanism at the dbi-dev list and having already a sort-of-working prototype. So hopefully there will be no need for Apache::DBI in the near future, as DBI will be able to handle pooling internally. However it may take some time, as the drivers will have to adjust to support the new functionality. You can see the thread here: http://archive.develooper.com/[EMAIL PROTECTED]/index.html#02118 Some working examples are attached to this message: http://archive.develooper.com/[EMAIL PROTECTED]/msg02134.html This is totally cool, Stas! Nice work. I look forward to answering yes when people ask if mod_perl has database connections pooling. ;) actually it's going to be: if perl has database connections pooling, which will include mod_perl by definition. Also, the pooling mechanism should work transparently w/ and w/o threads on the user level. By the way, to completely get rid of Apache::DBI this would need to cover the safety functionality in there as well, i.e. the pinging and the part where it rolls back any pending transactions when a a handle is returned to the pool. Certainly. Quite a few features are missing. The first step was (is) to make the dbh shared between threads (which is far from trivial). The rest should be just a matter of coding. re: rollback, the DBD drivers will perform the normal disconnect(), but without doing the physical disconnect, and normal DESTROY, without destroying the datastructures which maintain the physical connection, so there shouldn't be much to change for this feature. Only the ping() is needed to be added to connect(). __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] CGI redirects incorrectly handled?
Mark James wrote: Stas Bekman wrote: Mark James wrote: I'm having CGI redirect problems mp2 (cvs). as the comment just above this line says, that code was copy-n-pasted from mod_cgi. Can you reproduce the same problem while running a cgi script? No, them problem only manifests under mod_perl (2, haven't used 1). Sorry, I'm not following your comment. I've suggested to test with mod_cgi (under Apache2), since mod_perl mimics mod_cgi's behavior here. Also could it be that it has to do with the recent change, I've applied which was already reported by Beau as broken. May be your headers don't get parsed What happens if you do: [patch] Applied the patch, but the problem still occurred. No change also when I commented out the location[0]=='/' test. The redirect header being printed by my perl script is: Server: Apache/2.0.44 (Unix) mod_perl/1.99_09-dev Perl/v5.8.0 Status: 302 Moved Date: Thu, 06 Mar 2003 01:10:54 GMT Location: http://makethecase.net/db?auth=ckffb2a5c44ee0editCmds=compactfile=62 Which is returned as a 302 link page. This is a redirect response to a POST. Strangely, another redirect, with header: Server: Apache/2.0.44 (Unix) mod_perl/1.99_09-dev Perl/v5.8.0 Status: 302 Moved Date: Thu, 06 Mar 2003 01:15:54 GMT Location: http://makethecase.net/db?_reason=6%20Case1Pro_restart=editPartcheckSequenceNumber=60cmd=authenticateeditCmds=compactfile=62partnum= works just fine. This is a redirect after a GET. Should POST-redirect return 307? http://ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html http://rfc.net/rfc2616.html#s10.3.8 __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Env::C threads env flashback
When I've suggested to use Env::C::getenv to debug the problem with env vars, and Mark decided to use Env::C::setenv to solve it, I've forgotten to warn you that you shouldn't be using this workaround in the threaded env. If you could, modperl would have been doing the right thing in first place. I've added the following section to Env::C doc and will upload the new version (with only the doc change on CPAN shortly). --- =head1 Thread-safety and Thread-locality This module should not be used in the threaded enviroment. Thread-locality: the OS, which maintains the struct Cenviron, shares it between all threads in the process. So if you modify it in one thread, all other threads will see the new value. Something that will most likely break the code. This module is not thread-safe, since two threads may attempt to modify/read the struct Cenviron at the same time. I could add locking if in threaded-environment. However since the lock can't be seen by other applications, they can still bypass it causing race condition. But since thread-locality is not maintained, making this module thread-safe is useless. If you need to modify the C level of C%ENV for all threads to see, do that before threads are started. (e.g. for mod_perl 2.0, at the server startup). --- Also see: http://perl.apache.org/docs/2.0/user/coding/coding.html#Thread_environment_Issues __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::DBI on mp2
Haroon Rafique wrote: On Today at 11:16am, SB=Stas Bekman [EMAIL PROTECTED] wrote: SB FWIW, we are discussing the internal DBI pooling mechanism at the SB dbi-dev list and having already a sort-of-working prototype. So SB hopefully there will be no need for Apache::DBI in the near future, as SB DBI will be able to handle pooling internally. However it may take SB some time, as the drivers will have to adjust to support the new SB functionality. SB SB You can see the thread here: SB http://archive.develooper.com/[EMAIL PROTECTED]/index.html#02118 SB SB Some working examples are attached to this message: SB http://archive.develooper.com/[EMAIL PROTECTED]/msg02134.html SB Stas, Thanks for your response. I will try and keep up with the developments in the above-mentioned threads. However, for now, I'll focus on your alternate solution as mentioned below. If I find some free time (what are the chances?) I may also give DBI::Pool a try under mp2. I've already tried it and it works ;) However DBI::Pool won't have a life on its own and will be integrated into DBI itself and its DBD drivers. SB [..snip..] SB SB If you apply the following patch (will commit it soon) against the modperl-2.0 SB source, you will be able to use connect_on_init unmodified, assuming that SB Apache::compat was loaded before Apache::DBI. Let me know whether it works for SB you. SB I'm happy to report that the patch to lib/Apache/compat.pm works. I did not even have to use CVS versions of any of the packages. Apache/2.0.44 (Gentoo/Linux) mod_perl/1.99_08 Perl/v5.8.0 I simply patched: /usr/lib/perl5/vendor_perl/5.8.0/i686-linux/Apache2/Apache/compat.pm with your patch and connect_on_init works unmodified. And as mentioned in your email, I do have Apache::compat loaded before Apache::DBI. Great. I've already committed that patch. Perhaps Ask could load 'Apache::compat' inside Apache::DBI if mp2 is used. Or to use the mp2 API if mp2 is used. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Trouble with sysread in modperl
Liu, Hui (GXS) wrote: There appears to be a bug with the read and sysread functions when being used in a loop to read STDIN. We're using a loop to read from STDIN in 4k blocks, and the read or sysread appears to work great until the very last read to pick up the final partial block. Here is the code: $readSize = min($bytesLeft, $blockReadSize); $bufferLength = length($buffer); $bytesRead = sysread(STDIN, $dataRead, $readSize); html(bytesRead=[$bytesRead . $bufferLength . $dataRead]) if ($debug); if (!(defined $bytesRead)) { $bytesRead = 0; } $buffer .= $dataRead; In the last loop, the values that are returned in the debug statement are: 674 . 3268 . So sysread says that 674 bytes were read, however $dataRead is empty. Both read and sysread exhibit the same behavior, returning the right number of bytes to be read, but not populating the variable with the actual data. This code works fine in versions of Perl other than Apache modperl. Has anyone experienced this behavior and have any suggestions? Could it be the buffering issue as described in the manpage? perldoc -f sysread: sysread FILEHANDLE,SCALAR,LENGTH,OFFSET sysread FILEHANDLE,SCALAR,LENGTH Attempts to read LENGTH characters of data into variable SCALAR from the specified FILEHANDLE, using the system call read(2). It bypasses buffered IO, so mixing this with other kinds of reads, print, write, seek, tell, or eof can cause confusion because stdio usually buffers data. Returns the num- ber of characters actually read, 0 at end of file, or undef if there was an error. SCALAR will be grown or shrunk so that the last byte actually read is the last byte of the scalar after the read. [...] can you try whether you get all the data, by reading via STDIN (even though you have no control over chunks size) __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: SubRequest weirdness
[moving this back to the users list] Jon Salz wrote: Sorry, I'm not sure if I've found a mod_perl bug or if I'm just doing something wrong. Any idea why the following behavior happens?: test1.pl is use Apache::SubRequest; Apache-request-lookup_uri(test2.pl)-run; test2.pl is print Content-type: text/html\nSet-Cookie: foo=bar\n\nHello world!; test2.pl works fine by itself, but when I run test1.pl, the server output is HTTP/1.1 200 OK Date: Mon, 03 Mar 2003 06:48:59 GMT Server: Apache/2.0.44 (Unix) mod_perl/1.99_08 Perl/v5.8.0 DAV/2 Connection: close Content-Type: text/plain; charset=ISO-8859-1 Hello world! i.e., the Content-Type and Set-Cookie in test2.pl get ignored but the content goes through just fine. Any idea what I'm doing wrong? This doesn't seem to work with mp1 as well. So I doubt it's a bug in mp2. in mp1 test.pl doesn't send headers at all: telnet localhost 8000 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. GET /perl/callsubreq.pl HTTP/1.0 Hello world!Connection closed by foreign host. The eagle book says that the headers should be forwarded, but they aren't. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] Latest mod_perl funny test results
Beau E. Cox wrote: Hi - I just upgraded to Apache 2.0.44 (source) and mod_perl-1.99-09-dev (CVS source) on my SuSE 8.1 test server. All test scripts completed OK. I am omitting the details of my configuration - will supply them if anyone thinks this problem is related to them. As I have with prior installations, I am tip-toeing through the tests until my server is completely up to date (+mason, +mod_ssl, +lots of vhosts, etc.). To start, I set my httpd.conf as per the mod_perl docs: LoadModule perl_module /srv/www/modules/mod_perl.so PerlRequire /srv/www/conf/startup.pl Alias /perl/ /srv/www/perl/ Location /perl/ SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location And wrote the test script in /srv/www/perl/rocks.html (with the proper permissions/ownership): #!/usr/bin/perl print Content-type: text/html\n\n; print h3mod_perl 2.0 rocks!/h3\n; Browsing to localhost/perl/rocks.html gives: Content-type: text/html mod_perl 2.0 rocks! (with the second line emboldened to h3). The view-source shows: Content-type: text/html h3mod_perl 2.0 rocks!/h3 Question: why isn't my 'Content-type' line output as a HTTP header? Good catch, Beau. I broke the header parsing in one of the recent commits. Apparently relying on content_type not being set before the response handler was a bad bet. the default mime handler probably sets it since the file is called .html, whereas all our registry tests are .pl, which the mime handler doesn't know what to do with and therefore sets no content_type() do they weren't catching the problem. I'll fix that in a few days, since what I was trying to do is to solve some other more complicated problems. So it requires a good thinking how to solve them in a different way. So please bear with me. I want to finish first the update of the filters tutorial, and then will be back to fixing things. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] apache/mod_perl starup failure using cvs 09
Beau E. Cox wrote: -8-- Start Bug Report 8-- 1. Problem Description: Sorry - is this mason's problem? Apache does not start using latest mod_perl2 (cvs) when using a mason startup script. Failure matrix: mod_perl version mason version using startup.pl using simple-mason.pl OK? -- 08-source 1.16 yes yes OK 08-source 1.19 yes yes OK 09-cvs 1.19 yes yes FAIL 09-cvs 1.16 yes yes FAIL 09-cvs 1.19 no-in httpd no mason OK 09-cvs 1.19 no-in httpd no-in httpd OK Apache startup console output: [Tue Mar 04 16:45:09 2003] [error] Global $r object is not available. Set: PerlOptions +GlobalRequest in httpd.conf at /usr/lib/perl5/site_perl/5.8.0/HTML/Mason/ApacheHandler.pm line 573. Compilation failed in require at (eval 3) line 1. [...] HTML::Mason::ApacheHandler revelant lines: my $allowed_params = $class-allowed_params(%defaults, %params); 573: if ( exists $allowed_params-{comp_root} and my $req = $r || Apache-request ) # DocumentRoot is only available why does Mason needs $r at the server startup? There is no request object at the server startup, so it's only fair that mp reports the error. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] apache/mod_perl starup failure using cvs 09
[...] why does Mason needs $r at the server startup? There is no request object at the server startup, so it's only fair that mp reports the error. [...] Good point. However, I seemed to have given you the code of mason's ApacheHandler out of context; the snip above is from the 'new' method which I use in setting up the mason handler routine: # Create ApacheHandler object at startup. my $ah = HTML::Mason::ApacheHandler-new ( args_method = CGI, comp_root = /srv/www/htdocs, data_dir= /srv/www/mason, error_mode = 'output', ); In this trivial case it doesn't seem worthwhile to go to all that trouble, but, as in my production server, when working with a lot of (possible dynamic) vhosts, it works well. If the Apache-request (or a request passed as the last - odd - parameter to new) is defined, some further processing occurs; but at startup, the request is neither expected to be there nor needed. I guess (looking at my result matrix) that some change was made to mod_perl to prohibit even querying the presence of Apache-request at startup. So now I (and other mason folks) must find another way to instantiate handlers. Would you have and suggestions from the mod_perl perspective? I will take this query over to mason if you feel that is where it belongs - but I'll need some further insight into the mod_perl changes. I see what you mean. In mp1 you relied on Apache-request's not being defined as a side-effect to test whether you are inside request or not. I will explain why I've chosen to croak, rather than return 'undef'. In mp1 Apache-request was either undef (outside of request) or $r (during the request). You couldn't control that. In mp2 in order to optimize things, keeping the global request around is optional. So if you don't need it you get some speed improvement. So if the user has the global request setting off and Apache-request returns undef, he may think that he is not inside the request phases (precisely what mason does), which is wrong. Therefore if you still wish to rely on this (which is no longer always valid under mp2), you can do: eval { $r = Apache-request} to trap the croak. may be you should use something else as a predicate to calling Apache-request. For example you could use: ModPerl::Util::current_callback() to figure out where you are. Though it'll incur a checking of several options. So perhaps we need a new method or may be not. Ideas are welcome. Philippe has agreed with my reasoning when I've suggested the change and nobody else has objected (or had any opinion at all), so it went in. Since nothing is cast is stone (yet) on the mp2 API, you may suggest your explanation why it should behave differently if you think that my idea is wrong. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Problem with mod_perl and subroutines in multiple files.
Benjamin Grabkowitz wrote: I am a new Perl developer and just found out about the great benefits of mod_perl. I see that you try to work with mod_perl 2.0. So here is a bit of advice: mod_perl 2.0 (1.99_0x) while getting better every day, still has quite a few bugs, so you may want to start with the stable mod_perl 1.0 (1.27) instead and then move on to 2.0 when the time comes. If you do want to stick with mp2, (and we do want people to start using it to expose the bugs as early as possible), please make sure to use the latest cvs version, since what you use is a way too old and lots of bugs were fixed since 1.99_05. See: http://perl.apache.org/download/source.html#mod_perl_2_0 Finally regarding your original question, you probably need to read this: http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modules_and_libs and may be spend some time around http://perl.apache.org/docs/1.0/guide/ for your own good ;) I had a Perl cgi script that ran fine. It consisted of 1 main.pl file and multiple subroutines that each had their own file in a directory called libs (it is in the same directory as main.pl). When I got mod_perl properly configured (or to what I thought was properly configured), I got strange errors like: ModPerl::PerlRun: Not a CODE reference at /var/www/cgi-bin/main.pl line 31. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: WEb hosting..
Fco. Valladolid wrote: I'am introductory o newbie user of mod_perl.. so what book or tutorial recommend for me.. Please always reply to the list! Online docs: http://perl.apache.org/docs/index.html Books: http://perl.apache.org/docs/offsite/books.html __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: WEb hosting..
Fco. Valladolid wrote: http://www.upnix.com David Emery wrote: http://www.mediatemple.net please specify where the companies are based, since our list is sorted by country. Thanks. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::DBI on mp2
FWIW, we are discussing the internal DBI pooling mechanism at the dbi-dev list and having already a sort-of-working prototype. So hopefully there will be no need for Apache::DBI in the near future, as DBI will be able to handle pooling internally. However it may take some time, as the drivers will have to adjust to support the new functionality. You can see the thread here: http://archive.develooper.com/[EMAIL PROTECTED]/index.html#02118 Some working examples are attached to this message: http://archive.develooper.com/[EMAIL PROTECTED]/msg02134.html Haroon Rafique wrote: My setup is as follows: Apache/2.0.44 (Gentoo/Linux) mod_perl/1.99_08 Perl/v5.8.0 mod_perl was built from CVS. I was interested in getting Apache::DBI to run under mp2. I did read Ask's message at http://marc.theaimsgroup.com/?l=apache-modperlm=104225578207460w=2 which leads me to my question. What would it take to get connect_on_init to run under mp2? With the following patch I was able to get connect_on_init to work under mp2. Remember that my objective was to JUST get it to run. This is NOT release quality code. I'm happy to report that it works for me, so far. Anyone else who is running mp2 (no compat mode) willing to give it a try? Of course, then the gurus can come in and clean up the code so that it works under either mp1 or mp2. If you apply the following patch (will commit it soon) against the modperl-2.0 source, you will be able to use connect_on_init unmodified, assuming that Apache::compat was loaded before Apache::DBI. Let me know whether it works for you. Index: lib/Apache/compat.pm === RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v retrieving revision 1.81 diff -u -r1.81 compat.pm --- lib/Apache/compat.pm19 Feb 2003 23:55:23 - 1.81 +++ lib/Apache/compat.pm3 Mar 2003 23:49:19 - @@ -125,6 +125,16 @@ die $err if $err; } +sub push_handlers { +shift; +Apache-server-push_handlers(@_); +} + +sub set_handlers { +shift; +Apache-server-set_handlers(@_); +} + package Apache::Constants; use Apache::Const (); __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] disabling a perl handler within a specific location
Matt Avitable wrote: Hi list :-) Does anyone know how one goes about disabling a particular handler within a specific location? For example, consider the following: Location / PerlInitHandler config PerlOutputFilterHandler filter /Location LocationMatch /(images|gfx)/ ## what can I put here to say don't run to the above handlers? /Location ## OR Files ~ \.(jpg|jpe?g|gif|png)$ ## something here... /Files For all HTTP requests for files everywhere excluding directories with /images/ and /gfx/ in it, I want to run my PerlInitHandler and my PerlOutputFilterHandler. All my handlers do is set up some config variables and run an xml filter. It's useless overhead to run these handlers on images. This is not really a mp2 specific question I believe, unless I'm missing something. You have to do the same in mp1. I guess there might be a way to do that, but the simplest idiomatic modperl approach is to make the decisions once you are inside the Init handler. Location / PerlInitHandler Foo::handler /Location package Foo; # load the modules/constants here sub handler { my $r = shift; return Apache::DECLINED if $r-uri =~ /(?:jpe?g|gif|png)$/; $r-push_handlers(PerlOutputFilterHandler = \filter_handler); return Apache::OK; } 1; p.s. I've optimized your /jpg|jpe?g/ regex ;) Also you may need this :) http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache dies when configure mod_perl for use with Apache::DBI
Feite Brekeveld wrote: Richard Clarke wrote: PerlModule Apache::DBI;-- trouble line This line belongs in your httpd.conf file. PerlModule is an apache configuration directive, not a perl 'command'. http://perl.apache.org/docs/1.0/guide/config.html#PerlModule_and_PerlRequire _Directives Ric. Sorry about the typo, but I've tried it with the 'use' also. The 'startup.pl' that is in the link above to which you refer gives the same result too. make sure that you are using the latest DBI and Apache::DBI __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: WEb hosting..
Thank you! I've committed the isps you have submitted so far. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Help needed to set up Apache, PERL, PHP and MySQL
Mo Elwaisi wrote: Hi I have been tryin to set the following on a Linux machine for the last few months, but i have been having problem, especialy with PERL and Apache 2. I have been advised to use Apache 1.3.27!. i have formated the system and installed Red Hat 8 once again but this time i did not include any packages with the install except MySQL. Anyone could please spend a little bit of time with helping me in order for me to perform this right. as i am really becoming frustrusted with all the problems i have had!!! If you were a bit more specific about your problems you could already be on the way to having them resolved. The modperl list is not a help-desk service, but a volunteer effort. Therefore you don't ask someone first if they are willing to listen to your troubles, but you simply go ahead and tell what your troubles are and if someone has the right knowledge and time they will help you. If you have more than one problem, please report them in separate bug reports. To report problems you have to follow these guidelines: mod_perl 1.0: http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems mod_perl 2.0: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems Finally, this reply is not an invitation to email me privately. You must keep all the discussions on the list unless requested otherwise. Oh, and if you are willing to pay, I'm sure that you will be able to find more than one person on that list, that will provide the help-desk-like service for you. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: mp2 runs scripts as root?
Mark James wrote: Stas Bekman wrote: Mark James wrote: Some of my scripts break when running under mp2 (cvs) because the UID is set as root rather than the Apache user (which for me is web). The problem manifests with RCS file locking. Is there some switch to set so that I can run scripts as web? Eh? Are you talking about 'make test' or installed mod_perl? If the former, use the latest cvs where this should work if the latter, modify httpd.conf. The latter. Turned out to be a caused by the perl ENV not being propogated to forked programs: http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html#C_Libraries_Don_t_See_C__ENV__Entries_Set_by_Perl_Code Well, actually this is not the case. It behaves exactly the same as in modperl 1.0. You can use Env::C module (available from CPAN) to easily debug this: The following snippet prints the same under mp1 and mp2 (assuming that they are started under the same username) print map { Perl: $ENV{$_} C: . Env::C::getenv($_) . \n} qw(USER); print $ , scalar getpwuid($), \n; Fixed by adding: $ENV{'USER'} = 'web'; $ENV{'LOGNAME'} = 'web'; to the start-up script. Indeed. The point is that ENV is not passed from shell, you have to explicitly do that and this is an Apache thing. So you can do: SetEnv USER web or as you did, in perl. In any case you probably want to rely on getpwuid($), rather than $ENV{USER} if applicable. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: make errors with mod_perl-1.99_08 on aix 4.3.3
Priest, Darryl - BALTO wrote: I got the new CVS version applied the patch and I got a bit further good, I've committed that patch. , but it's still dying with: cd src/modules/perl make -f Makefile.modperl rm -f mod_perl.so ld -bhalt:4 -bM:SRE -bI:/usr/local/perl5.8.0/lib/5.8.0/aix/CORE/perl.exp -bE:mod_perl.exp -bnoentry -lc -L/usr/local/libmod_perl.lo modperl_interp.lo modperl_tipool.lo modperl_log.lo modperl_config.lo modperl_cmd.lo modperl_options.lo modperl_callback.lo modperl_handler.lo modperl_gtop.lo modperl_util.lo modperl_io.lo modperl_filter.lo modperl_bucket.lo modperl_mgv.lo modperl_pcw.lo modperl_global.lo modperl_env.lo modperl_cgi.lo modperl_perl.lo modperl_perl_global.lo modperl_perl_pp.lo modperl_sys.lo modperl_module.lo modperl_svptr_table.lo modperl_const.lo modperl_constants.lo modperl_hooks.lo modperl_directives.lo modperl_flags.lo modperl_xsinit.lo -bE:/usr/local/perl5.8.0/lib/5.8.0/aix/CORE/perl.exp -brtl -L/usr/local/lib -b32 /usr/local/perl5.8.0/lib/5.8.0/aix/auto/DynaLoader/DynaLoader.a -L/usr/local/perl5.8.0/lib/5.8.0/aix/CORE -lperl -lbind -lnsl -ldl -lld -lm -lc -lcrypt -lbsd -lPW -o mod_perl.so ld: 0706-004 Cannot find or read export file: mod_perl.exp ld:accessx(): A file or directory in the path name does not exist. make: 1254-004 The error code from the last command is 255. To get that far, in the src/modules/perl/Makefile.modperl I added definitions for BASEEXT and PERL_INC, as copied from modperl-2.0/Makefile, as shown below, since they were missing. why would you need them? I mean what was the error that you had to add them? BASEEXT = mod_perl what if you replace it with BASEEXT = modperl In any case, AIX seems to be a special case, and without having an access to it it's hard to debug the problem. So if you can debug what happens in the function write_export_file() in lib/ModPerl/WrapXS.pm (where the exp files are generated) and either it's a problem of the exp file not being generated or just not being found. Apparently, the exp files are needed only for AIX. Though currently generated for all, and I can see only these: ./xs/apache_global.exp ./xs/apache_inline.exp ./xs/apache_ithreads.exp ./xs/modperl_global.exp ./xs/modperl_inline.exp ./xs/modperl_ithreads.exp what if you create an empty mod_perl.exp in src/modules/perl? PERL_INC = /usr/local/perl5.8.0/lib/5.8.0/aix/CORE Thanks. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: register_cleanup
Denis Banovic wrote: Hi! I'm trying to migrate some stuff from mod_perl 1. I've read the tutorial on perl.apache.org but it didn't help. I've a perl script that looks like this: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } Under mod_perl 1.0 works fine with Apache::Registry. But I can't find out how to port this to mod_perl 2. I've tried to use Apache::compat(); but then I got another error from an Module we are using to cache the script's output: ModPerl::Registry: anonymous handlers not (yet) supported at... It's not an error in your code, anon callbacks aren't implemented yet. $self-{r}-push_handlers(PerlHandler = sub {$self-DESTROY}); that should be PerlCleanupHandler, btw. even though it doesn't work yet. 1) How to do a register_cleanup with mod_perl 2.0 ? If you are asking about requests cleanup it's one of these: sub my_cleanup {...} $r-pool-cleanup_register(\my_cleanup); $r-pool-cleanup_register('my_cleanup'); $r-pool-cleanup_register(sub {...}); # anon subs do work here! $r-push_handlers(PerlCleanupHandler = \my_cleanup); $r-push_handlers(PerlCleanupHandler = 'my_cleanup'); Also, your original 1.x code: if ($runnung_on_mod_perl) { Apache-request-register_cleanup(\init_globals); } should work unmodified, under Apache::compat. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: mp2 runs scripts as root?
Mark James wrote: Some of my scripts break when running under mp2 (cvs) because the UID is set as root rather than the Apache user (which for me is web). The problem manifests with RCS file locking. Is there some switch to set so that I can run scripts as web? Eh? Are you talking about 'make test' or installed mod_perl? If the former, use the latest cvs where this should work if the latter, modify httpd.conf. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp1] Help with Apache::MP3
Wilcox, Curtis wrote: I've resolved this problem, at least to a degree which satisfies me. I built apache-1.3.27 and mod_perl-1.27 together following the INSTALL.simple instructions from the mod_perl source but adding EVERYTHING=1 when running Makefile.PL. This makes Apache::MP3 work on a Red Hat 7.3 system with perl 5.8.0 added and also on Red Hat 8.0 (which has perl 5.8.0 included) but only if mod_perl-1.99 was *not* a selected package. On an 8.0 system with mod_perl-1.99 present, /usr/local/apache/bin/apachectl configtest still causes a segmentation fault. If you have a problem with mp2, you have to try the latest stable version or even the cvs version, since many bugs were fixed since the version bundled with RH8.0. If the bugs is still there, please do a complete bug report following the guidelines: http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Approaches to upgrading Apache but not mod_perl
Carlos Ramirez wrote: I've been using apache/mod_perl for some time now and have upgraded apache many times with mod_perl. In most cases I've only had to upgrade the web server only but since I use mod_perl I also compile mod_perl statically. Now my question is: What's the correct or best approach of compiling mod_perl into Apache without acutally installing mod_perl, since it's already installed? For example, when I want to upgrade to Apache 1.3.26/mod_perl-1.27 to 1.3.27/mod_perl-1.27 I perform the following standard compliation steps: 1. % tar xzvf apache_1.3.27.tar.gz 2. % cd mod_perl-1.xx 3. % perl Makefile.PL APACHE_SRC=../apache_1.3.27/src \ DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 4. % make make install 5. % cd ../apache_1.3.xx 6. % make make install Step 4. executes make install which copies mod_perl into the perl installation location, which seems harmless, but is thie ok? Or is there a way that I can somehow just copy the libperl.a into apache_1.3.27/src/modules/lib/perl ? Although, I've been following these steps for years and it works fine, I've got bitten by the curious bug and would like to know how other approach these types of upgrades. To upgrade Apache you are better off to do the whole installation from scratch. Mainly for binary compatibility reasons. e.g. in the 2.0 world, Apache won't start if you have a modperl module built with a previous Apache version. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Scripts and HTML docs in the same directory (+ modperl newbieexperiences)
Mark James wrote: Stas Bekman wrote: Mark James wrote: 1. In http://perl.apache.org/docs/1.0/guide/getwet.html , use of x.x.x for both the Apache and mod_perl version numbers made me think that the version numbers had to be matched. Maybe y.y.y should be used for one. Please get used to x.x.x meaning any. Otherwise we would need to remember to use z.z.z. for php plugs in and f.f.f. when openssl is added, etc... hope you get the idea. When they're discussed in the same sentence, and when building one requires linking to the installation or source directory of the other, I think a different variable helps. since I've already changed them to be mod_perl-1.xx and apache_1.3.xx there shouldn't be a confusion anymore. 2. In the configuration section of the 2.0 docs (http://perl.apache.org/docs/2.0/user/intro/start_fast.html#toc_Configuration) it neglects to state the need to issue a directive for the mod_perl handler one is going to use, e.g. PerlModule ModPerl::Registry, though it is covered in the configuration docs (including the startup-file option). you mean preloading the module? That's not necessarily in mp2, though advisable for performance reasons. In mp2, you can say: PerlResponseHandler ModPerl::Registry without: PerlModule ModPerl::Registry Well I just commented out use ModPerl::Registry () in my startup script and it still worked. But earlier I had found that adding PerlModule ModPerl::Registry the http.conf was the key to getting rid of the rash of error messages I was getting on server start-up. It must have been a manifestation of some other problem, perhaps with mod_perl-1.99_08 (now using the CVS version to fix a missing OPEN in Apache::RequestRec, and to avoid the failed perlio tests), or with an older CGI.pm (found out late that CGI=2.89 was needed). Bugs get fixed ;) you can also use the syntactic sugar to preload modules, by simply stating at the beginning of your mod_perl configuration 'PerlOptions +Autoload'. See http://perl.apache.org/docs/2.0/user/config/config.html#C_AutoLoad_ or using + before the handler name: PerlResponseHandler +ModPerl::Registry OK, so 2.0 is not like 1.0 where PerlModule acts like use() (http://perl.apache.org/docs/1.0/guide/config.html#PerlModule_and_PerlRequire_Directives), but is more like @INC manipulation; and these handler autoload directives are an alternative to use-ing them in a start-up script. No, it works exactly the same. It's just that in 2.0 you don't have to preload the modules. An attempt to load them will happen when they will be used for the first time. My start-up script is very long because it calls use for just about every package in an extensive package set. I suppose an import function could be created in a master package of package suite that when called require-ed all the associated packages, so that mod_perl can have the entire suite pre-loaded prior to forking through just one line in the start-up script. You can certainly do that. Or you can even preload *all* available mp2 packages :) http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html#preload_all_modules__ Thank you Stas for your prompt help. ;) __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: mod_perl Developer's Cookbook
Gazi, Nasser (London) wrote: A question about mod_perl Developer's Cookbook by Young, Lindner and Kobes: Is this book still relevant and worth buying for mod_perl2 ? (I'm about to dive into web development using Apache/mod_perl and intend to go straight to mp2). Remember that mp2 is mp1++. Most of the things that worked in mp1 will work the same way in mp2. In addition mp2 introduces a whole lot of new things. The majority of examples from the Eagle book and The Cookbook should work out of box with Apache::compat. See: http://perl.apache.org/docs/2.0/user/compat/compat.html Therefore you want to have these two books on your bookshelf. Believe me you won't need to dust them if you do modperl development. Another reason to purchase the book is to support their authors and publishers. If the books don't pay off, don't expect their second editions that should cover modperl 2.0 to come out any time soon, if at all. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Problem headers_out
Geoffrey Young wrote: Udlei Nattis wrote: Hi all Why i have problem? $cookie1 = new CGI::Cookie( -name = 'sessid', -value = $session-id()); $r-headers_out-{'Set-Cookie'} = $cookie1; [snip] Can't locate object method STORE via package APR::Table at /export/eShop/lib/eShop/Web/Shop/index.pm line 30. if i remove $r-headers_out-{'Set-Cookie'} = $cookie1; you need to use APR::Table; in your script. In the future use: http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html#lookup_method__ The reason is explained here: http://perl.apache.org/docs/2.0/user/compat/compat.html#Code_Porting also please remember to mark your subject with mp2 when asking mp2 questions. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: make errors with mod_perl-1.99_08 on aix 4.3.3
Priest, Darryl - BALTO wrote: Thanks for the quick response, additional information as requested is below. Cool, please let me know whether this patch solves the problem (you need to apply the patch: cd modperl-2.0 patch -p0 patch_itself rebuild mod_perl from scratch Index: lib/ModPerl/Code.pm === RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v retrieving revision 1.92 diff -u -r1.92 Code.pm --- lib/ModPerl/Code.pm 8 Feb 2003 04:17:11 - 1.92 +++ lib/ModPerl/Code.pm 28 Feb 2003 00:22:23 - @@ -512,6 +512,7 @@ return unless $flags; for my $flag (split /\s+/, $flags) { +next if /^-/; # skip -foo flags my($name, $val) = split '=', $flag; $val ||= ''; $name =~ s/^-D//; __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: make errors with mod_perl-1.99_08 on aix 4.3.3
Stas Bekman wrote: Priest, Darryl - BALTO wrote: Thanks for the quick response, additional information as requested is below. Cool, please let me know whether this patch solves the problem (you need to apply the patch: cd modperl-2.0 patch -p0 patch_itself rebuild mod_perl from scratch oops, please try this one instead: Index: lib/ModPerl/Code.pm === RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v retrieving revision 1.92 diff -u -r1.92 Code.pm --- lib/ModPerl/Code.pm 8 Feb 2003 04:17:11 - 1.92 +++ lib/ModPerl/Code.pm 28 Feb 2003 00:24:45 - @@ -512,6 +512,7 @@ return unless $flags; for my $flag (split /\s+/, $flags) { +next if $flag =~ /^-/; # skip -foo flags my($name, $val) = split '=', $flag; $val ||= ''; $name =~ s/^-D//; __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: mp2: works with NetBSD? was Re: mp2: anyone got mp2 and apache2.0.44 working on any version of OpenBSD?
Carl Brewer wrote: As no-one seems interested in this after a few weeks, It's not about not being interested, but lacking the access to the system and/or lacking the expertise on these platforms. We really need to have at least one person taking care of problems on each of the less-mainstream platforms. I'm considering NetBSD ... anyone got mod_perl2 and apache2 running nicely on NetBSD 1.6? That's my next-choice O/S for my application, but I don't have a testbed yet to play with. Carl Carl Brewer wrote: Scanning both dev.modperl and here, I've found a couple of mails concerning OpenBSD and mod_perl 2 (1.99_08) with Apache 2.0.44, I've tried a few quick hacks and have been unable to get it working either, with the same error as seen on : http://mathforum.org/epigone/modperl/sponggrunlim/[EMAIL PROTECTED] I'm using perl 5.8.0 on OpenBSD 2.9, but the same error crops up. Has anyone been able to get it to run? (it seems to work well on SunOS 5.8 with the same apache perl versions) Carl -- __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: mp2: works with NetBSD? was Re: mp2: anyone got mp2 and apache2.0.44 working on any version of OpenBSD?
Carl Brewer wrote: Stas Bekman wrote: Carl Brewer wrote: As no-one seems interested in this after a few weeks, It's not about not being interested, but lacking the access to the system and/or lacking the expertise on these platforms. We really need to have at least one person taking care of problems on each of the less-mainstream platforms. Understood, I can make a box available to you if it helps? Unfortunately, the and/or lacking the expertise on these platforms part is valid for me. I've responded in hope that somebody else who has the expertise or is interested in getting one, will followup. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [error] Insecure dependency in unlink while running with -T switchat /usr/lib/perl5/site_perl/5.6.0/Apache/Session/Store/File.pm line 106
Quoting Martin Moss [EMAIL PROTECTED]: just a minor comment regarding untainting techniques. If do /(.*)/ to launder tainted vars as you did in: if ($Directory =~ /^XX_GR_XX(.*)XX_GR_XX$/) you can as well turn the taint mode off. For more info see: http://www.gunther.web66.com/FAQS/taintmode.html#clear_taint __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: WEb hosting..
Fco. Valladolid wrote: Hi. Some know web hosting providers with mod_perl support... http://perl.apache.org/help/isps.html As usual, if you know of ISPs that aren't listed there (or listed, but not providing modperl support any longer), please let us know. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Help: Can't coerce GLOB to string...
Kurt George Gjerde wrote: On Wed, 26 Feb 2003, Stas Bekman wrote: use threads; use threads::shared; why do you need to load threads? Do you plan to spawn your own threads? No, they're not supposed to be there. ### TRANSFORM my $results; eval { $results = $stylesheet-transform($document); ### --- ERROR HERE It's expecting a scalar as an argument, right? could it be that $document is not a scalar? try to print ref($document)? It's expecting an XML::LibXML::Document which is a blessed scalar, yes. And that's what it gets. I've also done some further tests now and all objects ($document, $stylesheet, etc) are identical for ok'ed and failed requests. Also, I've found that not all threads fail on the first request (but most do) and, older requests may fail as well... Then you should probably try to interactively debug it. I've also tried adding the following to httpd.conf: PerlInterpMaxRequests 10 PerlInterpStart 1 PerlInterpMax 1 This would limit the number of threads to 1, right? Well, it doesn't. Multiple threads are still being created. I'll post this to the dev list. No, this is how you control the perl interpreters pool. Threads are controlled by: IfModule worker.c StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 /IfModule There isn't a bugzilla or something for the mp2, is there? No, most bugs are solved as soon as they come in, at least we are trying to and didn't have a need for the bug tracking systems so far. -- __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: subrequest-run() doesn't send HTTP headers
to alter this behavior, use $sub-run(1). Ah, thank's a _lot_, that did it. Now, the only question is: why isn't that documented? Please submit a documentation patch for this. It should be somewhere in http://perl.apache.org/docs/1.0/api/ __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: perl 5.8.0/modperl 1.99/apache2/HPUX 11.00 config problem
Nathan Sweaney wrote: OK, I've installed perl apache 2 fine. Then I try to configure mod_perl 1.99_08, using the command: # perl Makefile.PL MP_AP_PREFIX=/usr/local/apache2 it seems to work fine except for this warning: Reading Makefile.PL args from @ARGV MP_AP_PREFIX = /usr/local/apache2 * WARNING * mod_perl is unlikely to link with your libperl, suggestions: *) Rebuild Perl with Configure -Accflags=+Z ... I suppose, it's because in some cases it works so Doug made it a warning, rather than an assertion. Or may be so mod_perl build can be tested without fixing perl ;) * WARNING * Configuring Apache/2.0.43 mod_perl/1.99_08 Perl/v5.8.0 But it doesn't stop, it just keeps going acts all happy. Then when I run make i get: /usr/bin/ld: DP relative code in file /usr/local/lib/perl5/5.8.0/PA-RISC1.1/auto/DynaLoader/DynaLoader.a (DynaLoader.o) - shared library must be position independent. Use +z or +Z to recompile. *** Error exit code 1 Stop. *** Error exit code 1 Stop. # I've tried recompiling perl numerous times, but i'm basically a total newb. I'm a college student with no experience on HPUX very little unix experience to begin with, but somehow I ended up responsible for this, so any help would be greatly appreciated. well, since your problem now is compiling perl with -Accflags=+Z enabled, it's no longer a mod_perl question and should be taken elsewhere. However, this may help: http://perl.apache.org/docs/2.0/user/install/install.html#Configuring_and_Installing_Prerequisites just add the -Accflags=+Z, to the ./Configure command as described in that document. If you still have problems you should try one of the resources listed here: http://perl.apache.org/docs/offsite/other.html#Perl __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Invalid command 'PerlCleanupHandler'
Jie Gao wrote: Hi All, On redhat 8 using mod_perl-1.99_05-3 I have the folloing in httpd.conf: PerlCleanupHandler sub { %ENV = () } in VirtualHost, and am getting: Invalid command 'PerlCleanupHandler', perhaps mis-spelled or defined by a module not included in the server configuration Not a problem with mod_perl 1. Any help is appreciated. The documentation is pretty much trying to be up-to-date with the modperl cvs. So if you use an old mod_perl release, it may not work as described. Update your mod_perl to the current cvs and it'll work. See: http://perl.apache.org/docs/2.0/user/install/install.html#Installing_mod_perl_from_Source You need the 'CVS Bleeding-Edge Version' section __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: make errors with mod_perl-1.99_08 on aix 4.3.3
Priest, Darryl - BALTO wrote: I'm getting the error below for every cc in the make: /usr/local/perl5.8.0/lib/5.8.0/aix/CORE/config.h, line 41.9: 1506-236 (W) Macro name __attribute__ has been redefined. /usr/local/perl5.8.0/lib/5.8.0/aix/CORE/config.h, line 41.9: 1506-358 (I) __attribute__ is defined on line 28 of /usr/local/apache/include/apr.h. I'll take this issue to the apr/p5p lists, but this is non-fatal. But the make sails along until: cc -I/tmp/mod_perl-1.99_08/src/modules/perl -I/tmp/mod_perl-1.99_08/xs -I/usr/local/apache/include -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -I/usr/local/perl5.8.0/lib/5.8.0/aix/CORE -DMOD_PERL -O -c modperl_sys.c mv modperl_sys.o modperl_sys.lo modperl_largefiles.h, line 15.9: 1506-199 (S) #define directive requires a macro name. modperl_largefiles.h, line 17.9: 1506-199 (S) #define directive requires a macro name. [...] Is it just a coincidence that perl has USE_LARGE_FILES on and the file that make finally fails on is modperl_largefiles.h ? Can you please post your src/modules/perl/modperl_largefiles.h and the output of: % perl -MConfig -e 'print $Config{ccflags_uselargefiles}' __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Scripts and HTML docs in the same directory (+ modperl newbieexperiences)
Mark James wrote: Hello All, Took me a day, but I think I've finally been able to move my scripts from plain cgi perl to mod_perl2. The extensive documention on perl.apache.org was invaluable, though I have some comments below. One question: Prior to using mod_perl I was able to have unsuffixed scripts and .html files residing together in the server root directory by using Apache's Files directive to force the scripts to be executed: e.g. Files db ForceType application/x-httpd-cgi /Files I can't seem to do this with mod_perl because I now have to use a SetHandler directive on the directory, so Apache now executes the HTML files. I've tried forcing the scripts to type application/x-httpd-perl, but this doesn't work. I'd like to keep both the scripts and HTML docs in the root directory so that URLs are as short as possible, but can I do this with mod_perl without having to use URL re-writing? Set the normal behavior per dir/location and then override for specific files Location /perl SetHandler perl-script ... /Location Files *.html SetHandler default /Files if I remember correctly you can even nest that Files container inside the Location container. Finally, some comments on mod_perl installation: 1. In http://perl.apache.org/docs/1.0/guide/getwet.html , use of x.x.x for both the Apache and mod_perl version numbers made me think that the version numbers had to be matched. Maybe y.y.y should be used for one. Please get used to x.x.x meaning any. Otherwise we would need to remember to use z.z.z. for php plugs in and f.f.f. when openssl is added, etc... hope you get the idea. It also should be stated in this section that one has to use mod_perl-2.x if one is running Apache 2.y. yup, thank you, will fix that shortly. 2. In the configuration section of the 2.0 docs (http://perl.apache.org/docs/2.0/user/intro/start_fast.html#toc_Configuration) it neglects to state the need to issue a directive for the mod_perl handler one is going to use, e.g. PerlModule ModPerl::Registry, though it is covered in the configuration docs (including the startup-file option). you mean preloading the module? That's not necessarily in mp2, though advisable for performance reasons. In mp2, you can say: PerlResponseHandler ModPerl::Registry without: PerlModule ModPerl::Registry you can also use the syntactic sugar to preload modules, by simply stating at the beginning of your mod_perl configuration 'PerlOptions +Autoload'. See http://perl.apache.org/docs/2.0/user/config/config.html#C_AutoLoad_ or using + before the handler name: PerlResponseHandler +ModPerl::Registry Thanks to all mod_perl coders! Thanks for the comments. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [MP2] Apache::Reload date bug
Ron Savage wrote: On Tue, 25 Feb 2003 09:40:05 +1100, Stas Bekman wrote: And what your error_log says? Nothing is output to the error_log. Have you tried the current mod_perl cvs? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Help: Can't coerce GLOB to string...
Kurt George Gjerde wrote: Hi, I get a Can't coerce GLOB to string-error for every new thread that is started (mp2). I have no idea why this happens (or even what this error actually means). The module is included below (line producing the error is marked ERROR HERE). Error happens for every new thread (on the first request). When running ApacheBench ab -c 3 -n 100 http://... I get 3 errors and 97 OKs. [...] use threads; use threads::shared; why do you need to load threads? Do you plan to spawn your own threads? [...] ### PARSE DOCUMENT my $document; eval { $document = $xmlParser-parse_file($documentFilename); }; if ($@) { return error($r,'Error parsing XML document',$@); } [...] ### TRANSFORM my $results; eval { $results = $stylesheet-transform($document); ### --- ERROR HERE It's expecting a scalar as an argument, right? could it be that $document is not a scalar? try to print ref($document)? [...] [Tue Feb 25 16:04:04 2003] [error] [xslTransformer] Error transforming document - Can't coerce GLOB to string in entersub at E:/data/www/perlLib/MyApache/XSLTransformer.pm line 74. [tid=APR::OS::Thread=SCALAR(0x1205be4)|reqno=1|errno=1] -- __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [MP2] Apache::Reload date bug
Ron Savage wrote: On Wed, 19 Feb 2003 10:04:02 +1100, Stas Bekman wrote: Ron Savage wrote: On Tue, 18 Feb 2003 12:56:38 +1100, Stas Bekman wrote: Hi Folks In endeavouring to reproduce this problem, I've encountered another: main.cgi: -8- #!/usr/bin/perl use strict; use warnings; use CGI; use Dummy; # -- my($title) = 'Test'; my($q) = CGI - new(); my($s) = Dummy - string(); print $q - header({type = 'text/html;charset=ISO-8859-1'}), $q - start_html({title = $title}), $q - h1({align = 'center'}, $s), $q - end_html(); -8- Dummy.pm (in /perl/site/lib/): -8- package Dummy; sub string{'This is a string'} 1; -8- Output when run as /perl/main.cgi. Only the first line is expected (by me.) Ie why does the text from OK down, appear? : -8- This is a string OK The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. And what your error_log says? OK is part of the error message. I think I've fixed that in the cvs version. See if you get any better with it. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Redirects: relative vs absolute
Geoffrey Young wrote: to generate a URI that points to the same server as the current request it's best to use Apache::URI methods, which are pretty easy. my $uri = Apache::URI-parse($r); $uri-path('/some/new/document.html'); my $absolute_uri = $uri-unparse; note that calling path() (or any other method) is optional - you don't need to change anything in order to unparse() the URI and get an absolute URI back. So basically it's: my $absolute_uri = Apache::URI-parse($r)-unparse; So just a heads up for mp2, there is a new method to do that: use Apache::URI (); my $absolute_uri = $r-construct_url(); __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
mp2: a new helper module: ModPerl::MethodLookup
I've just committed a new module, called ModPerl::MethodLookup to figure out which modules to load for wanted functionality, or to simply preload all mod_perl modules. For more info see: http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: HELP - Problem installing modperl
Pablo Jejcic wrote: Here is my 'perl -V'. Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: [...] Compiler: cc='cc', ccflags ='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', [...] cccdlflags='-KPIC', lddlflags='-G' Still, either you aren't using the same compiler as you've used to build perl or the build has a wrong Config.pm. I've read a few threads on this issue via google and they all say the same thing: You must be using the native Solaris cc to build mod_perl (which doesn't support -KPIC). Your perl must have been built with gcc. Try to rebuild mod_perl, with CC=gcc perl Makefile ... __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2.0] Can't locate object method push_handlers via packageApache::RequestRec
Eric A. Zarko wrote: I am a little rusty (switched to telecomm ... just doing some web work on the side now), but my script looks okay to me. The archive and many hours to trying different things do not seem to be helping. Has anyone seen this before, or can you see a problem with it? TIA [...] [Sun Feb 23 21:26:07 2003] [error] [client 12.236.181.139] Can't locate object method push_handlers via package Apache::RequestRec at /usr/lib/perl5/site_perl/5.8.0/InfoMart/SessionFixupHandler.pm line 33. You simply haven't loaded the module which contains this method. I use the following helper alias: % lookup push_handlers There is more than one class with method 'push_handlers' try one of: use Apache::ServerUtil (); use Apache::RequestUtil (); For more info see: http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html though you will need to build the cvs version of mod_perl to get this functionality. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] what is GEN1 and why is it my log?
Ged Haywood wrote: On Thu, 20 Feb 2003, Nick Tonkin wrote: Hi, In my logs when dumping a warn() I see this occasionally: 192.168.0.24 at /home/wm/perl/WM/Auth/Access.pm line 28. 192.168.0.24 at /home/wm/perl/WM/Auth/Access.pm line 28. 192.168.0.24 at /home/wm/perl/WM/Auth/Access.pm line 28. 192.168.0.24 at /home/wm/perl/WM/Auth/Access.pm line 28, GEN1 line 245. 192.168.0.24 at /home/wm/perl/WM/Auth/Access.pm line 28. 192.168.0.24 at /home/wm/perl/WM/Auth/Access.pm line 28. Anyone know what GEN1 is I think it comes from Symbol.pm. It's a handle: the string GEN is in the source, the digit is just picked by the package when it opens a file/socket/whatever it's doing. Most likely. and why it appears every so often? Try adding use Carp; $SIG{__WARN__} = \Carp::cluck; in your startup.pl, this may shed some light. what's the call at line 28 of Access.pm? May be some debug print was forgotten in the modperl source code. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
FYI: Apache Modeling Portal
If you are interested in the Apache internals, the Apache Modeling Portal seems to be a great resourse http://apache.hpi.uni-potsdam.de/ (someone has posted the link to httpd-dev). I suppose that the most interesting part is the introduction to the Apache HTTP Server, covering both an overview and implementation details. It presents results of the Apache Modelling Project done by research assistants and students of the Hasso-Plattner-Institute in 2001 and 2002. HTML: http://apache.hpi.uni-potsdam.de/document PDF: http://apache.hpi.uni-potsdam.de/modules.php?name=Downloadsd_op=getitlid=3 It's still incomplete, but has quite a lot of things covered. Including numerous diagrams. From a quick browsing it seems like it's concentrating on Apache 2.0, while covering 1.0 as well. I'll add this resource to the Apache resources soonish: http://perl.apache.org/docs/offsite/other.html#Apache __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: HELP - Problem installing modperl
Pablo Jejcic wrote: I rebuild PERL and when I use perl -V I can see -KPIC but when I try to make mod_perl I receive the same error Any other thoughts??? How is it possible that the same compiler accepts an option for building one program, but not the other? Can you please post your 'perl -V'? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] porting tip - DefaultType text/html
Nick Tonkin wrote: As the docs say $r-send_http_header is deprecated because it is unneeded in mp2 ... but $r-content_type must be set. Just a minor nit: $r-send_http_header is *not* deprecated, it's *gone*. Since yesterday for it's gone for real and is only available only in the back compatibility layer Apache::compat. So if you choose to use Apache::compat you can keep it, if you don't use Apache::compat you have to remove it. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [OT?] Win32 permissions puzzler
Alessandro Forghieri wrote: This is a bit of a surprise the following, in fact, runs just fine: --Foo.pm-- package Foo; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = ( qw( $foo ) ); our @EXPORT = qw(); our $VERSION = '0.01'; our $foo=1; 1; --usefoo.pl use strict; use warnings; use Foo qw($foo); print foo is $foo\n; $ perl usefoo.pl foo is 1 This is according to my instinct - and practice: I have been using this idiom, under strict, for the longest time and the interpreter has never raised an eyebrow about it. BTW, this also works with @IMPORT (not only with @IMPORT_OK). I cannot give you a doc pointer that explicitely says that it must be so (or why), though. It works because Exporter aliases variables in the exporting package to the importing one and probably adds some black magic ;) However I thought that you may have hit the problem described here: http://perl.apache.org/docs/general/perl_reference/perl_reference.html#toc_Using_Exporter_pm_to_Share_Global_Variables when the same variable is to be shared by several packages. But I guess that wasn't the case. Can you reduce the code to a generic case so it can be reproduced at will? Does it behave the same with and without mod_perl? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: libapreq
David Wilde wrote: Is there a beta version of libapreq available for Apache 2? No, but subscribe to [EMAIL PROTECTED] to stay up to date with the new developments. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Help with Apache 1.3.27 + mod_perl 1.27 installation
Arshavir Grigorian wrote: Hi, I was trying to build Apache 1.3.27 + mod_perl 1.27 from the mod_perl tree. Dir structure as follows: /usr/local/apache2-19 /use/local/apache2-19/build /use/local/apache2-19/build/apache_1.3.27 /use/local/apache2-19/build/mod_perl-1.27 So, following the suggestion from http://perl.apache.org/docs/1.0/guide/install.html#APACI_ARGS that one can pass *any* arguments to the Apache ./configure through the APACI_ARGS directive, I placed the following lines into And it's correct. I'm using --enable-module inside APACI_ARGS all the time at the *command* line, as the section suggests. /use/local/apache2-19/build/makepl_args.mod_perl APACHE_SRC=../apache_1.3.27/src DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 \ APACI_ARGS='--prefix=/usr/local/apache2-19, --enable-module=dir' This generated some errors during the configure process cd /use/local/apache2-19/build/mod_perl-1.27/ make clean perl Makefile.pl ... '--ENABLE-MODULE' is not a known MakeMaker parameter name. ... I then discovered ADD_MODULE parameter and used that instead of using the Apache's --enable-module parameter. Correct me I am wrong, but I think the guide's section on using the APACI_ARGS parameter should say something about not being able to use '--enable-module' there, and have a pointer to the ADD_MODULE parameter. However there must be a glitch in the way a special makepl_args.mod_perl is processed. If someone can try to resolve a problem and post a patch, that would be very helpful. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp1] Alternative for CHECK
David Wheeler wrote: Hi All, I'm writing a module that will run in Apache and has important code that needs to run after all modules have loaded but before Apache forks and starts serving requests. Since mod_perl 1.x ignores CHECK and INIT blocks, and BEGIN blocks run too early for what I'm doing, I was wondering if there's a hook in the mod_perl API where I can run some code just before before Apache forks and starts serving requests? If you must know what I'm doing, I'm looking for stuff in the symbol table. PerlChildInitHandler? e.g. used by Apache::DBI to pre-connect to the db. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp1] Alternative for CHECK
David Wheeler wrote: On Thursday, February 20, 2003, at 07:04 PM, Stas Bekman wrote: PerlChildInitHandler? e.g. used by Apache::DBI to pre-connect to the db. Yeah, but I was looking for something pre-fork. Anything come to mind? startup.pl? in 2.0 you have: PerlPostConfigHandler http://perl.apache.org/docs/2.0/user/handlers/server.html#PerlPostConfigHandler __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp1] Alternative for CHECK
David Wheeler wrote: On Thursday, February 20, 2003, at 09:41 PM, Stas Bekman wrote: startup.pl? Won't work too well in a module, I think. I have a workaround for my problem for now, but it ain't pretty. Why not? Use a separate module to drive the others? package My::PostConfig; BEGIN { # whatever needs to be done for other modules } 1; startup.pl: --- use My::PostConfig __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: cvs commit: modperl Makefile.PL
[EMAIL PROTECTED] wrote: randyk 2003/02/20 08:42:46 Modified:.Makefile.PL Log: Reviewed by: stas Use Perl's touch(), in case a system touch() isn't available. Revision ChangesPath 1.208 +5 -1 modperl/Makefile.PL Index: Makefile.PL === RCS file: /home/cvs/modperl/Makefile.PL,v retrieving revision 1.207 retrieving revision 1.208 diff -u -r1.207 -r1.208 --- Makefile.PL 20 Feb 2003 16:34:35 - 1.207 +++ Makefile.PL 20 Feb 2003 16:42:46 - 1.208 -1602,7 +1602,11 my $to = '$(INST_ARCHLIB)/' . auto/Apache/include/$_; unless ($self-{PM}-{$from}) { $self-{PM}-{$from} = $to; - system $Config{touch} $from; +# system $Config{touch} $from; + my args = ($Config{perlpath}, '-MExtUtils::Command', + '-e', 'touch', $from); + system(args) == 0 + or die system args failed: $?; } } since we use cvs, we don't commented out snippets of the older code that was replaced with the new one. If in the future we realize the the recent change broke something we can always revert to the previous version. So please remove this commented out line and the same in your other commit on PERL_SECTIONS. Thanks. BTW, in case you were wondering. the style guide doesn't apply to the modperl (1.0) rep, since it's all a mess. We try to keep it clean for 2.0 from the very beginning. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas2003/02/19 15:55:23 Modified:.Changes lib/Apache compat.pm t/response/TestCompat apache.pm xs/Apache/Response Apache__Response.h xs/maps modperl_functions.map xs/tables/current/ModPerl FunctionTable.pm Log: move $r-send_http_header implementation to Apache::compat. This allows the 1.0 code to run unmodified if $r-send_http_header is called before the response change. we already handle the check whether content_type was set, when deciding whether the headers are to be parsed inside modperl_wbucket_pass(). Revision ChangesPath 1.130 +6 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.129 retrieving revision 1.130 diff -u -r1.129 -r1.130 --- Changes 19 Feb 2003 14:14:35 - 1.129 +++ Changes 19 Feb 2003 23:55:22 - 1.130 @@ -10,6 +10,12 @@ =item 1.99_09-dev +move $r-send_http_header implementation to Apache::compat. This +allows the 1.0 code to run unmodified if $r-send_http_header is +called before the response change. we already handle the check whether +content_type was set, when deciding whether the headers are to be +parsed inside modperl_wbucket_pass(). [Stas] + fixes to Apache::compat. make $r-connection-auth_type interface with r-ap_auth_type. make both $r-connection-auth_type and $r-connection-user writable. [Geoffrey Young] 1.81 +5 -0 modperl-2.0/lib/Apache/compat.pm Index: compat.pm === RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- compat.pm 19 Feb 2003 14:14:36 - 1.80 +++ compat.pm 19 Feb 2003 23:55:23 - 1.81 @@ -154,6 +154,11 @@ return Apache::current_callback(); } +sub send_http_header { +my ($r, $type) = @_; +$r-content_type($type) if defined $type; +} + #to support $r-server_root_relative *server_root_relative = \Apache::server_root_relative; 1.5 +3 -0 modperl-2.0/t/response/TestCompat/apache.pm Index: apache.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- apache.pm 17 Feb 2003 09:03:17 - 1.4 +++ apache.pm 19 Feb 2003 23:55:23 - 1.5 @@ -55,3 +55,6 @@ 1; +__END__ +# so we can test whether send_httpd_header() works fine +PerlOptions +ParseHeaders 1.9 +0 -22 modperl-2.0/xs/Apache/Response/Apache__Response.h Index: Apache__Response.h === RCS file: /home/cvs/modperl-2.0/xs/Apache/Response/Apache__Response.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Apache__Response.h17 Jan 2003 02:26:31 - 1.8 +++ Apache__Response.h19 Feb 2003 23:55:23 - 1.9 @@ -13,28 +13,6 @@ rcfg-wbucket-header_parse = 0; \ } -/* XXX: should only be part of Apache::compat */ -static MP_INLINE void -mpxs_Apache__RequestRec_send_http_header(pTHX_ request_rec *r, - const char *type) -{ -MP_dRCFG; - -if (type) { -ap_set_content_type(r, apr_pstrdup(r-pool, type)); -} - -if (rcfg-wbucket) { -/* turn off PerlOptions +ParseHeaders */ -rcfg-wbucket-header_parse = 0; -} -else { -/* the response is not initialized yet */ -Perl_croak(aTHX_ send_http_header() can't be called before - the response phase); -} -} - static MP_INLINE void mpxs_Apache__RequestRec_set_last_modified(request_rec *r, apr_time_t mtime) { 1.54 +0 -1 modperl-2.0/xs/maps/modperl_functions.map Index: modperl_functions.map === RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- modperl_functions.map 17 Feb 2003 09:03:17 - 1.53 +++ modperl_functions.map 19 Feb 2003 23:55:23 - 1.54 @@ -56,7 +56,6 @@ MODULE=Apache::Response PACKAGE=Apache::RequestRec DEFINE_send_cgi_header | | request_rec *:r, SV *:buffer - mpxs_Apache__RequestRec_send_http_header | | r, type=NULL mpxs_Apache__RequestRec_set_last_modified | | r, mtime=0 1.105 +0 -18 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm Index: FunctionTable.pm
cvs commit: modperl-2.0 STATUS
stas2003/02/19 16:41:51 Modified:.STATUS Log: need to resolve the issue with END blocks Revision ChangesPath 1.34 +5 -1 modperl-2.0/STATUS Index: STATUS === RCS file: /home/cvs/modperl-2.0/STATUS,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- STATUS15 Jan 2003 05:22:53 - 1.33 +++ STATUS20 Feb 2003 00:41:51 - 1.34 @@ -50,6 +50,10 @@ Needs Patch or Further Investigation: - +* child processes never run END blocks. a good example is + Apache::TestUtil, which doesn't cleanup files and dirs it has + created, because the END block is not run. + * Currently modperl_filter_add_{connection|request} check the filter handler function attrs before accepting the filter. If the module wasn't preloaded the check fails and filter handler is skipped. We
cvs commit: modperl-2.0 Changes
stas2003/02/19 17:28:25 Modified:t/response/TestAPI uri.pm xs/APR/URI APR__URI.h .Changes Log: fix a bug for apr 0.9.3, where it segfaults in apr_uri_unparse, if hostname is set, but not the scheme. Revision ChangesPath 1.9 +13 -1 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- uri.pm14 May 2002 01:32:50 - 1.8 +++ uri.pm20 Feb 2003 01:28:24 - 1.9 @@ -4,6 +4,7 @@ use warnings FATAL = 'all'; use Apache::Test; +use Apache::TestUtil; use APR::URI (); use Apache::URI (); @@ -17,7 +18,7 @@ sub handler { my $r = shift; -plan $r, tests = 14; +plan $r, tests = 15; $r-args('query'); @@ -49,6 +50,17 @@ $parsed-path($path); ok $parsed-path eq $path; + +{ +# test the segfault in apr 0.9.3 (fixed on mod_perl side) +# passing only the /path +my $parsed = APR::URI-parse($r-pool, $r-uri); +# set hostname, but not the scheme +$parsed-hostname($r-get_server_name); +$parsed-port($r-get_server_port); +#$parsed-scheme('http'); +ok t_cmp($r-construct_url, $parsed-unparse); +} my $newr = Apache::RequestRec-new($r-connection, $r-pool); my $url_string = $path?query; 1.5 +9 -0 modperl-2.0/xs/APR/URI/APR__URI.h Index: APR__URI.h === RCS file: /home/cvs/modperl-2.0/xs/APR/URI/APR__URI.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- APR__URI.h14 May 2002 01:32:50 - 1.4 +++ APR__URI.h20 Feb 2003 01:28:24 - 1.5 @@ -3,6 +3,15 @@ apr_uri_t *uptr, unsigned flags) { + +/* XXX: check that my patch was actually applied in apr v9.3 */ +#if APR_MINOR_VERSION == 9 APR_PATCH_VERSION 3 +/* apr 0.9.3 segfaults if hostname is set, but scheme is not */ +if (uptr-hostname !uptr-scheme) { +uptr-scheme = http; +} +#endif + return apr_uri_unparse(((modperl_uri_t *)uptr)-pool, uptr, flags); } 1.131 +3 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.130 retrieving revision 1.131 diff -u -r1.130 -r1.131 --- Changes 19 Feb 2003 23:55:22 - 1.130 +++ Changes 20 Feb 2003 01:28:25 - 1.131 @@ -10,6 +10,9 @@ =item 1.99_09-dev +fix a bug for apr 0.9.3, where it segfaults in apr_uri_unparse, if +hostname is set, but not the scheme. [Stas] + move $r-send_http_header implementation to Apache::compat. This allows the 1.0 code to run unmodified if $r-send_http_header is called before the response change. we already handle the check whether
Re: Building mod-perl 2 for cygwin: taint cleanup
[splitting the thread in two] Stas Bekman wrote: Steve Baldwin wrote: I've got Apache2 installed and as far as I can tell, it is functional. I'm trying to build mod-perl from source (as I couldn't find any binaries for cygwin). When I initially ran the command : perl Makefile.PL MP_AP_PREFIX=/usr/local/apache2 I got errors telling me it couldn't find cygdb-3.1.dll, which I eventually tracked down to Apache::TextConfig::open_cmd. I commented out the line : local @ENV{ qw(PATH IFS CDPATH ENV BASH_ENV) }; and the errors went away (it was clearing $ENV{PATH} which I think was causing the error). We need to explicitly set $ENV{PATH} to be able to start a process under -T (see perlsec). We could hardcode the path of the value, but that would be different for each platform. What the normal value of PATH on your system? Is this something standard that other cygwin users can rely on? this issue needs to be resolved as well. can you follow up on this? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] $r-server()-server_hostname compatibility?
Nick Tonkin wrote: server_hostname is not documented on the list. Anyone know the equivalent please? it hasn't changes from 1.0. I thought we have been through this already, just yesterday. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] warnings
Nick Tonkin wrote: Is it possible to combine the recommended syntax: use warnings FATAL = 'all', NONFATAL = 'redefine'; with the ability to turn warnings on in httpd.conf with PerlSwitches -w? -w is the same as: use warnings 'all'; then you can override things in your code using the warnings pragma. Though I should add a note that NONFATAL was introduced only in 5.8, so you probably don't want to use it. Instead use: use warnings FATAL = 'all'; no warnings 'redefine'; __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] handler running twice for one request
Nick Tonkin wrote: Hi all, I my httpd.conf I have: Location / AddType text/html .html PerlAccessHandler WM::Auth::Access /Location And in my handler I have: package WM::Auth::Access; use strict; use warnings; use Time::HiRes qw(gettimeofday); sub handler { my $r = shift; my $s = $r-server; $s-warn( [$$] beginning at . gettimeofday . with [ . $r-uri . ] ); if (! $r-is_initial_req) { $s-warn( [$$] \$r-is_initial_req false; declining at . gettimeofday ); return Apache::DECLINED; } elsif ($r-lookup_uri($r-uri)-content_type =~ /image/) { $s-warn( [$$] image requested; declining at . gettimeofday ); return Apache::DECLINED; } [ ... ] When I request /img/logo.gif, I get: [warn] [1168] beginning at 1045540634.07781 with [/img/logo.gif] [warn] [1168] beginning at 1045540634.07883 with [/img/logo.gif] [warn] [1168] $r-is_initial_req false; declining at 1045540634.07908 [warn] [1168] image requested; declining at 1045540634.07941 So, my quesstions are: 1) Why two times through the handler? 2) Why does the second time through start before the first one apparently gets to the conditional? 3) Why is a simple request like that not the is_initial_req 4) If the first time through it reurns DECLINED because it's not an initial req, how come it goes through again? 5) What the heck is going on here? do you have mod_dir configured? but then you aren't requisting / Run with the tracing enabled and you will be able to debug it easily: http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlTrace_ __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Building mod-perl 2 for cygwin
Steve Baldwin wrote: Unfortunately, I get the same (as far as I can see) result. Here's my latest perl -V ... You mean, you get a bunch of unresolved symbols, right? from your previous report: Now, make (of mod-perl) gives the following errors ... modperl_env.lo(.text+0x89e):modperl_env.c: variable '_PL_vtbl_env' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. : Creating library file: libmod_perl.dll.a mod_perl.lo(.text+0x2f9):mod_perl.c: undefined reference to `_apr_pool_cleanup_null' mod_perl.lo(.text+0x2fe):mod_perl.c: undefined reference to `_apr_pool_cleanup_register' mod_perl.lo(.text+0x4e9):mod_perl.c: undefined reference to `_ap_log_error' mod_perl.lo(.text+0x52b):mod_perl.c: undefined reference to `_ap_mpm_query' What looks weird is: Creating library file: libmod_perl.dll.a I'm not a win32 user, but it looks strange to me that dll.a thing. Is that a valid thing? I understand that cygwin is unix over win32. Though it still builds native win32 dlls, no? So may be the problem is that the mod_perl build decides to go with unix build when it should really do the win32 build? Any developers on cygwin that can help us here? Hopefully Per Einar is around and can help. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: help with Apache::DB
Perrin Harkins wrote: On Tue, 2003-02-18 at 08:07, giorgos zervas wrote: i am using Apache::DB to debug my mod_perl handlers and altough the debugger seems to be working fine it won't display the source code next to the current line being debugged. That's because you are compiling that code before you activate the debugger, so it doesn't get to put in the debugging symbols. Look at the init method in the Apache::DB documentation. Thanks Perrin, now I recall that ;) and it's even documented: http://perl.apache.org/docs/1.0/guide/debug.html#Interactive_mod_perl_Debugging __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] send_http_header() can't be called before the responsephase
Stas Bekman wrote: Nick Tonkin wrote: [...] send_http_header() can't be called before the response phase Nick, I've just committed a better solution. Please verify that it works for you. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [OT?] Win32 permissions puzzler
Alessandro Forghieri wrote: Alessandro Forghieri wrote: [...] use Bar qw($foo); if($foo) { ... Global symbol $foo requires explicit package name at use vars qw($foo); use Bar qw($foo); [...] Not sure I am following you here. $foo is in the @EXPORT_OK list of module Bar, which is, in turn,an Exporter. It is my understanding that this should work (as it does after the impersonated user has been given Admin powers). You have to declare variables as globals before using them. Even the imported ones. That's a pure perl issue. Please proceed to the perl lists/groups/monks for further discussion. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: mod_perl 2 apache::session and or die
Perrin Harkins wrote: Chris Faust wrote: All works well except when there is any kind of problem in the script where the condition will die.. [...] When this happens everything to do with that script is unresponsive - I know that is a little vague but that is the best way I can describe it. What happens is the error comes up (standard server error) and that is the last thing that is logged, if you try to go back and refresh the hourglass will go for hours and nothing happens and nothing is ever logged It sounds like a locking problem to me. I'm guessing that mod_perl 2 is not calling the right hooks when it traps a die() to trigger the DESTROY method in Apache::Session which releases all locks. You can find out exactly what's going on if you run it in the debugger (Apache::DB) or throw some debug logging into Apache::Session to find out where it gets stuck. This is the beauty of having the source code. I've noticed that there are several issues with END blocks with the current cvs, when the used perl is threaded. Could be that DESTROY misbehaves too. I've planned to investigate these issues, but didn't have a chance to yet. Hopefully someone will beat me to it. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] $r-server()-server_hostname compatibility?
Nick Tonkin wrote: On Thu, 20 Feb 2003, Stas Bekman wrote: Nick Tonkin wrote: server_hostname is not documented on the list. Anyone know the equivalent please? it hasn't changes from 1.0. I thought we have been through this already, just yesterday. We did. The list is resending mail. Or maybe the mail was trying to get through? weird It's not quite the same: it's $r-get_server_name or $r-server-server_name in mp2 versus $r-server-server_hostname in mp1. No, it's exactly the same in mp1 and mp2: $r-server-server_hostname there is no such a thing as $r-server-server_name plus there is $r-get_server_name in 2.0 __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] warnings
Nick Tonkin wrote: On Thu, 20 Feb 2003, Stas Bekman wrote: Nick Tonkin wrote: Is it possible to combine the recommended syntax: use warnings FATAL = 'all', NONFATAL = 'redefine'; with the ability to turn warnings on in httpd.conf with PerlSwitches -w? -w is the same as: use warnings 'all'; then you can override things in your code using the warnings pragma. Though I should add a note that NONFATAL was introduced only in 5.8, so you probably don't want to use it. I think that is already clear in the docs at http://perl.apache.org/docs/2.0/user/coding/coding.html#Auto_Reloading_Modified_Modules_with_Apache__Reload I've added a warning, just in case. and removed the use of NONFATAL in examples, so people won't copy-n-paste it. I just wanted to know if it was possible to get the same effect somehow using PerlSwitches in httpd.conf -- I guess not. If I put the 'use warnings;' pragma in startup.pl it will be server-wide, though, won't it? no. all pragmas have work without a scope they are defined in. That's why you should use '-w' in httpd.conf __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] $r-server()-server_hostname compatibility?
Nick Tonkin wrote: On Thu, 20 Feb 2003, Stas Bekman wrote: Nick Tonkin wrote: On Thu, 20 Feb 2003, Stas Bekman wrote: Nick Tonkin wrote: server_hostname is not documented on the list. Anyone know the equivalent please? it hasn't changes from 1.0. I thought we have been through this already, just yesterday. We did. The list is resending mail. Or maybe the mail was trying to get through? weird It's not quite the same: it's $r-get_server_name or $r-server-server_name in mp2 versus $r-server-server_hostname in mp1. No, it's exactly the same in mp1 and mp2: $r-server-server_hostname Confusing. The docs mention server_name() at http://perl.apache.org/docs/2.0/api/Apache/RequestUtil.html#METHODS fixed. I actually prefer to get rid of the get_ part, but it indicates that you can't change it. -- __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] $mod_perl::VERSION not defined
User NICKNick Tonkin wrote: Following the docs at http://perl.apache.org/docs/2.0/devel/porting/porting.html#Adjusting_Modules_to_Work_with_1_0_and_2_0_ I am trying to test $mod_perl::VERSION but it is undef. Any clues? use mod_perl; ? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Program received signal SIGBUS, Bus error. 0x80b2953 in ap_unescape_url()
Stas Bekman wrote: Richard Clarke wrote: Stas, Doesn't seem like an apreq problem. It happens in the modperl function. Any chance you can rebuild mod_perl with debug mode enabled (PERL_DEBUG=1), so we can see the arguments and file/linenumbers? See: http://perl.apache.org/docs/1.0/guide/debug.html#PERL_DEBUG_1_Build_Option Program received signal SIGBUS, Bus error. 0x80b445b in ap_unescape_url (url=0x8162e89 ) at util.c:1609 1609url[x] = '\0'; (gdb) bt #0 0x80b445b in ap_unescape_url (url=0x8162e89 ) at util.c:1609 #1 0x8085c20 in XS_Apache_unescape_url (cv=0x8227b0c) at Apache.c:931 Richard, attached is the real fix, which will be committed shortly. The problem is in the way perl's default typemap translates undefs into char *. It wasn't allocating any strings. The following does the right thing. I've tested that undefs are now happily accepted and you get a proper warnings under -w. Index: src/modules/perl/Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.125 diff -u -r1.125 Apache.xs --- src/modules/perl/Apache.xs 6 Jul 2001 20:33:35 - 1.125 +++ src/modules/perl/Apache.xs 20 Feb 2003 05:11:36 - @@ -655,8 +655,11 @@ Apache r char * -unescape_url(string) -char *string +unescape_url(sv) +SV *sv + +INIT: +char *string = SvPV_force(sv, PL_na); CODE: unescape_url(string); __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Building mod-perl 2 for cygwin
I have cygwin (for the tools), but haven't looked into compiling Apache/mod_perl with it. From what I understand, cygwin provides a C library (a dll) to get a unix-style API; this is to be contrasted with MinGW, which produces programs that don't rely on 3rd party dlls. cygwin, as well as having the usual .a (static) and .dll libs, does have a .dll.a type of lib, which is an import library. So having such a lib isn't unusual - whether that should be done here is another question ... OK, hopefully someone with try cygwin soonish and help Steve resolve the problems. It should definitely compile the threaded modperl. we will look at resolving the MULTIPLICITY alone, later. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
cvs commit: modperl Changes
stas2003/02/19 21:21:56 Modified:src/modules/perl Apache.xs .Changes Log: can't let the default typemap rule to convert sv into char* in unescape_url, since it doesn't handle correctly undefs (returns an unallocated string, which then causes a segfault in ap_unescape_url. use SvPV_force, instead, which does the right thing. Revision ChangesPath 1.126 +5 -2 modperl/src/modules/perl/Apache.xs Index: Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.125 retrieving revision 1.126 diff -u -r1.125 -r1.126 --- Apache.xs 6 Jul 2001 20:33:35 - 1.125 +++ Apache.xs 20 Feb 2003 05:21:55 - 1.126 @@ -655,8 +655,11 @@ Apache r char * -unescape_url(string) -char *string +unescape_url(sv) +SV *sv + +INIT: +char *string = SvPV_force(sv, PL_na); CODE: unescape_url(string); 1.662 +6 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.661 retrieving revision 1.662 diff -u -r1.661 -r1.662 --- Changes 19 Feb 2003 02:38:21 - 1.661 +++ Changes 20 Feb 2003 05:21:55 - 1.662 @@ -10,6 +10,12 @@ =item 1.27_01-dev +can't let the default typemap rule to convert sv into char* in +unescape_url, since it doesn't handle correctly undefs (returns an +unallocated string, which then causes a segfault in +ap_unescape_url. use SvPV_force, instead, which does the right +thing. [Stas Bekman] + Make sure to start perl, if it's not running, before processing Perl* directives, with threaded perl and PERL_STACKED_HANDLERS=0 [Stas Bekman]
cvs commit: modperl/t/net/perl util.pl
stas2003/02/19 22:48:05 Modified:t/net/perl util.pl Log: add tests for Apache::unescape_url Revision ChangesPath 1.16 +20 -1 modperl/t/net/perl/util.pl Index: util.pl === RCS file: /home/cvs/modperl/t/net/perl/util.pl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- util.pl 19 Jun 2002 16:31:52 - 1.15 +++ util.pl 20 Feb 2003 06:48:04 - 1.16 @@ -3,7 +3,7 @@ use Apache::test; $|++; my $i = 0; -my $tests = 7; +my $tests = 9; my $r = shift; $r-send_http_header('text/plain'); @@ -100,6 +100,25 @@ Perl = sub { my $esc = URI::Escape::uri_escape($uri) }, }); =cut + +{ +my $str = aa%20dd%2epl; +my $expected = aa dd.pl; +my $received = Apache::unescape_url($str); +test ++$i, $received eq $expected; +print expected: $expected\n; +print received: $received\n; +} + +{ +my $str = undef; +my $expected = ; +no warnings; +my $received = Apache::unescape_url($str); +test ++$i, $received eq $expected; +print expected: $expected\n; +print received: $received\n; +} $C = Apache::Util::ht_time(); $Perl = HTTP::Date::time2str();
cvs commit: modperl/Apache Apache.pm
stas2003/02/19 22:52:10 Modified:Apache Apache.pm Log: add a note that the original string passed to Apache::unescape_url is mangled, so only the return value should be used. Revision ChangesPath 1.73 +6 -1 modperl/Apache/Apache.pm Index: Apache.pm === RCS file: /home/cvs/modperl/Apache/Apache.pm,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- Apache.pm 13 Aug 2002 03:18:48 - 1.72 +++ Apache.pm 20 Feb 2003 06:52:10 - 1.73 @@ -1209,7 +1209,12 @@ =item Apache::unescape_url($string) -Handy function for unescapes. Use this one for filenames/paths. + $unescaped_url = Apache::unescape_url($string) + +Handy function for unescapes. Use this one for +filenames/paths. Notice that the original C$string is mangled in the +process (because it shrinks). + Use unescape_url_info for the result of submitted form data. =item Apache::unescape_url_info($string)
cvs commit: modperl/Apache Apache.pm
stas2003/02/19 22:54:23 Modified:Apache Apache.pm Log: add the reason why the variable gets rendered invalid on Apache::unescape_url Revision ChangesPath 1.74 +2 -1 modperl/Apache/Apache.pm Index: Apache.pm === RCS file: /home/cvs/modperl/Apache/Apache.pm,v retrieving revision 1.73 retrieving revision 1.74 diff -u -r1.73 -r1.74 --- Apache.pm 20 Feb 2003 06:52:10 - 1.73 +++ Apache.pm 20 Feb 2003 06:54:23 - 1.74 @@ -1213,7 +1213,8 @@ Handy function for unescapes. Use this one for filenames/paths. Notice that the original C$string is mangled in the -process (because it shrinks). +process (because the string part of PV shrinks, but the variable is +not updated, to speed things up). Use unescape_url_info for the result of submitted form data.
cvs commit: modperl/t/net/perl util.pl
stas2003/02/19 23:09:14 Modified:t/net/perl util.pl Log: s/no warnings/local $^W = 0/, I forgot that we have to deal with perl 5.6 on the mod_perl 1.0 land. Revision ChangesPath 1.17 +1 -1 modperl/t/net/perl/util.pl Index: util.pl === RCS file: /home/cvs/modperl/t/net/perl/util.pl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- util.pl 20 Feb 2003 06:48:04 - 1.16 +++ util.pl 20 Feb 2003 07:09:14 - 1.17 @@ -113,7 +113,7 @@ { my $str = undef; my $expected = ; -no warnings; +local $^W = 0; my $received = Apache::unescape_url($str); test ++$i, $received eq $expected; print expected: $expected\n;
cvs commit: modperl-2.0/lib/Bundle - New directory
stas2003/02/18 16:32:14 modperl-2.0/lib/Bundle - New directory
cvs commit: modperl-2.0 Changes
stas2003/02/18 16:32:45 Modified:.Changes Added: lib/Bundle Apache2.pm Log: add Apache::Bundle2 Revision ChangesPath 1.1 modperl-2.0/lib/Bundle/Apache2.pm Index: Apache2.pm === package Bundle::Apache2; $VERSION = '1.00'; 1; __END__ =head1 NAME Bundle::Apache2 - Install Apache mod_perl2 and related modules =head1 SYNOPSIS Cperl -MCPAN -e 'install Bundle::Apache2' =head1 CONTENTS LWP - Used in testing Chatbot::Eliza- Used in testing Devel::Symdump- Symbol table browsing with Apache::Status CGI - Used in testing (it's in core, but some vendors exclude it) =head1 DESCRIPTION This bundle contains modules used by Apache mod_perl2. Asking CPAN.pm to install a bundle means to install the bundle itself along with all the modules contained in the CONTENTS section above. Modules that are up to date are not installed, of course. =head1 AUTHOR Doug MacEachern, Stas Bekman 1.127 +2 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.126 retrieving revision 1.127 diff -u -r1.126 -r1.127 --- Changes 17 Feb 2003 09:39:54 - 1.126 +++ Changes 19 Feb 2003 00:32:45 - 1.127 @@ -10,6 +10,8 @@ =item 1.99_09-dev +add Apache::Bundle2 [Stas] + Apache::Reload now supports the PerlPreConnectionHandler invocation mode, so connection filter and protocol modules can be automatically reloaded on change. [Stas]
cvs commit: modperl-2.0/todo api.txt
stas2003/02/18 20:07:17 Modified:todo api.txt Log: $uri-rpath is missing from APR::URI Revision ChangesPath 1.33 +3 -0 modperl-2.0/todo/api.txt Index: api.txt === RCS file: /home/cvs/modperl-2.0/todo/api.txt,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- api.txt 17 Feb 2003 09:03:17 - 1.32 +++ api.txt 19 Feb 2003 04:07:17 - 1.33 @@ -28,6 +28,9 @@ needs to default to current pool (pconf at startup, r-pool at request time) +APR::URI +missing $uri-rpath + Apache::Util::* escape_path() - (was escape_uri) can be changed in apache not to require a pool
Re: modperl segfault with threaded Perl 5.8
Pavel Hlavnicka wrote: Ok, here is a complete backtrace (after a nice couple of hours observing the compilation progress... :) Can you please share the details of what you have changed, that allowed you to get the args and line numbers/file names? Why didn't you have them in the original report (I want this to be documented). I did it easily, but I'm not sure, it is a way for everyone... I just built Perl form the source with CFLAGS='-O0 -g' (-O0 is not necessary, I guess, it just usually makes debugger more precise on line tracking). What I exactly did was: sh Configure -des -Dprefix='/home/pavel/perl-5.8' -Duseshrplib -Doptimize='-O0 -g' -Uinstallusrbinperl -Dusethreads I compiled mod_perl for debugging too: env CFLAGS='-O0 -g' perl Makefile.PL I'm telling it just to be complete, but having more perl installations and calling the appropriate perl executable to generate mod_perl Makefile puts everything nicely together in right directory structures. Thanks Pavel, I was always building with -g, that's why my args were always complete. I suppose different levels of -O[0..3] strip different amount of information. At least on my system (linux/gcc3.2) providing -g is enough (as it sets -O0). #0 0x4003e32d in Perl_gv_fetchpv (my_perl=0x0, nambeg=0x80c68a7 Apache::Server::AutoPreLoad, add=0, sv_type=4) at gv.c:646 #1 0x4003726b in Perl_get_sv (my_perl=0x0, name=0x80c68a7 Apache::Server::AutoPreLoad, create=0) at perl.c:1712 #2 0x08058c40 in mp_preload_module (name=0xbfff93e8) at perl_config.c:428 The key here is my_perl=0x0, an attempt to call into perl was made before it was started. Since you didn't provide the details requested at: http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems (in particular build arguments) I'm doing a wild guesswork, assuming that you have built without PERL_STACKED_HANDLERS=1 (or EVERYTHING=1). So if my guess was correct, does the following patch fixes the problem with the threaded perl? Mea culpa, but I didn't tell you, bacause I did nothing particular - no swithes to Makefile.PL at all, so your wild guess was correct. Sorry for this omission. ... and the good message at last.. your patch works great. Thank you very much! Great, I'll commit a proper patch. (the one I've posted was duplicating a chunk of code) Have you got a clue, when (and whether) some maintenance release will go out? I don't know. But probably not very soon. Meanwhile I'll prefer the workaround and I'll build modperl with stacked handlers. May it have some impact to the performance? (...ok not so critical for me, indeed). I doubt so, you should be fine with stacked handlers. If performance is critical and you don't need the threads functionality, you are better off with non-threaded perl. Many thanks, and thaks for modperl. ;) __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] $r-server-server_hostname() compatibility?
Nick Tonkin wrote: Does anyone know the equivalent directive for $r-server()-server_hostname() it's right there: use Apache::Server; $r-server-server_name; __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] $r-server_name not working
Nick Tonkin wrote: I have use Apache::RequestRec; use Apache::RequestUtil; [ ... ] $server_name = $r-server_name; This fails with: Can't locate object method server_name via package Apache::RequestRec (even though server_name() is in RequestUtil ...) I will try to test a bit but I may have to focus on getting a 1.x installation built on this box ... no, it's get_server_name(): use Apache::RequestUtil; $server_name = $r-get_server_name; __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: HELP - Problem installing modperl
Pablo Jejcic wrote: Hello guys, I have just installed PERL/Apache and mod_perl, but this last one gave me an error when I try to compile. Could anyone help me? Thi is the error: bash-2.05# make make test cd src/modules/perl make -f Makefile.modperl make[1]: Entering directory `/projects/IRIG/mod_perl-1.99_08/src/modules/perl' cc -I/projects/IRIG/mod_perl-1.99_08/src/modules/perl -I/projects/IRIG/mod_perl-1.99_08/xs -I/projects/IRIG/apache2/prefork/include -I/usr/perl5/5.6.1/lib/sun4-solaris-64int/CORE -DMOD_PERL -xO3 -xdepend -KPIC \ -c mod_perl.c mv mod_perl.o mod_perl.lo cc: unrecognized option `-KPIC' mod_perl reuses the compiler flags perl was built with. It picks them up from Config.pm. Do you see -KPIC in the output of 'perl -V'? You must use exactly the same compiler that you've built your perl with and it should work. cc: language depend not recognized cc: mod_perl.c: linker input file unused because linking not done mv: cannot access mod_perl.o make[1]: *** [mod_perl.lo] Error 2 make[1]: Leaving directory `/projects/IRIG/mod_perl-1.99_08/src/modules/perl' make: *** [modperl_lib] Error 2 bash-2.05# c bash: c: command not found bash-2.05# cc cc: no input files And I'm running: Solaris 9 PERL 5.6.1 Apache 2.0.4 mod_perl 1.99_08 Thanks in advance!! Pablo.- Kind Regards. Pablo Jejcic Smartweb Senior system Administrator School of Computing - Robert Gordon University [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] *T*:44-(0)1224-262797 *F*:44-(0)1224-262790 ``The nice thing about standards is that there are so many to choose from. And if you really don't like all the standards you just have to wait another year until the one arises you are looking for.'' A. Tanenbaum, ``Introduction to Computer Networks' -- __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com