From: Buchan M. <bg...@st...> - 2011-01-22 21:53:41
|
On Tuesday, 4 January 2011 13:56:07 W.J.M. Nelis wrote: > Hello, > > for a test (of a Cisco switch) the following OID is defined in file 'oids': > ifDuplexNum : .1.3.6.1.2.1.10.7.2.1.19 : branch > > In order to make a combined test, this variable was used in a MATH > transform: > > ifStSpDu : MATH : {ifBps} + {ifOperStatNum} - 1 + ({ifDuplexNum}-1)x7 > > This resulted in the following error to be logged: > [11-01-04@10:30:29] Failed eval for TRANS_MATH on ifStSpDu.10101: > $dep_val[0] + $dep_val[1] - 1 + ({ifDuple*Num}-1)*7 (Bareword "ifDuple" > not allowed while "strict subs" in use at (eval 2127005512) line 1, > <$__ANONIO__> line 16594987. Bareword "Num" not allowed while "strict > subs" in use at (eval 2127005512) line 1, <$__ANONIO__> line 16594987. > > The 'x' in 'ifDuplexNum' has been changed to a '*' as well. This happens in > module dm_tests.pm, function trans_math near line 442: > > # Convert our math symbols to their perl equivalents > $expr =~ s/x/\*/g; # Multiplication > $expr =~ s/\^/**/g; # Exponentiation > > The RE sgould be replaced by one which replaces any 'x' outside '{' and > '}'. Lacking the knowledge to write such an RE, I've changed the name of > the variable, such that is does not contain an 'x' in it any more. I have changed it instead to only honour ' x ': http://devmon.svn.sourceforge.net/viewvc/devmon?view=revision&revision=195 It might be better to allow '*' as multiplication operator instead, and phase 'x' or ' x ' out. There was only one template in svn using {oid}xINT, you'll see the commit fixed it. Regards, Buchan |