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

http://www.foo.com/cgi-bin/dirlist.pl/docs What does this URL mean ? When "dirlist.pl" is executed, ie will produce the outout, which will be displayed on browser. whats "/docs" after that for ? does it mean that output will be stored in "docs" dir ?
  • Comment on what does dir after program name mean ?

Replies are listed 'Best First'.
Re: what does dir after program name mean ?
by SuicideJunkie (Vicar) on Oct 19, 2009 at 14:07 UTC

    This is really more of a webserver question.

    However, consider that "dirlist.pl" is a perfectly valid directory name.
    There might be a /dirlist.pl/docs/index.html and a /dirlist.pl/script/dirlist.pl too.

Re: what does dir after program name mean ?
by merlyn (Sage) on Oct 19, 2009 at 14:08 UTC
    This URL might do anything at all. It might not even be Perl.

    if you think Perl is involved, you'll have to show some code.

    -- Randal L. Schwartz, Perl hacker

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Re: what does dir after program name mean ?
by moritz (Cardinal) on Oct 19, 2009 at 14:16 UTC

    First you have to know that whatever URL you pass to a webserver, it is free to do anything with it. /cgi-bin/dirlist.pl/docs could be a static HTML page.

    Usually files below /cgi-bin/ are executed as CGI scripts, and the rest of the URL is passed as some kind of argument to that script. It is free to do with it whatever it likes.

    Perl 6 - links to (nearly) everything that is Perl 6.
Re: what does dir after program name mean ?
by derby (Abbot) on Oct 19, 2009 at 16:20 UTC

    Well ... it could be anything but more than likely it's just path info:

    #!/usr/bin/perl use strict; use warnings; use CGI; use Data::Dumper; my $cgi = CGI->new(); print $cgi->header, $cgi->start_html( 'Path Info?' ), $cgi->pre( Dumper( $cgi->path_info() ) ), $cgi->end_html;

    -derby
Re: what does dir after program name mean ?
by CountZero (Bishop) on Oct 19, 2009 at 20:34 UTC
    Unless you have access to the configuration files of the web-server, there is no way to know what this (or any other URL) will actually do.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James