"Benjamin Jeeves" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> I have now used the code below to download the CSV file which it does but
the
> rest of the script does not get executed e.g. to open the file and read
the
> data and place it in to it databases are ideas why?
>
> use LWP::Simple;
>
> $url = "web-server here";
> $file = "/home/filename.csv";
>
> $content = getstore($url,$file);
>
> more code here which does not run
>

Do you have to store the file to disk? Why not just keep it in memory?

use DBI;
use Text::CSV;
use LWP::Simple;

$dbh = DBI->connect( ... );
$sth = $dbh->prepare( 'INSERT INTO table VALUES (?, ?, ...)' )
foreach my $line ( split(/\n/, get( $url )) ) {
  # split record in to fields... see Text::CSV
  $sth->execute( @splitted_stuff );
}

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to