Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^6: Combining Ffile:fetch with MySQL

by hippo (Bishop)
on Jul 24, 2022 at 22:34 UTC ( [id://11145695]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Combining Ffile:fetch with MySQL
in thread Combining Ffile:fetch with MySQL

my $ff = File::Fetch->new(uri=> '$ref' );

You have potentially 2 errors here. Firstly you are enclosing $ref in single quotes which prevent interpolation. Just lose the quotes entirely. Secondly, my understanding is that you need to pass $ref->{url} as the argument to new() rather than just $ref. Try those fixes and see if you get any further.


🦛

Replies are listed 'Best First'.
Re^7: Combining Ffile:fetch with MySQL
by justin423 (Scribe) on Jul 24, 2022 at 23:13 UTC
    updated it to this and it prints all the links, but no saved files in the /data/ folder.
    while (my $ref = $query->fetchrow_hashref()) { print "url: $ref->{url}\n"; my $ff = File::Fetch->new(uri=>$ref->{url}); my $where = $ff->fetch( to => '/data/'); } $query->finish;
      but no saved files in the /data/ folder.

      Is your /data/ directory really at the root of the filesystem? That would be unusual. Pass it the actual path if not.

      Try printing $ff->error after the call to fetch to see more detail of what's going wrong. See also the Basic Debugging Checklist.


      🦛

        it is a windows machine and it is in the C:\ directory. so C:\data\ is the path. to test that, I updated it to download to both /data/ and a new subdirectory called: /data/documents/ changed it to this:
        #$path='/data/'; $path= '/data/documents/'; while (my $ref = $query->fetchrow_hashref()) { print "url: $ref->{url}\n"; my $ff = File::Fetch->new(uri=>$ref->{url}); my $where = $ff->fetch( to => '$path'); my $error= $ff->error(); print $error;
        and the output is the same. no error messages. changing it from print $error to print $ff, I get the link followed by: File::Fetch=HASH(0x30d2a18)

Log In?
Username:
Password:

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

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

    No recent polls found