Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

how do I learn about Perl CGI programming?

by Anonymous Monk
on Mar 30, 2005 at 14:40 UTC ( [id://443473]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have seen web apps that work off of one file, say index.pl, in the root that process requests like /path/to/stuff/.

How do they do that?

==Please retitle this post as you wish.==

20050404 Edit by ysth: change title from: How do they do that?

Replies are listed 'Best First'.
Re: how do I learn about Perl CGI programming?
by merlyn (Sage) on Mar 30, 2005 at 14:53 UTC
Re: how do I learn about Perl CGI programming?
by matthewb (Curate) on Mar 30, 2005 at 15:48 UTC

    I'm not sure that everyone else is following what you're talking about but it may be me so apologies if so.

    You can access the query string with $cgi_object->self_url(), split it on the forward-slash into an array, shift off the sections and get your script to respond based on what they contain. An example of this procedure can be found in the source of Maypole (look at the parse_path() method.

    If, for whatever reason, you just want to set up a simple web app that works this way to see how you get on, you might find CGI::Application::Dispatch useful; it loads CGI::Application modules and runs their so-called `run-modes' according to the path in the query string.


    MB
Re: how do I learn about Perl CGI programming?
by ambs (Pilgrim) on Mar 30, 2005 at 14:46 UTC
    Didn't understand quite well your idea. But, you have at $ENV{PATH_INFO} the path not processed by Apache. So, if you have the CGI at /foo, when you call /foo/bar the value of that hash position have /bar.

    Update: Thanks great merlyn for correcting me the key name.

    Alberto Simões

Re: how do I learn about Perl CGI programming?
by tlm (Prior) on Mar 30, 2005 at 14:57 UTC

    I don't know how it's done in other server/OS configurations, but with Apache/Unix, the CGI script can inspect the environment variable DOCUMENT_ROOT to get a physical path. From there one can get a physical path to /path/to/stuff as /path/to/docroot/path/to/stuff.

    the lowliest monk

Re: how do I learn about Perl CGI programming?
by Anonymous Monk on Mar 30, 2005 at 16:49 UTC
    I think mod_rewrite was what i was looking for. Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://443473]
Approved by moot
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 16:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found