hello dear Linux - experts
i am pretty new to per.l - and i want to do the first steps to store some values:
how to put the output of the request to the db
have perl :: DBI installed
also the mysql-db is up and running
use Parse::CPAN::Authors; # must have downloaded my $p = Parse::CPAN::Authors->new("01mailrc.txt.gz"); # either a filename as above or pass in the contents of the file my $p = Parse::CPAN::Authors->new($mailrc_contents); my $author = $p->author('LBROCARD'); # $a is a Parse::CPAN::Authors::Author object # ... objects are returned by Parse::CPAN::Authors print $author->email, " "; # email@example.com print $author->name, " "; # Leon Brocard print $author->pauseid, " "; # LBROCARD # all the author objects my @authors = $p->authors;
i want to store all the output in the mysql-db
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:
use Storable use DBI; # ... connect to database # Store 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?