MySQL Forums
Forum List  »  Perl

store a result of a parser job in a mysql-db
Posted by: floo bee
Date: October 22, 2010 10:09AM

Good day dear friends,

i am new to the list - and my name is floo

i am new to Perl and new to MySQL too.

Well i want to use store a result of a parser job in a mysql-db: and i also want to use a MySQL-DB. Perhaps i should take Perl::DBI.

see the following code - and the output



!/usr/bin/perl

use strict; use warnings;
use HTML::TableExtract;
use YAML;

my $te = HTML::TableExtract->new( attribs => {
border => 0,
bgcolor => '#EFEFEF',
leftmargin => 15,
topmargin => 5,
});

$te->parse_file('kultus-bw.html');
my ($table) = $te->tables;

for my $row ( $table->rows ) {
cleanup(@$row);
print "@$row\n";
}

sub cleanup {
for ( @_ ) {
s/\s+//;
s/[\xa0 ]+\z//;
s/\s+/ /g;
}
}

Output


School: MyShool
Schultype: lycee
adresss: champs-elysee, 75000 Paris
Postbox: Keine Angabe
Telefon: 45 - 07361/680040
Fax: 07361/680040
E-Mail: lycee@schools.fr
Internet: www.lycee-paris.fr
departement: Paris Rubaix
head of school: Bill Clinton
deputy: Ron Wood
number of pupils: 259
classes: 8
number of teachers: 22
region: paris-midi
gouvernment: the french center council


Hard to be too specific as my question is very general. I've retrieved pages using LWP and used TableExtract to extract data and now i want to store the output in a mysql-database. I haven't used Mech, but by all accounts it is simpler than LWP.

Well i want to use LWP - and i also want to use a MySQL-DB. Perhaps i should take Perl::DBI.

Well do not bear with me. I am a beginner when it cones to perl.
You see: The data is parsed; I now want to store this results in a database:

How do i do that.

Note - i have many pages of the above mentioned. So it is worth to do the storage with MySQL

Can you give me some hints how to do it with Perl and DBI

love to hear from you

Regards floo

Options: ReplyQuote


Subject
Written By
Posted
store a result of a parser job in a mysql-db
October 22, 2010 10:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.