Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Setting variable explicitly using Net::SNMP works, but assigning through another variable does not

by c (Hermit)
on Jul 08, 2002 at 13:03 UTC ( [id://180162]=perlquestion: print w/replies, xml ) Need Help??

c has asked for the wisdom of the Perl Monks concerning the following question:

I am getting a peculiar error when using Net::SNMP and sending a community string to a remote device.

[2 extra after iSEQ]C=private [asnlen? 26<32] (DF)

I'm not sure what the 2 extra is referring to.The variable is being set via:

## set the v1/2c specific session traits $snmp_options{community} = $xml->{node}->{$args->{host}}->{snmp}->[0]- +>{community}->[0] || $xml->{snmp}->[0]->{community}->[0];

however, when I remove the entry from xml file and let the value be set explicitly, such as in...

## set the v1/2c specific session traits $snmp_options{community} = $xml->{node}->{$args->{host}}->{snmp}->[0]- +>{community}->[0] || $xml->{snmp}->[0]->{community}->[0] || "private";

All works well and the community is sent correctly. I've tried chop/chomping the $xml value to see if a newline might be causing the issue.

My XML file is pretty straightforward since it is just for testing

<global> <node id="router"> <snmp> <version>1</version> <retries>1</retries> <wait>5.0</wait> <mtu>1500</mtu> <debug>0</debug> <community>private</community> </snmp> <tftp> <server>10.6.21.230</server> </tftp> </node> </global>

My gut reaction is to think that there must be something wrong with the XML file, but I just dont see anything incorrect with it. Would there be something be conveyed though the XML variable that I am missing?

thanks -c

Edited: ~Mon Jul 8 15:49:33 2002 (GMT), by footpad:
Replaced typed brackets with numeric entities in sample data

  • Comment on Setting variable explicitly using Net::SNMP works, but assigning through another variable does not
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://180162]
Approved by IlyaM
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-20 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found