Re: Something like Tomcat for Perl
by The Mad Hatter (Priest) on May 18, 2003 at 03:18 UTC
|
If I understand correctly, you can definately do the first one using CGI::Session. I think you can do the second if you use Apache (and possibly IIS).
If you call the CGI script Resources.cgi, you should be able to configure Apache (it may be enabled by default even) to execute it when called as "Resources/stuff/goes/here". Once that is working, check out the path_info method of CGI; it should let you fetch the last bit of the URL the script was called with (ex/ "stuff/goes/here").
I know both of these work, as I use them myself.
Update You might also be interested in the Jellybean Object Web Server. I don't personally use it, but it is written by our very own chromatic.
NB I know that I responded to this and then front-paged it, but I think it is a good question. I'm honestly not trying to gain XP, and you can feel free to downvote this if you really think it was in bad form to front-page and reply. | [reply] [d/l] |
|
Redirect /index.html http://www.somewhere.org/opencivics
<Location /opencivics>
PerlSetEnv ALZABO_DEBUG ALL
SetHandler perl-script
PerlModule Apache::Request
PerlModule OpenCivics
PerlHandler OpenCivics::WebApp
</Location>
| [reply] [d/l] |
|
| [reply] |
|
I got distracted writing one book and then another. I have code in evserver that needs to be merged and plan to do that in the near future.
"Near", of course, is open to interpretation, users, and patches.
| [reply] |
|
Hmmm, good question. :-) I guess I missed that. You could probably find out by /msg-ing chromatic...
| [reply] |
•Re: Something like Tomcat for Perl
by merlyn (Sage) on May 18, 2003 at 12:24 UTC
|
| [reply] |
Re: Something like Tomcat for Perl
by Zaxo (Archbishop) on May 18, 2003 at 05:15 UTC
|
| [reply] |
|
The path tricks you want are handled by Apache's mod_rewrite.
And handled well they are. I've really fallen in love with mod_rewrite, it is just so useful. I set up a demo server for our customers, where depending on the login name used, a completely different server will be presented to them. On the server-side, it's just subdirectories (makes it easy for us to manage them), but the clients are never aware that there's anything else on the server apart from what they're seeing. I also use it to redirect multi-language pages and setting environment variables according to the language selected.
| [reply] |
|
| [reply] |
Re: Something like Tomcat for Perl
by TVSET (Chaplain) on May 18, 2003 at 15:09 UTC
|
I might be interested in Mason. You can create the following structure:
/my/super/dir/somefile.mhtml
/my/super/dir/autohandler
/my/super/autohandler
/my/autohandler
/autohandler
If someone, say requests /my/super/dir/somefile.blah you can take care of it in /my/super/dir/autohandler. You can even forward the request to the handlers in other directories.
As to sessions - it does them too :)
Leonid Mamtchenkov aka TVSET | [reply] [d/l] [select] |
|
#Get the current component's session information
my $current = $m->current_comp();
#Get the current directory relative the the web server's
#root directory.
my $directory = $current->dir_path;
I then use that information for other purposes. HTML::Mason
looks and feels extremely similar to both JSP and ASP. Give it a try Mason's HomePage.
Kristofer Hoch
Si vos can lego is, vos es super erudio | [reply] [d/l] |
Re: Something like Tomcat for Perl
by belg4mit (Prior) on May 18, 2003 at 12:56 UTC
|
| [reply] |
Re: Something like Tomcat for Perl
by crenz (Priest) on May 18, 2003 at 12:17 UTC
|
| [reply] |
Re: Something like Tomcat for Perl
by Starky (Chaplain) on May 19, 2003 at 03:54 UTC
|
You may be interested in Apache::PageKit. It is a mod_perl based system with session management features (you can store and retrieve objects with something like FreezeThaw) via Apache::SessionX and directories mapping to classes.
I've used it before, and it works bee-yoo-tee-fully. Fast and reliable with many nice features. The only caveat I would offer is that the documentation was sparse last time I checked. | [reply] |
Re: Something like Tomcat for Perl
by mvc (Scribe) on May 19, 2003 at 19:30 UTC
|
You will that Perl/Apache handle the directory aliasing feature very nicely, and even sessions work OK. For simple things.
Sometimes you need to store objects (blessed references) in the session or application scope. This is easy in Java. In Perl you must deal with serialization issues. Even 5.8 with mod_perl2 offers little help here.
Luckily this is rarely needed.
| [reply] |
|
If you create a resource pool that your objects can fetch resources from then serialization of those objects becomes less of a problem.
See ResourcePool on the CPAN.
| [reply] |
Re: Something like Tomcat for Perl
by tent8f (Initiate) on Oct 17, 2006 at 09:32 UTC
|
I've been looking into this myself.
Why are there no multi-thread Perl-centric application servers (ala Java's Tomcat) ?
mod_perl is not a realistic option for me because some of our customers use IIS / ISA proxy server.
What would be ideal is a standalone multi-thread webserver written in Perl that could be reverse-proxied using Apache or IIS/Proxy Server. I want to avoid the startup overhead of CGI, and the non-portability of mod_perl. Having a standalone HTTP app server that's proxied seems to be the way to build scalable web apps.
At least according to these guys...
The web is a pipe
fastcgi-scgi-and-apache-background-and-future
Is building a light-weight multi-threaded web-server in perl really that hard ? | [reply] |
|
Why are there no multi-thread Perl-centric application servers?
Maybe because there was no need to do that?
I'm not aware of any out-of-the-box drop-in replacement for tomcat, but I guess the POE framework provides the bits for that,
not using threads but cooperative multitasking. On the POE projects page there is Philip Gwyn's Just Another Application Server. Have a look. There's PAS also - a Perl Application Server.
On CPAN you find Net::Server, a generic Perl server engine, HTTP::Server::Simple, a simple standalone Perl HTTP server, templating engines, parsers and so on... it's all there, so it shouldn't be hard to do it. But somebody has to put the bits together.
Happy assembling ;-)
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
| [reply] |