I have written Perl code to access a MySQL database. I am changing the code to cache previously loaded web pages into a 4k text buffer in the database. The internet response is loaded into a variable called $response as follows:
To save the information the following is done:
$respstr = $response->as_string;
$respstr1 = substr($respstr, 0, 4000);
$cachepage = $respstr1;
$sql = "update links set cachepage='$cachepage' where id=$id";
$tda = $dbh->prepare($sql) or die "Error preparing: ", $dbh->errstr;
$tda->execute or die "Error executing: ", $dbh->errstr;
The variable $cachepage is a text type in the MySQL database.
When the execute is attempted, no response is returned and I am sure it fails since the database is not written to.
Do I need to set a length work or something to get this to work? Thanks for any help.