Loading ...
Sorry, an error occurred while loading the content.
 

Re: Website organization for secure ASP, perl scriptig

Expand Messages
  • Josh Chamas
    ... Apache::ASP does a chdir() to the directory the script is running in, so you can access files as relative to that directory. A better approach is to find
    Message 1 of 3 , Jan 11, 2004
      Ted Byers wrote:
      > OK, It looks like I have Apache setup and working correctly, including Perl,
      > using mod-perl, and ASP. Now, I want to setup my website so that the
      > scripts and the data they work on (that isn't taken from either a form or a
      > database) live in directories outside htdocs (just as cgi-bin). But I have
      > encountered a bit of trouble in that, when I use a script that does not need
      > to read data from a file, it works perfectly, but I have yet to get a script
      > that reads from a file to work. Note, it isn't getting the perl for reading
      > a file that is the problem, since the script works fine from the command
      > line. The problem is either where the script thinks it is running (which
      > may not be where I would intuitively think it is, given all other programs I

      Apache::ASP does a chdir() to the directory the script is running in, so you
      can access files as relative to that directory. A better approach is to find
      the absolute file name that you want to read, and then read it, so you don't
      rely on the chdir() behavior.

      To find a file path relative to the include file search path, use the
      $Server->MapInclude() API, see http://www.apache-asp.org/objects.html#%24Server-%3EMapd3711f06

      To find a file path transalated from a URI, use $Server->MapPath API,
      see http://www.apache-asp.org/objects.html#%24Server-%3EMap0fe1ebb5

      Finally, after you have a file name, you can:

      open(FILE, $file_name) || die("can't read file $file_name: $!");

      Regards,

      Josh
      ________________________________________________________________
      Josh Chamas, Founder phone:925-552-0128
      Chamas Enterprises Inc. http://www.chamas.com
      NodeWorks Link Checker http://www.nodeworks.com


      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    Your message has been successfully submitted and would be delivered to recipients shortly.