Forum Moderators: coopster & phranque

Message Too Old, No Replies

Is there a Perl equivalent for Server.MapPath

         

spiv

4:05 pm on Sep 12, 2005 (gmt 0)

10+ Year Member



In ASP script (which I use a lot) there is a built-in function called "Server.MapPath" which takes a file path relative to the currrent website and converts it into an absolute path which is sometimes needed for other processing or calling another function:

It converts something like "store/data/" to "c:/websites/mysite/store/data/"

Is there something equivalent in Perl?

I'm not very familiar with Perl programming - How do you write code in Perl with relative paths instead of hard-coding (which is website/server specific).

KevinADC

12:40 am on Sep 13, 2005 (gmt 0)

10+ Year Member



the Cwd module might be what you are wanting, two examples from the Cwd documentation:

use Cwd;
my $dir = getcwd;

use Cwd 'abs_path';
my $abs_path = abs_path($file);