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

I maintain a couple of TWikis at work, and it suddenly struck me that I have no idea how the perl scripts are receiving their arguements

For example, the url:
http://twikitest/bin/view/Main/WebHome
looks, to me, like the perl-script "view" is being called with a param. of "Main/WebHome"

How does this work? It's not what I think of as the normal format for script parameters in a url - I would expect something like:
http://twikitest/bin/view?doc=Main/WebHome

Tom Melly, tom@tomandlu.co.uk

Replies are listed 'Best First'.
Re: Lazy TWiki-inspired question
by cmeyer (Pilgrim) on Feb 22, 2006 at 19:21 UTC
    use CGI; my $cgi = CGI->new(); my @path_params = split /\//, $cgi->path_info();

    -Colin.

    WHITEPAGES.COM | INC

      Thanks - I'm still non-plussed as to why the server doesn't just return a 404 when it tries to access /bin/view/Main/WebHome, but I'll fire up a local apache server, rustle up a script, read some docs, and figure it out....

      Tom Melly, tom@tomandlu.co.uk

        The server knows what to do with /bin/view and in lieu of knowing what to do with a path more specific, invokes that program, passing the full URI. Web servers don't have to map URIs to file paths at all; that's just the most useful and most prevalent default behavior.