ok, here is the code I put together from the really helpful response. it runs with no errors, it just doesn't download... I must be missing something.

$host = "localhost"; $port = "3306"; $dbdriver='mysql'; $tablename = "linktable"; print "Enter year and month to download in format YYYYMM:"; $date = <STDIN>; chomp $date; $dsn = "dbi:$dbdriver:$database:$host:$port"; $path='/data/'; my $dbh = DBI->connect($dsn, $user, $password) or die "Couldn't connect to database: " . DBI->errstr; $dbh-> do("DROP TABLE IF EXISTS LINKTABLE"); $dbh-> do("CREATE TABLE IF NOT EXISTS LINKTABLE(document_id CHAR(9),IN +DEX(DOCUMENT_ID),PUBLISH_DATE CHAR(8),URL CHAR(150))"); $dbh-> do("LOAD DATA LOCAL INFILE '/data/DATA.CSV' INTO TABLE $tablena +me(DOCUMENT_ID,PUBLISH_DATE)"); $dbh-> do("UPDATE LINKTABLE SET URL=CONCAT('www.example.com/document/' +,DOCUMENT_ID,'document.pdf')") ; my $SQL = "select url,document_id FROM $tablename where left(publish_d +ate,6) ='$date'"; my $query = $dbh->prepare($SQL) or die "prepare: ".$dbh->errstr; $query-> execute() or die "execute: ".$dbh->errstr; while ($url,$document_id = $query->fetchrow_array()) { print "url: $row->{url} \n"; my $outfile = '$path.$document_id'; my $ff = File::Fetch->new( uri => url ); $ff->fetch(to => $outfile) or die "failed to fetch '$url' to '$outf +ile'."; #rename("document.pdf","/output/$document_id.pdf") || die "Can't re +name file: ";

In reply to Re^2: Combining Ffile:fetch with MySQL by justin423
in thread Combining Ffile:fetch with MySQL by justin423

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.