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

[MacPerl] FindFolder puzzler



The script below is an attempt at writing a generic handler script for
getting the paths to standard folders. Though logic says by passing the
name of the folder to FindFolder() it should yield the path to the folder,
yet I get

# Use of uninitialized value.
File 'Untitled'; Line 37 # (#1)

What gives?

#! perl -w

use diagnostics-verbose;
use strict;


#-=-=-=-=-=Declare Includes-=-=-=-=-=-=-=-=-=-=-=
use Mac::Files;
use File::Find;
#-=-=-=-=-=Declare Variables-=-=-=-=-=-=-=-=-=-=

my ($path,$folder,$file,@StdFolders,);

#-=-=-=-=-=Script Body-=-=-=-=-=-=-=-=-=-=-=-=-=

$path = FindFolder(kOnSystemDisk(),kDesktopFolderType()); #typing the
folder name like this

#  works
print "path to desktop folder is> $path\n";

@StdFolders= q(kAppleMenuFolderType() #load the standard folders into an array
kShutdownFolderType()
kControlPanelFolderType()
kStartupFolderType()
kDesktopFolderType()
kSystemFolderType()
kExtensionFolderType()
kTemporaryFolderType()
kFontsFolderType()
kTrashFolderType()
kPreferencesFolderType()
);


foreach $file (@StdFolders) {
    $path=(FindFolder(kOnSystemDisk(),$file));
    print "$path\n";
    print "$file\n";

	 }
_END_

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org