Carl Rogers writes ..

>I used the opendir() function in my Perl script to point to a folder
>with 200+ text files for the purpose of extracting data from each file.
>
>If I run the script with opendir/readdir pointing to a directory on a
>shared drive, I'll get to a point where Perl tells me "Can't open file-
>no such file or directory"

possibly - this is because of network instability .. ie. the network is not
available for that file .. you could try putting the open attempt in a loop
so that it tries a few times before giving up

  my $attempts = 100;

  until( open FILE, "$filename")
  {
    die qq(Could not open "$filename": $!) unless $attempts--;
  }


>If I copy the "bad" file to my home directory, run the same script with
>opendir/readdir pointing to my home directory now- it can be opened and
>read.

smells of something caused by the share


>The weird part: If I go back and opendir/readdir to the shared
>directory, the "bad" file is all of a sudden working and another
>file later in the directory becomes the "bad" file. As the steps are
>repeated, more files in the shared directory are able to be read.

can't explain that other than by saying "Windows is weird"


>Question: Is there a "feature" in WindowsNT that would cause Perl to
>behave this way? I've tried by changing the properties on the files,
>and that doesn't seem to help. (BTW: I'm using Perl 5.001running on NT
>4.0 SP 6)


have you tried upgrading your Perl .. 5.001 - are you sure ??? .. the above
code snippet might not work in 5.001 - I don't know when they introduced the
post-conditional syntax

in any case you should not be running such an old version of Perl .. it is a
possible cause of this weird problem

you should upgrade to at least 5.005_03 .. but why not 5.6.0 or 5.6.1 .. get
the latest version from ActiveState

  http://www.activestate.com/

-- 
  jason king

  In Hibbing, Minnesota, it shall be the duty of all policemen to kill
  all cats running at large. - http://dumblaws.com/

Reply via email to