--- print/print.pl 2000/05/31 14:32:39 1.4 +++ print/print.pl 2000/06/02 07:07:27 1.5 @@ -34,7 +34,8 @@ open(WHO,"who am i |") || die "who am i? $!"; my $db_user=; chomp $db_user; -$db_user=~s/\s.+$//g; +$db_user=~s/\s.+$//g; # OSF obriši sve iza logina +$db_user=~s/^[^!]+!//g; # Linux obriši hostname close(WHO); open(HOSTNAME,"hostname |") || die "hostname: $!"; @@ -42,9 +43,12 @@ chomp $hostname; close(HOSTNAME); -my $sth = $dbh->prepare("select ko_id from unix2ko where login='$db_user' and host='$hostname'") || die $dbh->errstr(); +$sth = $dbh->prepare("select ko_id from unix2ko where login='$db_user' and host='$hostname'") || die $dbh->errstr(); $sth->execute() || die $sth->errstr(); my ($ko_id)=$sth->fetchrow_array; +die "Ne mogu naći odgovarajuću kontakt osobu u tablici unix2ko!\n\tlogin=$db_user host=$hostname\n" if (!defined($ko_id)); + +print "kontakt_osoba_id (koja je pokrenula skriptu): $ko_id\n" if ($debug); #$sth = $dbh->prepare("select id from kontakt_osobe where e_mail like '%hana%'") || die $dbh->errstr(); #$sth->execute() || die $sth->errstr(); @@ -106,7 +110,9 @@ while (my @arr = $sth->fetchrow_array() ) { print join("|",@arr),"\n"; - $dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($arr[0],$ko_id,'now'::datetime,5)") if (!$debug); + if (!$debug) { + $dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($arr[0],$ko_id,'now'::datetime,5)") || die $dbh->errstr(); + } seek(IN,$begin_pos,0); while() {