What I did was write a quick script to send STDERR to a log file. Things went astray again and this is the message that I got.

 fileparse(): need a valid pathname at ftpData.pl line 312

I am using fileparse (File::Basename) to disregard any file extensions in directory comparisons and to remove the existing extension when the file is copied and renamed with a different extension, like so:

#Disregard file extension in comparison: foreach my $item (@wrkDirList) { my ( $fileName, $filePath, $fileExt ) = fileparse($item, qr/\.[^.]*/); $item = $fileName; }

and

foreach $item (@filesToRetrv) { my ( $fileName, $filePath, $fileExt ) = fileparse($item, qr/\.[^.] +*/); if (rename($item, $fileName)) { push (@filesToMove, $fileName); } else { print LOG "Rename failed for $localName to $fileName\n"; } }

So, and correct me if I am wrong, somewhere along the line it looks like fileparse is getting passed an empty filehandle? I'm not really sure how this could happen. The STDERR message seems to be occurring at the second instance of fileparse (the one working on @filesToRetrv). Here is a little snippet with info about this array and what goes into it:

foreach $fileToGet (@matches) { my $remoteFileSize = $ftp->size($fileToGet); $localFileName = "$fileToGet".".xxx"; $ftpReturnVar = $ftp->get($fileToGet, $localFileName); $localFileSize = (stat "$workingDir/$localFileName")[7]; if ($remoteFileSize == $localFileSize) { push (@filesToRetrv, $ftpReturnVar); } else { ... } }

Any ideas? Thanks for the help!


In reply to Re^2: Infinite Loop Question by joeymac
in thread Infinite Loop Question by joeymac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.