Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

how do I learn about Perl CGI programming?

by Anonymous Monk
on Mar 30, 2005 at 14:40 UTC ( #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?

Comment on how do I learn about Perl CGI programming?
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 merlyn (Sage) on Mar 30, 2005 at 14:53 UTC
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 matthewb (Deacon) 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 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
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? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-12-21 14:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (106 votes), past polls