Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 43 lines (33 sloc) 1.02 KB
use strict;
use warnings;
use XML::LibXML;
use DBI;
use Digest::MD5 'md5_hex';
my $dbh = DBI->connect("dbi:mysql:database=$ENV{PM_DB};host=$ENV{PM_HOST}",
or die DBI::errstr;
my $xml_file = 'perl_mongers.xml';
my $xml_parser = XML::LibXML->new;
open my $xml_fh, '<', $xml_file or die "$xml_file: $!\n";
my $xml = $xml_parser->parse_fh($xml_fh);
my $sql = '
insert into pm_group (id, xml_key, name, leader_name, leader_email,
country, continent)
values (?, ?, ?, ?, ?, ?, ?)';
my $sth = $dbh->prepare($sql) or die $dbh->errstr;
foreach ($xml->findnodes('//group[@status="active" or @status="on hold" or @status="sleeping"]')) {
my $name = $_->findvalue('name');
my $mail = $_->findvalue('tsar/email');
my $md5 = md5_hex("$name|$mail");
or die $sth->errstr;
Something went wrong with that request. Please try again.