B
bettyann
i have an input file, Icons.lis, like so:
#--------------
# line starting with "%" is an executable perl command
% $zyxDir = "/System/Library/CoreServices/SystemIcons.bundle/Contents/Resources";
% $cbaDir = "/Users/bettyann/icons/03-08-04_Bubbly-System";
# System Icon Files # Local Icon File
$zyxDir/ApplicationsFolderIcon.icns $cbaDir/older-applications
$zyxDir/CDAudioVolumeIcon.icns $cbaDir/cd
#--------------
how do i get perl to interpret the variable "$zyxDir" and "$cbaDir" in
the filenames (in the last two lines of the above input file)? i can
evaluate the "%" command just fine but i cannot resolve/ interpret/
expand the filenames. in other words, how do i get the first
filename, $zyxDir/ApplicationsFolderIcon.icns, to resolve to
/System/Library/CoreServices/SystemIcons.bundle/Contents/Resources/ApplicationsFolderIcon.icns?
my code:
#!/usr/bin/perl
# open the list file
$listFile = "Icons.lis";
open( FID, "< $listFile" ) || die "Could not open $listFile for
reading.";
while(<FID>){ # Read line by line
# skip blanks and comment lines
s/#.*//; # ignore comments by erasing them
next if /^(\s)*$/; # skip blank lines
chomp; # remove trailing newline characters
if ( s/^%// ) {
# this is an executable perl command
print "eval >>$_<< \n";
eval( $_ ); # debug
next;
}
# debug - these variables are defined from above "eval"
print "\n";
print "zyxDir >>$zyxDir<< \n";
print "cbaDir >>$cbaDir<< \n";
# get the two filenames from this line
( $sysIcns, $newIcon ) = split;
print "sysIcns >>$sysIcns<< \n";
print "newIcon >>$newIcon<< \n";
`ls $sysIcns`;
} # while( <FID>)
close( FID );
i get this output and error:
eval >> $zyxDir = "/System/Library/CoreServices/SystemIcons.bundle/Contents/Resources";<<
eval >> $cbaDir = "/Users/bettyann/icons/03-08-04_Bubbly-System";<<
zyxDir >>/System/Library/CoreServices/SystemIcons.bundle/Contents/Resources<<
cbaDir >>/Users/bettyann/icons/03-08-04_Bubbly-System<<
sysIcns >>$zyxDir/ApplicationsFolderIcon.icns<<
newIcon >>$cbaDir/folder-applications<<
ls: /ApplicationsFolderIcon.icns: No such file or directory
the error is presumably because the "$zyxDir" in $sysIcns is not
evaluated. i tried a number of eval combinations ... with no success.
thanks - bettyann
#--------------
# line starting with "%" is an executable perl command
% $zyxDir = "/System/Library/CoreServices/SystemIcons.bundle/Contents/Resources";
% $cbaDir = "/Users/bettyann/icons/03-08-04_Bubbly-System";
# System Icon Files # Local Icon File
$zyxDir/ApplicationsFolderIcon.icns $cbaDir/older-applications
$zyxDir/CDAudioVolumeIcon.icns $cbaDir/cd
#--------------
how do i get perl to interpret the variable "$zyxDir" and "$cbaDir" in
the filenames (in the last two lines of the above input file)? i can
evaluate the "%" command just fine but i cannot resolve/ interpret/
expand the filenames. in other words, how do i get the first
filename, $zyxDir/ApplicationsFolderIcon.icns, to resolve to
/System/Library/CoreServices/SystemIcons.bundle/Contents/Resources/ApplicationsFolderIcon.icns?
my code:
#!/usr/bin/perl
# open the list file
$listFile = "Icons.lis";
open( FID, "< $listFile" ) || die "Could not open $listFile for
reading.";
while(<FID>){ # Read line by line
# skip blanks and comment lines
s/#.*//; # ignore comments by erasing them
next if /^(\s)*$/; # skip blank lines
chomp; # remove trailing newline characters
if ( s/^%// ) {
# this is an executable perl command
print "eval >>$_<< \n";
eval( $_ ); # debug
next;
}
# debug - these variables are defined from above "eval"
print "\n";
print "zyxDir >>$zyxDir<< \n";
print "cbaDir >>$cbaDir<< \n";
# get the two filenames from this line
( $sysIcns, $newIcon ) = split;
print "sysIcns >>$sysIcns<< \n";
print "newIcon >>$newIcon<< \n";
`ls $sysIcns`;
} # while( <FID>)
close( FID );
i get this output and error:
eval >> $zyxDir = "/System/Library/CoreServices/SystemIcons.bundle/Contents/Resources";<<
eval >> $cbaDir = "/Users/bettyann/icons/03-08-04_Bubbly-System";<<
zyxDir >>/System/Library/CoreServices/SystemIcons.bundle/Contents/Resources<<
cbaDir >>/Users/bettyann/icons/03-08-04_Bubbly-System<<
sysIcns >>$zyxDir/ApplicationsFolderIcon.icns<<
newIcon >>$cbaDir/folder-applications<<
ls: /ApplicationsFolderIcon.icns: No such file or directory
the error is presumably because the "$zyxDir" in $sysIcns is not
evaluated. i tried a number of eval combinations ... with no success.
thanks - bettyann