From 382957f9adc345ea7cdffce5261ffbf6f7c8117f Mon Sep 17 00:00:00 2001 From: dpavlin Date: Thu, 23 Jun 2005 12:22:21 +0000 Subject: [PATCH] fix git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@8 8392b6e1-25fa-0310-8288-cc32f8e212ea --- bin/BackupPC_updatedb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/BackupPC_updatedb b/bin/BackupPC_updatedb index f953075..1f6bb8a 100755 --- a/bin/BackupPC_updatedb +++ b/bin/BackupPC_updatedb @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl -w +#!/usr/local/bin/perl $| = 1; use strict; @@ -127,13 +127,13 @@ if ($opt{d}) #################################INSERT VALUES############################# # get hosts -$hosts = $bpc->HostInfoRead("localhost"); -my $host_key; +$hosts = $bpc->HostInfoRead(); +print Dumper($hosts); my $hostID; my $shareID; -foreach $host_key (keys %{$hosts}) +foreach my $host_key (keys %{$hosts}) { - my $hostname = $hosts->{$host_key}->{'host'}; + my $hostname = $hosts->{$host_key}->{'host'} || die "can't find host for $host_key"; my $backups; my $sql; @@ -141,8 +141,7 @@ foreach $host_key (keys %{$hosts}) my $st = $dbh->prepare($sql); $st->bind_param(1,$hosts->{$host_key}->{'host'}); $st->execute(); - my $tmp = $st->fetchrow_hashref(); - if ($tmp->{'ID'} ne "") + if (my $tmp = $st->fetchrow_hashref()) { $hostID = $tmp->{'ID'}; } -- 2.20.1