From c47e1a9c28db2890f724ee57e59f3a3c30d7740c Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Wed, 14 May 2008 11:19:53 +0000 Subject: Fixed parsing of scientific notation git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1993 f882894a-f735-0410-b71e-b25c423dba1c --- lib/Nagios/Plugin/Performance.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/Nagios/Plugin/Performance.pm') diff --git a/lib/Nagios/Plugin/Performance.pm b/lib/Nagios/Plugin/Performance.pm index 403492c..a7655fc 100644 --- a/lib/Nagios/Plugin/Performance.pm +++ b/lib/Nagios/Plugin/Performance.pm @@ -11,7 +11,7 @@ __PACKAGE__->mk_ro_accessors( qw(label value uom warning critical min max) ); -use Nagios::Plugin::Functions; +use Nagios::Plugin::Functions qw($value_re); use Nagios::Plugin::Threshold; use Nagios::Plugin::Range; our ($VERSION) = $Nagios::Plugin::Functions::VERSION; @@ -22,12 +22,11 @@ sub import { Nagios::Plugin::Functions::_use_die($_); } -my $value_re = qr/[-+]?[\d\.]+/; -my $value_re_with_negative_infinity = qr/$value_re|~/; +my $value_with_negative_infinity = qr/$value_re|~/; sub _parse { my $class = shift; my $string = shift; - $string =~ s/^([^=]+)=($value_re)([\w%]*);?($value_re_with_negative_infinity\:?$value_re?)?;?($value_re_with_negative_infinity\:?$value_re?)?;?($value_re)?;?($value_re)?\s*//o; + $string =~ s/^([^=]+)=($value_re)([\w%]*);?($value_with_negative_infinity\:?$value_re?)?;?($value_with_negative_infinity\:?$value_re?)?;?($value_re)?;?($value_re)?\s*//o; return undef unless ((defined $1 && $1 ne "") && (defined $2 && $2 ne "")); my $p = $class->new( label => $1, value => $2+0, uom => $3, warning => $4, critical => $5, -- cgit v1.2.3-74-g34f1