Re: Using handler for index
Drew Taylor ([EMAIL PROTECTED]) said something to this effect: Hi all, I am using an Apache Handler module to create my home page, using Location /index.pl SetHandler perl-script PerlHandler ModuleName /Location I have DirectoryIndex set to "index.pl index.html", but the Location directive is not being picked up for the index, so I get the default directory listing. Is there another solution instead of a RewriteRule to redirect "/" to "/index.pl"? Any thoughts would be appreciated. Calling /index.pl explicitly works correctly, right? Replacing Location /index.pl with a FilesMatch "*.pl$" which sets the correct handler for .pl files should do it, and let mod_dir call index.pl itself. (darren) -- Life would be so much easier if we could just look at the source code.
Re: Using handler for index
darren chamberlain wrote: Drew Taylor ([EMAIL PROTECTED]) said something to this effect: Hi all, I am using an Apache Handler module to create my home page, using Location /index.pl SetHandler perl-script PerlHandler ModuleName /Location I have DirectoryIndex set to "index.pl index.html", but the Location directive is not being picked up for the index, so I get the default directory listing. Is there another solution instead of a RewriteRule to redirect "/" to "/index.pl"? Any thoughts would be appreciated. Calling /index.pl explicitly works correctly, right? Yes, /index.pl works properly. But since it's a "virtual" file, I have to just type it in. Replacing Location /index.pl with a FilesMatch "*.pl$" which sets the correct handler for .pl files should do it, and let mod_dir call index.pl itself. Well, the thing is "index.pl" really is Base::HomePage::Anystock. What I'm really looking for is a way to use a module as the directory index. I'm not terribly opposed to using Rewrite, but I'm curious if there is an alternative method. -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
Re: Using handler for index
On Mon, 10 Jul 2000, Drew Taylor wrote: darren chamberlain wrote: Drew Taylor ([EMAIL PROTECTED]) said something to this effect: Hi all, I am using an Apache Handler module to create my home page, using Location /index.pl SetHandler perl-script PerlHandler ModuleName /Location I have DirectoryIndex set to "index.pl index.html", but the Location directive is not being picked up for the index, so I get the default directory listing. Is there another solution instead of a RewriteRule to redirect "/" to "/index.pl"? Any thoughts would be appreciated. Calling /index.pl explicitly works correctly, right? Yes, /index.pl works properly. But since it's a "virtual" file, I have to just type it in. Replacing Location /index.pl with a FilesMatch "*.pl$" which sets the correct handler for .pl files should do it, and let mod_dir call index.pl itself. Well, the thing is "index.pl" really is Base::HomePage::Anystock. What I'm really looking for is a way to use a module as the directory index. I'm not terribly opposed to using Rewrite, but I'm curious if there is an alternative method. Yes, use a PerlFixupHandler instead of DirectoryIndex. This use of a fixup handler is detailed in the Eagle book. -- Matt/ Fastnet Software Ltd. High Performance Web Specialists Providing mod_perl, XML, Sybase and Oracle solutions Email for training and consultancy availability. http://sergeant.org | AxKit: http://axkit.org
Re: Using handler for index
This always worked for me: Location / SetHandler perl-script PerlHandler ModuleName /Location But maybe it worked for reasons I don't understand :) Chris * Drew Taylor ([EMAIL PROTECTED]) [000710 10:22]: darren chamberlain wrote: Drew Taylor ([EMAIL PROTECTED]) said something to this effect: Hi all, I am using an Apache Handler module to create my home page, using Location /index.pl SetHandler perl-script PerlHandler ModuleName /Location I have DirectoryIndex set to "index.pl index.html", but the Location directive is not being picked up for the index, so I get the default directory listing. Is there another solution instead of a RewriteRule to redirect "/" to "/index.pl"? Any thoughts would be appreciated. Calling /index.pl explicitly works correctly, right? Yes, /index.pl works properly. But since it's a "virtual" file, I have to just type it in. Replacing Location /index.pl with a FilesMatch "*.pl$" which sets the correct handler for .pl files should do it, and let mod_dir call index.pl itself. Well, the thing is "index.pl" really is Base::HomePage::Anystock. What I'm really looking for is a way to use a module as the directory index. I'm not terribly opposed to using Rewrite, but I'm curious if there is an alternative method. -- Chris Winters Internet DeveloperINTES Networking [EMAIL PROTECTED]http://www.intes.net/ Integrated hardware/software solutions to make the Internet work for you.
Re: Using handler for index
Chris Winters wrote: This always worked for me: Location / SetHandler perl-script PerlHandler ModuleName /Location Well, seems like I tried that, and then it ALWAYS used that handler. I also have other handlers, and I _think_ the setup above overrode the others. I'll give it a try again now. OK, I just tried it, and it overrode everything else. :-( -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
Re: Using handler for index
Matt Sergeant wrote: On Mon, 10 Jul 2000, Drew Taylor wrote: darren chamberlain wrote: Drew Taylor ([EMAIL PROTECTED]) said something to this effect: Hi all, I am using an Apache Handler module to create my home page, using Location /index.pl SetHandler perl-script PerlHandler ModuleName /Location I have DirectoryIndex set to "index.pl index.html", but the Location directive is not being picked up for the index, so I get the default directory listing. Is there another solution instead of a RewriteRule to redirect "/" to "/index.pl"? Any thoughts would be appreciated. Calling /index.pl explicitly works correctly, right? Yes, /index.pl works properly. But since it's a "virtual" file, I have to just type it in. Replacing Location /index.pl with a FilesMatch "*.pl$" which sets the correct handler for .pl files should do it, and let mod_dir call index.pl itself. Well, the thing is "index.pl" really is Base::HomePage::Anystock. What I'm really looking for is a way to use a module as the directory index. I'm not terribly opposed to using Rewrite, but I'm curious if there is an alternative method. Yes, use a PerlFixupHandler instead of DirectoryIndex. This use of a fixup handler is detailed in the Eagle book. Now that's a good thought. I already have a fixup handler to do my browser sniffing. But rather than write another module, I'll probably stick with the two-line RewriteRule. :-) Now I just have to recompile apache on my workstations because I didn't add mod_rewrite the first time... RewriteEngine On RewriteRule ^/$ /index.pl [R,L] -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
Re: Using handler for index
Location / SetHandler perl-script PerlHandler ModuleName /Location Well, seems like I tried that, and then it ALWAYS used that handler. I also have other handlers, and I _think_ the setup above overrode the others. I'll give it a try again now. OK, I just tried it, and it overrode everything else. :-( Try LocationMatch ^/$ -- Eric
Re: Using handler for index
At 10:33 AM 7/10/00 -0400, Drew Taylor wrote: Chris Winters wrote: This always worked for me: Location / SetHandler perl-script PerlHandler ModuleName /Location Well, seems like I tried that, and then it ALWAYS used that handler. I also have other handlers, and I _think_ the setup above overrode the others. I'll give it a try again now. OK, I just tried it, and it overrode everything else. :-( I'm doing this... in a way inspired by Scoop (scoop.kuro5hin.org). The handler accepts different query-string arguments to do different things... if ($query_string_arg eq "this') { do that stuff; elsif ($query_string_arg eq "that") { do this other stuff; } elsif ... Anything that doesn't match what I'm explicitly looking for will go back to the default behavior. In other words, the handler handles it, and Apache just sends it to the handler. David Veatch - [EMAIL PROTECTED] "Many people would sooner die than think. In fact, they do." - Bertrand Russell
RE: Using handler for index
Drew Taylor wrote: Chris Winters wroe: This always worked for me: Location / SetHandler perl-script PerlHandler ModuleName /Location Well, seems like I tried that, and then it ALWAYS used that handler. I also have other handlers, and I _think_ the setup above overrode the others. I'll give it a try again now. OK, I just tried it, and it overrode everything else. :-( I use this: LocationMatch "^/$" SetHandler perl-script PerlHandler $MATCH::method_objs::provider_project_selector-handler /LocationMatch It does not override everything else, and you get the right handler called. The problem is that Location / matches any URI that BEGINS with that substring. LocationMatch is a regular expression driven thing, so you can make it just match that one specific URI. David Harris President, DRH Internet Inc. [EMAIL PROTECTED] http://www.drh.net/
Re: Using handler for index
Drew Taylor ([EMAIL PROTECTED]) said something to this effect: Yes, use a PerlFixupHandler instead of DirectoryIndex. This use of a fixup handler is detailed in the Eagle book. Now that's a good thought. I already have a fixup handler to do my browser sniffing. But rather than write another module, I'll probably stick with the two-line RewriteRule. :-) Now I just have to recompile apache on my workstations because I didn't add mod_rewrite the first time... RewriteEngine On RewriteRule ^/$ /index.pl [R,L] What does that do to calls for for example, /?foo=bar ? Slashdot does this (they switch in the user id cookie, and redirect to either the static page or the index.pl page based on that), and because of this, calls for /?section=apache (for example) results in a plain index page, rather than the Apache page. (darren) -- It's not that I'm afraid to die, I just don't want to be there when it happens. -- Woody Allen
Re: Using handler for index
Eric Cholet wrote: Location / SetHandler perl-script PerlHandler ModuleName /Location Well, seems like I tried that, and then it ALWAYS used that handler. I also have other handlers, and I _think_ the setup above overrode the others. I'll give it a try again now. OK, I just tried it, and it overrode everything else. :-( Try LocationMatch ^/$ Thanks to both of you. I have never used the regular expression part of the directives before. This is exactly what I need. Thanks! -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
RE: Using handler for index
At 10:47 AM 7/10/00 -0400, you wrote: Drew Taylor wrote: I use this: LocationMatch "^/$" SetHandler perl-script PerlHandler $MATCH::method_objs::provider_project_selector-handler /LocationMatch That will probably fit your needs a little better than my example. My first read through missed the fact that you have various handlers to do different things... though your various handlers could probably be placed "behind" a main handler much like mine are. Either way... this should work as well. It all depends on where you want to do the work... in the conf file, or in the handler. David Veatch - [EMAIL PROTECTED] "Many people would sooner die than think. In fact, they do." - Bertrand Russell
Re: Using handler for index
That's funny, because until a few weeks ago I worked with Rusty (author of Scoop) :) And previous versions of Scoop were handling it the way Drew mentioned, with an 'index.pl'. Another alternative (which I prefer) has been discussed previously on this list. Taking something like: http://.../User/display/?user_id=7162 or: http://.../News/edit/?news_id=9182 The handler specified in the Location / configuration takes the request, breaks up the path info, looks at the first entry and maps it to a particular module. The second item is normally a subroutine to call, although that module can map it to whatever it wishes. (There are, of course, mechanisms for ensuring that 'private' routines cannot be called from the outside world.) So the first will map 'User' to a module and call the -display() method; the second maps 'News' to a module and calls the -edit() method. GET (or POST) parameters are handled via normal means. Works swimmingly so far :) Chris * David Veatch ([EMAIL PROTECTED]) [000710 11:10]: At 10:33 AM 7/10/00 -0400, Drew Taylor wrote: Chris Winters wrote: This always worked for me: Location / SetHandler perl-script PerlHandler ModuleName /Location Well, seems like I tried that, and then it ALWAYS used that handler. I also have other handlers, and I _think_ the setup above overrode the others. I'll give it a try again now. OK, I just tried it, and it overrode everything else. :-( I'm doing this... in a way inspired by Scoop (scoop.kuro5hin.org). The handler accepts different query-string arguments to do different things... if ($query_string_arg eq "this') { do that stuff; elsif ($query_string_arg eq "that") { do this other stuff; } elsif ... Anything that doesn't match what I'm explicitly looking for will go back to the default behavior. In other words, the handler handles it, and Apache just sends it to the handler. -- Chris Winters Internet DeveloperINTES Networking [EMAIL PROTECTED]http://www.intes.net/ Integrated hardware/software solutions to make the Internet work for you.
Re: Using handler for index
At 11:19 AM 7/10/00 -0400, Chris Winters wrote: That's funny, because until a few weeks ago I worked with Rusty (author of Scoop) :) And previous versions of Scoop were handling it the way Drew mentioned, with an 'index.pl'. Like I said... "inspired by", certainly not copied. In fact, if you go to sourceforge, you'll notice "dvicci" as one of the co-developers for scoop. That's me. :) Not terribly active at the moment, but still keeping my dirty little fingers in there. Another alternative (which I prefer) has been discussed previously on this list. Taking something like: ... So the first will map 'User' to a module and call the -display() method; the second maps 'News' to a module and calls the -edit() method. GET (or POST) parameters are handled via normal means. That's pretty nice... looks a lot cleaner than a lot of this=thatso=what stuff. David Veatch - [EMAIL PROTECTED] "Many people would sooner die than think. In fact, they do." - Bertrand Russell
Re: Using handler for index
.--[ Chris Winters wrote (2000/07/10 at 11:19:58) ]-- | | That's funny, because until a few weeks ago I worked with Rusty | (author of Scoop) :) And previous versions of Scoop were handling it | the way Drew mentioned, with an 'index.pl'. | | Another alternative (which I prefer) has been discussed previously on | this list. Taking something like: | | http://.../User/display/?user_id=7162 | | [...snip...] `- What we do where I work is very similiar except the above URL would come out like: http:///User/display/7162 This works out well because whatever method you are calling probably already knows what input you're needing. The userid in this example. --- Frank Wiles [EMAIL PROTECTED] http://frank.wiles.org ---
Re: Using handler for index
* Frank Wiles ([EMAIL PROTECTED]) [000710 12:24]: What we do where I work is very similiar except the above URL would come out like: http:///User/display/7162 This works out well because whatever method you are calling probably already knows what input you're needing. The userid in this example. Frank Wiles [EMAIL PROTECTED] http://frank.wiles.org Actually, I tried that. It looks nicer, but if I'm passing more than one parameter it got confusing to remember which order they should go in. At least it was confusing for me :) Chris -- Chris Winters Internet DeveloperINTES Networking [EMAIL PROTECTED]http://www.intes.net/ Integrated hardware/software solutions to make the Internet work for you.