Installing mod_perl for 2 versions of Perl?
Hi, Under Ubuntu 10.04, is it possible to install mod_perl for 2 versions of Perl for the same Apache? I have the default build of Apache that comes with Ubuntu and the default Perl that comes with Ubuntu and I also have the mod_perl installed with apt-get. I want to test ActivePerl 5.14 and I want to install Mod_perl for it but I wouldn't like to need uninstalling the actual Apache/Perl/mod_perl. Thanks. --Octavian
Re: Installing mod_perl for 2 versions of Perl?
Octavian Rasnita wrote: Hi, Under Ubuntu 10.04, is it possible to install mod_perl for 2 versions of Perl for the same Apache? I have the default build of Apache that comes with Ubuntu and the default Perl that comes with Ubuntu and I also have the mod_perl installed with apt-get. I want to test ActivePerl 5.14 and I want to install Mod_perl for it but I wouldn't like to need uninstalling the actual Apache/Perl/mod_perl. In my opinion, the short practical answer is no. It is technically possible, but you are going to spend so much time trying to combine this properly, that it is probably not worth the effort. You would save yourself a lot of time by using another host, installing your chosen versions of Apache and Perl on it, and then installing mod_perl from source, pointing it to the installed Apache and Perl. Personal opinion, all of it. YMMV.
Re: Installing mod_perl for 2 versions of Perl?
On Monday, July 11, 2011 09:13:25 Octavian Rasnita wrote: I want to test ActivePerl 5.14 and I want to install Mod_perl for it but I wouldn't like to need uninstalling the actual Apache/Perl/mod_perl. Don't you have separate module libraries? Anyway, you always can use the DESTDIR=... option: make DESTDIR=/some/where install This takes /some/where as root directory. You then have to use PerlSwitches -I... or similar in the httpd.conf. You also have to modify the LoadModule statement to load the right modperl. If you want to compile additional modules make sure they use the right header files and also use the DESTDIR option. Torsten Förtsch -- Need professional modperl support? Hire me! (http://foertsch.name) Like fantasy? http://kabatinte.net
Re: Installing mod_perl for 2 versions of Perl?
Torsten Förtsch wrote: On Monday, July 11, 2011 09:13:25 Octavian Rasnita wrote: I want to test ActivePerl 5.14 and I want to install Mod_perl for it but I wouldn't like to need uninstalling the actual Apache/Perl/mod_perl. Don't you have separate module libraries? Anyway, you always can use the DESTDIR=... option: make DESTDIR=/some/where install This takes /some/where as root directory. You then have to use PerlSwitches -I... or similar in the httpd.conf. You also have to modify the LoadModule statement to load the right modperl. If you want to compile additional modules make sure they use the right header files and also use the DESTDIR option. By personal experience, I believe that this is over-simplifying a bit. Ubuntu/Debian packages are nice, and they just work. But these packages work by putting (very clever) links all over the place, and I wish good luck to someone wanting to combine this with, for example, another perl and a mod_perl installed from source, while keeping the same Apache. (E.g. if it needs changing the LoadModule line in Apache, then of course you cannot run this concurrently with the normal version.) And trying to install a CPAN package over that, to a directory library that is not the default one, is a real pain. At least the last time I tried. Admittedly, I am not the ultimate perl/mod_perl expert, and in the end I will defer to the real experts. But I believe that the OP is not a real expert either, and for now I'll stick to my earlier recommendation.
Re: mod_perl EC2 AMI's or other platform providers?
On 07/10/2011 06:28 AM, Tosh Cooey wrote: Looks there like they have a Perl stack available, which is super for the world but not so for me since the stack requires you use PSGI which is a great approach but since I don't require portability I never went that route, oh woe is me... PSGI isn't just about portability, it's also about middleware. With a common interface between components we get out of the rut where each new cool plugin was re-implemented by every existing framework. Now most things can just be written as PSGI middleware and anything can use it no matter what your framework (or lack of one). For instance, these are some handy ones to have: Plack::Middleware::InteractiveDebugger Plack::Middleware::REPL Plack::Middleware::Firebug::Lite Plack::Middleware::JSONP Plack::Middleware::RefererCheck Plack::Middleware::Static::Minifier Plack::Middleware::HTMLMinify Plack::Middleware::Mirror Plack::Middleware::iPhone And there's a ton more. Yes lots of them can be done with other existing Apache modules (but not all of them) and lots of them might already exist in your framework of choice. But pulling things out into middleware seems to be the future of such work and will thus get new features and be better maintained than lots of other alternatives. -- Michael Peters Plus Three, LP
Re: Installing mod_perl for 2 versions of Perl?
2011/7/11 Octavian Rasnita orasn...@gmail.com: Under Ubuntu 10.04, is it possible to install mod_perl for 2 versions of Perl for the same Apache? Just install another apache. It's pretty simple to compile apache and mod_perl against your own perl, and it avoids needing to put a bunch of custom stuff in your httpd.conf to specify library paths, etc. - Perrin
Re: Installing mod_perl for 2 versions of Perl?
On Mon, Jul 11, 2011 at 10:44 AM, Perrin Harkins per...@elem.com wrote: 2011/7/11 Octavian Rasnita orasn...@gmail.com: Under Ubuntu 10.04, is it possible to install mod_perl for 2 versions of Perl for the same Apache? Just install another apache. It's pretty simple to compile apache and mod_perl against your own perl, and it avoids needing to put a bunch of custom stuff in your httpd.conf to specify library paths, etc. But you will likely want to compile Apache with the --with-included-apr so that it uses the included apr libraries and not those provided by Ubuntu.
Re: mod_perl EC2 AMI's or other platform providers?
I saw Miyagawa at YAPC::NA and it looks like DotCloud is serious about their Perl support. The situation seems pretty good to me. We have DotCloud, for people who want to try something simple very quickly with minimal startup costs. We have cheap virtual servers (e.g. Linode) running linux with simple installation of pre-compiled perl, apache, and mod_perl, for those who want a little more control but can live with outdated versions in exchange for ease of administration. Then we have compile-your-own, for those running large systems who want the latest versions and need the best performance and debugging possible. I don't think we're missing anyone at this point. - Perrin On Sun, Jul 10, 2011 at 7:22 AM, Dave Hodgkinson daveh...@gmail.com wrote: Also, I believe DotCloud has Miyagawa on board which is a big win IMHO. Legend has it he had perl support shipped two days after joining. Or something. I'm about to put a Catalyst app on it so we'll see how that flies. On 10 Jul 2011, at 11:28, Tosh Cooey wrote: Mr. Hodgkinson was awesome enough to point out the existence of DotCloud: https://docs.dotcloud.com/#perl.html Looks there like they have a Perl stack available, which is super for the world but not so for me since the stack requires you use PSGI which is a great approach but since I don't require portability I never went that route, oh woe is me... Anyway, it's good to see there's some good Perl options out there for getting rid of my admin(s). Thanks Dave! Tosh On 7/22/64 8:59 PM, Tosh Cooey wrote: The point was, and is, that it's unfortunate that mod_perl developers need to: 1) Build and optimize Apache. 2) Build and optimize MySql. 3) Build and optimize Perl+mod_perl. 4) Build and optimize a Linux server environment. or 5) Have enough money to pay for all of the above. Those are all roadblocks to development, much like your responses are to this discussion. My life would be a different experience if I could pay for six months of your time whenever I wanted to create a new web application. It would be nice to fire up a mod_perl stack somewhere (say EC2) and then just modify startup.pl and install your required modules and go. The dev world is moving away from requiring system administrators and towards more PaaS'. Tosh On 7/5/11 10:48 AM, Dave Hodgkinson wrote: On 5 Jul 2011, at 08:53, Tosh Cooey wrote: On 7/4/11 11:26 PM, Dave Hodgkinson wrote: I'm not happy, hence the complaining about the AMI from 2009. But I'm glad you changed the subject from your first one, which is that I should build my own stack. So basically you are saying (and only you, not a community voice) that in order to be a mod_perl developer one also needs to: 1) Build and optimize Apache. 2) Build and optimize MySql. 3) Build and optimize Perl+mod_perl. 4) Build and optimize a Linux server environment. or 5) Have enough money to pay for all of the above. You have no stack. Make one. Better still, get a bunch of people together with the same problem. Dunno where you'd find 'em. I just spent six months helping a company do exactly[0] this and move off a dated RH platform onto a modern, current, Debian, perl 5.14, all new CPAN modules. You seem to have missed the point of my kvetching, which is perhaps a suitable answer anyway. What was the point? -- McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/
Changing browser URL based on condition
Hi All, I would like to know if there is a way to change the URL displayed on browser without using Redirect option. The URL visible on client browser must be based on some condition that is evaluated in my mod_perl handler. For example - 1. User types the URL - www.example.com, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/home, instead it remains the same (i.e. www.example.com/login). I am using Template toolkit to render my pages. I tried $req-url('/home'), but that does not change the browser URI. Any help will be appreciated. Thanks, Jerry
Re: Changing browser URL based on condition
On Mon, Jul 11, 2011 at 11:48:09AM -0700, Jerry Pereira wrote: I would like to know if there is a way to change the URL displayed on browser without using Redirect option. The URL visible on client browser must be based on some condition that is evaluated in my mod_perl handler. Imagine if a web page could cause the browser to display any URL it wanted, rather than the URL of the page the user is actually viewing... That would be a huge security hole for spoofing of web sites! So, why don't you want to do a redirect, exactly? Ronald
RE: Changing browser URL based on condition
If you are looking to do this for cosmetic reasons, I do this be simply using frame sets and doing redirects in the child frame. The URL displayed in the location bar will always be constant for the parent frame. I don't think there is any way to do this at the core level or it would be a spoofers windfall. The browser will always have the actual location in the info panel. From: Jerry Pereira [mailto:online.je...@gmail.com] Sent: Monday, July 11, 2011 2:48 PM To: modperl@perl.apache.org Subject: Changing browser URL based on condition Hi All, I would like to know if there is a way to change the URL displayed on browser without using Redirect option. The URL visible on client browser must be based on some condition that is evaluated in my mod_perl handler. For example - 1. User types the URL - www.example.comhttp://www.example.com/, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/loginhttp://www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/homehttp://www.example.com/home, instead it remains the same (i.e. www.example.com/loginhttp://www.example.com/login). I am using Template toolkit to render my pages. I tried $req-url('/home'), but that does not change the browser URI. Any help will be appreciated. Thanks, Jerry
Re: Changing browser URL based on condition
From: Jerry Pereira online.je...@gmail.com Hi All, I would like to know if there is a way to change the URL displayed on browser without using Redirect option. Nope, not possible. You need to do that redirection somehow. What the user sees in the address bar is the URL accessed by the browser. If the browser is not told to access a certain URL, how can that URL appear in the address bar? Why don't you want to do that redirection? It is pretty common (and recommended) to do a redirect after POST because in that case the users won't need to meet that ugly warning window that appear if the user does a page refresh after the POST. Octavian
Re: Changing browser URL based on condition
Hi Edward, I have the following design: A single PerlResponseHandler for all requests. This handler based on the path decides the action to be taken For example, if the user submits to www.example.com/login, then the handler delegates the request to authentication module, which will then either display the home page (throug home page template) or login page again, based on the success/failure of authentication mechanism. Since i am rendering the page via template, i am able to generate the content of home page which i then send back to the client, but the URL on the browser remails the same (i.e. www.example.com/login), which is not true. Any suggestions to handle this scenario will be great. Thanks, Jerry On Mon, Jul 11, 2011 at 12:03 PM, Szekeres, Edward edward.szeke...@perkinelmer.com wrote: If you are looking to do this for “cosmetic reasons”, I do this be simply using frame sets and doing redirects in the child frame. The URL displayed in the location bar will always be constant for the parent frame. I don’t think there is any way to do this at the core level or it would be a spoofers windfall. The browser will always have the actual location in the info panel. ** ** *From:* Jerry Pereira [mailto:online.je...@gmail.com] *Sent:* Monday, July 11, 2011 2:48 PM *To:* modperl@perl.apache.org *Subject:* Changing browser URL based on condition ** ** Hi All, I would like to know if there is a way to change the URL displayed on browser without using Redirect option. The URL visible on client browser must be based on some condition that is evaluated in my mod_perl handler.* *** For example - 1. User types the URL - www.example.com, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/home, instead it remains the same (i.e. www.example.com/login). I am using Template toolkit to render my pages. I tried $req-url('/home'), but that does not change the browser URI. Any help will be appreciated. Thanks, Jerry -- Your clothes may be the latest in style but you aint completely dressed until you wear a smile! Keep smiling : )
Re: Changing browser URL based on condition
On 07/11/2011 03:14 PM, Jerry Pereira wrote: Any suggestions to handle this scenario will be great. As others have noted, there isn't a way to do this. If it's a requirement of your application then the only way to handle it is to do redirection. And as others have pointed out it's a good idea to do a redirect after a POST anyway since it prevents other problems. -- Michael Peters Plus Three, LP
Re: Installing mod_perl for 2 versions of Perl?
From: Fred Moyer f...@redhotpenguin.com On Mon, Jul 11, 2011 at 10:44 AM, Perrin Harkins per...@elem.com wrote: 2011/7/11 Octavian Rasnita orasn...@gmail.com: Under Ubuntu 10.04, is it possible to install mod_perl for 2 versions of Perl for the same Apache? Just install another apache. It's pretty simple to compile apache and mod_perl against your own perl, and it avoids needing to put a bunch of custom stuff in your httpd.conf to specify library paths, etc. But you will likely want to compile Apache with the --with-included-apr so that it uses the included apr libraries and not those provided by Ubuntu. Thanks for the suggestion. What's the problem with the one provided by Ubuntu? Will it be used by default if I will compile Apache, or it won't be used at all? Thanks.
Re: Installing mod_perl for 2 versions of Perl?
From: Perrin Harkins per...@elem.com 2011/7/11 Octavian Rasnita orasn...@gmail.com: Under Ubuntu 10.04, is it possible to install mod_perl for 2 versions of Perl for the same Apache? Just install another apache. It's pretty simple to compile apache and mod_perl against your own perl, and it avoids needing to put a bunch of custom stuff in your httpd.conf to specify library paths, etc. - Perrin Mmm, I like the word simple :-) I am still afraid to compile Perl+Apache+mod_perl since the old days when I needed to do that because there were no other solutions, and when I needed to face some ugly compiling errors... But if you say that it is simple, I will try it. ...because my current solution is not less uglier. I have installed Apache using apt-get, multiplied it to have 3 instances of Apache, with their own services and settings in /etc and due to the way Apache is installed under Ubuntu it was not very funny. (Because I needed to test an Apache-proxy and 2 Apache back-ends with mod_perl on the same machine... Thanks. Octavian
Re: mod_perl EC2 AMI's or other platform providers?
From: Perrin Harkins per...@elem.com I saw Miyagawa at YAPC::NA and it looks like DotCloud is serious about their Perl support. The situation seems pretty good to me. We have DotCloud, for people who want to try something simple very quickly with minimal startup costs. I have tried, or better said tried to try DotCloud. :-) But I couldn't access it from Windows. They say that for the moment they don't really support Windows but I read a blog with some tips for making it work under Windows. The problem was that rsync didn't work under Windows, or at least this is what their client program said. I have installed cwRsync that includes cygwin and rsync, but I don't know for what reason... it didn't work. For the moment their pricing plan is not clear for me. 0 USD/Mo is clear, and I understand that for this it offers 2 services, that can be say... Perl and MySQL. The second level... is 99 USD/Mo for which they offer 4 services, but without beeing clear about the processors/memory/space (or I missed that part), and this second step is much expensive than the first few tariff plans of linode. I was interested by DotCloud because I wanted to see how accessible is the interface they offer, but for the moment... it is not very. If you know something more about these, please tell us. Perl programs are usually harder to deploy than the PHP apps, and it would be very good if there would be a solution easy to use for apps wich are a little more complex. Octavian
Re: Changing browser URL based on condition
Much better to go with a more RESTful approach - the URL is the identifier for the page and you don't want that identifier to represent the wrong page, e.g. if example.com/login sometimes returns the home page and sometimes returns some other page (assuming you can login from and return to multiple pages.) Make it so that your home page (or any page) have a login form (or link which expands to a login form) which POSTs to the login page (or to think of it in a RESTful way, PUT to a sessions URL, thus defining the idea of create a new session - except that browser forms have problems with PUT). Then from the login page do a redirect to whatever was the referer. On Mon, Jul 11, 2011 at 12:14 PM, Jerry Pereira online.je...@gmail.comwrote: Hi Edward, I have the following design: A single PerlResponseHandler for all requests. This handler based on the path decides the action to be taken For example, if the user submits to www.example.com/login, then the handler delegates the request to authentication module, which will then either display the home page (throug home page template) or login page again, based on the success/failure of authentication mechanism. Since i am rendering the page via template, i am able to generate the content of home page which i then send back to the client, but the URL on the browser remails the same (i.e. www.example.com/login), which is not true. Any suggestions to handle this scenario will be great. Thanks, Jerry On Mon, Jul 11, 2011 at 12:03 PM, Szekeres, Edward edward.szeke...@perkinelmer.com wrote: If you are looking to do this for “cosmetic reasons”, I do this be simply using frame sets and doing redirects in the child frame. The URL displayed in the location bar will always be constant for the parent frame. I don’t think there is any way to do this at the core level or it would be a spoofers windfall. The browser will always have the actual location in the info panel. ** ** *From:* Jerry Pereira [mailto:online.je...@gmail.com] *Sent:* Monday, July 11, 2011 2:48 PM *To:* modperl@perl.apache.org *Subject:* Changing browser URL based on condition ** ** Hi All, I would like to know if there is a way to change the URL displayed on browser without using Redirect option. The URL visible on client browser must be based on some condition that is evaluated in my mod_perl handler. For example - 1. User types the URL - www.example.com, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/home, instead it remains the same (i.e. www.example.com/login). I am using Template toolkit to render my pages. I tried $req-url('/home'), but that does not change the browser URI. Any help will be appreciated. Thanks, Jerry -- Your clothes may be the latest in style but you aint completely dressed until you wear a smile! Keep smiling : )
Re: Changing browser URL based on condition
From: Jerry Pereira online.je...@gmail.com Hi Edward, I have the following design: A single PerlResponseHandler for all requests. This handler based on the path decides the action to be taken For example, if the user submits to www.example.com/login, then the handler delegates the request to authentication module, which will then either display the home page (throug home page template) or login page again, based on the success/failure of authentication mechanism. Instead of displaying those pages, why can't the authentication module do a redirect to the handler that display the wanted page? Octavian
Re: Changing browser URL based on condition
On Mon, 11 Jul 2011 11:48:09 -0700 Jerry Pereira online.je...@gmail.com wrote: 1. User types the URL - www.example.com, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/home, instead it remains the same (i.e. www.example.com/login). One important reason to do something like that is because you do not want the user to bookmark or otherwise pass on an url with completely ambiguous content -- /login should refer to the login page, /home should refer to the home page, they are two different things. Having /login refer to both is no good. So I think your desire is justified. IMO, this is best handled client-side: you return your login data via an AJAX call. If the login succeeds, the client loads /home. If the login has failed, the client displays a message to that effect. You need to prevent spoofed access to /home, but of course you have to do that anyway (via cookies or whatever method you are already using). -- Enthusiasm is not the enemy of the intellect. (said of Irving Howe) The angel of history[...]is turned toward the past. (Walter Benjamin)
Re: Installing mod_perl for 2 versions of Perl?
On Mon, Jul 11, 2011 at 3:14 PM, Octavian Rasnita orasn...@gmail.com wrote: From: Perrin Harkins per...@elem.com I am still afraid to compile Perl+Apache+mod_perl since the old days when I needed to do that because there were no other solutions, and when I needed to face some ugly compiling errors... But if you say that it is simple, I will try it. I know some people have issues but I've never had any on common Linux platforms. It complies very nicely. Just be sure to use the perl you want to compile against when running Makefile.PL for mod_perl. - Perrin
Re: Changing browser URL based on condition
Agree with the consensus. The URI should be descriptive of the function, so any requests to /login should be from users who are attempting to... login. The home page should be housed under a separate URL (/home for example) After the user has authenticated, the login module should redirect to the /home URI. Any links to the home page from within the application should likewise refer to /home. You should have security in place to redirect any unauthenticated users to /login before requests for /home (or any other part of your application) are processed. If you for some reason simply MUST keep referring people to /login when they are expecting to see the home page, put code in your login module to check for authenticated users and redirect them to /home before displaying the login page. If the user doesn't have a session, then go ahead and display the login form. On 11-07-11 03:14 PM, Jerry Pereira wrote: Hi Edward, I have the following design: A single PerlResponseHandler for all requests. This handler based on the path decides the action to be taken For example, if the user submits to www.example.com/login http://www.example.com/login, then the handler delegates the request to authentication module, which will then either display the home page (throug home page template) or login page again, based on the success/failure of authentication mechanism. Since i am rendering the page via template, i am able to generate the content of home page which i then send back to the client, but the URL on the browser remails the same (i.e. www.example.com/login http://www.example.com/login), which is not true. Any suggestions to handle this scenario will be great. Thanks, Jerry On Mon, Jul 11, 2011 at 12:03 PM, Szekeres, Edward edward.szeke...@perkinelmer.com mailto:edward.szeke...@perkinelmer.com wrote: If you are looking to do this for “cosmetic reasons”, I do this be simply using frame sets and doing redirects in the child frame. The URL displayed in the location bar will always be constant for the parent frame. I don’t think there is any way to do this at the core level or it would be a spoofers windfall. The browser will always have the actual location in the info panel. *From:*Jerry Pereira [mailto:online.je...@gmail.com mailto:online.je...@gmail.com] *Sent:* Monday, July 11, 2011 2:48 PM *To:* modperl@perl.apache.org mailto:modperl@perl.apache.org *Subject:* Changing browser URL based on condition Hi All, I would like to know if there is a way to change the URL displayed on browser without using Redirect option. The URL visible on client browser must be based on some condition that is evaluated in my mod_perl handler. For example - 1. User types the URL - www.example.com http://www.example.com/, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/login http://www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/home http://www.example.com/home, instead it remains the same (i.e. www.example.com/login http://www.example.com/login). I am using Template toolkit to render my pages. I tried $req-url('/home'), but that does not change the browser URI. Any help will be appreciated. Thanks, Jerry -- Your clothes may be the latest in style but you aint completely dressed until you wear a smile! Keep smiling : )
Re: Installing mod_perl for 2 versions of Perl?
On Mon, Jul 11, 2011 at 12:38 PM, Perrin Harkins per...@elem.com wrote: On Mon, Jul 11, 2011 at 3:14 PM, Octavian Rasnita orasn...@gmail.com wrote: From: Perrin Harkins per...@elem.com I am still afraid to compile Perl+Apache+mod_perl since the old days when I needed to do that because there were no other solutions, and when I needed to face some ugly compiling errors... But if you say that it is simple, I will try it. I know some people have issues but I've never had any on common Linux platforms. It complies very nicely. Just be sure to use the perl you want to compile against when running Makefile.PL for mod_perl. and the desired apxs binary with: /my/perl Makefile.PL MP_APXS=/my/apxs By default version 2.0.5 will look for installed apxs/apxs2 binaries in certain places like your PATH and use those by default if you don't explicitly specify which apxs binary to use.
RE: Changing browser URL based on condition
It seems to be just an attempt to do what is already done in Apache2::AuthCookie (CPAN), which encapsulates a server side authentication. -Original Message- From: MK [mailto:m...@cognitivedissonance.ca] Sent: Monday, July 11, 2011 3:37 PM To: modperl@perl.apache.org Subject: Re: Changing browser URL based on condition On Mon, 11 Jul 2011 11:48:09 -0700 Jerry Pereira online.je...@gmail.com wrote: 1. User types the URL - www.example.com, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/home, instead it remains the same (i.e. www.example.com/login). One important reason to do something like that is because you do not want the user to bookmark or otherwise pass on an url with completely ambiguous content -- /login should refer to the login page, /home should refer to the home page, they are two different things. Having /login refer to both is no good. So I think your desire is justified. IMO, this is best handled client-side: you return your login data via an AJAX call. If the login succeeds, the client loads /home. If the login has failed, the client displays a message to that effect. You need to prevent spoofed access to /home, but of course you have to do that anyway (via cookies or whatever method you are already using). -- Enthusiasm is not the enemy of the intellect. (said of Irving Howe) The angel of history[...]is turned toward the past. (Walter Benjamin)
Re: Changing browser URL based on condition
Thanks Guys!!! I will go ahead with Redirect approach. I was more interested in building a generic framework for my application that would handle such scenarios (login was just one of them). On Mon, Jul 11, 2011 at 12:42 PM, Szekeres, Edward edward.szeke...@perkinelmer.com wrote: It seems to be just an attempt to do what is already done in Apache2::AuthCookie (CPAN), which encapsulates a server side authentication. -Original Message- From: MK [mailto:m...@cognitivedissonance.ca] Sent: Monday, July 11, 2011 3:37 PM To: modperl@perl.apache.org Subject: Re: Changing browser URL based on condition On Mon, 11 Jul 2011 11:48:09 -0700 Jerry Pereira online.je...@gmail.com wrote: 1. User types the URL - www.example.com, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/home, instead it remains the same (i.e. www.example.com/login). One important reason to do something like that is because you do not want the user to bookmark or otherwise pass on an url with completely ambiguous content -- /login should refer to the login page, /home should refer to the home page, they are two different things. Having /login refer to both is no good. So I think your desire is justified. IMO, this is best handled client-side: you return your login data via an AJAX call. If the login succeeds, the client loads /home. If the login has failed, the client displays a message to that effect. You need to prevent spoofed access to /home, but of course you have to do that anyway (via cookies or whatever method you are already using). -- Enthusiasm is not the enemy of the intellect. (said of Irving Howe) The angel of history[...]is turned toward the past. (Walter Benjamin) -- Your clothes may be the latest in style but you aint completely dressed until you wear a smile! Keep smiling : )
RE: Changing browser URL based on condition
I think you need to do a redirect. From within your mod_perl handler try something like this: $r-content_type(text/plain); $r-headers_out-set(Location=$url); return Apache2::Const::HTTP_TEMPORARY_REDIRECT; From: Jerry Pereira [mailto:online.je...@gmail.com] Sent: Monday, July 11, 2011 2:48 PM To: modperl@perl.apache.org Subject: Changing browser URL based on condition Hi All, I would like to know if there is a way to change the URL displayed on browser without using Redirect option. The URL visible on client browser must be based on some condition that is evaluated in my mod_perl handler. For example - 1. User types the URL - www.example.comhttp://www.example.com/, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/loginhttp://www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/homehttp://www.example.com/home, instead it remains the same (i.e. www.example.com/loginhttp://www.example.com/login). I am using Template toolkit to render my pages. I tried $req-url('/home'), but that does not change the browser URI. Any help will be appreciated. Thanks, Jerry IMPORTANT NOTICE REGARDING THIS ELECTRONIC MESSAGE: This message is intended for the use of the person to whom it is addressed and may contain information that is privileged, confidential, and protected from disclosure under applicable law. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.
Best approach to store Application Configuration
Hi All, I am new to mod_perl (a java developer). I would like to know the best approach to store and retrieve Applicaiton configurations that is accessible to all packages in my mod_perl application. My application configuration includes - Database details, Template mapping, LDAP configuration details etc. I would like my to load all these configuratoins when my application starts and then on, i should be able to access these configuration from anywhere. For Example: my $dbDetails = ConfigUtil-getDBDetails(); //returns reference to hash my dbUser = dbDetails-user; I belive PerlSetVar only allows strings variables. I would like to get some suggestions on how configuration management in mod_perl applications. Thanks, Jerry
RE: Best approach to store Application Configuration
This page describes pretty well how to set up custom configuration directives; perhaps helpful? http://perl.apache.org/docs/2.0/user/config/custom.html -James From: Jerry Pereira [mailto:online.je...@gmail.com] Sent: Monday, July 11, 2011 5:08 PM To: modperl@perl.apache.org Subject: Best approach to store Application Configuration Hi All, I am new to mod_perl (a java developer). I would like to know the best approach to store and retrieve Applicaiton configurations that is accessible to all packages in my mod_perl application. My application configuration includes - Database details, Template mapping, LDAP configuration details etc. I would like my to load all these configuratoins when my application starts and then on, i should be able to access these configuration from anywhere. For Example: my $dbDetails = ConfigUtil-getDBDetails(); //returns reference to hash my dbUser = dbDetails-user; I belive PerlSetVar only allows strings variables. I would like to get some suggestions on how configuration management in mod_perl applications. Thanks, Jerry IMPORTANT NOTICE REGARDING THIS ELECTRONIC MESSAGE: This message is intended for the use of the person to whom it is addressed and may contain information that is privileged, confidential, and protected from disclosure under applicable law. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.
RE: Best approach to store Application Configuration
Database Flatfile on disk (look up Storable module on how to save/load binary representation of PERL structures), works well if you want to have an instant structure, but flatfiles need location on the server. I use both regularly From: Jerry Pereira [mailto:online.je...@gmail.com] Sent: Monday, July 11, 2011 5:08 PM To: modperl@perl.apache.org Subject: Best approach to store Application Configuration Hi All, I am new to mod_perl (a java developer). I would like to know the best approach to store and retrieve Applicaiton configurations that is accessible to all packages in my mod_perl application. My application configuration includes - Database details, Template mapping, LDAP configuration details etc. I would like my to load all these configuratoins when my application starts and then on, i should be able to access these configuration from anywhere. For Example: my $dbDetails = ConfigUtil-getDBDetails(); //returns reference to hash my dbUser = dbDetails-user; I belive PerlSetVar only allows strings variables. I would like to get some suggestions on how configuration management in mod_perl applications. Thanks, Jerry
Re: Best approach to store Application Configuration
On 07/11/2011 05:16 PM, James B. Muir wrote: This page describes pretty well how to set up custom configuration directives; perhaps helpful? http://perl.apache.org/docs/2.0/user/config/custom.html I would almost always avoid this kind of configuration and go with an external configuration file. Every project of any decent size will have some scripts or processes that don't run under mod_perl and thus can't use this apache-only configuration. As for configuration in Perl if I were starting a new project, I'd probably go with something like Config::Any and then pick a backend format. But in practice it probably doesn't matter a whole lot which config module you use as long as it's not tied to Apache. But if you like the apache-style format you can use Config::ApacheFormat which works well. -- Michael Peters Plus Three, LP
Re: Best approach to store Application Configuration
Hi Jerry. I went through a couple of different approaches before settling on using YAML files to describe configuration. There are several nice properties of YAML IMO, not least of which is arbitrary nesting so the config can closely match the software being configured. Here is a sanitized example of my production config: # -*- mode: perl -*- # configuration file for XXX config: { version: 1 } # XYZ configuration # across the entire XXX tier xyz: { # enable / disable all ... feature_X_enabled: true, # name of cookie(s) to emit: [xx, yy, zz] emit_cookies: [ xx ] # substructure configuration sub_structures: { disabled: { foo: [], bar: [], baz: [], } } } There are several YAML readers available; I preferred YAML::XS because of its speed and correctness. My apps need to run a long time, so they poll the configuration file every n seconds, and reload it if needed. Overall, I was pretty happy with this approach, and so were the operations folks who have to configure the settings in production. HTH, -- jeff From: Jerry Pereira online.je...@gmail.commailto:online.je...@gmail.com Date: Mon, 11 Jul 2011 16:07:58 -0500 To: modperl@perl.apache.orgmailto:modperl@perl.apache.org modperl@perl.apache.orgmailto:modperl@perl.apache.org Subject: Best approach to store Application Configuration Hi All, I am new to mod_perl (a java developer). I would like to know the best approach to store and retrieve Applicaiton configurations that is accessible to all packages in my mod_perl application. My application configuration includes - Database details, Template mapping, LDAP configuration details etc. I would like my to load all these configuratoins when my application starts and then on, i should be able to access these configuration from anywhere. For Example: my $dbDetails = ConfigUtil-getDBDetails(); //returns reference to hash my dbUser = dbDetails-user; I belive PerlSetVar only allows strings variables. I would like to get some suggestions on how configuration management in mod_perl applications. Thanks, Jerry
Re: Best approach to store Application Configuration
On Mon, Jul 11, 2011 at 2:23 PM, Michael Peters mpet...@plusthree.com wrote: On 07/11/2011 05:16 PM, James B. Muir wrote: This page describes pretty well how to set up custom configuration directives; perhaps helpful? http://perl.apache.org/docs/2.0/user/config/custom.html I would almost always avoid this kind of configuration and go with an external configuration file. Every project of any decent size will have some scripts or processes that don't run under mod_perl and thus can't use this apache-only configuration. This kind of configuration has the advantage of avoiding the overhead associated with PerlSetVar if I recall correctly. The downside is that the custom config directives can be a bit tricky to setup correctly. As for configuration in Perl if I were starting a new project, I'd probably go with something like Config::Any and then pick a backend format. +1
Re: Best approach to store Application Configuration
please correct me if I am wrong, I should be using tool like YAML/Config::General for application configuration storage and reteieval, and load them on startup using startup.pl script? That would mean i will have to store the name of configuration file some where (probabaly in mod_perl configuration block in httpd.conf). On Mon, Jul 11, 2011 at 2:26 PM, McCarrell, Jeff jmcca...@akamai.comwrote: Hi Jerry. I went through a couple of different approaches before settling on using YAML files to describe configuration. There are several nice properties of YAML IMO, not least of which is arbitrary nesting so the config can closely match the software being configured. Here is a sanitized example of my production config: # -*- mode: perl -*- # configuration file for XXX config: { version: 1 } # XYZ configuration # across the entire XXX tier xyz: { # enable / disable all ... feature_X_enabled: true, # name of cookie(s) to emit: [xx, yy, zz] emit_cookies: [ xx ] # substructure configuration sub_structures: { disabled: { foo: [], bar: [], baz: [], } } } There are several YAML readers available; I preferred YAML::XS because of its speed and correctness. My apps need to run a long time, so they poll the configuration file every n seconds, and reload it if needed. Overall, I was pretty happy with this approach, and so were the operations folks who have to configure the settings in production. HTH, -- jeff From: Jerry Pereira online.je...@gmail.com Date: Mon, 11 Jul 2011 16:07:58 -0500 To: modperl@perl.apache.org modperl@perl.apache.org Subject: Best approach to store Application Configuration Hi All, I am new to mod_perl (a java developer). I would like to know the best approach to store and retrieve Applicaiton configurations that is accessible to all packages in my mod_perl application. My application configuration includes - Database details, Template mapping, LDAP configuration details etc. I would like my to load all these configuratoins when my application starts and then on, i should be able to access these configuration from anywhere. For Example: my $dbDetails = ConfigUtil-getDBDetails(); //returns reference to hash my dbUser = dbDetails-user; I belive PerlSetVar only allows strings variables. I would like to get some suggestions on how configuration management in mod_perl applications. Thanks, Jerry -- Your clothes may be the latest in style but you aint completely dressed until you wear a smile! Keep smiling : )
RE: Best approach to store Application Configuration
The PerlSetVar overhead occurs on every request, whereas the overhead associated with using the custom configuration occurs once when Apache is started. -James -Original Message- From: Fred Moyer [mailto:f...@redhotpenguin.com] Sent: Monday, July 11, 2011 5:35 PM To: Michael Peters Cc: James B. Muir; Jerry Pereira; modperl@perl.apache.org Subject: Re: Best approach to store Application Configuration On Mon, Jul 11, 2011 at 2:23 PM, Michael Peters mpet...@plusthree.com wrote: On 07/11/2011 05:16 PM, James B. Muir wrote: This page describes pretty well how to set up custom configuration directives; perhaps helpful? http://perl.apache.org/docs/2.0/user/config/custom.html I would almost always avoid this kind of configuration and go with an external configuration file. Every project of any decent size will have some scripts or processes that don't run under mod_perl and thus can't use this apache-only configuration. This kind of configuration has the advantage of avoiding the overhead associated with PerlSetVar if I recall correctly. The downside is that the custom config directives can be a bit tricky to setup correctly. As for configuration in Perl if I were starting a new project, I'd probably go with something like Config::Any and then pick a backend format. +1 IMPORTANT NOTICE REGARDING THIS ELECTRONIC MESSAGE: This message is intended for the use of the person to whom it is addressed and may contain information that is privileged, confidential, and protected from disclosure under applicable law. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.
Re: Best approach to store Application Configuration
Naming the path to the config file in an httpd conf will certainly work. In my case, the path the config file is hard coded in the method that reads the config as it is not something that changes. Here is on of my httpd conf file (a separate file loaded in the http configuration directory so your install process doesn't have to change the actual httpd.conf): PerlModuleYour::App PerlPostConfigHandler Your::App::httpd_start Location /foo/app SetHandler modperl PerlResponseHandler +Your::App # Apache::DBI needs GlobalRequest PerlOptions +GlobalRequest /Location The httpd_start method gets called at apache startup time, and reads the config in once. Also, one other possible advantage to YAML is that YAML is not perl, so if you have a mixed language env, it is easy to share/move/port your config to the language of your choice. YAML has pretty good support across the common languages you will find in the LAMP world. BTW, if you haven't already done so, I recommend becoming familiar with the handlers and their life cycles: http://perl.apache.org/docs/2.0/user/handlers/server.html http://perl.apache.org/docs/2.0/user/handlers/http.html#HTTP_Request_Cycle_Phases Have fun, -- jeff From: Jerry Pereira online.je...@gmail.commailto:online.je...@gmail.com Date: Mon, 11 Jul 2011 16:41:13 -0500 To: Jeff McCarrell jmcca...@akamai.commailto:jmcca...@akamai.com Cc: modperl@perl.apache.orgmailto:modperl@perl.apache.org modperl@perl.apache.orgmailto:modperl@perl.apache.org Subject: Re: Best approach to store Application Configuration please correct me if I am wrong, I should be using tool like YAML/Config::General for application configuration storage and reteieval, and load them on startup using startup.plhttp://startup.pl script? That would mean i will have to store the name of configuration file some where (probabaly in mod_perl configuration block in httpd.conf).
Re: Best approach to store Application Configuration
On 07/11/2011 05:41 PM, Jerry Pereira wrote: please correct me if I am wrong, I should be using tool like YAML/Config::General for application configuration storage and reteieval, and load them on startup using startup.pl http://startup.pl script? Yes. That would mean i will have to store the name of configuration file some where (probabaly in mod_perl configuration block in httpd.conf). Again, if you think about just using a mod_perl specific way of doing this you'll leave all of your non-mod_perl stuff out in the cold and any project of significant size is going to have some non-mod_perl processes involved somewhere. I prefer to use environment variables if you need to specify the location of a config file. These are available no matter where you're running (in mod_perl you'll want to use a PerlPassEnv directive so the mod_perl side sees it). -- Michael Peters Plus Three, LP
Re: Best approach to store Application Configuration
Hi Jerry, I use JSON:XS in my framework, but before writing a hole framework from the scratch, think about using catalyst. regards keywan Am 11.07.2011 23:07, schrieb Jerry Pereira: Hi All, I am new to mod_perl (a java developer). I would like to know the best approach to store and retrieve Applicaiton configurations that is accessible to all packages in my mod_perl application. My application configuration includes - Database details, Template mapping, LDAP configuration details etc. I would like my to load all these configuratoins when my application starts and then on, i should be able to access these configuration from anywhere. For Example: my $dbDetails = ConfigUtil-getDBDetails(); //returns reference to hash my dbUser = dbDetails-user; I belive PerlSetVar only allows strings variables. I would like to get some suggestions on how configuration management in mod_perl applications. Thanks, Jerry -- Mit freundlichen Grüßen Keywan Ghadami Telefon +49 (0)75 31 / 81 39 7 95 Fax +49 (0)75 31 / 81 39 7 89 Anschrift ibson Fritz-Arnold-Str. 23 D-78467 Konstanz
Re: Help Debugging Windows Server 2003 Win32 + Apache2.2 + mod_perl + Activestate Pelr 5.8.8 ErrorID 26
awarnier wrote: snip What happens if you disable Apache2::Reload ? 48 hours continuous operations now without a single glitch at all. Almost certain that Apache2::Reload was not the root cause, but it was certainly heavily implicated in the problem and resultant instability. If anyone's interested in a crash dump I can re-enable this module temporarily and try and generate one for you. I experienced similar problems many years ago with Apache2::Reload in a Microsoft Windows environment. Although disabling Apache2::Reload did reduce the problem, it didn't completely eliminate it and instability continued, although much less frequently and after much longer time periods. After having additional troubles with .DLL files and the perl.exe.manifest file, I finally abandoned Windows and now run everything under NetBSD Unix which simply doesn't exhibit these problems for me... I know this probably isn't the most constructive solution for you, but it's good to know that there are other options. I suspect that there was some problem either with Apache HTTPd or one of its modules (and I haven't ruled out ModPerl 2 or APR 2), or MS-Windows itself. The main reason I gave up on Windows is that each OS version exhibited different patterns of when and how the crashing occurred. On one system I saw blue screens, on another the system would just stop responding (and there were less than 10 simultaneous connections at any one time due to limits on the external firewall, so this wasn't it either), and then on another I had problems with Apache HTTPd just crashing with a variety of different error codes in the Windows Event Viewer thingy. I could not narrow down specific results to a particular version of Windows, but Unix did solve the problem for me while also yielding better performance so I decided to just ignore this problem and [mostly] forget about it. Randolf Richardson - rand...@inter-corporate.com Inter-Corporate Computer Network Services, Inc. Vancouver, British Columbia, Canada http://www.inter-corporate.com
Re: mod_perl-1.31 compilation with perl 5.14.1 fails
Looks like a patch for this issue was posted. Greg, do you want to try out this patch and report back? https://rt.cpan.org/Public/Bug/Display.html?id=64999#txn-954785 On Mon, Jul 4, 2011 at 10:20 AM, Fred Moyer f...@redhotpenguin.com wrote: On Mon, Jun 27, 2011 at 4:54 PM, Gregory Coleman gregory.cole...@cbsinteractive.com wrote: hello - am getting compilation errors in building older mod_perl with newer perl. Things worked as of 5.12.X, but alas, not with today's 5.14.1 ... Any witnesses/experiences/thoughts on this? For what it is worth, I successfully compiled mod_perl 1.31 with apache 1.3.42 and perl 5.14.1 on my snow leopard based platform. I used the EVERYTHING=1 option with 'perl Makefile.PL'.
Re: Installing mod_perl for 2 versions of Perl?
From: Fred Moyer f...@redhotpenguin.com On Mon, Jul 11, 2011 at 12:38 PM, Perrin Harkins per...@elem.com wrote: On Mon, Jul 11, 2011 at 3:14 PM, Octavian Rasnita orasn...@gmail.com wrote: From: Perrin Harkins per...@elem.com I am still afraid to compile Perl+Apache+mod_perl since the old days when I needed to do that because there were no other solutions, and when I needed to face some ugly compiling errors... But if you say that it is simple, I will try it. I know some people have issues but I've never had any on common Linux platforms. It complies very nicely. Just be sure to use the perl you want to compile against when running Makefile.PL for mod_perl. and the desired apxs binary with: /my/perl Makefile.PL MP_APXS=/my/apxs By default version 2.0.5 will look for installed apxs/apxs2 binaries in certain places like your PATH and use those by default if you don't explicitly specify which apxs binary to use. Thank you for all the tips, Fred. Octavian
Re: Changing browser URL based on condition
From: Jerry Pereira Thanks Guys!!! I will go ahead with Redirect approach. I was more interested in building a generic framework for my application that would handle such scenarios (login was just one of them). Then, as somebody suggested, start using Catalyst framework. It will handle the authentication/authorization very easy, and you will be able to continue to use your app with mod_perl if you want that. And of course, you will have many other good features in it. Octavian
Re: Installing mod_perl for 2 versions of Perl?
Le lundi 11 juillet 2011 à 22:14 +0300, Octavian Rasnita a écrit : Mmm, I like the word simple :-) These are the notes I took about a year ago for compilation on Debian of Perl/Apache2/Mod_perl2. If I am not mistaken, they are all you need. Look for 'Compilation' under each title. Perl Download source wget -c http://www.cpan.org/src/stable.tar.gz Compilation ./Configure -Dcc=gcc -Dprefix=/home/perl/5.X.X -Dextras=Bundle::LWP DBI ExtUtils::XSBuilder DBD::Pg DBD::SQLite Date::Simple URI::Escape Apache::Session Apache::DBI make make test make install Installation des modules /home/perl/5.X.X/bin/perl -MCPAN -e shell Apache2 Guide d'installation http://perl.apache.org/docs/2.0/user/install/install.html Download source wget -c http://apache.crihan.fr/dist/httpd/httpd-2.X.X.tar.gz Compilation mkdir /home/httpd/2.X.X CC=gcc-4.1 ./configure --prefix=/home/httpd/2.X.X --enable-module=shared --enable-rewrite=shared --enable-dir=shared make make install Init.d script scp /etc/init.d/apache2 192.168.1.6:'/etc/init.d' Populate rc?.d update-rc.d apache2 defaults 91 Mod_perl Download source http://perl.apache.org/download/index.html Compilation /home/perl/5.X.X/bin/perl Makefile.PL MP_AP_PREFIX=/home/httpd/2.X.X make make test make install Éditer httpd.conf LoadModule perl_module modules/mod_perl.so Libapreq2 Download source wget -c http://mirror.mkhelif.fr/apache/httpd/libapreq/libapreq2-2.08.tar.gz Compilation /home/perl/5.X.X/bin/perl Makefile.PL --with-apache2-apxs=/home/httpd/2.X.X/bin/apxs --with-expat=/home/httpd/2.X.X/ make make test make install edit httpd.conf LoadModule apreq_module /home/httpd/2.X.X/modules/mod_apreq2.so -- Vincent Veyron http://marica.fr/ Logiciel de gestion des sinistres et des contentieux pour le service juridique