develooper Front page | perl.beginners | Postings from February 2002

AARGHHH,..... chdir(yes - no)

david wright
February 11, 2002 16:01
AARGHHH,..... chdir(yes - no)
Message ID:
Man, i am going crazy on this,... this is actually within a package but 
that doesn't matter in this case (that's why i have line #20). Anyway,
i have #, (commented out) lines for testing purposes. I have isolated 
the problem to this area. line 27 vs. 29.  chdir will not open any file 
passed to it in the form of a $. line 27 works fine. so i know that the 
code works. I tried creating line #25 to add quotes around the $ to see 
if that helps, it didn't. i moved chomp, took it out, etc,... i have 
line #28 in there to just check that i typed the correct line and that 
it is interpreted correctly. I have typed the path exactly as shown in 
line #27 and as a regular path (/etc/etc) and a variety of ways. It just 
seems like chdir($) is not supported on my machine. (OS X.1 perl 5.6) I 
know someone here will have an answer, ... thanks

  sub openfolder_a {                              # This is where you are 
asked what file to open
      20         my $self = shift @_;
      21         my($folder_a, $folder_b, $checkit_a);
      22         print "What folder do you want to open? (Need complete 
path name: /Volumes/OS\ X\ Users/etc,...)\n";
      23         $folder_a=<>;
      24         chomp $folder_a;
      25         #$folder_a ="\"$folder_a\"";
      26         #chomp $folder_a;
      27         #chdir("/Volumes/Music\ Tunes/Toad\ Music") || die "cant 
open that, sorry: $!";
      28         print $folder_a;
      29         chdir($folder_a) || die "cant open that, sorry: $!";
      30 #       opendir(FOLDER_A,"$folder_a") || die "cant open 
$folder_a: $!";
      31 #       $checkit_a = readdir(FOLDER_A);
  etc,etc,... Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About