Re: each considered harmful?
Calling keys() (or values()) in void context is quite efficient. Nice to now. So it seems the correct idiom for using each is: keys %hash; while( my($k,$v) = each %hash ) { ... } p.s. I've shown an example, so we can have this issue documented together with other mod_perl gotchas. It's interesting that I don't remember this issue being reported earlier. Maybe it could be of some interest where I happened to get this problem. I got it in my custom TransHandler implemented to reduce stat calls and to obtain 'select from multiple directories' effect. ... (config file) our %STATIC_FILES = ( '/img' = [ '/alternative/img', '/myapp/install/img' ], '/css' = [ '/alternative/css', '/myapp/install/css' ], ... ) ... (transhandler file, simplified of course) ... sub handler { my $r = shift; my $uri = $r-uri; ... detecting dynamic handlers ... while( my($url, $dirs) = each %STATIC_FILES ) { if( $uri =~ m{$url/(.*)$} ) { foreach my $d (@$dirs) { my $file = $d/$1; if( -f $file ) { $r-filename($file); return OK; } } } } }
Re: mod_perl on Solaris notes..
Hi there, On Mon, 16 Jun 2003, Ryan Dietrich wrote: mod_perl on Solaris Thanks for the tips! things ended up being ridiculously stable (they haven't rebooted since last February I'm told).. Hehe: www2:~$ top -bn1 | head 9:57am up 421 days, 19:57, 1 user, load average: 0.03, 0.10, 0.08 134 processes: 131 sleeping, 1 running, 0 zombie, 2 stopped CPU states: 0.0% user, 0.1% system, 0.0% nice, 0.0% idle Mem: 971560K av, 452444K used, 519116K free, 105828K shrd, 101196K buff Swap: 1044184K av,1032K used, 1043152K free 64372K cached PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND 9912 ged 11 0 916 916 652 R 0 34.9 0.0 0:01 top :) 73, Ged.
Re: each considered harmful?
Marcin Kasperski wrote: Calling keys() (or values()) in void context is quite efficient. Nice to now. So it seems the correct idiom for using each is: keys %hash; while( my($k,$v) = each %hash ) { ... } Looks like it. probably with a comment so you (or other readers) won't forget why you did that. p.s. I've shown an example, so we can have this issue documented together with other mod_perl gotchas. It's interesting that I don't remember this issue being reported earlier. Maybe it could be of some interest where I happened to get this problem. I got it in my custom TransHandler implemented to reduce stat calls and to obtain 'select from multiple directories' effect. ... (config file) our %STATIC_FILES = ( '/img' = [ '/alternative/img', '/myapp/install/img' ], '/css' = [ '/alternative/css', '/myapp/install/css' ], ... ) ... (transhandler file, simplified of course) ... sub handler { my $r = shift; my $uri = $r-uri; ... detecting dynamic handlers ... while( my($url, $dirs) = each %STATIC_FILES ) { if( $uri =~ m{$url/(.*)$} ) { foreach my $d (@$dirs) { my $file = $d/$1; if( -f $file ) { $r-filename($file); return OK; } } } } } ah, a real-world example. Just what we need. Care to write a short pod section using this example, explaining the problem and the solution? plain text or pod will do. we will add it to the coding chapter. 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: How practical is that Practical mod_perl?
Stas Bekman wrote: [...] BTW, Eric is working on creating a new site for http://modperlbook.org/ which will include the source code, errata and other useful information. We will let you know when this work has been completed. I've just put it online. Enjoy, -- Eric Cholet
Re: each considered harmful?
Hi guys, On Mon, 16 Jun 2003, Stas Bekman wrote: [snip,snip] keys %hash; does the trick interesting that I don't remember this issue being reported earlier. Probably because we all read the Camel Book, section 5.4.3, the bit about FIRSTKEY. All except Randal that is... :) Most people when iterating over a hash will say something like foreach $scalar_name ( keys %hash_name ) { ... } which automatically resets the iterator and is safe in a perisitent Perl environment like mod_perl. I hope. 73, Ged.
Re: each considered harmful?
Ged Haywood wrote: [...] Most people when iterating over a hash will say something like foreach $scalar_name ( keys %hash_name ) { ... } which automatically resets the iterator and is safe in a perisitent Perl environment like mod_perl. I hope. That's a good point, Ged. Marcin, please include this preferred solution in the possible solutions section (assuming that you are going to write 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: UTF-8 support
I did a search for UTF-8 and locale at http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/ In the past 2-3 months the only problem seems to be that regex doesnt seem to work properly on UTF-8 input [http://www.xray.mpe.mpg.de/cgi-bin/w3glimpse2html/perl5-porters/2003-05/msg00183.html?68#mfs] and that RedHat 9.0 ships with a buggy maintenance snapshot of perl 5.8.x [http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-05/msg00352.html] I think it means we better wait a while before making large scale applications to manipulate UTF-8 data but I could possibly be wrong. Also ofcourse dont develop applications using RedHat 9.0's perl :). Mithun --- Stas Bekman [EMAIL PROTECTED] wrote: To second Perrin, 5.8.0's UTF8 support is not broken. From what I was following on the p5p, 5.8.0 had some minor issues, but 5.8.1 which will be released really soon now (my guess: July at OSCon) have them (all?) sorted out. You may want to browse p5p archives and rt.perl.org to see what UTF8 problems were if any and whether they were resolved. If you find something that would be of interest to other readers, please post a summary here. __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
Sharing memory between children
I had a look at the memory usage of my apache/mod_perl 1 processes, and was alarmed to find that only 3Mb of 25Mb processes was being shared (and that's straight after startup) I have gone to great lengths to (1) Preload modules in my startup file (2) Load shared config data during server startup so that that info can also be shared The only module I load during child init is a wrapper to handle database connections so that database handles don't get shared between children. I've read the memory optimization bit on the mod_perl web site and am complying with all of those suggestions. My next step is to remove all of the modules and start adding them in again to see which has such poor memory usage. What numbers should I be expecting to achieve on a reasonably large web site (http://ww.traveljury.com - still a test site at the moment) and are there any gotchas that you know about that aren't mentioned on the mod_perl site? thanks Clint
Re: Sharing memory between children
On Mon, 2003-06-16 at 12:12, Clinton Gormley wrote: I had a look at the memory usage of my apache/mod_perl 1 processes, and was alarmed to find that only 3Mb of 25Mb processes was being shared (and that's straight after startup) I have gone to great lengths to (1) Preload modules in my startup file (2) Load shared config data during server startup so that that info can also be shared i've pulled everything out and started adding it back in, and it looks like nothing much gets shared other than the perl interpreter. When I load nothing, the size of my processes starts at 4204 (2504 shared) . When I load everything, the size rises to 17144 (3920 shared) - not much is being shared... Am I being really dumb here? What am I missing? thanks Clint My Apache compile options : _ ./configure --prefix=/usr/local/apache-1.3.27_perl_ssl_mm \ --activate-module=src/modules/perl/libperl.a \ --disable-module=userdir \ --disable-module=asis \ --disable-module=include \ --enable-shared=info \ --enable-shared=status \ --enable-module=so \ --enable-shared=env \ --enable-shared=setenvif \ --enable-shared=negotiation \ --enable-shared=autoindex \ --enable-shared=access \ --enable-shared=auth \ --enable-shared=cgi \ --enable-shared=actions \ --disable-module=imap \ --enable-module=ssl \ --enable-shared=ssl \ --disable-rule=SSL_COMPAT _ mod_perl compile options _ perl Makefile.PL \ APACHE_SRC=../apache_1.3.27/src \ DO_HTTPD=1 \ USE_APACI=1 \ PREP_HTTPD=1 \ EVERYTHING=1 _ My startup file (which is required in the apache config): _ use strict; use warnings FATAL = 'all', NONFATAL = 'redefine'; use Apache(); use Apache::DBI(); use lib Apache-server_root_relative ('projects/traveljury/modules'); $Apache::VMonitor::PROC_REGEX = join |, qw(httpd mysql); ## Set DB connection credentials use TravelJury::Startup::InitDBI(); ## Load constants before using Apache::DBI so that $dbh from parent process doesn't get shared use TravelJury::Startup::Constants(); ## Any initialisation which needs to occure during server startup use TravelJury::Startup::ServerInit(); use TravelJury::Gateway(); Apache-push_handlers(PerlChildInitHandler ='TravelJury::Startup::ChildInit'); _
Re: each considered harmful?
Marcin == Marcin Kasperski [EMAIL PROTECTED] writes: Marcin Maybe it could be of some interest where I happened to get this Marcin problem. I got it in my custom TransHandler implemented to reduce stat Marcin calls and to obtain 'select from multiple directories' effect. Marcin ... (config file) Marcin our %STATIC_FILES = ( Marcin '/img' = [ '/alternative/img', '/myapp/install/img' ], Marcin '/css' = [ '/alternative/css', '/myapp/install/css' ], Marcin ... Marcin ) Marcin ... (transhandler file, simplified of course) ... Marcin sub handler { Marcin my $r = shift; Marcin my $uri = $r-uri; Marcin ... detecting dynamic handlers ... Marcin while( my($url, $dirs) = each %STATIC_FILES ) { Marcin if( $uri =~ m{$url/(.*)$} ) { Marcin foreach my $d (@$dirs) { Marcin my $file = $d/$1; Marcin if( -f $file ) { Marcin$r-filename($file); Marcinreturn OK; Marcin } Marcin } Marcin } Marcin } Marcin } That's actually the wrong data structure then. What you want if you're only ever accessing it as a list, is a list! And, you're needlessly recompiling the regex each time. Here's a much better way to do that... our @STATIC_FILES = ( [ qr{^/img/(.*)$} = [ qw(/alternative/img /myapp/install/img) ], [ qr{^/css/(.*)$} = [ qw(/alternative/css /myapp/install/css) ], ... ); sub handler { my $r = shift; my $uri = $r-uri; for (@STATIC_FILES) { my ($pat, @dirs) = @$_; if ($uri =~ $pat) { my $tail = $1; foreach my $dir (@dirs) { my $file = $dir/$tail; if (-f $file) { $r-filename($file); return OK; } } } } return DECLINED; } -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: each considered harmful?
Randal == Randal L Schwartz [EMAIL PROTECTED] writes: Randal our @STATIC_FILES = ( Randal [ qr{^/img/(.*)$} = [ qw(/alternative/img /myapp/install/img) ], Randal [ qr{^/css/(.*)$} = [ qw(/alternative/css /myapp/install/css) ], Argh. extra left bracket snuck in. [ qr{^/img/(.*)$} = qw(/alternative/img /myapp/install/img) ], [ qr{^/css/(.*)$} = qw(/alternative/css /myapp/install/css) ], Randal ... Randal ); Randal sub handler { Randal my $r = shift; Randal my $uri = $r-uri; Randal for (@STATIC_FILES) { Randal my ($pat, @dirs) = @$_; Randal if ($uri =~ $pat) { Randal my $tail = $1; Randal foreach my $dir (@dirs) { Randal my $file = $dir/$tail; Randal if (-f $file) { Randal $r-filename($file); Randal return OK; Randal } Randal } Randal } Randal } Randal return DECLINED; Randal } Randal -- Randal Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Randal [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Randal Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. Randal See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Current stable platform for mod_perl application ?
I have a opportunity to upgrade and standardize a couple of mod_perl enabled servers to the most stable configuration as of now. Apache 1.3 and mod_perl was easy to choose since it is a production environment. What I am very much confused is to what should I chose for the distribution. For various reasons it is certainly going to be RedHat but I have a choice between the very well tested 7.3 but highly likely to become unsupported by RedHat soon. Or I could go for RedHat 9.0 and rollback perl to 5.6.1 - I dont like the idea of running a production server on a maintenance snapshots of perl especially a .0 release. If anyone has recently had the opportunity to make simillar decisions do share what made him/her decide on whatever platform was chosen. Also does the Native Posix Thread Library support in RedHat 9.0 have any added benifit for mod_perl/my applications ? Mithun __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
Re: Sharing memory between children
Hi there, On 16 Jun 2003, Clinton Gormley wrote: I had a look at the memory usage of my apache/mod_perl 1 processes, and was alarmed to find that only 3Mb of 25Mb processes was being shared (and that's straight after startup) I see about the same on my own server when processes get bloated, but I don't let the processes live to serve large numbers of requests so eventually they're killed off and replaced with new, smaller children. Generally about 25% of the processes are big ones, the rest staying around their initial size, but that's just the way things happen on this server, and it's not especially busy - it runs about half a dozen virtual hosts. Just in case, I put in a lot more RAM than I thought I needed. Of course with a completely different set of (Perl) software and operating conditions, there's no reason why your experience should be anything like this. When I load nothing, the size of my processes starts at 4204 (2504 Sounds a little on the high side, but not outrageous. You're putting quite a lot of stuff into your httpd, do you really need it all? Am I being really dumb here? I don't think so. If it's a problem for your machines you might want to consider a light proxy front end + mod_perl backend. It's easy to set up. A lot depends on the amount and type of traffic that you're going to see. If everything is dynamic HTML you might not gain much, but if there's a lot of static content you might gain a lot. Every site is different - even if they're on the same machine. 73, Ged.
Re: Current stable platform for mod_perl application ?
Hi there, On Mon, 16 Jun 2003, Mithun Bhattacharya wrote: I have a choice between the very well tested 7.3 but highly likely to become unsupported by RedHat soon. Or I could go for RedHat 9.0 A distribution is just a package of stuff that you could put together yourself if you had the time and energy. Generally it includes an enormous mountain of stuff you neither need nor want, but it has to have frills, bells and whistles to compete. For a mod_perl server all you need is a decent kernel, networking support, a shell and tools to build the server(s) e.g. an editor, a C compiler suite and Perl. You can add all kinds of goodies like mail, ftp and name servers but that isn't what we're talking about here. The less you have in there, the less there is to go wrong and the fewer holes there are in it. Even having a C compiler on the machine is an added security risk. Do you actually need or use RH support? I'm not saying that there's anything wrong with it, but by the time you've a few years of Linux experience under your belt it's unlikely you'll need much more than the odd security patch - and you'll be able to deal with that sort of thing easily, even if it means installing a new kernel. I'd say stick with what you know. I tried RH9.0 on internal servers: I found so many things broke it was hardly worth the effort, except for the machine on our receptionist's desk which needs a nice GUI for her word processing stuff (even if it's less reliable than I'd like). Having said that, I had as much trouble with the latest Slackware distro. Things have changed a lot in a couple of years, so I think you either need to keep regularly up to date or else only do it when it's forced on you. I belong to the inertial navigation group. Must be my age. Also does the Native Posix Thread Library support in RedHat 9.0 have any added benifit for mod_perl/my applications ? I've no idea, but that's all a bit new and exciting for me anyway... :) 73, Ged.
Re: Sharing memory between children
On Mon, 2003-06-16 at 13:03, Ged Haywood wrote: I had a look at the memory usage of my apache/mod_perl 1 processes, and was alarmed to find that only 3Mb of 25Mb processes was being shared (and that's straight after startup) I see about the same on my own server when processes get bloated, but I don't let the processes live to serve large numbers of requests so eventually they're killed off and replaced with new, smaller children. But this is happening right at startup... before any bloating. Sounds a little on the high side, but not outrageous. You're putting quite a lot of stuff into your httpd, do you really need it all? Sorry - that includes the perl processor. I don't think so. If it's a problem for your machines you might want to consider a light proxy front end + mod_perl backend. I will be using a lightweight frontend, but clearly still want to optimise my mod_perl processes. But I just don't get why I'm seeing the numbers I'm seeing. I preload everything, and yet the shared memory rises all of 1Mb, while the unshared memory rises 12Mb, before the first request has been served! Surely, at this stage, pretty much everything should stil be shared? yours bemusedly Clint
Re: Current stable platform for mod_perl application ?
--- Ged Haywood [EMAIL PROTECTED] wrote: Hi there, On Mon, 16 Jun 2003, Mithun Bhattacharya wrote: I have a choice between the very well tested 7.3 but highly likely to become unsupported by RedHat soon. Or I could go for RedHat 9.0 Ohh no no one is using RedHat support it is just the fact that most of the administrators are used to RedHat and I am not going to be maintaining the servers in the long run therefore I wanted them to have something they know their way around. I want something which they can manage on their own, they can upgrade without breaking everything down - and ending up ruining my happiness :). I do a minimal install for the servers anyway other than kernel and perl they wont have much else to worry about. Ofcoure RedHat 7.3 has the notorious gcc 2.96 - no body has been able to figure out whether it is actually broken or not I guess :). Do you actually need or use RH support? I'm not saying that there's anything wrong with it, but by the time you've a few years of Linux experience under your belt it's unlikely you'll need much more than the odd security patch - and you'll be able to deal with that sort of thing easily, even if it means installing a new kernel. The problem with ease of maintenance is that I need to give something which will have patches coming out for it for atleast a year - with the way new versions are poping up with all the distros I guess it is a dream for the time being. Mithun __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
Re: Sharing memory between children
Hi There, On 16 Jun 2003, Clinton Gormley wrote: On Mon, 2003-06-16 at 13:03, Ged Haywood wrote: I had a look at the memory usage of my apache/mod_perl 1 processes, and was alarmed to find that only 3Mb of 25Mb processes was being shared (and that's straight after startup) But this is happening right at startup... before any bloating. Maybe there are lots of variables in your code that are different for each different process. Do you use the process ID for example? I wouldn't get too excited about it until you see how your servers behave in actual use. I shouldn't be a bit surprised if you find that suddenly there are lots of things that seem to be more important... 73, Ged.
Re: Current stable platform for mod_perl application ?
Hi there, On Mon, 16 Jun 2003, Mithun Bhattacharya wrote: [snip] RedHat 7.3 has the notorious gcc 2.96 - no body has been able to figure out whether it is actually broken or not I guess :). [snip] Whether it's broken or not it was never released, it escaped. :) The developers called it a development release, not to be used in production: http://gcc.gnu.org/gcc-2.96.html Until recently I used gcc 2.95 and I had next to no trouble with it, compiling certainly many hundreds (perhaps thousands, didn't count) of all kinds of packages, including almost all versions of Apache, Perl and mod_perl since mid-1999 i.e. (if memory serves) Apache 1.2.19, mod_perl 1.19 and Perl 5.005_03. To my mind there are more programmers in this world than there should be who don't mind warnings in compiler output, but if you have a fussy compiler you'll expect to see the odd warning amongst the slew of messages you get when you build something. Apache, Perl and mod_perl are better than many in this respect. Recently I started to use gcc 3.2 although I never used it to compile mod_perl. I had a few problems with gcc 3.2 - I was mostly compiling kernels and kernel modules - so I upgraded to 3.2.3 which has given me very good service so far. Slower than 2.95 :( but just as fussy. :) It's a real slog to buid the compiler and support stuff on an old system, if you're thinking of doing it I'd advise getting a recent distribution which has at least gcc version 3.0 already in there. Changing libraries can be just as traumatic as changing compilers. I'm using glibc 2.3.1 at present. I've used gcc 3.2.3 to compile Apache 1.3.23 and the latest mod_perl versions (1.27 and the candidate for 1.28), with no problems at all. Using 3.2.3 as yet I've only built Apache with statically linked modules, and that's unlikely to change unless someone offers money. Since the last guy who did that never paid, it would probably need to be cash in advance. (You know who you are... :) 73, Ged.
Re: Help needed !!
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 12 June 2003 08:22, ECE Webmaster wrote: Hi , I am having a problem with an application that I am running on an Apache server. It says that it is unable to load the script. I have chmod all things to 777. My application is at http://www.ece.ufl.edu/COE/pages/chat/chatmain.html Need more info. What version of Apache / mod_perl are you running? What is the conf file (at least the relevant sections)? What is the directory structure? What are the files you are trying to run? Chmod everything to 775 or 755. 777 is plain stupid. - -- Jonathan Gardner [EMAIL PROTECTED] (was [EMAIL PROTECTED]) Live Free, Use Linux! -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+7fhQWgwF3QvpWNwRAuPeAJ9SsNz4TGlEdXlHCZ1n26FoyxttnwCfXpPo s0Jax/7EbWhLNRbhhDtDq8s= =a+bo -END PGP SIGNATURE-
Re: Current stable platform for mod_perl application ?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 16 June 2003 05:02, Mithun Bhattacharya wrote: I have a opportunity to upgrade and standardize a couple of mod_perl enabled servers to the most stable configuration as of now. Apache 1.3 and mod_perl was easy to choose since it is a production environment. What I am very much confused is to what should I chose for the distribution. For various reasons it is certainly going to be RedHat but I have a choice between the very well tested 7.3 but highly likely to become unsupported by RedHat soon. Or I could go for RedHat 9.0 and rollback perl to 5.6.1 - I dont like the idea of running a production server on a maintenance snapshots of perl especially a .0 release. If anyone has recently had the opportunity to make simillar decisions do share what made him/her decide on whatever platform was chosen. Go ahead and install RedHat 9. Sure, they use Apache 2.0, but you can do the barebones install and build everything you need from there. I've not had any problems building Apache 1.3 and mod_perl at all. I dunno, if you are really paranoid, just spend a couple of days and get LFS working! ;-) I don't know what the other guy is talking about when he says a whole bunch of stuff is broken. I guess if you don't upgrade to the latest versions of the packages you can't expect a whole lot. But who runs an unpatched system anyways? And as far as the .0 scare, consider RedHat 9 like RedHat 8.1, or even RedHat 7.5. There isn't going to be a RedHat 9.1, or any .0 or .1 from here on out. Things are just developing too fast. I use Redhat 9 because it's just easier to manage, and it has a lot of things I like (Apache 2.0 w/ mod_perl and mod_python). I think when you start managing more and more machines (I've 3 at home!) that it's easier just to keep them all bleeding edge and updated. I don't even build my own software outside of a few RPMs I maintain anymore as it was just too much work. - -- Jonathan Gardner [EMAIL PROTECTED] (was [EMAIL PROTECTED]) Live Free, Use Linux! -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+7fwSWgwF3QvpWNwRAiuhAKDEDqx31+8Jz0VMrGdRSYwEGwIpDACfSekv D6P6I/XPzXV4DHb9i2Ujj2k= =75sb -END PGP SIGNATURE-
list of ported modules?
Hi! Is there a list of CPAN modules that have already been ported to work with mod_perl2? If so, can I add my two modules to it? (Apache::AuthNetLDAP and Apache::AuthzNetLDAP). thanks, speeves cws
AuthenNTLM undefined value
I am trying to use AuthenNTLM. I put an .htaccess file in a directory and when I try to access the URL for the directory, it gives me an internal server error. The apache error log contains: Can't call method connection on an undefined value at /usr/opt/perl5/lib/site_perl/5.005/aix/Apache/AuthenNTLM.pm line 478. I am using Apache-AuthenNTLM-0.23 + apache_1.3.27 + mod_perl-1.27. Here is the .htaccess file: PerlAuthenHandler Apache::AuthenNTLM AuthType ntlm AuthName test require user 208512 PerlAddVar ntdomain PHS phsntpdc #PerlAddVar ntdomain other_domain pdc_for_domain bdc_for_domain PerlSetVar defaultdomain PHS PerlSetVar ntlmdebug 1 Any ideas? Dave Franks [EMAIL PROTECTED]
Re: handler($$) unreliability
On Sun, Jun 15, 2003 at 02:44:02PM +0800, Philippe M. Chiasson wrote: [...] This could be related to a recently discovered bug in mp_preload_module(), see http://marc.theaimsgroup.com/?t=10553271073r=1w=2 for the original report. That is a possiblity. I am preloading Project::Control, but I am not preloading other modules that inherit from it. I am also using Apache::Reload, if that matters. Below is how Project::Control is setup, which is the module/handler that most commonly exhibits the problem. Project::Control is a dispatcher that loads (require-s) a module based on a URI to module name mapping hash, then calls the run method in that package. The require-d module is always a subclass of Project::Control.pm. The failure becomes apparent when the $apache-status call is made because $apache is not an object in the failing case. Again, this module almost always works. It usually only begins failing after apache has been running for several hours, and seems to be more common under heavy load. *** http.conf ***: Files *.pcm SetHandler perl-script PerlModule Project::Control PerlHandler Project::Control /Files *** library/Project/Control.pm ***: package Project::Control; use Apache(); use Apache::Constants qw(:common :response REDIRECT SERVER_ERROR); use Apache::Reload; use Class::MethodMaker get_set = [ qw( apache ... ) ], new_hash_init = '_create'; ... use vars qw/%URI_MAP/; %URI_MAP = ( '/uri/one' = 'Project::Control::HandleUriOne', ... for different URIs ); sub handler ($$) = { my ($class, $apache) = @_; Apache::request($apache); $apache-status(200); # sets default *** Failure occurs here ... my $self = $class-_create(apache = $apache, ...); (my $uri = $apache-uri) =~ s/\.[^\.]+$//; my $module = $URI_MAP{$uri} or Carp::confess(Page [$uri] not installed); (my $path = $module) =~ s!::!/!g; $path .= .pm; bless $self, $module; eval { require $path; $self-run( $apache ); }; ... return OK; } 1; *** library/Project/HandleUriOne ***: package Project::HandleUriOne; ... use Apache::Reload; use base qw( Project::Control ); sub run { my $self = shift; ... code to generate output goes here ... } 1; [Fri Jun 13 06:00:06 2003] [error] Can't call method status on an undefin= ed +value at Project/Control.pm line 116. Does this happen only once per child, or does the affected child behaves like that for each and every request to that handler? It seems to happen for every request that the affected child handles. I don't have a test case that exercises the problem, so I don't have real solid data on the behavior, but it seems like once a child begins exhibiting this erroneous behavior, it continues to do so for the rest of its lifetime. I am not sure whether it exhibits this behavior from the time it is created or starts doing that later after having successfully served other requests. Any suggestions as to how to contruct a test case so that I can make this problem be repeatable would be greatly appreciated. One thing that can fix this problem, if it's indeed caused by mp_preload_module, would be to make sure to preload that module with a PerlModule My::Class in your httpd.conf I am preloading Project::Control, which I think would be sufficient, but am not preloading the subclass modules that it uses. I am not sure whether that matters or not. sub handler is never overridden in the subclasses. Thanks for your help. -- Matthew Pressly
Re: each considered harmful?
sub handler { my $r = shift; my $uri = $r-uri; ... detecting dynamic handlers ... while( my($url, $dirs) = each %STATIC_FILES ) { if( $uri =~ m{$url/(.*)$} ) { foreach my $d (@$dirs) { my $file = $d/$1; if( -f $file ) { $r-filename($file); return OK; } } } } } ah, a real-world example. Just what we need. Care to write a short pod section using this example, explaining the problem and the solution? plain text or pod will do. we will add it to the coding chapter. Hmm, let's use my english-like language... The problem: - the application static files are installed in /myapp/img, /myapp/css, ... - local site customization can be made by installing customized files in /custom/img, /custom/css... - in both cases they are accessed via /img/..., /css/... urls The solution - we use custom transhandler to check whether the customized version exists and use it if so. -- ( Marcin Kasperski | Working overtime sucks the spirit and motivation ) ( http://www.mk.w.pl | out of a team. (Wells) ) () ( O CVS i zarzdzaniu wersjami: http://www.mk.w.pl/narzedzia/narzedzia_cvs )
AuthenNTLM undefined value
I am trying to use AuthenNTLM. I put an .htaccess file in a directory and when I try to access the URL for the directory, it gives me an internal server error. The apache error log contains: Can't call method connection on an undefined value at /usr/opt/perl5/lib/site_perl/5.005/aix/Apache/AuthenNTLM.pm line 478. I am using Apache-AuthenNTLM-0.23 + apache_1.3.27 + mod_perl-1.27. Here is the .htaccess file: PerlAuthenHandler Apache::AuthenNTLM AuthType ntlm AuthName test require user 208512 PerlAddVar ntdomain PHS phsntpdc #PerlAddVar ntdomain other_domain pdc_for_domainbdc_for_domain PerlSetVar defaultdomain PHS PerlSetVar ntlmdebug 1 Any ideas? Dave Franks [EMAIL PROTECTED]
AuthenNTLM undefined value
I'm new to this list. Last attempt didn't seem to post. Her it is again... I am trying to use AuthenNTLM. I put an .htaccess file in a directory and when I try to access the URL for the directory, it gives me an internal server error. The apache error log contains: Can't call method connection on an undefined value at /usr/opt/perl5/lib/site_perl/5.005/aix/Apache/AuthenNTLM.pm line 478. I am using Apache-AuthenNTLM-0.23 + apache_1.3.27 + mod_perl-1.27. Here is the .htaccess file: PerlAuthenHandler Apache::AuthenNTLM AuthType ntlm AuthName test require user 208512 PerlAddVar ntdomain PHS phsntpdc #PerlAddVar ntdomain other_domain pdc_for_domainbdc_for_domain PerlSetVar defaultdomain PHS PerlSetVar ntlmdebug 1 Any ideas? Dave Franks [EMAIL PROTECTED]
IPC::Open3
Hi there, I am having trouble making open3 work with perl, v5.6.1 built for i386-linux. I am running Apache/1.3.27 Ben-SSL/1.48 (Unix) PHP/4.2.3 mod_perl/1.27. My problem is that I can't write to STDIN. Does any one know of any solution to this problem? Has any one encountered the same issue? Any suggestions and help is greatly appreciated. -r
[DIGEST] mod_perl digest 2003/06/02
-- mod_perl digest June 2, 2003 - June 15, 2003 -- Recent happenings in the mod_perl world... Features o mod_perl status o module announcements o application announcements o mailing list highlights o mp2 porting tips / documentation o links o problem reporting guidelines mod_perl status o mod_perl - stable: 1.27 (released June 1, 2002) [1] - development: 1.27_01-dev [2] o Apache - stable: 1.3.27 (released October 3, 2002) [3] - development: 1.3.28-dev [4] o mod_perl 2.0 - beta: 1.99_09 (released April 28, 2003) [5] - development: 1.99_10-dev [6] o Apache 2.0 - stable: 2.0.46 (released May 27, 2003) [7] - developement: 2.0.47-dev - new-territories: 2.1.xx o Perl - stable: 5.8.0 (released July 18, 2002) [8] - development: ...towards 5.9.0 has started [9] module announcements o CGI::Application 3.1 - framework for building reusable web applications [10] o Embperl 2.0b9 - system for building dynamic websites [11] o Gestinanna::POF 0.02 - yet another persistent object framework [12] application announcements o Bricolage 1.6.1 (devel) - an enterprise content management system [13] o Mason-CM 1.1 - Mason content manager [14] o OpenInteract 1.99_00 (2.0 beta) - a web application framework [15] mailing list highlights o _Practical mod_perl_ is available [16] o `each' with caveats under mod_perl [17] mp2 porting tips / documentation o perl.apache.org documents [18] o Apache::compat [19] links o The Apache/Perl Integration Project [20] o mod_perl documentation [21] o Apache modules on CPAN [22] o _Writing Apache Modules with Perl and C_ homepage [23] o _mod_perl Developer's Cookbook_ homepage [24] o Other mod_perl-related books [25] o mod_perl news and advocacy [26] o mod_perl list archives - modperl@ [27] - dev@ [28] - docs-dev@ [29] - advocacy@ [30] problem reporting guidelines Whenever you have a problem that you want to ask about on the modperl list, please be sure to read the instructions on how to report problems: For mod_perl 1.0 [31] For mod_perl 2.0 [32] For your convenience, these are located in the shortcuts menu on all pages at http://perl.apache.org/. You will save yourself and us a lot of time by following the instructions on these pages. Thank you! happy mod_perling... --James [EMAIL PROTECTED] -- [1] http://perl.apache.org/dist/ [2] http://cvs.apache.org/snapshots/modperl/ [3] http://www.apache.org/dist/httpd/ [4] http://cvs.apache.org/snapshots/apache-1.3/ [5] http://perl.apache.org/dist/mod_perl-1.99_04.tar.gz [6] http://cvs.apache.org/snapshots/modperl-2.0/ [7] http://www.apache.org/dist/httpd/ [8] http://www.cpan.org/src/stable.tar.gz [9] http://www.cpan.org/src/README.html [10] http://mathforum.org/epigone/modperl/groydraldbreld [11] http://mathforum.org/epigone/modperl/ghooclalkerd [12] http://mathforum.org/epigone/modperl/gerthaxcand [13] http://mathforum.org/epigone/modperl/khoothaxstrung [14] http://mathforum.org/epigone/modperl/drandyelgox [15] http://mathforum.org/epigone/modperl/fehzehtweld [16] http://mathforum.org/epigone/modperl/swongzuspoo [17] http://mathforum.org/epigone/modperl/nalprungyun [18] http://perl.apache.org/docs/2.0/devel/porting/porting.html [19] http://perl.apache.org/docs/2.0/api/Apache/compat.html [20] http://perl.apache.org/ [21] http://perl.apache.org/docs/ [22] http://www.cpan.org/modules/by-module/Apache/ [23] http://www.modperl.com/ [24] http://www.modperlcookbook.org/ [25] http://perl.apache.org/docs/offsite/books.html [26] http://www.take23.org/ [27] http://perl.apache.org/maillist/modperl.html#Searchable_Archives [28] http://perl.apache.org/maillist/dev.html#Searchable_Archives [29] http://perl.apache.org/maillist/docs-dev.html#Searchable_Archives [30] http://perl.apache.org/maillist/advocacy.html#Searchable_Archives [31] http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems [32] http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems
Re: each considered harmful?
Marcin Kasperski wrote: sub handler { my $r = shift; my $uri = $r-uri; ... detecting dynamic handlers ... while( my($url, $dirs) = each %STATIC_FILES ) { if( $uri =~ m{$url/(.*)$} ) { foreach my $d (@$dirs) { my $file = $d/$1; if( -f $file ) { $r-filename($file); return OK; } } } } } ah, a real-world example. Just what we need. Care to write a short pod section using this example, explaining the problem and the solution? plain text or pod will do. we will add it to the coding chapter. Hmm, let's use my english-like language... The problem: - the application static files are installed in /myapp/img, /myapp/css, ... - local site customization can be made by installing customized files in /custom/img, /custom/css... - in both cases they are accessed via /img/..., /css/... urls The solution - we use custom transhandler to check whether the customized version exists and use it if so. Yes, but can you write a section to be added to the documentation, explaining the problem, providing an example and a solution. Something that you'd have loved to find in the docs, when you first discovered it? Of course digesting all the helpful comments from others in this thread. Good docs don't grow on the trees, someone has to put them together. __ 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
Current directory
Hi, when I am executing perl scripton Apache it seems that the current directory is not the directory where the script is locatedbut the directory c:\program files\apache group\apache. I need current dir to be the script dir since i have some pm in the script directories. I have apache 1.3.27 and mod_perl 1. Thanks Oskar
Re: Sharing memory between children
Clinton Gormley wrote: On Mon, 2003-06-16 at 13:03, Ged Haywood wrote: / I had a look at the memory usage of my apache/mod_perl 1 processes, and was alarmed to find that only 3Mb of 25Mb processes was being shared (and that's straight after startup) I see about the same on my own server when processes get bloated, but I don't let the processes live to serve large numbers of requests so eventually they're killed off and replaced with new, smaller children./ But this is happening right at startup... before any bloating. Take all the modules out, and start adding them one by one and see which one causes the bloat, then may be try to split it in chunks and again look at what parts create the bloat. B::TerseSize should be of a great help, it's called from the Apache::Status module, and shows you the exact memory size used by each subroutine, line of code, file, etc. Chapters 9 and 13 in the Practical mod_perl book should give you a good idea on how to use them. There is also some info here: http://perl.apache.org/docs/1.0/guide/performance.html#Measuring_the_Memory_Usage_of_Subroutines __ 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: Current stable platform for mod_perl application ?
Mithun Bhattacharya wrote: I have a opportunity to upgrade and standardize a couple of mod_perl enabled servers to the most stable configuration as of now. Apache 1.3 and mod_perl was easy to choose since it is a production environment. What I am very much confused is to what should I chose for the distribution. For various reasons it is certainly going to be RedHat but I have a choice between the very well tested 7.3 but highly likely to become unsupported by RedHat soon. Or I could go for RedHat 9.0 and rollback perl to 5.6.1 - I dont like the idea of running a production server on a maintenance snapshots of perl especially a .0 release. If anyone has recently had the opportunity to make simillar decisions do share what made him/her decide on whatever platform was chosen. As Jonathan Gardner suggested go with the latest version. You have a better kernel, better glibc and many more better things. You can always downgrade parts that you don't find good. Also does the Native Posix Thread Library support in RedHat 9.0 have any added benifit for mod_perl/my applications ? Not if you don't use threads. perl 5.8.1 is about to be released and after doing some testing I'd suggest to go with it. It has a pretty good ithreads support when you need it. However don't build this feature in, unless you really need it, since ithreads support slows perl down. Of course when you use ithreads you get the speedups/benefits on other fronts, so the lost is compensated. Having perl 5.8.0/1 gives you a chance to try your applications on threaded mpms of Apache2/mod_perl 2.0 and they may scale much better. __ 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: list of ported modules?
Shannon Eric Peevey wrote: Hi! Is there a list of CPAN modules that have already been ported to work with mod_perl2? Not at the moment, but it's a great idea. Where should we add it? I suppose that this should be a short-life document and eventually it will be removed. So we can put it anywhere. there is: http://perl.apache.org/products/apache-modules.html we could put a section there. What do we have now: Already ported: --- CGI CGI::Cookie Apache::Peek In the process: Module Porters Apache::MP3 Stas Bekman/Clemens Schrimpe [EMAIL PROTECTED] Apache::Scoreboard Stas Bekman Apache::VMonitor Stas Bekman Anything else I have missed? If you have ported a module or in the middle of porting please tell us. the latter should list the email of the porter so the interested parties can help with the porting. If so, can I add my two modules to it? (Apache::AuthNetLDAP and Apache::AuthzNetLDAP). are they on CPAN already? __ 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: IPC::Open3
Rasoul Hajikhani wrote: Hi there, I am having trouble making open3 work with perl, v5.6.1 built for i386-linux. I am running Apache/1.3.27 Ben-SSL/1.48 (Unix) PHP/4.2.3 mod_perl/1.27. My problem is that I can't write to STDIN. Does any one know of any solution to this problem? Has any one encountered the same issue? Any suggestions and help is greatly appreciated. It's a known problem. The solution: s/IPC::Open3/IPC::Run/ Barries has also written IPC::Run3, which should act as a drop-in replacement for IPC::Open3, if you have to stick with the same 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
temporal directory used by apache/mod-perl?
Hello, last week I asked about the problem I had with the partial uploaded files,and how Apache::Request never got the error code correctly. (By the way, thanks for the answer, looks like a bug) Well, the solution for me was to use Apache read() and parse the incoming data myself. Uf, what a job! Everything looks fine now, when I receive several files in the same posting froma form and the user aborts the process, say, closing the form window, I can rescue and save the files completed and dismiss the last one incomplete. My problem now is that I have the /tmp directory in another partition in the server.When I want to move the uploaded files from temporal to final, I can't do 'rename' as this function doesn't work across different filesystems. How can Ichange the temporal dir from '/tmp' to, say, '/home/tmp'? I'm not using Apache::Request so it can't be done as a parameter there, is it possible to setthis in mod_perl, apache or I have to do it in the linux itself? if it is the last one,any idea where? Any information will be welcome, thanks people. -- Hector Pizarro Amautatech
Re[2]: each considered harmful?
Hello Marcin Kasperski, Tuesday, June 17, 2003, 3:13:23 AM, you wrote: sub handler { my $r = shift; my $uri = $r-uri; ... detecting dynamic handlers ... while( my($url, $dirs) = each %STATIC_FILES ) { if( $uri =~ m{$url/(.*)$} ) { foreach my $d (@$dirs) { my $file = $d/$1; if( -f $file ) { $r-filename($file); return OK; } } } } } ah, a real-world example. Just what we need. Care to write a short pod section using this example, explaining the problem and the solution? plain text or pod will do. we will add it to the coding chapter. MK Hmm, let's use my english-like language... MK The problem: MK - the application static files are installed in /myapp/img, MK /myapp/css, ... MK - local site customization can be made by installing customized files MK in /custom/img, /custom/css... MK - in both cases they are accessed via /img/..., /css/... urls MK The solution - we use custom transhandler to check whether the MK customized version exists and use it if so. In our setup we use mod_rewrite for things like that. It checks for static resources in the few places and if there is no custom version finally looks in the some standard location (images, css, javascripts, any static resources etc ...). In the dual frontend/backend setup I think this approach is better -- requests for static resources may still be served by light frontend server. -- WBR, Mike P. Mikhailov mailto: [EMAIL PROTECTED] ICQ:280990142 Who is General Failure, and what is he doing reading my hard disk ?
Re: temporal directory used by apache/mod-perl?
Hello Hector Pizarro, Tuesday, June 17, 2003, 1:47:04 PM, you wrote: HP Hello, last week I asked about the problem I had with the partial uploaded HP files,and how Apache::Request never got the error code correctly. (By the way, HP thanks for the answer, looks like a bug) Well, the solution for me was to use HP Apache read() and parse the incoming data myself. Uf, what a job! HP Everything looks fine now, when I receive several files in the same HP posting froma form and the user aborts the process, say, closing the form window, I can HP rescue and save the files completed and dismiss the last one incomplete. My HP problem now is that I have the /tmp directory in another partition in the HP server.When I want to move the uploaded files from temporal to final, I can't do HP 'rename' as this function doesn't work across different filesystems. How HP can Ichange the temporal dir from '/tmp' to, say, '/home/tmp'? I'm not using HP Apache::Request so it can't be done as a parameter there, is it possible HP to setthis in mod_perl, apache or I have to do it in the linux itself? if it is HP the last one,any idea where? HP Any information will be welcome, thanks people. HP -- HP Hector Pizarro HP Amautatech What's wrong with TEMP_DIR ? my $apr = Apache::Request-new($r, TEMP_DIR = /home/httpd/tmp); my $upload = $apr-upload('file'); $upload-link(/home/user/myfile) || warn link failed: $!; see: perldoc Apache::Request -- WBR, Mike P. Mikhailov mailto: [EMAIL PROTECTED] ICQ:280990142 My mother always used to tell me, The early bird gets the worm.