#!/usr/bin/perl # # gabriel 2010/06/03 # apt-get install libdbd-mysql-perl use strict; use DBI; my $config_file = '/srv/refbase/initialize/db.inc.php'; my $connect_name = qx{ grep '\$username =' $config_file | cut -f 2 -d '"' }; my $connect_pass = qx{ grep '\$password =' $config_file | cut -f 2 -d '"' }; chomp($connect_name, $connect_pass); my $dbh = DBI->connect( "DBI:mysql:database=refbaselegi;host=localhost", "$connect_name", "$connect_pass", { 'RaiseError' => 1 } ); # refbase server my $sth = $dbh->prepare("SELECT serial FROM refs"); $sth->execute(); print $sth->rows."\n";