Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Downloading only new files added to a local path with Perl (FTP)

by roboticus (Chancellor)
on Aug 19, 2020 at 13:26 UTC ( [id://11120900]=note: print w/replies, xml ) Need Help??


in reply to Downloading only new files added to a local path with Perl (FTP)

SaraMirabi:

I'm not 100% certain, but the problem looks like you're not properly interpolating the bash variable list into line 72:

  epoch=$(perl -MFile::stat -e "print stat('$list')->mtime")

So perl is likely trying to execute:

perl -MFile::stat -e "print stat('')->mtime"

Since you don't have a file named '' in your local filesystem, the stat function returns undef, which is why you get the "Can't call method "mtime" on an undefined value at -e line 1" error.

If you put a "set -x" and "set -v" commands in your bash script, you'll be able to see what the expanded command lines expand to in your script, so you can more easily see what bash is telling perl what to do for you.

Also, while I'm happy you're trying to "use strict" and "use warnings", I don't think they'll work well in bash. ;^)

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11120900]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-24 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found