There's no reason/need to use the Storable module if you're planning on putting the data into a database.
@authors is an array of objects. You need to loop over that array and insert each author's info into the DB.
You could use the Data::Dumper module to inspect/review the structure of the @authors array. For example, if you add a
print Dumper \@authors; statement your output would look like this:
acme@astray.com
Leon Brocard
LBROCARD
$VAR1 = [
bless( {
'name' => 'Neil Hainer',
'email' => 'CENSORED',
'pauseid' => 'NHAINER'
}, 'Parse::CPAN::Authors::Author' ),
bless( {
'pauseid' => 'CROSSWIRE',
'email' => 'matt@crosswire.com',
'name' => 'Matthew Sibley'
}, 'Parse::CPAN::Authors::Author' ),
bless( {
'pauseid' => 'DAVIDJNSN',
'name' => 'David Jensen',
'email' => 'CENSORED'
}, 'Parse::CPAN::Authors::Author' ),
bless( {
'pauseid' => 'KESZLER',
'name' => 'Scott R. Keszler',
'email' => 'keszler@srkconsulting.com'
}, 'Parse::CPAN::Authors::Author' ),
This is how you'd loop over the array.
for my $author ( @authors ) {
print $author->email, "\n";
print $author->name, "\n";
print $author->pauseid, "\n\n";
}
But instead of printing the data, you would insert it into the db.
The DB table will need the 3 fields to hold the author's ID, name, and email address.
Have you created the database?
Do you know how to connect to the database from your script?
Do you know how to write the insert statement?
Reading over the DBI and DBD::mysql module documentation will answer those questions.
use DBI;
$dsn = "DBI:mysql:$database";
$dsn = "DBI:mysql:database=$database;host=$hostname";
$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
$dbh = DBI->connect($dsn, $user, $password);