[Nagiosplug-devel] Perfdata pattern in Nagios::Plugin::Performance.pm

Ton Voon ton.voon at opsera.com
Mon Jul 13 11:18:01 CEST 2009


On 13 Jul 2009, at 09:30, Gerhard Lausser wrote:

> according to the development guidelines, the = character is allowed  
> in a
> label.
>
> 2.label can contain any characters
> 3.the single quotes for the label are optional. Required if spaces,  
> = or '
> are in the label
>
> Now i see in the function Nagios::Plugin::Performance::_parse the  
> following
> pattern:
> $string =~ /^'?([^'=]+)'?=($value_re)([.....
>
> Shouldn't it be /^'?([^']+)'?=($value_re)([..... instead? I see no  
> reason
> why the = is excluded. The pattern will try to match as much  
> characters as
> possible so the = in '?=($value_re... will always be the =  
> separating label
> from value.
>
> Do you agree or am i wrong because there is a reason why the = is  
> excluded?

One thing I'm learning is to try and keep the design restricted first  
and then open up as necessary. Trying to do things the other way round  
leads to holes in implementation.

I think the parsing routines could probably do with a bit of work in a  
different way, rather than using regexps. Happy to take any patches  
that pass all the test cases.

Turning the question around - what use case uses an equal sign in the  
label?

Ton





More information about the Devel mailing list