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

Thomas Guyot-Sionnest dermoth at aei.ca
Mon Jul 13 14:02:11 CEST 2009

Hash: SHA1

On 13/07/09 05:18 AM, Ton Voon wrote:
> 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?

Let's just remove the = sign from the label... Even spaces shouldn't be
allowed. It makes parsing much simpler.

Any plugging actually using quoted spaces or equals?

- --
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Devel mailing list