Есть скрипт вроде
use DBI;
use Fcntl; #The Module
$database = "xxx";
$host = "xxxx";
$driver = "mysql";
$data_source = "DBI:$driver:database=$database;host=$host";
$username = "user";
$password = "somepasswd";
$dbh = DBI->connect($data_source, $username, $password)
or die $DBI::errstr;
$query = "SELECT inet_ntoa(ip) FROM users JOIN ip_networks ON inet_ntoa(ip&mask)=inet_ntoa(ip_networks.network)
WHERE ip_networks.router_id=crc32('xxx') ORDER BY ip";
$query_handle = $dbh->prepare($query);
# EXECUTE THE QUERY
$query_handle->execute();
# BIND TABLE COLUMNS TO VARIABLES
$query_handle->bind_columns(undef, \$ip);
$data = `cat test.txt| grep -E -o '[0-9,aAbBcCdDeEfF]{1,2}(\:[0-9,aAbBcCdDeEfF;]{1,3}){5}'`;
print "$data\n";
#print $result;
sysopen ( FF, "file.txt", O_WRONLY | O_CREAT | O_TRUNC);
while ($query_handle->fetch()){
print (FF "$ip\n");
}
close (FF ) or die "Ошибка закрытия файла: $!";
$dbh->disconnect
or warn $dbh->errstr;
Как тогда глянуть содержимое переменных во время отладки? ЧЯДНТ?
Gentoo amd64.
Perl v5.12.2