CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Relative Addressing with MS Adv Ser 2k



Jan 4, 2001, 7:33 AM

Post #1 of 2 (1432 views)
Relative Addressing with MS Adv Ser 2k Can't Post

I am running a win2k adv server with Active Perl. Everything works fine but perl scripts cannot read files in other directories except the cgi-bin using relative addressing. EG.
$relative = "..\";
$filepath = "apps\downloads";
opendir(DIR, "$relative$filepath") || die("Cannot Open Dir!");
@dirlist = readdir(DIR);
All the directories and scripts have full permissions with the server and the same scripts
work perfectly on win 2k pro pws, win NT3.51server, win 98pws, and any remote unix server. This inability prevents the use of some of perls most powerful features. Is this an
attempt of MS to widen the gulf between them and Unix and force programmers to adopt ASP?

User / Moderator

Jan 4, 2001, 8:20 PM

Post #2 of 2 (1429 views)
Re: Relative Addressing with MS Adv Ser 2k [In reply to] Can't Post

Backslashes have special meaning in Perl when you interpolate them in strings, so you need to escape them either by prefixing them with another \ ..

    $filepath = "apps\\downloads";

.. or by using single quotes to avoid interpolation ...

    $filepath = 'apps\downloads';

However, my personal preference when working with Perl in a Windows enviroment is to use the UNIX style paths as perl is smart enough to figure out what you really mean.

    $filepath = "apps/downloads";


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives