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

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on is there a way download script source from web?

Replies are listed 'Best First'.
Re: is there a way download script source from web?
by davidrw (Prior) on Jul 08, 2005 at 15:01 UTC
    if you mean the source of the output, then LWP::Simple (see also this recent node: opening a webpage's source).

    If you mean the actual (for example) perl source of a url like http://example.com/cgi-bin/foo.pl then no, it's not possible if the example.com's web server is configured properly. (if it were allowed it would be a huge security risk because people would be able to see the internals of your code)

      Seeing code should not be a security risk. Your code should not contain embedded passwords, etc. Also, the Open Source movement has shown that open and available code, combined with a mechanism for others to review and submit changes to that code, results in better security (in general).

      The reason script source isn't available is rather one of these:

      1. The source embodies a trade-secret or some sort of intellectual property.
      2. Script-capable web servers are configured to execute that code, so no mechanism is in place to simply tranfer it -- putting the file up in a downloadable form is an extra step, and most people simply don't bother.
      3. The code is either trivial or publicly available from a different forum (e.g. the Scoop code that drives Kuro5hin has its own site, so Kuro5hin doesn't publish it on the main site).
      Larry Wall is Yoda: there is no try{}
      The Code that can be seen is not the true Code
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: is there a way download script source from web?
by Transient (Hermit) on Jul 08, 2005 at 15:00 UTC
    Any client-side script can be downloaded by viewing the source of the page (for inline script) or going to the script itself (for externally referenced script).

    Server-side script (in most cases) cannot be downloaded.
Re: is there a way download script source from web?
by blue_cowdawg (Monsignor) on Jul 08, 2005 at 15:46 UTC
        I have found one code but I can not get it since host is old and is not supported anymore.

    Monk, why do I get the idea you are trying to do something you aren't implicitly allowed to do? If you can't get access to the script itself there must be a reason. Leave well enough alone.

    CGI script run on the server side not on the client side. A well formed CGI just outputs HTML to the browser. You can look at that just fine using the "View Source" function of your browser.