Jun 5, 2014, 1:40 PM
Post #3 of 3
Re: [Laurent_R] store the values in a mysql db instead of printing out
[In reply to]
hello dear Laurent,
first of all - many thanks
your re right: to post this in the beginner-forum would be a better idea.
regarding the db-things: well i am pretty new to perl-tasks.
but with the above mentioned module - i think i can learn alot - it is quite very simple. And with this i can play around - and try to find out how to store the data into a mysql db.
well could the results that i get be regarded as a perl object (reference to array of references) like the below:
my $a = [ [$a, $ab, $c ], [$a, $b, $c] ] ;
and need to store it on the DB then retrieve it.
i look for a good mechanism to serialize it and then store it on the DB?
hmm - if i want to store:
# ... connect to database
my $data = [ [$a, $b, $c ], [ $a, $b, $c ] ];
my $bytestream = nfreeze $data;
$dbh->do('insert into table (field) values(?)', undef, $bytestream);
by the way: What about Data::Dumper? We could dump the objects into a TEXT field of the DB and then eval the content to get it back.
And perldoc says the return value of Data::Dumper can be "evaled to get back an identical copy of the original reference structure". we could then put the Dumper output into a large enough text field in the database.
love to hear from you