Re: connection monitoring
Am Sa, 2003-11-29 um 09.49 schrieb John Michael: > But This: > > if ($h->r->connection->aborted) { > > would not be called until this > > $h->r->send_fd($fh); > > were already through. For a large file, wouldn't that it too late. > or would a real aborted connection cause send_fd($fh) to go ahead and stop > sending the file. > > I've been reading through the cookbook and trying to piece this together. > > Say I want to only allow one coneection per ip to a certain folder. > I think I need to create an access handle to determine and monitor whether > to allow someone another connection from their ip. Return OK if they are > allowed, update a list of some sort showing that the ip does have an active > connection. > Be aware of proxies. Many ISPs use proxies, in this situation your are excluding all people using the same proxy because one of their users is accessing a directory/file. > I need to know where to remove the active connection. > WOuld I then create a handler to run in the logging phase to remove the the > IP from the active connection list. > JM > > > > - Original Message - > From: "Thomas Klausner" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, November 29, 2003 2:19 AM > Subject: Re: connection monitoring > > > > Hi! > > > > On Sat, Nov 29, 2003 at 02:00:18AM -0600, John Michael wrote: > > > Someone pointed me to checking the connection class for an abort. I > found > > > info on this in the modperl cookbook..That seems useful if you want to > > > server your own files, but would take a lot of overhead if you had to > > > continue to check it for a large file. It would not really do me any > good > > > to serve the file myself if under modperl I would think anyway > > > > I'm not really sure I understand completely what you're after, but > recently > > I had to implement something wich sound similar: Registeres users are > > allowed to download a fixed quantity of mp3 files. If they abort the > > download, their quota shouldn't be decremented. > > > > So I did something like this: > > > > $h->r->send_fd($fh); > > > > if ($h->r->connection->aborted) { > > $h->debug("DOWNLOAD ABBORTED!!"); > > > > # reset download count > > } > > > > return OK; > > > > Obviously, I am serving the mp3-files using a mod_perl enabled Apache. > > > > > > > > -- > > #!/usr/bin/perl http://domm.zsi.at > > for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/} > > > > -- > > Reporting bugs: http://perl.apache.org/bugs/ > > Mail list info: http://perl.apache.org/maillist/modperl.html > > > -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: Mod Perl + Apache Error logs, extend DBILogger
Hi, I'm not sure whether I'm right or wrong. Your problem is that the logging phase is coming after the PerlHandler-phase and that $r->content from the PerlHandler-phase has already consumed the posted data. To come across this problem you could use Apache::Request which works as a singleton any where to access the submitted parameters. 8< my $apr = Apache::Request->instance($r) 8< Tom [EMAIL PROTECTED] wrote: I don't know if this is possible or not, but I took parts of DBILogger and wanted to extend what I could do with it. What I would like to do is for a given request to a cgi program (or mason) if the script causes an internal error (which should not happen in production, but does) I would like to capture the parameters that were called from the cgi form so that later on I can look to see what cgi program it was that caused the problems and what parameters the user used to cause the problem. So far what I have works, except for getting information from $r->content(), what I have done is placed the directive "PerlLogHandler Apache::ErrorLogger" which calls the script below, which is placing information into the logfile. The $r->args() call works, when I place parameters in the URL after the '?' it does get this information. What I really need though is the content in the content() call. The form does have 'application/x-www-form-urlencoded' in the form tag. Is the content() not coming through because apache redirects to the error page ? package Apache::ErrorLogger; use strict; use Apache::Constants qw( :common ); use Apache::Log; use Apache::Request; use Date::Format; sub handler { my $r = shift->last; my $s = $r->server; my $c = $r->connection; my %data = ( 'host' => "xrayfish-ssl", 'server'=> $s->server_hostname, 'bytes' => $r->bytes_sent, 'filename' => $r->filename || '', 'remotehost'=> $c->remote_host || '', 'remoteip' => $c->remote_ip || '', 'status'=> $r->status || '', 'urlpath' => $r->uri || '', 'referer' => $r->header_in("Referer") || '', 'useragent' => $r->header_in('User-Agent') || '', 'timeserved'=> time2str("%Y-%m-%d %X", time), 'contenttype' => $r->content_type || '' ); my $content = $r->content(); my $args = $r->args(); $data{usertrack} = $r->notes('cookie') || ''; my $error_msg = %data->{'host'}." >^..^< ".%data->{'server'}." >^..^< ". %data->{'bytes'}." >^..^< ".%data->{'filename'}." >^..^< ". %data->{'remotehost'}." >^..^< ".%data->{'remoteip'}." >^..^< ". %data->{'status'}." >^..^< ".%data->{'urlpath'}." >^..^< ". %data->{'referer'}." >^..^< ".%data->{'useragent'}." >^..^< ". %data->{'timeserved'}." >^..^< ".%data->{'contenttype'}." >^..^< ". %data->{'usertrack'}." >^..^< ".$content." args ".$args; if($r->status eq '500') { # Bomb is just a generic error logger that sends this information to the specified logfile. &Bomb({display=>0, footer=>0, level=>3, exit=>0, output=>'text', error=>"Internal Server Error >^..^< $error_msg", logfile=>'/var/apache_errorlogfile' }); } return OK; } ** ** ** PRIVILEGED AND CONFIDENTIAL ** ** ** This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient or a person responsible for delivering this message to an intended recipient, please delete the email and immediately notify the sender via the email return address or mailto:[EMAIL PROTECTED] Thank you. -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: Current URL
It's: 8< $r->connection->remote_ip 8< See: http://perl.apache.org/docs/1.0/api/Apache.html#_cr_E_gt_connection Ian Joyce wrote: This may be day 1 stuff for most of you, but... What's the quckest way to determine the URL that made the current request in mod_perl 1? -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Serving specific files with some authentication
On Fri, 2004-01-23 at 20:56, Sasan Dashtinezhad wrote: > Hi guys, > > My question is more site-development related. > > What I plan to do is to distribute tasks to clients which will connect > to the Web server. Jobs are defined in files, residing on the server, > and clients have to be somehow authenticated (nothing really serious, > they just need to be privously registered in the site) My question is > what is a good and easy to implement way to do this? A small registration form using a database system(e.g. MySQL, SQLLite,...) should do the trick. For authentication take a look at http://search.cpan.org/~abh/Apache-DBI-0.94/AuthDBI.pm > The other > constraint is that a program should be able to download a task too (no > user interaction is allowed.) > > I was thinking of having the files defining the jobs in a password > protected directory and then making the programs send the username and > password to the server. But I don't know how to do that. The other If you are using HTTP-authentification you could the use HTTP-libs the language you've chosen provides? What is the language you've written your client-app in? e.g. Java => http://jakarta.apache.org/commons/httpclient/ e.g. Perl => http://search.cpan.org/~gaas/libwww-perl-5.76/ ... Tom > problemm is that I'm not really happy with this desing, and was thinking > that there might be better ways to do it. Yet another problem is that > how will the client download the file? I was hoping to redirect the > client to the URL to the file. Is there a better way to do this...? > > Has anybody done this before? Any suggestions or comments are welcome. > > Sorry folks, but I'm just new to all of this... > > Cheers, > --Sasan -- \\\||/// \\ - - // ( @ @ ) -oOo--( )--oOo---------- ___ ___tom schindl o __/ / / innovative medientechnik planung AG / /\/\/ / / /__/ / __mailto:[EMAIL PROTECTED] / / / / /_/ / / /___/http://www.impire.de / voice:+43(512)34193431,fax:+43(512)34193420 Eduard-Bodem-Gasse 6, A-6020 Innsbruck, Austria, Software Engineering -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: reloading modules in a handler with eval
I go with you in a dev environment still it decreases performance so on a production server where modules should not change every minute I never use it. Nevertheless I don't know exactly how Apache::Reload is working but I suppose it deletes the module in %INC and reloads it using perls standard methods which is much wiser so one can import vars from the modules into its own namespace, syntax checking is done ... Tom Thomas Klausner wrote: Hi! On Fri, Feb 27, 2004 at 09:35:11AM +, Mark Maunder wrote: In a perl handler, I'm doing a stat on a module file, and if the file has been modified, I'm reloading the module by slurping the file into a scalar and eval'ing it. The module has a few subs and global vars that have defaults set on initialization. I have about 20 modules I'm doing this with (all subclasses of a parent generic module). I'm assuming the subs will be overwritten in the module namespace, and global vars re-initialized with their default values. All instances of objects created from these modules/classes are destroyed at the end of each request, and this reload happens at the beginning of a request before objects are instantiated. Anything wrong with doing this? It seems a little too easy! :) It might even be easier: use Apache::Reload; -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: passing external data into modperl
Hi, You can share data between processes using various techniques: 1. SHM 2. Berkely DB 3. ... See here for other modules: http://mathforum.org/epigone/modperl/naubrouclee/[EMAIL PROTECTED] Tom On Sun, 2004-03-14 at 22:34, Ethan Joffe wrote: > I am trying to find the most efficient way to send a piece of information > from an external program to apache/modperl such that each process will have > the value when next checked. The idea is to have an in memory variable that > changes infrequently, but needs to be checked every time a script that uses > it is run. The application is to keep frequently used database data cached > in modperl, and to send a cache dirty revision number when something which > might be cached is modified. I know one can use a file, and check the file > contents each time, but this seems extremely expensive considering my very > small script does not access any other files (I am ignoring the standard > overhead for modperl checking if the script has changed, etc). I could also > keep the revision number in the DB, but the DB overhead seems an even > bigger waste. Note that using a simple dirty flag does not suffice since > each process needs to keep track of whether it is up to date, so it needs > to be a value. > > Is there a way to pass a value into apache such that each modperl process > then has access to it? Note that when a new value is passed before a > process had a chance to check the previous one, it is OK for the previous > one to never have been seen. > > I am using Apache::Registry. > > Any ideas? > > -Ethan -- \\\||/// \\ - - // ( @ @ ) -oOo--( )--oOo---------- ___ ___tom schindl o __/ / / innovative medientechnik planung AG / /\/\/ / / /__/ / __mailto:[EMAIL PROTECTED] / / / / /_/ / / /___/http://www.impire.de / voice:+43(512)34193431,fax:+43(512)34193420 Eduard-Bodem-Gasse 6, A-6020 Innsbruck, Austria, Software Engineering -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: query_string
You don't have to parse the query-String yourself, use Apache::Request Tom Mike Ni wrote: Hey everyone, I am having a tough time to parse the "query_string". Does anyone know where I can find man page about how the Apache construct the "query_string"? Additionlly, is it right that Apache will place the returned "query_string" in "STDIN". Thanks! MIke __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: modifying request content
As far as I know not but you could pass information using $r->pnotes(), maybe you could also use my $apr = Apache::Request->instance($r); In all modules in the chain and use $apr->param() to set/reset different things. Tom dorian wrote: is there any way currently to take the content of a request (say, from a POST or PUT), modify it an arbitrary way, then somehow put it back into the request object to make it available to handlers further down the chain? thanks in advance .dorian -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: data from STDIN
You could use $r->read($buf, $bytes_to_read, [$offset]) if I'm not completely wrong. See: http://perl.apache.org/docs/1.0/api/Apache.html#_r_E_gt_read__buf___bytes_to_readoffset__ -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: data from STDIN
But there's nobody reading the STDIN if you avoid doing something like this: my $cgi = new CGI(); my $rq = Apache::Request->new($r); my $content = $r->content(); Why would you do that if you know that none of these methods will work because you don't get a real post. Tom simran wrote: You could use $r->read($buf, $bytes_to_read, [$offset]) if I'm not completely wrong. See: http://perl.apache.org/docs/1.0/api/Apache.html#_r_E_gt_read__buf___bytes_to_readoffset__ It would work if something had not already read the data once from the filehandle... and since its STDIN i don't think i can do a seek(...) on teh filehandle to put it at the start again... so what i really need is to be able to get the raw content from $r... -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: data from STDIN
simran wrote: But there's nobody reading the STDIN if you avoid doing something like this: my $cgi = new CGI(); my $rq = Apache::Request->new($r); my $content = $r->content(); Why would you do that if you know that none of these methods will work because you don't get a real post. I wish i could avoid the above methods being called, but unfortunately the application framework i am working in, calls the above methods (which of course cause the read from STDIN). My particular bit of code (in the application i am working in) is treated as a "plugin" and as such is passed things like the request object, but only after some internal pre-processing. My ideal situation would be if i could someone query the passed (and original) $r to give me the raw contents... Oh I see. So I have no idea how to solve it besides creating your own HTTP-Server in front of your apache. Taking the ugly POST-Request parsing the content and sending a real POST to your Apache-Framework-Solution. 1. Running an other Apache in front of your actually running Apache triggering the specific SMS request, all other request are simply redirected using RewriteRules 2. Using something like POE to create your own webserver e.g.: * http://poe.perl.org/?POE_Cookbook * http://poe.perl.org/?POE_Cookbook/Web_Proxy, * http://poe.perl.org/?POE_Cookbook/Web_Server Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Defining specific vars in conf for a shared script
Why are you not using config files and only set the path to this file like this. PerlSetVar my_cnf /etc/vhostconfs/80.cnf PerlSetVar my_cnf /etc/vhostconfs/81.cnf 80.cnf -8<- HTML_TEMPLATE_ROOT = "/websites/80/templates" ->8- You could read the config-file when your application starts-up and then retrieve the values very easily using something like e.g. http://search.cpan.org/~wadg/Config-IniFiles-2.38/ Tom Chris Faust wrote: Hello, I'm having a hard time figuring out a approach to what I thought would be a simple thing, but after reading a bit through the docs I'm more confused now and was hoping to get some advise. What I want to do is have a single mp2 script service multiple virtual hosts, in order to do this I'd need to set some specific settings related to that virtual host which I can then retrieve from the mp2 script - being able to set something like a hash in the conf for each virtualhost and then have access to all those keys and values would be perfect. For a example, I use HTML template, in my script I define the location of all my templates: $ENV{'HTML_TEMPLATE_ROOT'} = "/websites/domain1/templates"; I want that to become something like $ENV{'HTML_TEMPLATE_ROOT'} = $settings{'this_path_was_defined_in_the_conf_for_this_vh'}; So now that line is good for all the virtualhosts. Thanks -Chris -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Defining specific vars in conf for a shared script
Why are you not using config files and only set the path to this file like this. PerlSetVar my_cnf /etc/vhostconfs/80.cnf PerlSetVar my_cnf /etc/vhostconfs/81.cnf 80.cnf -8<- HTML_TEMPLATE_ROOT = "/websites/80/templates" ->8- You could read the config-file when your application starts-up and then retrieve the values very easily using something like e.g. http://search.cpan.org/~wadg/Config-IniFiles-2.38/ Tom Chris Faust wrote: Hello, I'm having a hard time figuring out a approach to what I thought would be a simple thing, but after reading a bit through the docs I'm more confused now and was hoping to get some advise. What I want to do is have a single mp2 script service multiple virtual hosts, in order to do this I'd need to set some specific settings related to that virtual host which I can then retrieve from the mp2 script - being able to set something like a hash in the conf for each virtualhost and then have access to all those keys and values would be perfect. For a example, I use HTML template, in my script I define the location of all my templates: $ENV{'HTML_TEMPLATE_ROOT'} = "/websites/domain1/templates"; I want that to become something like $ENV{'HTML_TEMPLATE_ROOT'} = $settings{'this_path_was_defined_in_the_conf_for_this_vh'}; So now that line is good for all the virtualhosts. Thanks -Chris -- b e s t s o l u t i o n . a tEDV Systemhaus GmbH ------------ tom schindlleiter softwareentwicklung mobile ++43 664 3145958 eduard-bodem-gasse 8/3A-6020 innsbruck fax ++43 512 935833 http://www.bestsolution.at phone++43 512 935834 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
mod-perl 2.0 - Docu Error
Hi, there's a small issue with the documentation of Apache::RequestRec, where it states in synopsis that one can use $r->dir_config without loading Apache::RequestUtil. One could remove $r->dir_config or also load Apache::RequestUtil. I'd prefer to remove it because its documented as a method of Apache::RequestUtil. Tom Index: RequestRec.pod === RCS file: /home/cvspublic/modperl-docs/src/docs/2.0/api/Apache/RequestRec.pod,v retrieving revision 1.13 diff -r1.13 RequestRec.pod 11c11,12 < --- > use Apache::RequestUtil (); > Index: RequestRec.pod === RCS file: /home/cvspublic/modperl-docs/src/docs/2.0/api/Apache/RequestRec.pod,v retrieving revision 1.13 diff -r1.13 RequestRec.pod 11c11 < --- > 18d17 < my $dir_config = $r->dir_config; -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: No output from script on OSX 10.3/Apache 1.3.29/mod_perl-1.26
You can not run this script in the shell because it expects a Apache::Request-Object which is passed by Apache::Registry to you. Why you are getting Apache::Request is because Apache::Registry is wrapping your "CGI"-Code in an subroutine. The code run inside mod_perl looks something like the following: package . sub handler { use strict; use diagnostics; my $r = shift; $r->print("Content-type: text/plain\n\n"); $r->print("It works"); } Tom Garry Heaton wrote: Sorry, Stas, I jumped the gun editing your original. Just tested: #!/usr/bin/perl -w use strict; use diagnostics; my $r = shift; $r->print("Content-type: text/plain\n\n"); $r->print("It works"); ./test.pl produced: Can't call method "print" on an undefined value at ./test.pl line 6 (#1) (F) You used the syntax of a method call, but the slot filled by the object reference or package name contains an undefined value. Something like this will reproduce the error: $BADREF = undef; process $BADREF 1,2,3; $BADREF->process(1,2,3); Uncaught exception from user code: Can't call method "print" on an undefined value at ./test.pl line 6. Garry -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Problem with perl system() function
Hi, system will wait until the executed shell-script has finished. I'd rather guess that you are not allowed to call the commandline programm you'd like to call. Did you get any thing in the error_log? How do you call the system-command: * system *`` * qx Maybe you could show us the code you're using and we'll tell you whats wrong there. Tom Alejandro Galue wrote: Hello All, I´m using mod_perl2 and Apache2 over Fedora Core 1. I have a handler that need to call an external program to complete the request. This program put its output to a file, and then I read this output from the handler (after system function) to complete the request. My problem is (I assume) when I call system, it returns inmediatly and of course when I try to read the file output, it does not exist; becase it was created later. How can I force to wait for a system function terminate the execution of an external program. Thanks, Alejandro Galue. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Turning off modperl in specific directories
Hi, have either set a ScriptAlias like ---8<--- ScriptAlias /cgi-bin/ "/var/www/main/sub/cgi-bin/" ---8<--- or an AddHandler ---8<--- AddHandler cgi-script .cgi ---8<--- set? Where from should apache know what do with the file? The default handler simply delivers every file. Tom Chad Arimura wrote: Thanks Stas. That makes sense, but when I set the handler to default-handler, running the cgi in a browser just displays the code of the script on the screen... do you know what I'm missing? chad -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED] Sent: Thursday, May 20, 2004 3:57 PM To: Chad Arimura Cc: [EMAIL PROTECTED] Subject: Re: Turning off modperl in specific directories Chad Arimura wrote: I setup our server to handle requests through mod_perl with the following directive: Options FollowSymLinks ExecCGI Order allow,deny Allow from all SetHandler perl-script PerlHandler Apache::Registry There is a subdirectory underneath there that I do NOT want mod_perl to handle. specifically: Turn off here. Is there something that I can use in there to handle the scripts through reg. CGI? Let the guide be with you: http://perl.apache.org/docs/1.0/guide/config.html#Overriding_E_lt_LocationE_ gt__Setting_in__Sub_Location_ -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Turning off modperl in specific directories
Hi, have either set a ScriptAlias like ---8<--- ScriptAlias /cgi-bin/ "/var/www/main/sub/cgi-bin/" ---8<--- or an AddHandler ---8<--- AddHandler cgi-script .cgi ---8<--- set? Where from should apache know what do with the file? The default handler simply delivers every file. Tom Chad Arimura wrote: Thanks Stas. That makes sense, but when I set the handler to default-handler, running the cgi in a browser just displays the code of the script on the screen... do you know what I'm missing? chad -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED] Sent: Thursday, May 20, 2004 3:57 PM To: Chad Arimura Cc: [EMAIL PROTECTED] Subject: Re: Turning off modperl in specific directories Chad Arimura wrote: I setup our server to handle requests through mod_perl with the following directive: Options FollowSymLinks ExecCGI Order allow,deny Allow from all SetHandler perl-script PerlHandler Apache::Registry There is a subdirectory underneath there that I do NOT want mod_perl to handle. specifically: Turn off here. Is there something that I can use in there to handle the scripts through reg. CGI? Let the guide be with you: http://perl.apache.org/docs/1.0/guide/config.html#Overriding_E_lt_LocationE_ gt__Setting_in__Sub_Location_ -- b e s t s o l u t i o n . a tEDV Systemhaus GmbH ------------ tom schindlleiter softwareentwicklung mobile ++43 664 3145958 eduard-bodem-gasse 8/3A-6020 innsbruck fax ++43 512 935833 http://www.bestsolution.at phone++43 512 935834 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Could not be able to compile perl 5.6.0 or 5.6.1 or 5.6.2 on AIX 5.2 with GCC
Hi, this has nothing to do with mod_perl you should give it a try at perl5porters. See http://lists.perl.org/. Tom Bheema Rao Merugu, BSC, Ambattur, Chennai wrote: Hi, Please suggest me on how to compile these versions of perl, moreover I am able to compile 5.8.3 of perl on AIX5.2. the error message its showing is # make make: *** No rule to make target `', needed by `miniperlmain.o'. Stop. Thanks, Bheema. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: mod_perl 2.0 globals question
Nathanial P. Hendler wrote: I'm not sure if this is a style or function question. I'd like to have a module called Debug.pm that has a variable in it that if set to '1' by anything (main script, or other modules) will print debug messages. Reading the Orielly "Practical mod_perl" I thought it was clear what I needed to do, but I am finding it difficult. The following works as one file, but when I break the Debug part into its own file, the value of $D just increments with every re-load... #!/usr/local/bin/perl use strict; use warnings; use CGI qw(:standard); use Debug; print header(); Debug::report('I should not see this line'); $Debug::D++; Debug::report('I should see this line'); $Debug::D++; Debug::report('This one too'); package Debug; use strict; use warnings; use vars qw($D); $D = 0; sub report { my $string = shift; print "DEBUG ($D): $string\n" if $D; } 1; Can anyone explain to me why I can't have a global variable when I put Debug into its own file? Well that's mod_perl. It will compile your script only once perl forked-process|thread (which means it also loads your Debug.pm only once) hence all global variables hold their value. This means the following: * you should see: ---8<--- I should see this line This one too ---8<--- when the request is served by new forked/thread process which has not already loaded your YourModule.pm. * you should see : ---8<--- I should not see this line I should see this line This one too ---8<--- on any next request servered by *exactly this* apache-child. What you could do: * reset $Debug::D directly before print header() e.g. Debug::reset() * make an object out of debug: e.g. $debug = new Debug(), $debug->increment_counter() * use mod_perls logging capabilities. Can anyone tell me how to accomplish what I'm after? Do you want to increase/decrease verbosity or why are you incrementing $D Tom Thanks, Nathanial Hendler Tucson, AZ USA http://retards.org/ -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: mod_perl 2.0 globals question
Nathanial P. Hendler wrote: I'm not sure if this is a style or function question. I'd like to have a module called Debug.pm that has a variable in it that if set to '1' by anything (main script, or other modules) will print debug messages. Reading the Orielly "Practical mod_perl" I thought it was clear what I needed to do, but I am finding it difficult. The following works as one file, but when I break the Debug part into its own file, the value of $D perl runs through the whole code and $D gets set to 0: * when module is loaded * when perl runs through the compiled code (at the end of every request) The var does not get reset at the start of request but at the end of it :-))) just increments with every re-load... #!/usr/local/bin/perl use strict; use warnings; use CGI qw(:standard); use Debug; print header(); Debug::report('I should not see this line'); $Debug::D++; Debug::report('I should see this line'); $Debug::D++; Debug::report('This one too'); package Debug; use strict; use warnings; use vars qw($D); $D = 0; sub report { my $string = shift; print "DEBUG ($D): $string\n" if $D; } 1; Can anyone explain to me why I can't have a global variable when I put Debug into its own file? Can anyone tell me how to accomplish what I'm after? Thanks, Nathanial Hendler Tucson, AZ USA http://retards.org/ -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: mod_perl 2.0 globals question
Nathanial P. Hendler wrote: I'm not sure if this is a style or function question. I'd like to have a module called Debug.pm that has a variable in it that if set to '1' by anything (main script, or other modules) will print debug messages. Reading the Orielly "Practical mod_perl" I thought it was clear what I needed to do, but I am finding it difficult. The following works as one file, but when I break the Debug part into its own file, the value of $D perl runs through the whole code and $D gets set to 0: * when module is loaded * when perl runs through the compiled code (at the end of every request) The var does not get reset at the start of request but at the end of it :-))) just increments with every re-load... #!/usr/local/bin/perl use strict; use warnings; use CGI qw(:standard); use Debug; print header(); Debug::report('I should not see this line'); $Debug::D++; Debug::report('I should see this line'); $Debug::D++; Debug::report('This one too'); package Debug; use strict; use warnings; use vars qw($D); $D = 0; sub report { my $string = shift; print "DEBUG ($D): $string\n" if $D; } 1; Can anyone explain to me why I can't have a global variable when I put Debug into its own file? Can anyone tell me how to accomplish what I'm after? Thanks, Nathanial Hendler Tucson, AZ USA http://retards.org/ -- b e s t s o l u t i o n . a tEDV Systemhaus GmbH tom schindlleiter softwareentwicklung mobile ++43 664 3145958 eduard-bodem-gasse 8/3A-6020 innsbruck fax ++43 512 935833 http://www.bestsolution.at phone++43 512 935834 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] $dbh and config values methods
Nathanial P. Hendler wrote: Ok, so I'm convinced that I should be using Log::Log4Perl. I'm using ModPerl::Registry and was wondering if people could share their approaches to configuration variables and database handlers under mp2. I'd like to have a config module, that holds things like: $document_root= '/var/www/html'; $images_base_path = $document_root . '/images'; $images_base_url = '/images'; %phrases = ( red=>'This is red', blue=>'this is blue' ); To read config-files you could use http://search.cpan.org/~wadg/Config-IniFiles-2.38/. When it comes to the point of creating an Configuration-Class (e.g. to represent things like above) its common to use Singleton-Pattern. But I can also think of reasons to have subroutines as well. The module would need to be available to all of the used modules, and I'd rather not have to pass around a handle. It also seems like it'd be nice if the values were re-written, that it would only last for that session, but that the change would be visible to all modules. How do you guys deal with that? What about a (or several) $dbh handle? I'm going to have SQL queries in all of my modules. Do they all have to create their own $dbh? Is there a well understood approach to this that I'm not finding on the interweb? Thanks again for all the help, I just seem to have a hard time building complex perl systems the same way I used to under mod_perl 2.0, and need a little experience and wisdom to make sure I head in mostly the right direction. As Perrin already said Apache::DBI or once more a Singleton-Class providing the DBH, although I'd use Apache::DBI because it handles everthing for you. Nathanial Hendler Tucson, AZ USA http://retards.org/ -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
[mp2]APR::Brigade issues
More perlish would be: insert_head => unshift insert_tail => push Although these method-names are perfect. next($b) => next() prev($b) => prev() I don't know whether my conception is right but $bb is something like an iterator. Why does one have to pass $bb->next($b) $b, wouldn't $bb->next() that's how iterator work, at least i'd expect that. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
[mp2] APR::Bucket issues
eos_create => create_eos would sound more like you would use it in a human language although I'm also happy with eos_create. flush_create => create_flush same as above Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: mod_perl not able to run some pl files.
well is the "perl" really executing your perl or the one that comes with the system? # which perl If you don't have uninstalled the default perl your command will execute the system perl because its located into /usr/bin/perl. Where's your personal built perl installed? # perl -V will tell you the include-paths of your perl installation. I think you've messed up something. Tom Bheema Rao Merugu, BSC, Ambattur, Chennai wrote: Hi, Please find the CGI.pm version installed in my system # perl -MCGI -e 'print "CGI.pm version $CGI::VERSION\n";' CGI.pm version 3.01 even though its giving the error I think there is some configuration issue with apache and mod_perl. [Thu May 27 18:38:43 2004] [error] Can't locate CGI.pm in @INC (@INC contains: /usr/local/apache/lib/perl5/5.8.3/aix-thread-multi /usr/local/apache/lib/perl5/5.8.3 /usr/local/apache/lib/perl5/site_perl/5.8.3/aix-thread-multi /usr/local/apache/lib/perl5/site_perl/5.8.3 /usr/local/apache/lib/perl5/5.8.3/aix-thread-multi /usr/local/apache/lib/perl5/5.8.3 /usr/local/apache/lib/perl5/site_perl/5.8.3/aix-thread-multi /usr/local/apache/lib/perl5/site_perl/5.8.3 /usr/local/apache/lib/perl5/site_perl . /usr/local/apache/ /usr/local/apache/lib/perl) at /export/home/perl/test.pl line 10. BEGIN failed--compilation aborted at /export/home/perl/test.pl line 10. Thanks, Bheema. -Original Message- From: Brian Reichert [mailto:[EMAIL PROTECTED] Sent: Thursday, May 27, 2004 10:01 PM To: Bheema Rao Merugu, BSC, Ambattur, Chennai Cc: [EMAIL PROTECTED]; Stas Bekman Subject: Re: mod_perl not able to run some pl files. On Thu, May 27, 2004 at 07:45:49PM +0530, Bheema Rao Merugu, BSC, Ambattur, Chennai wrote: Hi, I am getting the below error message in the error_log file. but I had the CGI.pm in the path /usr/local/apache/lib/perl5/5.8.3 When you say you 'had' CGI.pm in that path, do you mean that you used that perl installation to make/install the module? Or did you merely copy it in? If the latter, make sure that you have permissions on the file set properly. Thanks, Bheema -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2]APR::Brigade issues
Ok. I have no idea of the C-API so things should be fine. Tom Stas Bekman wrote: Tom Schindl wrote: More perlish would be: insert_head => unshift insert_tail => push Although these method-names are perfect. I should have mentioned that we want to stay as close as possible to the C API and change things only when things aren't quite perlish (like when C passes its arguments by reference, in order to return more than one argument). Otherwise we try to mostly stick to the C API. That's in order to make the life of those who have to write modules in Perl and C Apache API. [...] -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Updating Apache and Mod_Perl
Hi, I would download apache, perl and mod_perl and compile it my own. I would not uninstall anything from your 7.3-rpm-packages. You said that you want to switch to a newer OS version. Please also keep in mind if you want to switch e.g. to Fedora, Mandrake, SuSE that they ship with apache2 + mod_perl2 as standard-apaches. You should develop your mp2-modules for this target platform else you maybe have to port them when switching :-(. The additional diskspace needed is not very big: apache-1.3: ~12MB apache-2.0: ~27MB perl-5.8.4+CPAN-Modules: ~50MB + 10-20MB You could run the apache e.g. on port 8080 instead of the standard port 80. Tom David Arnold wrote: All, I've been encouraged on this list to update my versions of Apache and mod_perl, which I think a good suggestion. However, I am no operating system guru (just a math teacher), so I get quite fearful with these updates. Still, I do have an office machine that is quite behind the times, operating system wise: [EMAIL PROTECTED] root]# cat /proc/version Linux version 2.4.18-3 ([EMAIL PROTECTED]) (gcc version 2.96 2731 (Red Hat Linux 7.3 2.96-110)) #1 Thu Apr 18 07:37:53 EDT 2002 Note the Red Hat Linux 7.3. It's my intent to update the operating system on this machine this summer, so this would be a good machine on which to do an experimental update of Apache and mod_perl. If I mangle things badly, I can just resinstall a new version of Red Hat. However, what is the best way to proceed. On Windows, I go the the Uninstall Software tool in the control panel and remove the older piece of software before installing the update. In linux, particularly RedHat, I know that the Apache installation is spread out all over the distribution tree, which is probably far from ideal (why do they do that). To conserve disk space, I'd rather not have two distributions of Apache on the hard drive. So, how do I uninstall the older version before installing the new one? I know it probably has something to do with the rpm utility, but from what I've read over the years, what will probably happen is I will get asked a bunch of questions like "you'll have to remove this or that" which I never know whether to answer "yes" or "no." So, can anyone offer some step-by-step help about uninstalling the older versions of Apache and mod_perl on this machine. Secondly, what do I need to do after that (remember, I have Red Hat 7.3) prior to installing the latest versions of Apache and mod_perl. Once I get to this spot, I think I'll be OK, as the instructions for installing Apache and mod_perl seem pretty good. What I need help with is the uninstall and the other preparation that will be needed before starting the install of Apache and mod_perl. Thanks to anyone kind enough to help me out with this. :-) -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: XML::XSLT and mod_perl 2.0
Hi, I admit I've never used XML::XSLT but why are you not using XML::LibXSLT? Tom Jesse Stay wrote: I admit I have not tried this in mod_perl 1.x but I am really trying to move towards developing and helping out the mod_perl 2.0 movement. Hopefully someone has some pointers. Here's my problem: I am struggling to get XML::XSLT to work under mod_perl 2.0. All it takes is using the basic MyApache::Rocks module from the docs, and adding the following line to cause the error, but I have tried it in other various mod_perl 2.0 programs as well, all with the same results: Error while parsing: \nsyntax error at line 1, column 0, byte 0 at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/XML/Parser.pm line 187\n\ntest.xsl at /usr/lib/perl5/site_perl/5.8.0/XML/XSLT.pm line 1506.\n The code my Perl module is referencing contains one simple call (along with use XML::XSLT;): my $xslt = XML::XSLT->new ('test.xsl', warnings => 1); Doing a trace, that is what is generating the error, and it seems to fail in XML::Parser::Expat's ParseString() call. "test.xsl" contains the basic test xsl script from w3schools.com: http://www.w3.org/1999/XSL/Transform";> My CD Collection Title Artist When I run this under mod_perl I get the syntax error. When I run it as a regular perl script it runs fine without any errors. I have searched every resource I can find and can't seem to find anyone else with this problem. Does anyone have any suggestions on where I could go from here? It seems really weird that mod_perl would even affect something as simple as parsing an xml file. -Jesse -- b e s t s o l u t i o n . a tEDV Systemhaus GmbH ------------ tom schindlleiter softwareentwicklung mobile ++43 664 3145958 eduard-bodem-gasse 8/3A-6020 innsbruck fax ++43 512 935833 http://www.bestsolution.at phone++43 512 935834 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: XML::XSLT and mod_perl 2.0
Hi, Frankly I haven't tried XML::LibXSLT on Apache2 but I don't see any reason why it should not work beside maybe threading issues. For a instruction on getting started with libxml/libxslt on RH9 take a look at http://axkit.org/wiki/view/AxKit/AxKitRedHat9# and http://axkit.org/wiki/view/AxKit/AxKitRedHat9AnotherWay# Another way which is supported on apache2 would be mod_xslt which is based upon Saxon. Tom Jesse Stay wrote: Partially because XML::XSLT is more widely used and partially because XML::LibXSLT seems to have problems with RH 9.0 on the system I'm running it on. Can you verify that XML::LibXSLT will work in a mod_perl 2.0 environment? If it has been verified I will probably push a little more towards getting that to work instead. However, it still doesn't solve the problem of XML::XSLT not working under mod_perl 2.0 - try it yourself and you'll see. I had a friend try it and they can't get it to work either - is this an Apache 2.0 issue rather than mod_perl itself? I do appreciate your help! -Jesse -----Original Message- From: Tom Schindl [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 5:27 AM To: Jesse Stay Cc: [EMAIL PROTECTED] Subject: Re: XML::XSLT and mod_perl 2.0 Hi, I admit I've never used XML::XSLT but why are you not using XML::LibXSLT? Tom Jesse Stay wrote: I admit I have not tried this in mod_perl 1.x but I am really trying to move towards developing and helping out the mod_perl 2.0 movement. Hopefully someone has some pointers. Here's my problem: I am struggling to get XML::XSLT to work under mod_perl 2.0. All it takes is using the basic MyApache::Rocks module from the docs, and adding the following line to cause the error, but I have tried it in other various mod_perl 2.0 programs as well, all with the same results: Error while parsing: \nsyntax error at line 1, column 0, byte 0 at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/XML/Parser.pm line 187\n\ntest.xsl at /usr/lib/perl5/site_perl/5.8.0/XML/XSLT.pm line 1506.\n The code my Perl module is referencing contains one simple call (along with use XML::XSLT;): my $xslt = XML::XSLT->new ('test.xsl', warnings => 1); Doing a trace, that is what is generating the error, and it seems to fail in XML::Parser::Expat's ParseString() call. "test.xsl" contains the basic test xsl script from w3schools.com: http://www.w3.org/1999/XSL/Transform";> My CD Collection Title Artist When I run this under mod_perl I get the syntax error. When I run it as a regular perl script it runs fine without any errors. I have searched every resource I can find and can't seem to find anyone else with this problem. Does anyone have any suggestions on where I could go from here? It seems really weird that mod_perl would even affect something as simple as parsing an xml file. -Jesse -- b e s t s o l u t i o n . a tEDV Systemhaus GmbH -- -- tom schindlleiter softwareentwicklung mobile ++43 664 3145958 -- -- eduard-bodem-gasse 8/3A-6020 innsbruck fax ++43 512 935833 http://www.bestsolution.at phone++43 512 935834 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: IO::File problem on Mod_perl
Huilli Liu wrote: Hi All, Recently I are migrating cgi to mod_perl but it is running out of the problem for IO::File. Here are my original codes: Try it like this: -8<- use Apache::RequestUtil (); $template_file = new IO::File($r->document_root()."templates/quickquote.templ"); ->8- mp2 does not chdir because chdir will affect all threads!!! http://perl.apache.org/docs/2.0/user/coding/coding.html#Thread_environment_Issues Tom my $template_file = new IO::File("templates/quickquote.templ"); $template_file->input_record_separator(undef); my $template = <$template_file>; $template_file->close; "templates/quickquote.templ" is under "DocumentRoot" directory but it looks like it can not find the file. The error I got is as below: [Wed Jun 16 16:52:46 2004] [error] [client 10.5.20.105] Can't call method "input_record_separator" on an undefined value at c:/Apache2/modperl/MyApache/StockList.pm line 628. , referer: http://localhost:8080/stocklist Is there anyone who has the experience for this problem? Please give me some advices if you know how to fix it. Thanks, Willy Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
[mp2] and AuthDBI PerlAuth(en|z)Handler failing
hi all, preface: I'm not 100% sure that this is a mp2 resp. AuthDBI problem, this might as well be an apache problem or even worse my own blindness. We've a problem with a previously working configuration that looks approximately like this (httpd.conf): -CUT- AuthName "gimme all you know:" AuthType Basic PerlAuthenHandler Apache::AuthDBI::authen PerlAuthzHandler Apache::AuthDBI::authz PerlSetVar Auth_DBI_data_source dbi:$some_valid_dsn PerlSetVar Auth_DBI_username $a_db_user PerlSetVar Auth_DBI_password $the_db_pass PerlSetVar Auth_DBI_pwd_table users PerlSetVar Auth_DBI_uid_field u_username PerlSetVar Auth_DBI_pwd_field u_pwd #SELECT pwd_field FROM pwd_table WHERE uid_field=$user PerlSetVar Auth_DBI_grp_field u_ref_customer PerlSetVar Auth_DBI_encrypted off require valid-user -CUT- That allows me to secure /protectedthing, which is working just fine. I however have some sub-locations under /protectedthing: -CUT- SetHandler perl-script PerlResponseHandler Some::Nice::mp2::Handler -CUT- Previously this resulted in having a secured /protected/topsecret location. After upgrading to the lastest apache 2.0.49 and mp1.99_14, this does not work any more. I get 500 instead. The log shows this: -CUT- [Wed Jun 30 16:15:50 2004] [crit] [client 192.168.100.10] configuration error: couldn't check user. No user file?: /protectedthing/topsecret, referer: http://somesite/protectedthing -CUT- After enabling debug in AuthDBI I see that it is correctly invoked as a PerlAuth(en|z)Handler for "/protectedthing/topsecret", but it gets no configuration data passed (Auth_DBI_data_source etc.) for the sublocation. ... I am completely lost here ... Any ideas? happy hacking udo Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Cached vars
Hi, why are you not using the header functions provided by mod_perl, the problem you're having is described here: http://perl.apache.org/docs/2.0/user/coding/coding.html#Generating_HTTP_Response_Headers Things used here: http://perl.apache.org/docs/2.0/api/APR/Table.html#C_set_ http://perl.apache.org/docs/2.0/api/Apache/RequestRec.html#C_headers_out_ -8<- my $r = Apache->request; $r->content_type("text/html"); $r->headers_out->set("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); $r->headers_out->set("Last-Modified", gmtime(time) . " GMT"); $r->headers_out->set("Cache-Control", "no-cache"); $r->headers_out->set("Cache-Control", "post-check=0, pre-check=0"); $r->headers_out->set("Pragma", "no-cache"); $r->headers_out->set("Character-Set", "windows-1251"); $r->headers_out->set("Content-Type", "text/html;charset=windows-1251"); $r->print("mod_perl rules!"); 1; -8<- Tom Vadim wrote: I found a lot of useful information in "perldoc Apache::Status" (thanks Ruslan) But i still have a problem. When i run this script under ModPerl::Registry for several times, i get the warrning in the my error.log [Thu Jul 08 21:55:04 2004] [warn] /perl/test.pl did not send an HTTP header Why so it? Please, direct me to respective manual. So, test.pl - #!/usr/bin/perl -w package Headers; use strict; sub new { my $this = shift; my $class = ref($this) || $this; my $self = {}; bless $self, $class; $self->{headers} = { "Expires" => "Mon, 26 Jul 1997 05:00:00 GMT", "Last-Modified" => gmtime(time) . " GMT", "Cache-Control" => "no-cache", "Cache-Control" => "post-check=0, pre-check=0", "Pragma"=> "no-cache", "Character-Set" => "windows-1251", "Content-Type" => "text/html; charset=windows-1251", }; return $self; } sub print { my $self = shift; print $_, ": ", $self->{headers}->{$_}, "\n" for keys %{ $self->{headers} }; print "\n"; } package main; use strict; use warnings; our $HEADERS = new Headers; $HEADERS->print(); print 1; - On Thu, 2004-07-08 at 12:09, Vadim wrote: Are there any way to dump all cached vars for scripts under mod_perl? Can you explain what you mean by "cached vars"? Are you talking about global variables? - Perrin Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Cached vars
Hi, why are you not using the header functions provided by mod_perl, the problem you're having is described here: http://perl.apache.org/docs/2.0/user/coding/coding.html#Generating_HTTP_Response_Headers Things used here: http://perl.apache.org/docs/2.0/api/APR/Table.html#C_set_ http://perl.apache.org/docs/2.0/api/Apache/RequestRec.html#C_headers_out_ -8<- my $r = Apache->request; $r->content_type("text/html"); $r->headers_out->set("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); $r->headers_out->set("Last-Modified", gmtime(time) . " GMT"); $r->headers_out->set("Cache-Control", "no-cache"); $r->headers_out->set("Cache-Control", "post-check=0, pre-check=0"); $r->headers_out->set("Pragma", "no-cache"); $r->headers_out->set("Character-Set", "windows-1251"); $r->headers_out->set("Content-Type", "text/html;charset=windows-1251"); $r->print("mod_perl rules!"); 1; -8<- Tom Vadim wrote: I found a lot of useful information in "perldoc Apache::Status" (thanks Ruslan) But i still have a problem. When i run this script under ModPerl::Registry for several times, i get the warrning in the my error.log [Thu Jul 08 21:55:04 2004] [warn] /perl/test.pl did not send an HTTP header Why so it? Please, direct me to respective manual. So, test.pl - #!/usr/bin/perl -w package Headers; use strict; sub new { my $this = shift; my $class = ref($this) || $this; my $self = {}; bless $self, $class; $self->{headers} = { "Expires" => "Mon, 26 Jul 1997 05:00:00 GMT", "Last-Modified" => gmtime(time) . " GMT", "Cache-Control" => "no-cache", "Cache-Control" => "post-check=0, pre-check=0", "Pragma"=> "no-cache", "Character-Set" => "windows-1251", "Content-Type" => "text/html; charset=windows-1251", }; return $self; } sub print { my $self = shift; print $_, ": ", $self->{headers}->{$_}, "\n" for keys %{ $self->{headers} }; print "\n"; } package main; use strict; use warnings; our $HEADERS = new Headers; $HEADERS->print(); print 1; --------- On Thu, 2004-07-08 at 12:09, Vadim wrote: Are there any way to dump all cached vars for scripts under mod_perl? Can you explain what you mean by "cached vars"? Are you talking about global variables? - Perrin Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- b e s t s o l u t i o n . a tEDV Systemhaus GmbH tom schindlleiter softwareentwicklung mobile ++43 664 3145958 eduard-bodem-gasse 8/3A-6020 innsbruck fax ++43 512 935833 http://www.bestsolution.at phone++43 512 935834 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Cached vars
Stas Bekman wrote: Tom Schindl wrote: [...] The very first URL, that you've quoted Tom, mentions that for certain headers you ought to use special Apache methods. Which is the case for content_type, no_cache and a few others. Apache does more things than just setting those headers. Your suggestion may work in a simple case, but not in a more complex setup. Ok, I see. But how do you then set something like e.g an expires header? The only time when you want to use your own headers for everything is when you send non-parsed headers responses, which are also mentioned in that section. Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Cached vars
Stas Bekman wrote: [...] You set it explicitly, as in your example. Again, you need to use the special methods only for some of the headers. May be that section should explicitly list all those special headers. Patches are welcome. I forgot that we have a whole chapter on that topic: http://perl.apache.org/docs/general/correct_headers/correct_headers.html While it was written for mp1, the concepts apply for mp2 as well (With the tweaks for API changes) Ok. Working through the docs(converting to mp2-API) the following question came to my mind: Are there any rules, which (response-)method is in which module? - no_cache is found in Apache::RequestUtil - update_mtime/set_last_modified are found in Apache::Response - content_type is found in Apache::RequestRec - headers_out/error_headers_out are found in Apache::RequestRec Doesn't they all belong to Apache::Response, they all deal with the Response, don't they? Tom Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Cached vars
Stas Bekman wrote: Tom Schindl wrote: Stas Bekman wrote: Tom Schindl wrote: [...] The very first URL, that you've quoted Tom, mentions that for certain headers you ought to use special Apache methods. Which is the case for content_type, no_cache and a few others. Apache does more things than just setting those headers. Your suggestion may work in a simple case, but not in a more complex setup. Ok, I see. But how do you then set something like e.g an expires header? You set it explicitly, as in your example. Again, you need to use the special methods only for some of the headers. May be that section should explicitly list all those special headers. Patches are welcome. So far I've identified the following methods: Apache::ResquestUtil * no_cache Apache::Response * set_content_length * set_etag * set_keepalive * update_mtime * set_last_modified Have I forgotten any? Tom I forgot that we have a whole chapter on that topic: http://perl.apache.org/docs/general/correct_headers/correct_headers.html While it was written for mp1, the concepts apply for mp2 as well (With the tweaks for API changes) Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Hi, Is Apache allowed to change into this directory/read the file, try to move it to e.g. /tmp and see if it works. You could also insert a print-Statement and you should see the output on the console when apache is started (stop/start not restart). I'm not sure but I think a restart will not reload PerlRequire things. Maybe someone could correct me if I'm wrong. You could also test it using "apachectl configtest" and you should see the output. Tom David Arnold wrote: All, I have this in conf/httpd.conf: # Startup File: PerlRequire /home/darnold/modperl/startup.pl And: [EMAIL PROTECTED] apache]# cat /home/darnold/modperl/startup.pl # File: startup.pl use lib qw(/home/darnold/modperl/); 1; However, I am getting this in my error log: Can't locate OnlineTestingDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) Shouldn't @INC contain /home/darnold/modperl? Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Adding more locations to INC in startup.pl
Yes. David Arnold wrote: All, Is this OK? # File: startup.pl use lib qw(/home/darnold/modperl/); use lib qw(/usr/local/apache/module/); 1; Where I've mkdir the module directory in /usr/local/apache. Can't test at the moment until I figure out my last question. Thanks. Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Tom Schindl wrote: Hi, Is Apache allowed to change into this directory/read the file, try to move it to e.g. /tmp and see if it works. You could also insert a print-Statement and you should see the output on the console when apache is started (stop/start not restart). I'm not sure but I think a restart will not reload PerlRequire things. Maybe someone could correct me if I'm wrong. If I'm not wrong here's a doc-patch. You could also test it using "apachectl configtest" and you should see the output. Tom David Arnold wrote: All, I have this in conf/httpd.conf: # Startup File: PerlRequire /home/darnold/modperl/startup.pl And: [EMAIL PROTECTED] apache]# cat /home/darnold/modperl/startup.pl # File: startup.pl use lib qw(/home/darnold/modperl/); 1; However, I am getting this in my error log: Can't locate OnlineTestingDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) Shouldn't @INC contain /home/darnold/modperl? Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird Index: config.pod === RCS file: /home/cvspublic/modperl-docs/src/docs/1.0/guide/config.pod,v retrieving revision 1.18 diff -u -r1.18 config.pod --- config.pod 26 Nov 2003 08:40:10 - 1.18 +++ config.pod 23 Jul 2004 06:28:09 - @@ -665,6 +665,9 @@ C'd, it must return a I value. To ensure that this happens don't forget to add C<1;> at the end of I. +Modules and modification e.g. to C<@INC> loaded via these Directives are only +made if you issue a full stop/start, a restart is not sufficient. + =head2 Perl*Handlers As you probably know Apache traverses a loop for each HTTP request it -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Hi, you should have said that you are running as CGI. Here the modification using PerlRequire doesn't have any effects because you are starting a new perl-interpreter for every request. You should make a Apache::Registry-Script out of it, else you'll have to stick with use lib qw() in your .cgi. Tom David Arnold wrote: Tom et al, OK. Permissions on startup.pl are: -rwx--1 darnold darnold 146 Jul 22 23:07 startup.pl But I am running Apache with user=darnold and group darnold. I put a print statement in startup.pl, which was a good idea by the way. # File: startup.pl use lib qw(/home/darnold/modperl/); use lib qw(/usr/local/apache/modules/); print "Starting up David's startup.pl file\n"; 1; Then I stopped and started Apache: [EMAIL PROTECTED] apache]# bin/apachectl stop bin/apachectl stop: httpd stopped [EMAIL PROTECTED] apache]# bin/apachectl start Starting up David's startup.pl file bin/apachectl start: httpd started And there's my print statement, so I'm excited. But, I have a little module in /home/darnold/modperl called WebDB.pm. [EMAIL PROTECTED] modperl]$ ll WebDB.pm -rw---1 darnold darnold 716 Jul 18 14:21 WebDB.pm It's the usual, with: package WebDB; # File: WebDB.pm use strict; use DBI; . . . 1; Now, I have a file in /usr/local/apache/cgi-bin/ that "uses" this module. #! /usr/local/bin/perl -w # File: Quiz1Solns.pl use strict; use WebDB; . . . But calling it from my browser causes: Can't locate WebDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) at /usr/local/apache/cgi-bin/Quiz1Solns.pl line 9. See, those two extra locations in my startup are not included in INC. If I do this, #! /usr/local/bin/perl -w # File: Quiz1Solns.pl use lib qw(/home/darnold/modperl/); use strict; use WebDB; . . . Then all is well. Hmmm.... Any suggestions? At 07:25 AM 7/23/04 +0200, Tom Schindl wrote: Hi, Is Apache allowed to change into this directory/read the file, try to move it to e.g. /tmp and see if it works. You could also insert a print-Statement and you should see the output on the console when apache is started (stop/start not restart). I'm not sure but I think a restart will not reload PerlRequire things. Maybe someone could correct me if I'm wrong. You could also test it using "apachectl configtest" and you should see the output. Tom David Arnold wrote: All, I have this in conf/httpd.conf: # Startup File: PerlRequire /home/darnold/modperl/startup.pl And: [EMAIL PROTECTED] apache]# cat /home/darnold/modperl/startup.pl # File: startup.pl use lib qw(/home/darnold/modperl/); 1; However, I am getting this in my error log: Can't locate OnlineTestingDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) Shouldn't @INC contain /home/darnold/modperl? Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Hi, Is Apache allowed to change into this directory/read the file, try to move it to e.g. /tmp and see if it works. You could also insert a print-Statement and you should see the output on the console when apache is started (stop/start not restart). I'm not sure but I think a restart will not reload PerlRequire things. Maybe someone could correct me if I'm wrong. You could also test it using "apachectl configtest" and you should see the output. Tom David Arnold wrote: All, I have this in conf/httpd.conf: # Startup File: PerlRequire /home/darnold/modperl/startup.pl And: [EMAIL PROTECTED] apache]# cat /home/darnold/modperl/startup.pl # File: startup.pl use lib qw(/home/darnold/modperl/); 1; However, I am getting this in my error log: Can't locate OnlineTestingDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) Shouldn't @INC contain /home/darnold/modperl? Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- b e s t s o l u t i o n . a tEDV Systemhaus GmbH ------------ tom schindlleiter softwareentwicklung mobile ++43 664 3145958 eduard-bodem-gasse 8/3A-6020 innsbruck fax ++43 512 935833 http://www.bestsolution.at phone++43 512 935834 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Stas Bekman wrote: Tom Schindl wrote: [...] That's not special to startup.pl, but to any files loaded via PerlModule and PerlRequire. And it's not true if PerlFreshRestart is used or mod_perl is built as DSO. This is documented here: http://perl.apache.org/docs/1.0/guide/config.html#PerlFreshRestart and here: http://perl.apache.org/docs/1.0/guide/config.html#PerlModule_and_PerlRequire_Directives Cool. Now it's in the docs and people don't wonder why their @INC does not get changed, although they source in using startup.pl. Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Stas Bekman wrote: Tom Schindl wrote: Stas Bekman wrote: Tom Schindl wrote: [...] That's not special to startup.pl, but to any files loaded via PerlModule and PerlRequire. And it's not true if PerlFreshRestart is used or mod_perl is built as DSO. This is documented here: http://perl.apache.org/docs/1.0/guide/config.html#PerlFreshRestart and here: http://perl.apache.org/docs/1.0/guide/config.html#PerlModule_and_PerlRequire_Directives Cool. Now it's in the docs and people don't wonder why their @INC does not get changed, although they source in using startup.pl. Sorry, Tom, I didn't get it. Are you happy with the explanation in the above URLs, or do you suggest to add your doc patch for an extra clarification? No. I'm happy with the patches you made, you made one after my mail didn't you and I haven't seen it before. Mine is not needed anymore. Tom Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Using DBI and Apache::DBI together
Boris Zentner wrote: Am Mittwoch 28 Juli 2004 06:36 schrieb Chris Ochs: We have our own application server built on mod perl and the template toolkit. Most of the application specific sql queries all run as a single user which is great for Apache::DBI. Every end user also has 3-4 tables they can query (using the template toolkit DBI plugin) using their own username, and for I do not want to use Apache::DBI because it results in too many cached connections. Other than hacking DBI.pm and adding our own disconnect function which won't be overriden by Apache::DBI, does anyone know of a better way to have both cached and non cached connections in the same apache/mod perl process? # bypass Apache::DBI $dbh = DBI->connect($data_source, $username, $password, { dbi_connect_method => 'connect' }) || die; I knew there is such a parameter, but couldn't remember it. So I took a look at Apache::DBI's manpage but this parameter is not mentionned. Have I missed that somewhere or where did you find it? If its not in the man-page it might me good idea to contact the module author and ask :-) him to add this parameter. Tom Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Environment Variables and @INC
Ian Michell wrote: Hi, I have a slight problem. I want to know it is possible to use a variable to set part of the @INC path. Although that's a little bit off topic and much more a perl question. Yes. You can. testlib/MYTEST.pm 8< print "LOADED\n"; 1; 8< test-env.pl 8< my $test = "testlib"; use lib $ENV{testlib}; use MYTEST; print "ENDED\n"; 8< 8< [EMAIL PROTECTED] tom]$ export testlib=testlib [EMAIL PROTECTED] tom]$ perl test.pl LOADED ENDED [EMAIL PROTECTED] tom]$ 8< with a localy defined var I get the expected behaviour: test-var.pl 8< my $var = "testlib"; use lib $var; use MyModule; 8< but you can work around this with begin-block: test-var-begin.pl 8< BEGIN { $main::test = "testlib"; } use strict; use lib $main::test; use MYTEST; print "ENDED\n"; 8< i.e. current code that works: use lib qw ( /usr/local/www/cvg-bin/ ); Is there a way to make it use an environment variable But you don't really need that because the actual working directory which is /usr/local/www/cgi-bin/ (apache cds to this and executes the cgi) is already in the lib-path. If you want to add other lib-dirs below that path e.g. 8< /usr/local/www/cgi-bin/testlibs1 /usr/local/www/cgi-bin/testlibs2 8< a relative 8< use lib qw( testlibs1 testlibs2 ); 8< is sufficient. Rgds /usr/local/www/cvg-bin/ Ian M Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: "error 111" occurred when I run "make test"
Hi, well I don't know exactly what's going wrong but it seems that your mod_perl misses building with Transhandler hooks. Normally I let mod_perl also build/install my apache and secondly you should issue the following make file command: ---8<--- [EMAIL PROTECTED] apache]$ tar xzvf apache_1.3.29.tar.gz [EMAIL PROTECTED] apache]$ tar xzvf mod_perl-1.0-current.tar.gz [EMAIL PROTECTED] apache]$ cd mod_perl-1.29/ [EMAIL PROTECTED] mod_perl-1.29]$ perl Makefile.PL DO_HTTPD=1 USE_APACI=1 \ > APACHE_PREFIX=/usr/local/apache EVERYTHING=1 [EMAIL PROTECTED] apache]$ make && make test && make install ---8<--- This is also documented in INSTALL.simple which comes with your mod-perl-packages. Tom YY Liu wrote: Hello everyone! When I installed RH9.0, perl5 was installed on my system automatically. And now I tar apache-1.3.31 under the /home/globus/Project/apache-1.3.31 directory and install it under /usr/local/apache. Modperl-1.0 was tared in the same directory. I have installed apache successfully. When I run the following commands, everything looks good. perl Makefile.PL PL APACHE_SRC=/www/apache/src perl Makefile.PL DO_HTTPD=1 perl Makefile.PL USE_APACI=1 perl Makefile.PL PERL_HTTPD=1 perl Makefile.PL EVERYTHING=1 make Then I start to "make test" but there is some error occurred and there is no file t/logs/error_log. The following is the error info. Who know the reason and help me? Thanks a lot! // cp t/conf/mod_perl_srm.conf t/conf/srm.conf ../apache_1.3.31/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t & httpd listening on port 8529 will write error_log to: t/logs/error_log letting apache warm up...\c Syntax error on line 3 of /home/globus/Project/mod_perl-1.29/t/conf/srm.conf: Invalid command 'PerlTransHandler', perhaps mis-spelled or defined by a module not included in the server configuration done /usr/bin/perl t/TEST 0 still waiting for server to warm up...not ok server failed to start! (please examine t/logs/error_log) at t/TEST line 95. make: *** [run_tests] Error 111 _ Do You Yahoo!? 150äæMP3ççæïæéåéäæå http://music.yisou.com/ çåææåæåæïæéçåãèååéå http://image.yisou.com 100åéçåäåçïéèçéèåæåï http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/ Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: "error 111" has been solved and some error occurred when configure apache
Well once more let mod_perl do everything for you, see howto do that using INSTALL.simple.mod_ssl. --8<-- [EMAIL PROTECTED] apache]$ tar xzvf openssl-0.9.7d.tar.gz [EMAIL PROTECTED] apache]$ cd openssl-0.9.7d [EMAIL PROTECTED] openssl-0.9.7d]$ ./config --prefix=/opt/ssl [EMAIL PROTECTED] openssl-0.9.7d]$ make && make test [EMAIL PROTECTED] openssl-0.9.7d]$ su [EMAIL PROTECTED] openssl-0.9.7d]$ make install [EMAIL PROTECTED] openssl-0.9.7d]$ exit [EMAIL PROTECTED] apache]$ cd .. [EMAIL PROTECTED] apache]$ tar xzvf mod_ssl-2.8.16-1.3.29.tar.gz [EMAIL PROTECTED] apache]$ cd mod_ssl-2.8.16 [EMAIL PROTECTED] apache]$ cd mod_ssl-2.8.16-1.3.29 [EMAIL PROTECTED] mod_ssl-2.8.16-1.3.29]$ ./configure \ --with-apache=../apache_1.3.29 [EMAIL PROTECTED] mod_ssl-2.8.16-1.3.29]$ cd .. [EMAIL PROTECTED] apache]$ tar xzvf mod_gzip-1.3.26.1a.tgz [EMAIL PROTECTED] apache]$ mkdir apache_1.3.29/src/modules/gzip [EMAIL PROTECTED] apache]$ cp mod_gzip-1.3.26.1a/*.c \ > apache_1.3.29/src/modules/gzip/ [EMAIL PROTECTED] apache]$ cp mod_gzip-1.3.26.1a/*.h \ > apache_1.3.29/src/modules/gzip/ [EMAIL PROTECTED] apache]$ cp mod_gzip-1.3.26.1a/Makefile.tmpl \ > apache_1.3.29/src/modules/gzip/ [EMAIL PROTECTED] apache]$ vi apache_1.3.29/src/modules/gzip/Makefile.tmpl [ edit ... ] #LIB=libgzip.$(LIBEXT) LIB=libgzip.a [EMAIL PROTECTED] apache]$ cd mod_perl-1.29 [EMAIL PROTECTED] mod_perl-1.29]$ perl Makefile.PL DO_HTTPD=1 USE_APACI=1 \ > APACHE_PREFIX=/usr/local/apachessl EVERYTHING=1 \ > SSL_BASE=/opt/ssl \ > APACI_ARGS=--enable-module=ssl,--enable-module=rewrite,--activate-module=src/modules/gzip/mod_gzip.c ... --8<-- Tom YY Liu wrote: Thanks a million, Tom! I have installed the mod_perl successfully according to your method. And I want to configure the apche on RH9 and I hava installed the following components--mod_perl, mod_ssl, openssl, mod_gzip.c separeately and there is no error, but when I run the command which is to add all modules to apache: [EMAIL PROTECTED] apache_1.3.31]$ ./configure --prefix=/usr/local/apache --activate-module=src/modules/perl/libperl.a --activate-module=src/modules/ssl/libssl.a --add-module=src/modules/mod_gzip/mod_gzip.c --enable-module=so But there is some error info: Error: Cannot find SSL binaries under /home/globus/Project/mod_ssl-2.8.19-1.3.31 Do u know the reason? What's "SSL banaries"? Any others coould help me? Thanks a lot! --- Tom Schindl <[EMAIL PROTECTED]> çææï Hi, well I don't know exactly what's going wrong but it seems that your mod_perl misses building with Transhandler hooks. Normally I let mod_perl also build/install my apache and secondly you should issue the following make file command: ---8<--- [EMAIL PROTECTED] apache]$ tar xzvf apache_1.3.29.tar.gz [EMAIL PROTECTED] apache]$ tar xzvf mod_perl-1.0-current.tar.gz [EMAIL PROTECTED] apache]$ cd mod_perl-1.29/ [EMAIL PROTECTED] mod_perl-1.29]$ perl Makefile.PL DO_HTTPD=1 USE_APACI=1 \ > APACHE_PREFIX=/usr/local/apache EVERYTHING=1 [EMAIL PROTECTED] apache]$ make && make test && make install ---8<--- This is also documented in INSTALL.simple which comes with your mod-perl-packages. _ Do You Yahoo!? 150äæMP3ççæïæéåéäæå http://music.yisou.com/ çåææåæåæïæéçåãèååéå http://image.yisou.com 100åéçåäåçïéèçéèåæåï http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/ Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: request appears to be processed twice with PDF::Create
Hi, Are you sure that's working as you expected? If I got you right I'm afraid I have to disappoint you but this only works if the second request is handled by the same apache-child as the first one and there's another problem. If you come back one day later and hit the same apache-child which already processed the first request, you won't get anything. Tom Dermot Paikkos wrote: Arnaud, I have found a way around this. I don't know if your interested but it goes likes something like this: foreach my $param ($r->param) { if ($param =~ /\busers\b/) { $users{$r->param($param)} = 0; } snip...then later foreach my $key (keys %users) { next if ($users{$key} == 1; $users{$key} = 1; } The idea being you only work request that haven't been processed yet. Once you process a request you increment that hash key to 1 and can avoid using it again. IE still sends the request twice and it is working with the first request not the second. Just a thought. Dp. On 29 Jul 2004 at 16:20, Arnaud Blancher wrote: Dermot Paikkos a écrit : Does this mean you have to go an clean up these files later yes, if you dont want they stay on the disk. or is this done when the process ends? maybe you can write a special handle for the directory where you ll write your pdf that delete the pdf when the connection (due to the redirect) will be close by the client (but i'not sure). I don't want to slow the users down unless I have to. I think I would like to determine the user-agent and work around the repeating requestssomehow. Do you know how to find out the user- agent when using Apache::Request? I can't see it when I use this object. Thanx. Dp. ~~ Dermot Paikkos * [EMAIL PROTECTED] Network Administrator @ Science Photo Library Phone: 0207 432 1100 * Fax: 0207 286 8668 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: How to use, after install...
Hi, the best thing would be: 1. Read docs at perl.apache.org 2. Get one of the various good books which are out there: e.g. http://www.amazon.de/exec/obidos/ASIN/0596002270/qid=1091174088/ref=sr_8_xs_ap_i1_xgl/028-6908240-1456549 ModPerl List wrote: How do I actually use mod_perl once I install it? If I put a perl file written for mod_perl in the public_html/perl directory, it does not execute it, it just shows the "code". Is there a part I must put in the httpd.conf file for it to tell mod_perl to execute in the "perl" directory? Yes but read the docs please. Thank you, Richard Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Using DBI and Apache::DBI together
Ask has already stated that he's going to include it in his next release, I have already filed a doc-patch at rt.cpan.org Tom Stas Bekman wrote: Boris Zentner wrote: Hi, Am Mittwoch 28 Juli 2004 12:20 schrieb Tom Schindl: Boris Zentner wrote: [...] # bypass Apache::DBI $dbh = DBI->connect($data_source, $username, $password, { dbi_connect_method => 'connect' }) || die; I knew there is such a parameter, but couldn't remember it. So I took a look at Apache::DBI's manpage but this parameter is not mentionned. Have I missed that somewhere or where did you find it? If its not in the man-page it might me good idea to contact the module author and ask :-) him to add this parameter. Thats because you lokked in the Apache::DBI manpage. Look in the DBI man page: The "dbi_connect_method" attribute can be used to specify which driver method should be called to estab- lish the connection. The only useful values are 'con- nect', 'connect_cached', or some specialized case like 'Apache::DBI::connect' (which is automatically the default when running within Apache). I think the Apache::DBI manpage should mention that DBI's feature (plus example), since it's very relevant. Please send a doc patch to Ask. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: How to use a particular version of perl
Hi, Well now you need to recompile mod_perl using the new perl you compiled your own, I also recommend that you install your own apache. This way you can use the latest versions with the fewest bugs. If you are running into problems it is most likely that people will help you when running the latest versions. Download mod_perl from perl.apache.org and apache from httpd.apache.org and simply follow the INSTALL-File coming with mp2 you'll see it's not a mystery to get up your own httpd/perl. If you want mp2 to be compiled with your own perl instead of writing >8-- perl Makefile.PL && make && make test >8-- do >8-- /usr/local/bin/perl Makefile.PL && make && make test >8-- Maybe you also have to install some more cpan-modules in front of mod_perl but it will perl Makefile.PL will tell you about that. You can e.g. use the cpan-shell to install the missing prerequesits, and do not built as root as I think the test-suite has to be run as an non-root user. Tom Arnaud Blancher wrote: Hi, I want try to use perl 5.8.5 with MP2, in my system (fedora core 1) i have perl 5.8.3 ( the last rpm package) In have compile the last perl in other directory ( usr/local/bin/perl ) How could i tell MP to use this version of perl ? (i havent found it in MP2' doc) thanks Arnaud -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: request appears to be processed twice with PDF::Create
Hi, what you really want is an intelligent caching behaviour: 1. Generate PDF if not exists in Filesystem (the advantage is that multiple processes have a access to this PDF) or BerkleyDB for example 2a. Sent Generatated PDF from Cache 2b. Regenerate PDF if underlying data has been modified and restore for later [3. A cronjob which cleans up your disk-cache from time to time] Code looks like the following(Apache2): -8<- use Apache::RequestIO (); use Apache::RequestRec (); use Apache::Constants (); sub handler { my $r; ## my $cache_key = md5( $user . $path ); my $file = "/tmp/pdf-cache/$cache_key.pdf"; my $rc; if( -e $file && stat($_[0])[9] > stat($path)[9] ) { eval { $r->sendfile($file); } if( ! $@ ) { return Apache::OK; } } ## create your PDF like you've done before ## open( CACHEFILE, ">$file" ); print CACHEFILE $content; close( CACHEFILE ) } -8<- Dermot Paikkos wrote: Hi Tom, I think I see what your saying. What if you ignored the first and worked on the 2nd? Same problem I guess if you hit the first child. I haven't tried to determine if there are two processes as a result of hitting the form but I know from the logs that the module starts cycling through the form data again. It is probably very sloppy but my problem was that given a username and their file, the file was being opened twice which made parsing a bit tricky. All I want is to open the file once. I am open to more elegant suggestions though :-) Dp. On 30 Jul 2004 at 2:41, Tom Schindl wrote: Hi, Are you sure that's working as you expected? If I got you right I'm afraid I have to disappoint you but this only works if the second request is handled by the same apache-child as the first one and there's another problem. If you come back one day later and hit the same apache-child which already processed the first request, you won't get anything. Tom Dermot Paikkos wrote: Arnaud, I have found a way around this. I don't know if your interested but it goes likes something like this: foreach my $param ($r->param) { if ($param =~ /\busers\b/) { $users{$r->param($param)} = 0; } snip...then later foreach my $key (keys %users) { next if ($users{$key} == 1; $users{$key} = 1; } The idea being you only work request that haven't been processed yet. Once you process a request you increment that hash key to 1 and can avoid using it again. IE still sends the request twice and it is working with the first request not the second. Just a thought. Dp. On 29 Jul 2004 at 16:20, Arnaud Blancher wrote: Dermot Paikkos a écrit : Does this mean you have to go an clean up these files later yes, if you dont want they stay on the disk. or is this done when the process ends? maybe you can write a special handle for the directory where you ll write your pdf that delete the pdf when the connection (due to the redirect) will be close by the client (but i'not sure). I don't want to slow the users down unless I have to. I think I would like to determine the user-agent and work around the repeating requestssomehow. Do you know how to find out the user- agent when using Apache::Request? I can't see it when I use this object. Thanx. Dp. ~~ Dermot Paikkos * [EMAIL PROTECTED] Network Administrator @ Science Photo Library Phone: 0207 432 1100 * Fax: 0207 286 8668 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html ~~ Dermot Paikkos * [EMAIL PROTECTED] Network Administrator @ Science Photo Library Phone: 0207 432 1100 * Fax: 0207 286 8668 Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: request appears to be processed twice with PDF::Create
Dermot Paikkos wrote: Hi, [...] These reports are actually users clock-in/clock-out times for the week. So the reports would are generated weekly printed and rarely used again. The issue was that if the HR person uses IE5/6 the Oh. I see not a very heavy loaded service :-). Are you running the server on win32? That besides, the above method didn't work (see mail to list "Accessing form multiples". I think you replied to it. Whenever I tried to loop through the incoming list of "user=dermot+paikkos&user=joe+blogs" I was only getting the first user. Although that's perl here's the explanation. because $r->param( "key" ) can be used in 2 contexts (see perldoc -f wantarray). That's something very specific to perl which you maybe not familiar with when have used langs like java, c++, ...: 1. List-Context=> returns list of values: - Example for list contexts: @vals = $r->param("keys") foreach( $r->param("keys") ) @hash_slice{$r->param("keys")} 2. Scalar-Context => returns first value of list: - $val = $r->param("keys") $hash{$r->param("keys")} Still not sure why I can do my $r=Apache::Request->new(shift); my @users; foreach my $param ($r->param) { push(@users,$r->param($param)); } here you are in list context. @user{$apr->param("keys")} = (); map { $user{$_} = 0 } keys %user; and not: my $r=Apache::Request->new(shift); my %users; foreach my $param ($r->parm) { %users{$r->param($param) = 0; } That's not valid syntax at all if you meant $user{$r->param($param)} = 0 then you are here in scalar context. I am sure you code would work fine but what I have managed to do seems to work in both IE and firefox and is code I can manage. If I got stuck on yours I would out of my depth. So a sincere thanks but I am going to stick with what I have for now. Thanx. Dp. Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: MP2: Simple config question...
Tim Howell wrote: I've just installed Apache2 and mod_perl2. I'm not quite sure what I need to add to my httpd.conf to enable mod_perl on a directory. I'm not doing anything fancy--I just want to have a directory where scripts are executed with mod_perl rather than traditional CGI. I've read the docs and configuration examples, but somehow I seemed to have missed this. I've already added a line to load mod_perl and my startup.pl file. Thanks! =) --TWH http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Registry_Scripts Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Apache::Request multivalued parameters
Hi, I've never used $query->Vars but as far as I know Apache::Request does not provide a method like this. If the rest of your app depends on this behaviour you'll have to construct it your own like this: --8<-- my %params = (); while( $apr->param ) { $params{$_} = (join chr(0), $apr->param($_)); } --8<-- if your app does not depend on such a hash I'd do the following: --8<-- my %params = (); while( $apr->param ) { $params{$_} = [ $apr->param($_) ]; } --8<-- Still the best way is to pass around the Apache::Request object or at least the Request-object you received because you can always use Apache::Request->instance($r) to get the same Apache::Request-object back in any function/method you're calling. Tom David Hofmann wrote: I have a form where several of the in hidden fields are named the same thing with diffrent values. With CGI.pm the I can use %in = $readquery->Vars; to put everything in a hash. Then I break the values base on \0. What the best way to do this with Apache::Request, and how does it handle multivalued parameters ? David _ Don’t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/ Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: problem of persistance
Arnaud Blancher wrote: [...] third i put a 'use warning' in the script. In the apache error log i see the warning. that's ok but i must restart the serveur when i change a module, that's more boring . is it better way to test ? Are you looking for http://perl.apache.org/docs/2.0/api/Apache/Reload.html? At this time, there noting in the http://perl.apache.org/docs/2.0/devel/debug/perl.html :-( maybe i'm the once to bug ! Arnaud. Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Apache-AuthenNTLM-2.07 and ModPerl 1.99_16
Chris Hughes wrote: Fails as Apache-AuthenNTLM attempts to use Apache::Connection::remote_host to alter the remote hostname so it can check to see if is the same connection when it is next called: From AuthenNTLM.pm: 539 # we cannot attach our object to the connection record. Since in 540 # Apache 1.3 there is only one connection at a time per process 541 # we can cache our object and check if the connection has changed. 542 # The check is done by slightly changing the remote_host member, which 543 # persists as long as the connection does 544 # This has to be reworked to work with Apache 2.0 545 if (ref ($cache) ne $class || $$conn != $cache -> {connectionid} || $conn -> remote_host ne $cache->{remote_host}) 546 { 547 $conn -> remote_host ($conn -> remote_host . ' ') ; 548 $self = {connectionid => $$conn, remote_host => $conn -> remote_host} ; See http://gossamer-threads.com/lists/engine?list=modperl&do=search_results&search_forum=forum_4&search_string=%22Report+on+mp2+accessors+in+apache_structures.map%22&search_type=AND This method is defined read-only. But it's suggested to make it read/writeable again (see last message from stas). The change has been introduced here: http://cvs.apache.org/viewcvs.cgi/modperl-2.0/xs/maps/apache_structures.map?r1=text&tr1=1.41&r2=text&tr2=1.42&diff_format=h And is also menntionned into the changelog http://perl.apache.org/dist/mod_perl-2.0-current/Changes of 1.99_15. I really have no idea about Apache-AuthenNTLM but to make it working again you could apply the patch below and rebuilt your mod-perl. As far as I can tell from the last mail from Stas it's going to be read/writeable in future if one volunteers to write tests :-). Tom This breaks in 1.99_16, but AuthenNTLM suggests it has ModPerl 2 support written in, so is this something that has changed recently? I'm also not exactly sure why there are three checks (ie. that there is a cache object, that the cache object connection id is the same as the current, and then that the (altered) remote host name is the same in both). I would have thought it would be enought to compare the connectionid, but this seems to stay the same between connections..? Any ideas? ta, Chris Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird Index: apache_structures.map === RCS file: /home/cvspublic/modperl-2.0/xs/maps/apache_structures.map,v retrieving revision 1.48 diff -u -r1.48 apache_structures.map --- apache_structures.map 17 Sep 2004 00:07:24 - 1.48 +++ apache_structures.map 20 Sep 2004 17:15:58 - @@ -106,7 +106,7 @@ < local_addr < remote_addr < remote_ip -< remote_host + remote_host - remote_logname < aborted keepalive -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Best way to distinguish between mod_perl 1 and 2
Are you looking for this: -->8-- use constant MP2 => ($mod_perl::VERSION >= 1.99_12); -->8-- Tom John Siracusa wrote: I'm looking for the best, most reliable way to determine if I'm running under mod_perl 1 or 2, or not under mod_perl at all. I suppose I can look at $ENV{'MOD_PERL'}, but that reminds me a bit too much of a user-agent style opaque string that I may not be able to trust or predict. Also, what if I see "mod_perl/1.99" in that string? It just seems odd. So, any other suggestions? This needs to be code I can run even outside any mod_perl environment. I'll wrap it in an eval if I have to, but the low overhead of looking at $ENV{'MOD_PERL'} is kind of attractive... -John Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Best way to distinguish between mod_perl 1 and 2
Hi, !please always reply to the mailing list so the thread doesn't get broken! well mp uses this value internally and many CPAN-Modules do so either. Versions mp1 = VERSION < 1.99 mp2 = VERSION >= 1.99 The real syntax would be: ->8- use mod_perl; ## exists in mp1 and mp2 ## set the constant to 0 if mp1 and to 1 if mp2 ## but also subversions are working like this e.g. >= 1.99_12 which ## means the version the version must be at least 1.99_13 use constant MP2 => ($mod_perl::VERSION >= 1.99); BEGIN { if( MP2 ) { require Apache::Const; Apache::Const->import(-compile => 'HTTP_UNAUTHORIZED','HTTP_INTERNAL_SERVER_ERROR','DECLINED','HTTP_FORBIDDEN','OK'); } else { require Apache::Constants; Apache::Constants->import('HTTP_UNAUTHORIZED','HTTP_INTERNAL_SERVER_ERROR','DECLINED','HTTP_FORBIDDEN','OK'); } } ## proceed with your code ->8- Tom John Siracusa wrote: On Mon, 20 Sep 2004 21:19:58 +0200, Tom Schindl <[EMAIL PROTECTED]> wrote: Are you looking for this: -->8-- use constant MP2 => ($mod_perl::VERSION >= 1.99_12); -->8-- I don't know. What is that? :) Is that the "officially blessed" way to do this, or just another alternative that happens to work? Also, what's the equivalent for MP1? "$mod_perl::VERSION < 1.99_12"? -John -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] APR::Table FETCH method not found (reported when using $r->headers_in->{Cookie}
Hi, but the test-suite runs fine at least on my cvs checkout. You don't show which modules you're loading. Try to load the same modules "t/response/TestModperl/cookie.pm" does. These are: * use Apache::RequestRec (); * use Apache::RequestIO (); Tom [EMAIL PROTECTED] wrote: 1. Problem Description: When running a handler like: sub handler { my $r = shift; my $cookie = $r->headers_in->{Cookie}; } this results in the following error in the Apache error log: [Tue Sep 21 11:39:50 2004] [error] [client 130.89.164.70] Can't locate object method "FETCH" via package "APR::Table" at /home/sebastiaan/test/lib/perl5/site_perl/5.8.2/NederHost/Web/Handler/UCP.pm line 47.\n This error is also triggered by CGI/Cookie.pm (CGI 3.05, CGI/Cookie.pm 1.24): [Tue Sep 21 10:49:41 2004] [error] [client 130.89.164.70] Can't locate object method "FETCH" via package "APR::Table" at /home/sebastiaan/test/lib/perl5/5.8.2/CGI/Cookie.pm line 76.\n It seems to me that the tied interface of APR::Table is not completely implemented. I report this as a bug since this module is flagged as being completed. The error occurred in both latest stable release (mod_perl 1.99_16) as with the snapshot modperl-2.0_20040921043658.tar.gz. Or, I am doing something braindead, in which case this problem report should be ignored ;-) 2. Used Components and their Configuration: *** mod_perl version 1.9917 *** using /home/sebastiaan/test/src/modperl-2.0/lib/Apache/BuildConfig.pm *** Makefile.PL options: MP_APR_LIB => aprext MP_APXS=> /home/sebastiaan/test/apache/bin/apxs MP_COMPAT_1X => 1 MP_GENERATE_XS => 1 MP_LIBNAME => mod_perl MP_USE_DSO => 1 *** /home/sebastiaan/test/apache/bin/httpd -V Server version: Apache/2.0.51 Server built: Sep 20 2004 21:58:27 Server's Module Magic Number: 20020903:9 Architecture: 32-bit Server compiled with -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/home/sebastiaan/test/apache" -D SUEXEC_BIN="/home/sebastiaan/test/apache/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" *** (apr|apu)-config linking info -L/home/sebastiaan/test/apache/lib -lapr-0 -lrt -lm -lcrypt -lnsl -lpthread -ldl -L/home/sebastiaan/test/apache/lib -laprutil-0 -lgdbm -ldb -lexpat *** /home/sebastiaan/test/bin/perl -V Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration: Platform: osname=linux, osvers=2.4.25, archname=i686-linux uname='linux cartman 2.4.25 #2 mon feb 23 19:55:00 cet 2004 i686 unknown ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O3', cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.3 20010315 (release)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.2.3.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.2.3' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at Nov 29 2003 01:45:18 %ENV: PERL_LWP_USE_HTTP_10="1" @INC: /home/sebastiaan/test/lib/perl5/5.8.2/i686-linux /home/sebastiaan/test/lib/perl5/5.8.2 /home/sebastiaan/test/lib/perl5/site_perl/5.8.2/i686-linux /home/sebastiaan/test/lib/perl5/site_perl/5.8.2 /home/sebastiaan/test/lib/perl5/site_perl . *** Packages of interest status: Apache::Request: - CGI: 3.05 LWP: 5.69 mod_perl : 1.9917 3. This is the core dump trace: (if you get a core dump): [CORE TRACE COMES HERE] This report was generated by t/REPORT on Tue Sep 21 09:44:06 2004 GMT. Kind regards, Recla
Re: Variables in memory.
Stas Bekman wrote: Thomas Schindl wrote: When running with mp2 and worker mpm the case is slightly different: 1. Apache-starts and starts Apache-Child 1 which spawn Thread 1.1 and Thread 1.2 and Apache-Child 2 which spawn Thread 2.1 and Thread 2.2 2. User1 hits Apache-Child 1 Thread 1.1 and sets the global $FOO from 0 to 1 which is shared between the threads 3. User2 3.a. hits Apache-Child 1 Thread 1.2 $FOO is 1 because User1 has set $FOO to 1 3.b. hits Apache-Child 2 Thread 2.1 or Thread 2.2 $FOO is 0 because User1 has set $FOO to 1 in thread 1.1 and 1.2. That explanations serves as a good answer to the question. But... That's not what happens behind the scenes. - Apache threads have nothing to do with perl interpreters. - There is no 1:1 relationship between apache threads and perl interpreters. Inside one child process you can have 1 Apache thread, and 10 perl interpreters, and vice versa, 10 Apache threads and 1 perl interpreter. - Moreover, since interpreters live in pools, you can have several pools comprised of totally different/unrelated interpreters. - And all these could be used by Thread 1.1 if you are running under threaded apache. So one needs to talk about perl interpreters and not Apache threads. I hope it is not too confusing :) One day someone will chart the details for a better visual comprehension. In fact you can have perl interpreter pools with prefork-mpm too (because threads aren't relevant here at all). This feature, for example, allows two different developers use the same server with a totally different @INC. http://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_ Thanks Stas for the full explaination. Indeed I didn't know exactly what's really going on behind the scences. Thanks for your explaination I'm always learning something new when reading your answers. Still on the one hand I recognize what you're trying to tell me, on the other hand could you give me more information about how things like this could be accomplished or better the other wayround how could I prevent things like 1 thread with 10 perl-interpreters and vice versa if I don't want it? Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Variables in memory.
Stas Bekman wrote: Tom Schindl wrote: Thanks Stas for the full explaination. Indeed I didn't know exactly what's really going on behind the scences. Thanks for your explaination I'm always learning something new when reading your answers. Thanks :) Still on the one hand I recognize what you're trying to tell me, on the other hand could you give me more information about how things like this could be accomplished or better the other wayround how could I prevent things like 1 thread with 10 perl-interpreters and vice versa if I don't want it? You use interpreter pool size control directives: http://perl.apache.org/docs/2.0/user/config/config.html#Threads_Mode_Specific_Directives You don't need to prevent anything. It's just that if your server uses very little modperl and mostly doing static requests, you can have just a few perl interpreters around (in the threaded mpm) and many more threads. The above link explains how to set a limit on the size of the pool. I know we need to write some docs explaining the nuances, since I've done this more than once here on the list. But all that after mp2 is released. Oh. I see great. I dive into it when I have more time and I'm sure I'll come up with some "silly" questions, be prepared. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Variables in memory.
[EMAIL PROTECTED] wrote: Greetings, The problem is that the script takes more than 3 or 4 seconds to execute sometimes. So we have a script that takes 3-4 seconds to execute, each varaiable is defined with my $var. and when the script ends it resets the value of the variables using undef. If multiple users execute the script within those 3-4 seconds will the variables still be shared between them? Hi. May I suggest that you get one of the great books about mod-perl. See http://perl.apache.org/docs/offsite/books.html for more information. I think you'll have to get much more familiar with How Apache processes request, ... . The only variables which are shared are the ones set at server-startup *but* only as long as you *don't modify* them. This improves memory consumption. So that's not a possibility for you. And you also failed to tell us which version mp1 or mp2 (with which process/thread-model) you're using. The only possibility to share things in your case is a Cache/Persitence-technology I already pointed you to some search the archives for more information about performance, ... . I've successfully used BerkleyDB but really depends what you want to share, ... . Tom What would be the best way to avoid this ? Thank you all for the quick answers and great information. Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Variables in memory.
Tom Schindl wrote: [EMAIL PROTECTED] wrote: Greetings, The problem is that the script takes more than 3 or 4 seconds to execute sometimes. So we have a script that takes 3-4 seconds to execute, each varaiable is defined with my $var. and when the script ends it resets the value of the variables using undef. If multiple users execute the script within those 3-4 seconds will the variables still be shared between them? Hi. May I suggest that you get one of the great books about mod-perl. See http://perl.apache.org/docs/offsite/books.html for more information. I think you'll have to get much more familiar with How Apache processes request, ... . The only variables which are shared are the ones set at server-startup *but* only as long as you *don't modify* them. or you start to swap :-( This improves memory consumption. So that's not a possibility for you. And you also failed to tell us which version mp1 or mp2 (with which process/thread-model) you're using. The only possibility to share things in your case is a Cache/Persitence-technology I already pointed you to some search the archives for more information about performance, ... . I've successfully used BerkleyDB but really depends what you want to share, ... . Tom What would be the best way to avoid this ? Thank you all for the quick answers and great information. Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: how to parse arguments
Harald Meier wrote: Dear list members, I am using Apache-2.0.50 and mod_perl-1.99_16. I would like to know the most secure, best, and fastest way to parse arguments. I tried libapreq, but got some strange errors, arguments stayed persistent from one request to the next and other strange things happened. That happens when creating closures and has **nothing** todo with libapreq but is most of time an "error" in your application code (show us the app-code where libapreq caches params). I'd advise you to not use any param functions yourself. You could also use CGI.pm. Now I am using the following function and I am happy with it, but I dont think that it is really the best way to go. [...] Tom Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: mod_perl crashing / hanging
Alex Greg wrote: Geoffrey Young wrote: [...] Thanks for your response. Sorry I wasn't clear; the httpd processes don't actually kill the server, they just slow Apache right down to the point at which it doesn't respond to requests any more. I am still able to get onto the box and kill the processes etc. without having to do a hard reboot or anything. My question is what's causing Apache to get into the state where it can't fork any more shells from Perl. This is because a shell call to date ($date = `date`;) is failing - this is most likely what's causing the failure to fork we see above. if you want to avoid that shell call try POSIX::strftime() instead. We have quite a lot of calls via backticks throughout our code - and not just for things like date that are trivially replaceable. Would you recommend replacing these as far as possible? Yes because calling the shell is fairly slow if there are any perl-modules you could use these instead and it will certainly give you a performance boost. What calls do you make, are these custom programs? If not I'd take a look at CPAN maybe someone has already written a Perl-Module which does exactly what you need else you could maybe write it your own. I have done this for example librsvg because I wanted to avoid calls to the shell inside my httpd-processes. [...] Tom Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Embedding another webpage within a web page
Martin Moss wrote: All, I have an interesting issue. I'm in the process of whitelabeling a website, but part of the process I need to whitepabel is hosted by an outsourced company. Rather than get the outsource company to change their html, I would rather download and edit the html from the outsourced website on the fly. I was thinking of writing a contentHandler which uses LWP::Useragent etc.. to download from the outsourced website. however I have only limited experience with it. Also, if the page I wish to download is itself a form, how would I go about getting LWP to 'submit' values etc... I hope you don't use this in production but this should work if I'm not completely mistaken: 8< package Fake::FormRequest; use LWP::UserAgent(); use Apache::Constants(); my $ua = LWP::UserAgent->new; sub handler { my $r = shift; my $request; if( $r->method_number() == Apache::Constants::M_GET ) { $request = HTTP::Request->new(GET => 'http://bla.com/my.cgi?'.$r->args,&getHeaderAsArrayRef($r)); } else { $request = HTTP::Request->new(POST => 'http://bla.com/my.cgi?',&getHeaderAsArrayRef($r),$->content); } my $response = $ua->request($request); ## . } sub getHeaderAsArrayRef { my $r = shift; my %headers = $r->headers_in(); my @rv; map { push @rv, [ $_, $headers{$_} ] } keys %headers; return [EMAIL PROTECTED]; } 8< Kind Regards Marty ___ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Apache profiler errors
Frank Wiles wrote: On Tue, 2 Nov 2004 11:24:40 -0500 Jason Dixon <[EMAIL PROTECTED]> wrote: On Nov 2, 2004, at 11:15 AM, Frank Wiles wrote: I'm thinking Apache::compat might be confusing it. Can you try running without it? Commented out Apache::compat, same error. :( Unfortunately, I think Perrin is right. You'll have to upgrade to the latest Apache/mp2 combo to get this working. While I also try to keep in pace with RHEL, Apache2/mp2 is just a place where you really can't. Too much has changed since 1.99_12 (which IIRC is what RHEL ships with). Of course he is have you read the since tag in the docs? :-) ---8<--- ... since: 1.99_15 ... ---8<--- You can however, rebuild with RHEL RPMs with the newer sources without very much trouble. - Frank Wiles <[EMAIL PROTECTED]> http://www.wiles.org - -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: CGI_GATEWAY - modperl version 2
[EMAIL PROTECTED] wrote: 'SCRIPT_NAME' => '/perl/test.pl', 'SERVER_NAME' => 'localhost', 'SERVER_ADMIN' => '[EMAIL PROTECTED]', 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate', 'HTTP_CONNECTION' => 'keep-alive', 'REQUEST_METHOD' => 'GET', 'HTTP_ACCEPT' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1', 'SCRIPT_FILENAME' => '/programs/apache/perl/test.pl', 'SERVER_SOFTWARE' => 'Apache/2.0.52 (Unix) mod_perl/1.99_17 Perl/v5.8.0 mod_ssl/2.0.52 OpenSSL/0.9.7a', 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'QUERY_STRING' => '', 'REMOTE_PORT' => '33708', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.3) Gecko/20040803', 'SERVER_PORT' => '80', 'SERVER_SIGNATURE' => 'Apache/2.0.52 (Unix) mod_perl/1.99_17 Perl/v5.8.0 mod_ssl/2.0.52 OpenSSL/0.9.7a Server at localhost Port 80 ', 'HTTP_CACHE_CONTROL' => 'max-age=0', 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', 'REMOTE_ADDR' => '127.0.0.1', 'HTTP_KEEP_ALIVE' => '300', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'PATH' => '/programs/apache/bin:/download/j2sdk1.4/bin:/bin:/download/j2sdk1.4/bin/://download/tomcat_old/bin:/programs/ant-1.6.2/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/programs/root/bin', 'REQUEST_URI' => '/perl/test.pl', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_ADDR' => '127.0.0.1', 'DOCUMENT_ROOT' => '/programs/apache/htdocs', 'HTTP_HOST' => 'localhost:80', 'MOD_PERL' => 'mod_perl/1.99_17' and what's wrong about that? Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] can't locate object method "upload" via package "Apache::RequestRec"
Carl Brewer wrote: sub get_uploaded_image { my ($name, $max_size, $r) = @_; use Apache::Upload; my $req = Apache::Request->new($r); my $upload = $req->upload($name); my $upload = $r->upload($name); print STDERR $upload->filename(); } They're pretty crude, but hash_post does what I need (any suggestions for improvemend gladly accepted!). I'm working on the get_uploaded_image() at the moment (as you can see, it doesn't do anything yet!) I've declared $r in my calling script, and I'm not sure if I need to declare it again in the subroutines? The calling script looks like this : my $r = Apache->request; $r->content_type("text/html"); use lib qw(/home/benfab/lib); use BF; use Template; use Data::Dumper; use strict; . . . my %posted_data = BF::hash_post($r); my $upload = BF::get_uploaded_image("small_image", $BF::small_image_size, $r); If I change my subroutine to this : sub get_uploaded_image { my ($name, $max_size, $r) = @_; use Apache::Upload; my $req = Apache::Request->new($r); my $upload = $req->upload($name); print STDERR $upload->filename(); } It starts to work, but I don't understand why I need to declare $req again here? I want to keep my form parsing image stuff seperate, as not all my pages will have images to load, am I doing this the 'best' way? thanks! Carl -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] can't locate object method "upload" via package "Apache::RequestRec"
Carl Brewer wrote: Tom Schindl wrote: Carl Brewer wrote: sub get_uploaded_image { my ($name, $max_size, $r) = @_; use Apache::Upload; my $req = Apache::Request->new($r); Apache::Request->instance($r) just use Apache::Request->instance($r) and you're save but you definately need to do that or simply pass on the created Apache::Request-Object to you subroutine. 8< I think that you and not a small number of other people have a problem to see the difference between Apache::Request and Apache::RequestRec they're both not the same. Apache::RequestRec: === "simply" wrapps the inter apache request-record to be accessible by perl-modules. Docs at perl.apache.org libapreq: = is at it's heart a C library to deal easily with HTTP-Requests e.g. read out form-data, ... . It has a mod_perl-binding named Apache::Request but the whole lib can also be used by any other C-Module. The already mentionned perl-Binding Apache::Request of libapreq is also a derived from Apache::RequestRec and that's why it also has all methods. 8< Tom my $upload = $req->upload($name); I've got that in my subroutine and it works, but I'm concerned that I'm dipping into the buckets too much? Is it safe to call on $r more than once per form submission? I'm already runnign the new request() in a subroutine I call before I call the Upload one. thanks again, Carl -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: What is the correct Apache, mod_perl, and Apache::ASP version combination?
Hi, To help you we have see at least the output of your error-log and the relevant parts of the httpd.conf. Tom [EMAIL PROTECTED] wrote: We are trying out an application that worked in Apache 1 in Apache 2 and it's getting an "internal error or misconfiguration" and "200 OK" error. The message on the bottom of the error page shows Apache/2.0.52 (Win32) mod_perl/1.99_17 Perl/v5.8.4 mod_jk2/2.0.4 Server at csrstest Port 88 Do we have the correct version combination or Apache, mod_perl, and Apache::ASP (2.55) ? Please be patient with me -- newbie. Waldo Tumanut Database Analyst CONFIDENTIALITY NOTICE: This electronic transmission (including any accompanying attachments) is intended solely for its authorized recipient(s), and may contain confidential and/or legally privileged information. If you are not an intended recipient, or responsible for delivering some or all of this transmission to an intended recipient, be aware that any review, copying, printing, distribution, use or disclosure of the contents of this message is strictly prohibited. If you have received this electronic message in error, please contact us immediately by electronic mail at [EMAIL PROTECTED] or notify us immediately by telephone at 1-800-345-2021 or 816-531-5575 and destroy the original and all copies of this transmission (including any attachments). Thank you. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: logging at startup
Are you talking about mp1? This would be a possibility but with a significant performance hit. You could turn it the other wayround because you know when your server is starting: http://perl.apache.org/docs/1.0/api/Apache.html#Global_Variables Because I'm at it where do I find these variables in mp2 or what could be used instead of it? Tom Arshavir Grigorian wrote: eval { $r = Apache->request(); } if (! $@) { # we have a request, dump the error page } On a separate note, why would one even bother with Apache::Log->log_error? instead of just using CGI::Carp (for simple/basic error loggin that is I am just trying to wrap my head around the many ways of doing the same thing, so any comments you might have would be very much appreciated. Arshavir -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Need some help hijacking the page output pipe
Mark S Lowe wrote: I have a need to create my own suffix and hijack the output for page rendering code, and then re-output the page with my own OK. I have the O’Reilly book “Practical mod_perl” and there is a great example of this on page 114 in Chapter 4. However, the example is incomplete. The example suggests that we can intercept the request for a page, remove all the HTML tags, and re-output the page. This isn’t exactly what I want to do, but it will server as a great architecture for my needs. I’ve got my directive working perfectly in httpd.conf, but now I need some help intercepting the page request event, re-rendering the page, and then outputting it. I imagine this is like a three line explanation, but I can’t seem to find it anywhere. I imagine it something like this: PerlModule MyPlatform::Converter SetHandler perl-script PerlHandler MyPlatform::HTML2TextConverter MyPlatform:: HTMLContentGenerator I just don’t know how to grab the HTML page text once it gets to my module. STDIN doesn’t have it. So where is it? Suggestions? Thanks! Mark Well you have to read the file yourself: package MyPlatform::HTML2TextConverter MyPlatform:: HTMLContentGenerator; sub handler { # . my $content; local $/ = undef; open( READFILE, |$r->filename| ); $content = ; close( READFILE ); # ... } -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Segfaults with mod_php + mod_perl + mysql + mysqli
Sönke Ruempler wrote: Stas Bekman wrote on Tuesday, November 16, 2004 10:03 PM: Right. It's documented here: http://perl.apache.org/docs/1.0/guide/troubleshooting.html#_ex it_signal_Segmentation_fault__11___with_mysql I use PHP 5.0. There is no bundled mysql library with PHP anymore. I use MySQL 4.1.7. But it seems mod_perl uses the old library (although /usr/include and /usr/lib/mysql are clean from old versions). How can i safely recompile the mysql module of Perl against the new mysql library (and backupping the old if something goes wrong)? mod_perl has no mysql support built in. You have to reinstall DBD::mysql from cpan. Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Apache::Directive::conf tree error with mod_perl 1.99x and Apache 2
Beberle wrote: Ok, I've read the documentation and searched the archives for a similar problem but no luck. If anyone has any suggestions, I'd be most grateful. Here's my situation: I've got Apache 2.0.46 with mod_perl 1.99_09 (called 2.0-tobe in the documentation) both of which were installed by the Red Hat Enterprise installation. I copied this startup file form the mod_perl docs: #!/usr/bin/perl # File: startup.pl use Apache2 (); use lib '/etc/httpd/lib/perl'; use ModPerl::Util (); #for CORE::GLOBAL::exit use Apache::compat (); use Apache::RequestRec (); use Apache::RequestIO (); use Apache::RequestUtil (); # commented this out because Apache::ServerRec # doesn't exist on the server and throws errors #use Apache::ServerRec (); use Apache::ServerUtil (); use Apache::Connection (); use Apache::Log (); use APR::Table (); use ModPerl::Registry (); use Apache::Const -compile => ':common'; use APR::Const -compile => ':common'; use CGI qw(-compile :all); 1; --- In my perl.conf file, I've added the following lines: LoadModule perl_module modules/mod_perl.so PerlRequire conf/startup.pl # this is a test module PerlTransHandler Apache::DefaultTrans -- In my test module (modified from the O'Reilly "Writing Apache Modules" book), I have the following code: package Apache::DefaultTrans; # File: Apache/DefaultTrans.pm use Apache::Const qw(:common); use Apache::RequestIO (); use Apache::RequestRec (); use Apache::Log (); use Apache::Directive (); sub handler { my $r = shift; my $uri = $r->uri; my $tree = Apache::Directive::conftree(); my $document_root = $tree->lookup('DocumentRoot'); $r->filename($document_root . $r->uri); } - This throws the following error: [error] [client 10.1.0.28] Usage: Apache::Directive::conf tree(CLASS) at /etc/httpd/lib/perl/Apache/DefaultTrans.pm I've looked up this function in the documentation and this seems to be the right way to use it. Oddly, if I try to stuff some random variable in, like: my $tree = Apache::Directive::conftree($tree); the error goes away, but $tree is empty. Any help is appreciated. Thanks. __ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com your version is out-dated you'll have to upgrade your mod_perl and apache nowadays we are at apache-2.52 and mp-1.99_17 http://perl.apache.org/docs/2.0/api/Apache/Directive.html#C_conftree_ The method you try to use is part of mp-1.99_12 take a look at the since information. Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Advice needed on custom webapp framework
jonathan vanasco wrote: I built for mod_perl1 a customer webapp framework It functions as 2 perl modules/package sets /lib/WebAppFramework /lib/Website For each website/webapp, i make a new /lib/Website that subclasses the WebAppFramework (which handles users, email, webpage generation, etc -- and makes heavy use of cpan modules -- i just wanted a way to find a lowest-common-denominator to interface with multiple packages, so i can rapidly prototype webapps) It worked really well for everything I want it to do -- super simple and easy to build and add functions. except - its a little messy The idea I wanted to implement, is essentially this handler: my $DB = new Website::DB(); sub handler { DEBUG >0 && print STDERR " NEW REQUEST\n\n"; my $r = shift; my $user = new Website::User( \$r, \$DB ); my $page = new Website::Page( \$user , \$DB ); my $html = $page->processRequest(); $r->content_type('text/html'); $r->print( $html ); return OK; } I don't answer your questions but why are you passing all objects by reference. An object is already a reference (normally Hash or Scalar) and it does not improve your memory usage it only decreases your performance because you always have to dereference it. The idea, is that any page is just a view to a user (logged in or not), so is rendered to that person. Now, this is my issue -- I'm creating a user AND a page with a ref to the DB handle - which is wasteful. And requires a lot of extra typing on my part. Ideally, I would have the packages in Website and WebAppFramework lookup the right DB for the Website I can't figure out how to do this in a coherent way though. Any advice would be excellent. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Advice needed on custom webapp framework
Jonathan Vanasco wrote: package Website1; my $DB = new Website1::DB(); # make a new ref for the website sub handler { my $r = shift; my $user = new Website::User( \$r, \$DB ); my $page = new Website::Page( \$user , \$DB ); my $html = $page->processRequest(); } what i would like is: sub handler { my $r = shift; my $user = new Website::User( \$r ); my $page = new Website::Page( \$user ); my $html = $page->processRequest(); } now, i guess what i'm trying to do within Website1::User Website1::Page is access the $DB in the base of Website1 that i define just before the handler BUT I'm trying to do so in a way that both: Website1::PackageName Website2::PackageName WebAppFramework::PackageName Will all retreive the correct DB from the script that defines the handler Ok. This means you want to make your Website::User and Website::Page more intelligent. If I got you right the only thing have to implement for each user is Website1::DBI and Website2::DBI. What you really need here when talking about Pattern-Programming is a "Factory-Class" which creates the appropiate WebAppFramework::DBI-Sub-Class for you and design all your Website*::DBI-classes as "Singletons". ===8<=== package WebAppFramework::DBIFactory; sub getDb { my $dbiModule = shift; require($dbiModule); ## load the apprioate module return $dbiModule->instance(); ## get an instance of the module } 1; ===8<=== ===8<=== package WebAppFramework::User; sub new { my $class = shift; my $r = shift; my $this = { db => WebAppFramework::DBIFactory::getDb($r->dir_config("DBIModule")); }; bless $this, $class; } 1; ===8<=== ===8<=== PerlSetVar DBIModule Website1::DBI PerlSetVar DBIModule Website2::DBI ===8<=== Hope I got you right? If you don't want to use config values you could also use the name of the package in the handler e.g. Website1, Website2 and add "::DBI" in your factory method. Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] Usage: Apache::Connection::remote_ip(obj) error
Sean T Allen wrote: apache 2.0.52 mod_perl 1.99_17 perl 5.8.0 code in question: package ProxyRemoteAddr; use Apache::Const qw(OK); use strict; sub handler { my $r = shift; return OK unless ( $r->connection->remote_ip eq '127.0.0.1' ) && $r->header_in( 'X-Forwarded-For' ); if ( my ( $ip ) = $r->headers_in->{ 'X-Forwarded-For' } =~ /([^,\s]+)$/ ) { $r->connection->remote_ip($ip); } return OK; } 1; http://gossamer-threads.com/lists/engine?list=modperl&do=search_results&search_forum=forum_4&search_string=%22Report+on+mp2+accessors+in+apache_structures.map%22&search_type=AND yes its readonly since _15, in cvs/svn it's writeable once more. A patch against can be found here: http://gossamer-threads.com/lists/modperl/modperl/73063?search_string=Apache-AuthenNTLM-2.07%20and%20ModPerl%201.99_16;#73063 Tom Internal server error thrown error message: [Thu Nov 18 01:48:49 2004] [error] [client 127.0.0.1] Usage: Apache::Connection::remote_ip(obj) at /ai/toppik/lib/ProxyRemoteAddr.pm line 15.\n Line 15 being the: $r->connection->remote_ip($ip); I've seen numerous examples of this working. Any ideas on my problem? Thanks in advance... -Sean- -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] Usage: Apache::Connection::remote_ip(obj) error
Sean T Allen wrote: Tom... I see a 'AuthenNTLM' patch. but nothing specific to remote ip... which patch am i looking for on that page? Tom Schindl wrote: Uups: http://gossamer-threads.com/lists/modperl/modperl/74104?search_string=Report%20on%20mp2%20accessors%20in%20apache_structures.map;#74104 is much more appropiate, but the reason is the same. You'll have to patch apache_structures.map to make it writeable once more. Simply remove the < symbol in front of remote_ip. Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: mod_perl woes! frequent 500!
Perrin Harkins wrote: On Mon, 2004-11-22 at 14:01, Faisal Nasim wrote: It compiles and it runs great but for no reason it all the scripts randomly gives a 500 error! I was using XML::Simple so I realized I might have some unclosed file handles which cause a 500 after several hits. This is what I found in the logs: [error] Couldn't create file parser context for file "/home/.../xml/Test.xml": No such file or directory at /usr/../LibXML.pm line 427.\n at /usr/../LibXML/SAX.pm line 63\nCompilation failed in require a ... Sometimes this means that you've had a problem earlier in the request with a module that has XS code, and now things are screwed up for the memory space of that particular child process. I'd suggest you learn to debug with the -X option, as shown here: http://perl.apache.org/docs/1.0/guide/porting.html#Sometimes_it_Works__Sometimes_it_Doesn_t Well as Perrin already stated there are issues with XML::LibXML which you are using with XML::Simple. Which version do you have installed? See this thread and a working patch against these libs. Still I would upgrade as a first try libxml and XML::LibXML. http://aspn.activestate.com/ASPN/Mail/Message/perl-xml/1998065 But XML::LibXML are definately working under mp1 because AxKit makes heavy use of these libs. Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: mod_perl woes! frequent 500!
Faisal Nasim wrote: I added the IO::File wrapper in two scripts and they worked fine and the third one failed occasionally. Now I changed the third and the occasional 500 does not show up anymore. I think XML::Simple does not close the file handle after simply creating the data structure. I'll have to check that. I'm doing libxml = 2.5.8, XML::Simple... latest from CPAN. I've now upgraded to libxml 2.6.16. Your error indicated that it was coming from XML::LibXML which is the perl-binding to libxml. Upgrading only libxml doesn't help you there. You didn't show us the complete error-message and your version of XML::LibXML. perl -MXML::LibXML -le 'print " VERSION: $XML::LibXML::VERSION";' Tom Regards, Faisal Nasim http://fnasim.blogspot.com/ At 02:04 AM 11/23/2004, Perrin Harkins wrote: On Mon, 2004-11-22 at 15:50, Tom Schindl wrote: Well as Perrin already stated there are issues with XML::LibXML which you are using with XML::Simple. Which version do you have installed? See this thread and a working patch against these libs. Still I would upgrade as a first try libxml and XML::LibXML. Or try something faster. Benchmark: http://perlmonks.org/index.pl?node_id=409517 I'm not certain about expat thread-safety, but it might be worth trying. - Perrin -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: AIM/mp2 Apache::compat bug?
Stas Bekman wrote: That's really a question to httpd developers, mod_perl just provides the perl API for the Apache C API. Granted we could do that behind the scenes, but it's not always the desired behavior so I'm not sure we should. May be an option argument could be passed to do the work? I'd like the option argument, because I'm sure people will run into this many times. Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Hash Cache using Require
Perrin Harkins wrote: On Fri, 2004-12-03 at 11:17 -0800, Bill Whillers wrote: Am I more or less efficient than just creating the hashes directly from hitting the database everytime the application needs it? The database is *not* under heavy load, at all. If the data is small enough, loading it into memory should work fine, and will be faster than loading from the database. If you only need access to specific items at any given time, I'd read those individually from the database or use a local dbm file (try MLDBM::Sync or BerkeleyDB) because it will save you memory over loading the full hash in each process. I'd suggest reading the data from the mysql database directly and keeping it in memory. You've many possibilities to check whether the data in the database has been modified. e.g. by setting a update-timestamp which you request. Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Perl + apache + cgi
Hi, is apache allowed to change to your home directory? Tom Brent Clark wrote: Hi Would anyone care to share some info on setting up a CGI. I keep getting this error: [Tue Dec 7 09:48:47 2004] [error] [client 192.168.111.214] Premature end of script headers: /home/gevens/cgi-bin/ecco/scripts/agent/logon.pl and [2004-12-07 10:17:28]: info: (target/actual) uid: (gevens/gevens) gid: (gevens/gevens) cmd: logon.pl [2004-12-07 10:17:28]: error: command not in docroot (/home/gevens/cgi-bin/ecco/scripts/agent/logon.pl) [...] -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Perl + apache + cgi
Brent Clark wrote: Hi Would anyone care to share some info on setting up a CGI. I keep getting this error: [Tue Dec 7 09:48:47 2004] [error] [client 192.168.111.214] Premature end of script headers: /home/gevens/cgi-bin/ecco/scripts/agent/logon.pl and [2004-12-07 10:17:28]: info: (target/actual) uid: (gevens/gevens) gid: (gevens/gevens) cmd: logon.pl [2004-12-07 10:17:28]: error: command not in docroot (/home/gevens/cgi-bin/ecco/scripts/agent/logon.pl) Here is the permissions of the file in question: -rwxr-xr-x 1 gevens gevens 170 Dec 7 12:28 logon.pl Here is my apache conf: DocumentRoot /home/gevens/eccotours ScriptAlias /cgi-bin/ /home/gevens/cgi-bin/ AccessFileName a.htaccess User gevens Group gevens ErrorLog /var/log/apache/ecco.log CustomLog /var/log/apache/ecco-access.log common Oh. Think now I've got it. You are running into suexec-problems because your Root-Apache is running under anonther user than your V-Host-Apache. Apache is now using suexec to execute your scripts and because your script directory is not part of the suexec-path it cannot execute your script. Why do you need to run your scripts as gevens/gevens? Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Perl + apache + cgi
Brent Clark wrote: Oh. Think now I've got it. You are running into suexec-problems because your Root-Apache is running under anonther user than your V-Host-Apache. Apache is now using suexec to execute your scripts and because your script directory is not part of the suexec-path it cannot execute your script. Why do you need to run your scripts as gevens/gevens? Tom Hi Well the owners of the scripts are gevens, and I dont think if I remove those entrys, it will make any difference. Brent As far as I understand the docs if you have an apache compiled with suexec and you are using different users in different v-host apache is using suexec and this fails in your case because the paths of suexec can only be defined at compile-time. It doesn't make no difference who is the owner of the script it's much more important which user executes them. Normally it's a less privileged user like apache.apache because it has no write access e.g. to your home-directory. In most of the cases it's a bad idea to run scripts like you as a normal system user because it opens a security whole. Nevertheless this is not a cgi-support forum so we should take off the discussion from this list which is dedicated to mod-perl. You can E-Mail me offline but I suggest that you read the docs about apache-config especially this ones: http://httpd.apache.org/docs/howto/cgi.html http://httpd.apache.org/docs/suexec.html As a fast solution you could try to remove the entries User and Group from the conf-file and take care that the user/group your apache is running under has access to the directories you want to read/execute. Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] how to redirect POST data
Beberle wrote: Hi, I found a similar question posted in the newsgroups but no one seemed to have a solution. Here's what I'm trying to do. I have a web page that does a POST to a remote server. Basiscally, I'm trying to read the post data and if it matches a regex, I want to redirect it. Otherwise, I want to let the POST continue normally (submitting to the remote server). At the PerlTransHandler stage, I have a handler that reads the post data like so: my $method = $r->method(); if ($method =~ /post/i) { my $content; $r->read($content, $r->headers_in->{'content-length'}); if ($content =~ /some_regex/){ # redirect } else { # continue with post return OK; } } I can capture the POST data and redirect the user just fine. The problem occurs with the submitted forms that don't match the regex. If I just return OK, the browser hangs (because the POST data has been reset?). I'll admit I'm a bit confused as to what's actually going on here (still new to mod_perl). I read you're not supposed to parse the form data except at the ContentHandler step, but since the form is submitting to a remote host, I can't really do that. Not 100% sure what you are telling me here but why not simply use Apache::Request->instance($r). The problem with POSTED data is that you can not read them more than once you can think of it like STDIN when read once you can not go back and read it once more. Any ideaas? In mp2 you could also use an input-filter for this purpose. Thanks, Bill __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Apache::Resource needs to be released seperately to the CPAN
[...] You've just committed me to one or the other. Ick. I install mod_perl1, and I get an Apache::Request that works with mod_perl1. I install mod_perl2, and I get an Apache::Request that works with mod_perl2. This is unacceptable. But you can run both versions of mod_perl side by side. See http://perl.apache.org/docs/2.0/user/install/install.html#MP_INST_APACHE2 Tom You cannot use the same namespace for two different modules. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Runs on Perl 5.8.0 but no on 5.8.3:[DBI]
Although I doubt this has something todo with mod_perl which this list is dedicated to you should at least state: * Version of DBI.pm * Maybe also the part of DBI.pm around line 514 * try to run a programm on the command-line using DBI if it also fails => upgrade DBI.pm (are the version on the 2 servers the same)? * give it a try at the DBI-Mailling list Tom Chetan Anand wrote: Hi, Whenever I execute a Perl script the following error is displayed in apache's error_log: [error] [client 127.0.0.1] Can't use string ("") as a HASH ref while "strict refs" in use at /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi/DBI.pm line 514., referer: http://localhost/myforms/login.pl This happens for all Perl scripts.My server version on Fedora Core 2 is 2.0.49 and perl 5.8.3 The same scripts run perfectly on Red Hat 9's Apache server version 2.0.40 and perl 5.8.0 How to fix this? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: multiple developers on one Sever
Well you are not stating which mp-version you are running but for: mp1: http://perl.apache.org/docs/1.0/guide/modules.html#Apache__PerlVINC___Allows_Module_Versioning_in_Location_blocks_and_Virtual_Hosts mp2: http://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_ Tom Henning Meyer wrote: Hello, I've got a mod_perl-Apache running, which hosts multiple developement-versions (of multiple CVS-developers) of a webapp. Therefore I've got this apache-config: Options +Includes XBitHack on SetHandler perl-script PerlHandler Apache::Registry PerlModule Apache::DBI PerlSendHeader On Options ExecCGI +Includes Order allow,deny Allow from all AllowOverride None Each version has its own config (like a seperate DB per developer). This is done by: require 'config.pl'; in each of the mod_perl-scripts. config.pl looks like this: #!/usr/bin/perl use strict; package myconf; use vars qw(%c); %c = (DB=>"henningsDB"}; # or tutmannsDB in tutmanns config.pl 1; The point is, that in each version everything may be the same except of the config.pl. But: Apache and mod_perl seem to mix up the configurations. The reason seems to be, that the configuration is just read once the process starts, and not each time a script is executed. What is a good workaround? Local ini-Files? Or something even better? Thanks Henning -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: clearing a parameter using Apache::Request
You don't state which Version of mp you are using but Yes you can in both generations, by using the Apache::Table/APR::Table-Object. I have not tested it but as far as I understand the docs this could should work. 8< use mod_perl; my $apr = Apache::Request->new($r); my $table; ## check the mp-version if( $mod_perl::VERSION >= 1.99 ) { $table = $req->param; ## mp2 } else { $table = $apr->parms; ## mp1 } delete $table->{submitting} 8< Tom [EMAIL PROTECTED] wrote: Hi all, I'd also be interested to know if it is possible to get the params, alter them, from mod_perl without using the request object method... anyone? /Greger -- www.gh-webinteractive.com
Sharing readonly data between processes
Hi, I'm supporting a request on howto solve a memory problem with a farily huge XML-Document parsed using XML::LibXML and not sure whether I'm telling the truth when saying: 1. Loading/Parsing the XML before Apache forks its children and not modifying the data from this point on all apache/mp children will share the same data and it would not be copyied to each of them, copying only takes place when the data is modified. Is this true or have I got something wrong. 2. Is this also true when running e.g. under a thread mpm on mod_perl2, e.g. when you are on windows? thanks Tom
Re: Sharing readonly data between processes
Thanks Perrin your answers are as I suspected. Tom Perrin Harkins wrote: Tom Schindl wrote: Loading/Parsing the XML before Apache forks its children and not modifying the data from this point on all apache/mp children will share the same data and it would not be copyied to each of them, copying only takes place when the data is modified. Is this true or have I got something wrong. It's mostly true, but an XML object is usually something complex which may alter data in some way when you call methods to read it. Even reading a variable as a string when it had previously only been read as a number causes a write in perl. It doesn't unshare the entire thing when that happens, but you do lose in 4K chunks (or whatever the page size is on your OS). 2. Is this also true when running e.g. under a thread mpm on mod_perl2, e.g. when you are on windows? No, there is no equivalent copy-on-write concept with threads on Windows. There you would have to declare it shared between threads, which has catches with objects and may not be safe with this module. Read the threads man pages for more. - Perrin
Re: AJAX pseudo-push
Nicolas George schrieb: > Hi. > > There is an increasingly popular technique to emulate server-initiated push > over HTTP. I'm sure everyone here knows it well, but for the sake of > completeness: the clients sends a XMLHttpRequest to the server in the > background; the server does not answer it immediately, but keeps it for > later when there is actually something to say to the client; if the request > timeouts, the client re-sends it. > > I am wondering if this technique is usable with Apache in general and > mod_perl in particular. > > The obvious solution is to have the request handler sleep until it has > something to answer does not work, since it requires a worker thread and a > perl interpreter for each waiting client, and perl interpreters are few and > expensive. > > The ideal solution would be if some part of the request handler could put > the current request (A) "on hold". Later, the handler for another request > (B) could retrieve the request A and generate an answer for it, or at least > wake it up. > What you describe here is called Continuations in Java world :-) Tom http://docs.codehaus.org/display/JETTY/Continuations
Re: 2 Modules with same package name
Am Mo, 2003-10-06 um 20.15 schrieb Perrin Harkins: > On Mon, 2003-10-06 at 13:36, Stas Bekman wrote: > > But be careful with it. If you use the threaded mpm, it's all cool. If you use > > prefork it'll create 2 perl interpreters and more inside each httpd process > > gobbling up a lot of RAM, something that you don't want to do in production. > > It's OK for dev though. > > I wonder if we need something similar to Apache::PerlVINC for mp2 in > prefork mode. Why is that not appropiate? -8<- PerlOptions +Parent PerlSwitches -Mlib=/my/patha PerlOptions +Parent PerlSwitches -Mlib=/my/pathb -8<- > > > Notice that the "correct" solution for any mod_perl and perl in general is to > > always prefix your module packages with a unique name of a specific project, > > like so App1::vConfig, App2::VConfig, etc. > > Another approach that I would use for this sort of config file situation > is to have one module that looks at the current vhost and returns > different data accordingly. The actual data could go in a non-Perl > config file in AppConfig format or similar. > > - Perrin > Tom
Re: [Mason] Apache::Request and Mason
As far as I know Apache::Request is much smaller and faster than CGI which is bloated with many things you never need. If you don't have DBD::MySQL already installed you are running into same problem because to build DBD::MySQL you also need gcc. You will also need the devel-packages of mysql. Beside that: Nearly every distribution provides RPM-Packages for libapreq and DBD-MySQL(very common modules). If you find out which distribution is installed at your server you are very likly to find rpms. Tom Am Mo, 2003-10-06 um 23.11 schrieb Global Junk: > Thanks. It looks like Dave's answer worked: > > > Otherwise you can use CGI.pm with Mason, by setting > > this in your > > httpd.conf: > > > > PerlSetVar MasonArgsMethod CGI > > To answer some of your other questions about gcc, when > I try to install libapreq-1.3 to get Apache::Request I > get the following error: > > sh-2.05$ make > make[1]: Entering directory > `/usr/local/apache/htdocs/mason_install/libapreq-1.3/c' > gcc -c > -I/usr/local/perl/lib/site_perl/5.6.0/i686-linux/auto/Apache/include > -I/usr/local/perl/lib/site_perl/5.6.0/i686-linux/auto/Apache/include/modules/perl > -I/usr/local/apache/include -I/include > -I/usr/local/apache/include -fno-strict-aliasing > -I/usr/local/include -O2 -DVERSION=\"0.10\" > -DXS_VERSION=\"0.10\" -fpic > -I/usr/local/perl/lib/5.6.0/i686-linux/CORE > apache_request.c > make[1]: gcc: Command not found > make[1]: *** [apache_request.o] Error 127 > make[1]: Leaving directory > `/usr/local/apache/htdocs/mason_install/libapreq-1.3/c' > make: *** [subdirs] Error 2 > > So gcc is not found. I'm hosting on what is called a > virtual dedicated server at Jumpline.com. Somehow > they have it setup where you use part of a server but > have SSH access and can reboot and install anything > you want. It is pretty cool and it is about > $15/month. Anyway maybe they configued the server not > to have gcc. > > Does anyone know an easy way to install gcc? You know > a couple of Unix commands. > > Dave suggestion of using: > > PerlSetVar MasonArgsMethod CGI > > seems to have worked! So I'm excited. What tradoffs > are there with using this method as opposed to > Apache::Request? I'm just trying to build a web site > that can have Perl in the HTML and access a MYSQL > database. > > Thanks for everything. You guys have been great. > > --- Dave Rolsky <[EMAIL PROTECTED]> wrote: > > On Mon, 6 Oct 2003, Global Junk wrote: > > > > > I'm trying to get Mason installed on my Linux > > server. > > > I'm running Apache/1.3.26 (Unix) mod_perl/1.26. > > > > > > I've tried to install the Apache::Request module. > > > First I tried to install libapreq-1.3 to get > > > Apache::Request. I do not have a gcc compiler and > > so > > > I had some errors. I then tried to just install > > > > You're running Linux but gcc is not installed? I > > don't believe that. I > > can't imagine a Linux distro that comes without GCC. > > > > > I hesitate to install a gcc compiler since I do > > not > > > know a lot about it and I do not want to open up a > > can > > > of worms. I would like to avoid compiling if I > > can. > > > > Uh, you already have it, trust me. > > > > Your distro may have a package for Apache::Request. > > I know Debian does. > > > > Otherwise you can use CGI.pm with Mason, by setting > > this in your > > httpd.conf: > > > > PerlSetVar MasonArgsMethod CGI > > > > > > -dave > > > > /*=== > > House Absolute Consulting > > www.houseabsolute.com > > ===*/ > > > > > > > --- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > ___ > > Mason-users mailing list > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/mason-users > > > __ > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search > http://shopping.yahoo.com >
Re: Newbie question...
Strange. I did completely the same last week on my mdk-9.2 installation and no problem. Have you really used the perl Makefile.PL call I did? The mod_perl Makefile.PL builds your apache automatically. I'd suggest removing all files and starting once more. Simply put your apache.tar.gz and mod_perl.tar.gz into the /tmp, unpackage both and make the Makefile.PL-call like its mentionned in INSTALL.Simple and include the option EVERYTHING=1. Tom Am Do, 2003-11-13 um 14.49 schrieb Ken Corey: > Thanks for writing, but using 'EVERYTHING=1' doesn't solve it for me. > Even worse, with EVERYTHING=1, the install fails the tests, too (in > addition to Apache::Log not being provided). > > -Ken > > On Thu, 2003-11-13 at 13:28, Thomas Schindl wrote: > > I had completely the same problem myself, starting Apache with AxKit. > > > > http://www.gossamer-threads.com/archive/mod_perl_C1/modperl_F7/Problems_installing_mp1_and_apache-1.3.28_P73387/ > > > > Tom > > > > On Thu, 2003-11-13 at 13:45, Ken Corey wrote: > > > Hi All. > > > > > > I've had a search through the archives, and can't seem to find anything > > > relevant. Pointers would be welcome. > > > > > > I've got a Mandrake linux 8.1 system (yeah, old), from which I've > > > removed the provided apache 1.3.20 setup. > > > > > > So, I'm starting from scratch. I downloaded apache 1.3.29, mod_perl > > > 1.29, though I kept the perl 5.6.1 that I've already got. > > > > > > I've made apache, and gotten it running just fine. I shut it back down > > > again. > > > > > > Now I try to build mod_perl. > > > > > > perl Makefile.PL EVERYTHING=1 > > > > > > make > > > > > > make test > > > > > the web server won't start.> > > > > > > Hrm...okay...try it this way: > > > perl Makefile.PL PERL_LOG=1 PERL_LOG_API=1 PERL_SSI=1 > > > > > > make > > > > > > make test > > > > > > > > > I install AxKit on top of mod_perl, and then when the web server starts > > > to load, it crashes with the message "Can't locate loadable object for > > > Apache::Log in @INC...". > > > > > > I can find Log.pm in my library path, but no Log.so. Further, I can't > > > see where Log.so is being built in mod_perl, as there's no .c file in > > > the Log subdirectory. > > > > > > Clearly I'm doing something wrong here, but danged if I can tell what it > > > is. Any clues? > > > > > > -Ken > -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: Newbie question...
No that's not right. At least the tar.gz I downloaded does ***NOT*** include any mod_perl, anybody could correct me here but I think it should not get to the archives that apache ships with mod_perl, and one does not have to download it. I think that your mod_perl is coming from all commands/compilations you tried before you simply forgot to supply activate-module, when reconfiguring apache after having built mod_perl. That's why i always let mod_perl-Makefile.PL build my apache. Tom Am Do, 2003-11-13 um 16.57 schrieb Ken Corey: > Ah, okay, found out a solution (but not the cause). > > Turns out that apache 1.3.29 ships with mod_perl 1.29 as an extension > already. > > When I configured apache with this: > > ./configure \ > --activate-module=src/modules/perl/libperl.a > > and then did a make && make install, the mod_perl installation was hunky > dory, so *don't* download mod_perl and try to install it by hand, go > with what's shipped with apache. > > Installing AxKit on top of that was a pain, because I also had to update > the libxml2, libxslt and Sablotron libraries to get everything to > compile correctly. > > However, once all of that was in place, AxKit works just as the website > says it should. > > Hope this helps someone else. > > -Ken > > > On Thu, 2003-11-13 at 13:49, Ken Corey wrote: > > Thanks for writing, but using 'EVERYTHING=1' doesn't solve it for me. > > Even worse, with EVERYTHING=1, the install fails the tests, too (in > > addition to Apache::Log not being provided). > > > > -Ken > > > > On Thu, 2003-11-13 at 13:28, Thomas Schindl wrote: > > > I had completely the same problem myself, starting Apache with AxKit. > > > > > > http://www.gossamer-threads.com/archive/mod_perl_C1/modperl_F7/Problems_installing_mp1_and_apache-1.3.28_P73387/ > > > > > > Tom > > > > > > On Thu, 2003-11-13 at 13:45, Ken Corey wrote: > > > > Hi All. > > > > > > > > I've had a search through the archives, and can't seem to find anything > > > > relevant. Pointers would be welcome. > > > > > > > > I've got a Mandrake linux 8.1 system (yeah, old), from which I've > > > > removed the provided apache 1.3.20 setup. > > > > > > > > So, I'm starting from scratch. I downloaded apache 1.3.29, mod_perl > > > > 1.29, though I kept the perl 5.6.1 that I've already got. > > > > > > > > I've made apache, and gotten it running just fine. I shut it back down > > > > again. > > > > > > > > Now I try to build mod_perl. > > > > > > > > perl Makefile.PL EVERYTHING=1 > > > > > > > > make > > > > > > > > make test > > > > > > > the web server won't start.> > > > > > > > > Hrm...okay...try it this way: > > > > perl Makefile.PL PERL_LOG=1 PERL_LOG_API=1 PERL_SSI=1 > > > > > > > > make > > > > > > > > make test > > > > > > > > > > > > I install AxKit on top of mod_perl, and then when the web server starts > > > > to load, it crashes with the message "Can't locate loadable object for > > > > Apache::Log in @INC...". > > > > > > > > I can find Log.pm in my library path, but no Log.so. Further, I can't > > > > see where Log.so is being built in mod_perl, as there's no .c file in > > > > the Log subdirectory. > > > > > > > > Clearly I'm doing something wrong here, but danged if I can tell what it > > > > is. Any clues? > > > > > > > > -Ken > > > -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html