summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 761b500)
raw | patch | inline | side by side (parent: 761b500)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 19 Feb 2009 10:04:49 +0000 (11:04 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 19 Feb 2009 12:51:59 +0000 (13:51 +0100) |
contrib/cussh.pl | patch | blob | history |
diff --git a/contrib/cussh.pl b/contrib/cussh.pl
index ee4c89396b98d0ecaa9ae2e1769b26876a4cc787..47c72c33d337f53d48b1b249320d9a1bce7fa7ef 100755 (executable)
--- a/contrib/cussh.pl
+++ b/contrib/cussh.pl
my $id = getid(\$line);
+ my $ret;
+
if (! $id) {
- print STDERR $sock->{'error'} . $/;
+ print STDERR "Invalid id \"$line\"." . $/;
return;
}
my ($time, @values) = split m/:/, $line;
- return $sock->putval(%$id, time => $time, values => \@values);
+ $ret = $sock->putval(%$id, time => $time, values => \@values);
+
+ if (! $ret) {
+ print STDERR "socket error: " . $sock->{'error'} . $/;
+ }
+ return $ret;
}
=item B<PUTVAL> I<Identifier> I<Valuelist>
my $id = getid(\$line);
if (! $id) {
- print STDERR $sock->{'error'} . $/;
+ print STDERR "Invalid id \"$line\"." . $/;
return;
}
my $vals = $sock->getval(%$id);
if (! $vals) {
- print STDERR $sock->{'error'} . $/;
+ print STDERR "socket error: " . $sock->{'error'} . $/;
return;
}
}
if (! $res) {
- print STDERR $sock->{'error'} . $/;
- return;
+ print STDERR "socket error: " . $sock->{'error'} . $/;
}
- return 1;
+ return $res;
}
=item B<LISTVAL>
@res = $sock->listval();
if (! @res) {
- print STDERR $sock->{'error'} . $/;
+ print STDERR "socket error: " . $sock->{'error'} . $/;
return;
}
my $sock = shift || return;
my $line = shift || return;
+ my $ret;
+
my (%values) = ();
foreach my $i (split m/ /, $line) {
my($key,$val) = split m/=/, $i, 2;
}
}
$values{'time'} ||= time();
- my(@tmp) = %values;
- return $sock->putnotif(%values);
+
+ $ret = $sock->putnotif(%values);
+ if (! $ret) {
+ print STDERR "socket error: " . $sock->{'error'} . $/;
+ }
+ return $ret;
}
=back