summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 88949e5)
raw | patch | inline | side by side (parent: 88949e5)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 25 Jan 2006 19:09:12 +0000 (19:09 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 25 Jan 2006 19:09:12 +0000 (19:09 +0000) |
program/bindings/perl-piped/RRDp.pm | patch | blob | history |
index 1e267e7ddfc4cb01a77377cfc7968b751bbf6629..375578a3fe8bec0b3c472a235663d71eed51dc96 100644 (file)
$status = B<RRD::end>
-B<$RRDp::user>, B<$RRDp::sys>, B<$RRDp::real>
+B<$RRDp::user>, B<$RRDp::sys>, B<$RRDp::real>, B<$RRDp::error_mode>, B<$RRDp::error>
=head1 DESCRIPTION
waiting for things like the hard disk and new input from the perl
script.
+=item B<$RRDp::error_mode> and B<$RRDp::error>
+
+If you set the variable $RRDp::error_mode to the value 'catch' before you run RRDp::read a potential
+ERROR message will not cause the program to abort but will be returned in this variable. If no error
+occurs the variable will be empty.
+
+ $RRDp::error_mode = 'catch';
+ RRDp::cmd qw(info file.rrd);
+ print $RRDp::error if $RRDp::error;
+
=back
sub read () {
croak "RRDp::read can only be called after RRDp::cmd"
unless $Sequence eq 'C';
+ $RRDp::error = undef;
$Sequence = 'R';
my $inmask = 0;
my $srbuf;
$minibuf .= $srbuf;
while ($minibuf =~ s|^(.+?)\n||s) {
my $line = $1;
- # print $line,"\n";
- if ($line =~ m|^ERROR|) {
- croak $line;
+ # print $line,"\n";
+ $RRDp::error = undef;
+ if ($line =~ m|^ERROR|) {
+ $RRDp::error_mode eq 'catch' ? $RRDp::error = $line : croak $line;
$ERR = 1;
}
elsif ($line =~ m|^OK u:([\d\.]+) s:([\d\.]+) r:([\d\.]+)|){