On Fri, Mar 11, 2011 at 5:05 PM, Eric Smith <eri...@gmail.com> wrote:
> I'm trying to access enums for varbinds and I end up with error saying
> "uninitialized value in hash element"
>
> Code:
> @foreach $noti notifications@
>   @foreach $varb varbinds@
>      @if $varb.enums@
>        (

Here's a horrible thing to suggest: here, try:
@perleval $currentvar = $varbind; 1;@

>        @foreach $vare $varv enum@
>           varbing-enum====$varv $vare
>        @end@
>        )
>     @end@
>   @end@
> @end@

My suggestion completely relies on the internals of mib2c, which is
very likely to change (e.g., if this behavior gets fixed, obviously).

I think the problem is that nobody anticipated wanting to access enums
in the notification varbind context, so didn't use the same loop
variable as in the columns or scalars loops.

(Or, if you want to try a mib2c patch, off the top of my head, go find
this code in the "foreach ... varbinds" section:

                  $return = do_a_loop($stash, \$vars{$var}, $varbind,
                                      \$currentvarbind, $varbind);

and turn it into

                  $return = do_a_loop($stash, \$vars{$var}, $varbind,
                                      \$currentvarbind, $varbind,
                                      \$currentvar, $scalar);

(adding the 3rd line, and changing the ); to a , in the 2nd line).)

  Bill

>
> Error:
> Use of uninitialized value in hash element at
> /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/SNMP.pm line
> 1366, <GEN0> line 68263.
>
> The "@if $varb.enums@" executes successfully, but the enum values are not
> printed out. Can someone help?
>
> Eric
>
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>
>

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to