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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



Haygar
Deleted

Jan 4, 2001, 7:33 AM

Post #1 of 2 (520 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);
etc..............
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?



Kanji
User / Moderator

Jan 4, 2001, 8:20 PM

Post #2 of 2 (517 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 \ ..

Code
    $filepath = "apps\\downloads";

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

Code
    $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.

Code
    $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