Perl section and request object
Hello, I'm new to mod perl, I've setup an apache2 / MP2 on an linux debian etch server. I want to access in my apache conf to the HTML Request Header Host: I've written this code : NameVirtualHost 192.168.1.203 UseCanonicalName Off PerlOptions +GlobalRequest Perl use Apache2::RequestUtil (); my $r = Apache2::RequestUtil-request; [...] /Perl But when I restart the server I get the following error message etch:~# /etc/init.d/apache2 restart Forcing reload of web server (apache2)...Syntax error on line 7 of /etc/apache2/sites-enabled/999-vhost: \t(in cleanup) Global $r object is not available. Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at /etc/apache2/sites-enabled/999-vhost line 9.\n failed! But I've already add PerlOptions +GlobalRequest ... Has anyone got an idea ? Thanks -- View this message in context: http://www.nabble.com/Perl-section-and-request-object-tf4479522.html#a12773009 Sent from the mod_perl - General mailing list archive at Nabble.com.
Re: Perl section and request object
me thinks that PerlOptions +GlobalRequest should be inside your Directory or Location section. http://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_Directives_Argument_Types_and_Allowed_Location On 9/19/07, antoine7 [EMAIL PROTECTED] wrote: Hello, I'm new to mod perl, I've setup an apache2 / MP2 on an linux debian etch server. I want to access in my apache conf to the HTML Request Header Host: I've written this code : NameVirtualHost 192.168.1.203 UseCanonicalName Off PerlOptions +GlobalRequest Perl use Apache2::RequestUtil (); my $r = Apache2::RequestUtil-request; [...] /Perl But when I restart the server I get the following error message etch:~# /etc/init.d/apache2 restart Forcing reload of web server (apache2)...Syntax error on line 7 of /etc/apache2/sites-enabled/999-vhost: \t(in cleanup) Global $r object is not available. Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at /etc/apache2/sites-enabled/999-vhost line 9.\n failed! But I've already add PerlOptions +GlobalRequest ... Has anyone got an idea ? Thanks -- View this message in context: http://www.nabble.com/Perl-section-and-request-object-tf4479522.html#a12773009 Sent from the mod_perl - General mailing list archive at Nabble.com.
Re: Perl section and request object
I've just test, changing the directive to a Directory section in apache conf, but I've always the same error. -- View this message in context: http://www.nabble.com/Perl-section-and-request-object-tf4479522.html#a12774905 Sent from the mod_perl - General mailing list archive at Nabble.com.
mod_perl - Intercepting an external Redirect
Hi. I am new to mod_perl apache2 api and hope you can help me a little bit. I've got following scenario: A incoming request A is rewritten by apaches rewrite modul to be served by mod_proxy_ajp - which is connected to a tomcat. The servlet there produce the response and this one will passed back to the client. In my case i need to intercept these response from mod_proxy and check if the response is a redirect, code3xx and the url got some prefix, say /extern. In this case i want to do a $r-internal_redirect which than would be handled again by the rewrite modul, which does a proxy request to another server X, which delivers the content. So in short, i need to analyze the response of mod_proxy and if it matches some criteria, i want to do a internal redirect and serve some content under the requested url. The client should not see the external redirect the servlet triggers. I hope i can do this with a ResponseHandler, but as i am new to this stuff, i don't know if this is the right way. Using the Handler and telling the rewritemodul to do the proxyrequest does result in the answer of the proxy modul, my handler seems to be ignored. Does someone got this scenario already? How can it be handled best? Any hints are welcome. thx Torsten smime.p7s Description: S/MIME cryptographic signature
Re: Perl section and request object
On Wednesday 19 September 2007 4:43:25 am antoine7 wrote: Perl use Apache2::RequestUtil (); my $r = Apache2::RequestUtil-request; [...] /Perl But when I restart the server I get the following error message etch:~# /etc/init.d/apache2 restart Forcing reload of web server (apache2)...Syntax error on line 7 of /etc/apache2/sites-enabled/999-vhost: \t(in cleanup) Global $r object is not available. Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at /etc/apache2/sites-enabled/999-vhost line 9.\n failed! But I've already add PerlOptions +GlobalRequest ... Has anyone got an idea ? $r is a request object. It only exists when you're processing a request, so you can't use it during startup as there's no active request at that point. What is it you are trying to do?
Re: Newbie - Samples or Tutorials
On 9/18/07, Aqua [EMAIL PROTECTED] wrote: Someone please point me to a good tutorial or sample page. There's tons of documentation at http://perl.apache.org/, and there are multiple books available as well. If these aren't helping you, please tell us specifically what you need help with. - Perrin
Re: mod_perl - Intercepting an external Redirect
On 9/19/07, Torsten Krah [EMAIL PROTECTED] wrote: So in short, i need to analyze the response of mod_proxy and if it matches some criteria, i want to do a internal redirect and serve some content under the requested url. The client should not see the external redirect the servlet triggers. I hope i can do this with a ResponseHandler, but as i am new to this stuff, i don't know if this is the right way. I think a filter is what you want. It sounds like mod_proxy is your response handler already. A filter can step in afterward and change the response. - Perrin
apache2 graphs
Hey there What replacement do I have for Apache::GD to work on mod_perl 2 ? Thanks.
RE: Newbie - Samples or Tutorials
Thanks and I have alreday seen these documentations. But actually I am looking for few simple materials (tutorials) which will help my team to learn mod_perl tricks and enable them to build simple application to start with. Are there any simple sample mod_perl based applications available on the net? Any info on performace changes due to the use of mod_perl etc. Appreciate your help in this regard. Best Regards Dominic -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Perrin Harkins Sent: Wednesday, September 19, 2007 8:14 PM To: Aqua Cc: modperl@perl.apache.org Subject: Re: Newbie - Samples or Tutorials On 9/18/07, Aqua [EMAIL PROTECTED] wrote: Someone please point me to a good tutorial or sample page. There's tons of documentation at http://perl.apache.org/, and there are multiple books available as well. If these aren't helping you, please tell us specifically what you need help with. - Perrin
Re: mod_perl - Intercepting an external Redirect
Am Mittwoch, 19. September 2007 schrieb Perrin Harkins: On 9/19/07, Torsten Krah [EMAIL PROTECTED] wrote: So in short, i need to analyze the response of mod_proxy and if it matches some criteria, i want to do a internal redirect and serve some content under the requested url. The client should not see the external redirect the servlet triggers. I hope i can do this with a ResponseHandler, but as i am new to this stuff, i don't know if this is the right way. I think a filter is what you want. It sounds like mod_proxy is your response handler already. A filter can step in afterward and change the response. - Perrin Thx for this hint. Reading the filters.pod and looking at the examples i'll still got a problem. I've configured mod_proxy to deliver content from server otherhost (simulates the tomcat) and otherhost2 (which should deliver the content in special cases but be hidden from the user). RewriteEngine on RewriteRule ^/time/(.*)$ http://otherhost.local/$1 [P,L] RewriteRule ^/extern/(.*)$ http://otherhost2.local/$1 [P,L] PerlModule MyApache2::FilterRequestFoo Location /time SetHandler modperl PerlOutputFilterHandler MyApache2::FilterRequestFoo::Filter /Location The module does nothing special yet, as i want to see if it gets called on redirects (if this is done i can do the logic stuff when to deliver original content or when to do a internal_redirect to deliver content from otherhost2. sub Filter { my ($f, $bb) = @_; my $r=$f-r; warn Called Filter; $r-internal_redirect(/extern/hidden_document); return Apache2::Const::OK; } If i request /time/XYZ the filter get called and the internal_redirect is done, i get the content of otherhost2 under the original request put on otherhost. Now i configured the otherhost to do a permanent redirect when /time/blog is requested. If i request this uri, the redirect is done like configured there - my filter does not get called. Did i miss something? Torsten smime.p7s Description: S/MIME cryptographic signature
Re: Perl section and request object
I've an SVN server on the same machine, at each commit the svn server update the changes to a local directory /www with this structure /www/www.domain1.com.lan/trunk /www/www.domain1.com.lan/tags/001 /www/www.domain1.com.lan/tags/002 ... /www/www.domain1.com.lan/branches/001 ... /www/www.subdomain.domain2.com.lan/trunk etc so I will have apache that point dynamicly to trunk / each tags / each branches of each domain ... we have a lot of search engine optimisation on our websites, that restrict us, if a website is on a / of the production webserver it has to be too on the dev server. I've configurated a local TLD zone .lan with a wildcard that point *.lan demand to the apache developpement server. if the production website is www.domain1.com the local trunk is www.domain1.com.lan - DocumentRoot 'll point to /www/www.domain1.com.lan/trunk the first branche is dev.001.domain1.com.lan - DocumentRoot 'll point to /www/www.domain1.com.lan/branches/000 the fisrt tag is ver.001.domain1.com.lan - DocumentRoot 'll point to /www/www.domain1.com.lan/tags/001 etc I've all working, except I don't know what Host is asked by the developper on the apache server, so I can't calculate a DocumentRoot to serve him the correct pages I've also try with VirtualDocumentRoot with no success, I'm an SEO Project Architect I well known some languages but not a perl and I'm not an Apache expert ... There's the solution to read the /www directory and generate dynamicly some VHost but the server will have to be restarted each time a directory is added to /www ... it's not a good option in my point of view antoine -- View this message in context: http://www.nabble.com/Perl-section-and-request-object-tf4479522.html#a12780901 Sent from the mod_perl - General mailing list archive at Nabble.com.
RFC: Apache2::Filter::Minifier::JavaScript
I've been working on some projects needing JS minification recently and wanted to ping others and find out if anyone else would find it useful to have a mod_perl2 filter that auto-minified your JS (using JavaScript::Minifier)... Am thinking along the lines of something that you'd set up in your Apache config like: FilesMatch \.js$ PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript PerlSetVar MINIFIER_CACHE_ROOT /path/to/your/cache/dir /FilesMatch Results would be cached to disk, so that we didn't have to re-minify the JS files on each and every request. Obviously, if the original file changes, the cached copy would be considered invalid. Seeing the above makes me wonder, though... is there a way to set up a Perl output filter for -just- specific MIME-Types? Similarly to AddOutputFilterByType, but for mod_perl handlers? Thought I'd ask and see if others would find something like this useful, or if you've got suggestions on other ways to do this. I know that I could just minify all the JS files on disk, but it'd be a whole lot simpler to just set it up as a filter and not have to worry about it. Also means that I could turn the filter off during testing and be able to work with the un-minified JS. Also thinking that an Apache2::Filter::Minifier::CSS module would be possible using CSS::Minifier; basically same thing but for CSS instead. -- Graham TerMarsch
Re: Problem with perl-status memory usage
Perrin Harkins wrote: On 9/14/07, RA Jones [EMAIL PROTECTED] wrote: Yes, user 'nobody' gets a display on 'cat /opt/lampp/lib/perl5/site_perl/5.8.7/Devel/Symdump.pm' Okay, can you try making your own mod_perl handler that loads Devel::Symdump and see if it works? Sorry it's taken a while. A simple handler: require Devel::Symdump; my $obj = Devel::Symdump-new( 'DBI' ); print Content-type: text/html\n\n; print Dumper $obj; return Apache2::Const::OK; gives me a nice Data::Dumper data structure in the browser window. It probably doesn't make much sense as programming logic as I don't normally use Devel::Symdump, but I guess it shows the module is OK? -- Richard Jones
Re: Problem with perl-status memory usage
Richard Jones wrote: gives me a nice Data::Dumper data structure in the browser window. It probably doesn't make much sense as programming logic as I don't normally use Devel::Symdump, but I guess it shows the module is OK? The original error message was this: [Wed Sep 12 11:45:59 2007] [error] [client 127.0.0.1] Can't locate object method rnew via package Devel::Symdump (perhaps you forgot to load Devel::Symdump?) at /opt/lampp/lib/perl5/site_perl/5.8.7/i686-linux/B/TerseSize.pm line 632.\n, referer: http://xxx.xxx.xxx.xxx/perl-status Maybe it's as simple as B::TerseSize simplying not using/requiring Devel::Symdump? -- Michael Peters Developer Plus Three, LP
Re: RFC: Apache2::Filter::Minifier::JavaScript
I could use something like this. Right now I use Toolkit Template to build from. It already caches the JS file loaded from disk. I would want to then put it through the minifier process and cache then serve. Would you module allow for this? -bop On Sep 19, 2007, at 12:24 PM, Graham TerMarsch wrote: I've been working on some projects needing JS minification recently and wanted to ping others and find out if anyone else would find it useful to have a mod_perl2 filter that auto-minified your JS (using JavaScript::Minifier)... Am thinking along the lines of something that you'd set up in your Apache config like: FilesMatch \.js$ PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript PerlSetVar MINIFIER_CACHE_ROOT /path/to/your/cache/dir /FilesMatch Results would be cached to disk, so that we didn't have to re- minify the JS files on each and every request. Obviously, if the original file changes, the cached copy would be considered invalid. Seeing the above makes me wonder, though... is there a way to set up a Perl output filter for -just- specific MIME-Types? Similarly to AddOutputFilterByType, but for mod_perl handlers? Thought I'd ask and see if others would find something like this useful, or if you've got suggestions on other ways to do this. I know that I could just minify all the JS files on disk, but it'd be a whole lot simpler to just set it up as a filter and not have to worry about it. Also means that I could turn the filter off during testing and be able to work with the un- minified JS. Also thinking that an Apache2::Filter::Minifier::CSS module would be possible using CSS::Minifier; basically same thing but for CSS instead. -- Graham TerMarsch
Re: RFC: Apache2::Filter::Minifier::JavaScript
On Wednesday 19 September 2007 10:40 am, Boysenberry Payne wrote: I could use something like this. Right now I use Toolkit Template to build from. It already caches the JS file loaded from disk. I would want to then put it through the minifier process and cache then serve. Would you module allow for this? That'd be the idea... it'd just be a generic output filter that you'd have to hook up yourself into your existing JS pipeline. In my initial example I used FilesMatch to do it, but you could hook it up anywhere that you can set up a PerlOutpuFilterHandler. It'd just take the JS that it was provided, minify it, then cache the minified version. On subsequent requests, it'd (somehow) figure out that the cached copy was valid and then either use the cached copy or re-minify+re-cache as necessary. If we're dealing with -dynamically- generated JS, though, then I'll need to think a bit more about how I deal with is our cached copy valid/stale?, as that'd be done differently than if just serving static JS files. I'll have a look at that, though, as that's a good use case. I'd initially thought of using the r-finfo-inode() as a cache key, but I don't think that's there if I'm being handed dynamically generated JS. -- Graham TerMarsch
RE: Apache2::Filter::Minifier::JavaScript
hi -Original Message- From: Graham TerMarsch [mailto:[EMAIL PROTECTED] [deletions] I've been working on some projects needing JS minification recently and wanted to ping others and find out if anyone else would find it useful to have a mod_perl2 filter that auto-minified your JS (using JavaScript::Minifier)... Also thinking that an Apache2::Filter::Minifier::CSS module would be possible using CSS::Minifier; basically same thing but for CSS instead. i'm not so familiar with how the minifiers work, but in javascript, if it changes function or object names, and the HTML references those- you'd be SOL- right? and similarily with css class names and ids? am i not understanding something about how these modules work? -- \js
Re: Apache2::Filter::Minifier::JavaScript
On Wednesday 19 September 2007 10:51 am, John Saylor wrote: -Original Message- From: Graham TerMarsch [mailto:[EMAIL PROTECTED] [deletions] I've been working on some projects needing JS minification recently and wanted to ping others and find out if anyone else would find it useful to have a mod_perl2 filter that auto-minified your JS (using JavaScript::Minifier)... i'm not so familiar with how the minifiers work, but in javascript, if it changes function or object names, and the HTML references those- you'd be SOL- right? and similarily with css class names and ids? You're right, we would be SOL. JavaScript::Minifier and CSS::Minifier don't change those, though; they're minifiers, not obfuscators. You'll find more info on what they do over in their listings on CPAN: http://search.cpan.org/dist/JavaScript-Minifier http://search.cpan.org/dist/CSS-Minifier -- Graham TerMarsch
Re: RFC: Apache2::Filter::Minifier::JavaScript
If there is anything I can do to help let me know. I'd really like to have a small footprint on my JS output, right now its still pretty big. Boysenberry Payne Habitat Life, Inc. http://www.habitatlife.com/ On Sep 19, 2007, at 12:49 PM, Graham TerMarsch wrote: On Wednesday 19 September 2007 10:40 am, Boysenberry Payne wrote: I could use something like this. Right now I use Toolkit Template to build from. It already caches the JS file loaded from disk. I would want to then put it through the minifier process and cache then serve. Would you module allow for this? That'd be the idea... it'd just be a generic output filter that you'd have to hook up yourself into your existing JS pipeline. In my initial example I used FilesMatch to do it, but you could hook it up anywhere that you can set up a PerlOutpuFilterHandler. It'd just take the JS that it was provided, minify it, then cache the minified version. On subsequent requests, it'd (somehow) figure out that the cached copy was valid and then either use the cached copy or re-minify+re-cache as necessary. If we're dealing with -dynamically- generated JS, though, then I'll need to think a bit more about how I deal with is our cached copy valid/ stale?, as that'd be done differently than if just serving static JS files. I'll have a look at that, though, as that's a good use case. I'd initially thought of using the r-finfo-inode() as a cache key, but I don't think that's there if I'm being handed dynamically generated JS. -- Graham TerMarsch
Re: apache2 graphs
You can consider ImageMagick. It works on standard Perl apps as well. Eli Shemer wrote: Hey there What replacement do I have for Apache::GD to work on mod_perl 2 ? Thanks.
upgrade to mp2
Hello, currently we have mp1 installed.but I will upgrade it to mp2. does it have any risk?or will mp2 get conflict with mp1? thanks.