|
From: W.J.M. N. <Wim...@nl...> - 2011-04-20 11:46:02
|
Hello,
> Ok made those changes and still get this error.
>
> [11-04-15@09:50:32] SUBSTR transform uses only a single oid, a numeric
> offset and an optional shift value at
> /usr/local/devmon-0.3.1-beta1/templates/cisco-ITP/itp_msu/transforms,
> line 7
>
> I have this in transforms
> BAYTEST : SUBSTR : {procIndex} -1
>
SUBSTR requires three parameters, as you can see in de code snippet of
dm_templates.pm below. This contrasts with the errormessages, which
states that the third parameter is optional. I've tested the patch
below, and found it to work if three parameters are supplied to SUBSTR.
> -----Original Message-----
> From: W.J.M. Nelis [mailto:Wim...@nl...]
> Sent: Friday, April 15, 2011 2:12 AM
> To: dev...@li...
> Subject: Re: [Devmon] SUBSTR
>
> Hello,
>
>> I am attempting to use the SUBSTR transform but it does not seem to
>> allow a negative position. I am trying to grab the text at the end of
>>
> a
>
>> string. The application does not seem to like this. Or am I using it
>> wrong?
>>
>>
> Devmon does not check for a negative value of the offset. You might try
> the following patch, which I did NOT test:
>
> Index: dm_templates.pm
> ===================================================================
> --- dm_templates.pm (revision 14)
> +++ dm_templates.pm (working copy)
> @@ -567,7 +567,7 @@
> };
>
> $func_type eq 'substr' and do {
> - $temp =~ s/\s*\{\s*\S+?\s*\}\s+(\d+)\s*(\d*)\s*//;
> + $temp =~ s/\s*\{\s*\S+?\s*\}\s+(-?\d+)\s*(\d*)\s*//;
> do_log("SUBSTR transform uses only a single oid, a numeric
> offset " .
> "and an optional shift value at $trans_file, line
> $l_num", 0)
> and next LINE if $temp ne '';
> Index: dm_tests.pm
> ===================================================================
> --- dm_tests.pm (revision 15)
> +++ dm_tests.pm (working copy)
> @@ -533,7 +533,7 @@
> my $oid_h = \%{$oids->{$oid}};
>
> my ($dep_oid, $offset, $length) = ($1, $2, $3)
> - if $oid_h->{'trans_data'} =~ /\{(.+)\}\s+(\d+)\s*(\d*)/;
> + if $oid_h->{'trans_data'} =~ /\{(.+)\}\s+(-?\d+)\s*(\d*)/;
> my $dep_oid_h = \%{$oids->{$dep_oid}};
> $length = undef if $length eq '';
>
Kind regards,
Wim Nelis.
*******************************************************************************************************
The NLR disclaimer (http://www.nlr.nl/emaildisclaimer) is valid for NLR e-mail messages.
*******************************************************************************************************
|