[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Newbie Question



>Is there specific way to move in and out of folders on the Mac? Is it just
>like unix with "/root/users/bob/file.dat" or is it something different?  I
>know that the Mac uses a "root:users:bob:file.dat" setup when displaying a
>location.  Is this what I need in the script?

There's no specific way for that on the Mac, but as you already know, it
uses a different path separator ':' instead of '/'. To change it, you can
use:

use Config;
if ( $Config{ 'osname' } =~ /^macos/i ) {
        $dir_sep = ':';
} else { if ( $Config{ 'osname' } =~ /^msdos/i ) {
                        $dir_sep = '\\';
                } else { $dir_sep = '/' }
        }

$path =~ s|/|$dir_sep|g;

To get your home directory, you can use:

$home = `pwd`;

There's also a Module called File::Path which should do the job and create
a path if it doesn't exist, but I didn't get it to work :(

Greetings,
           Erich Rast.

--------------------------------------
        h0444zkf@rz.hu-berlin.de
http://www2.rz.hu-berlin.de/~h0444zkf
--------------------------------------