in reply to ERROR: The OBJECT IDENTIFIER value "ARRAY(0x1b80628)" is expected in dotted decimal notation.

IMO, it seems likely that "funny characters" means you're dealing (or more precisely, 'not dealing') with a character-set issue -- "There are Seven character encoding schemes in Unicode: UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32 (UCS-4), UTF-32BE (UCS-4BE) and UTF-32LE ...."

See perldoc -f encode. The module Encode::Guess may be helpful.


Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
  1. code
  2. verbatim error and/or warning messages
  3. a coherent explanation of what "doesn't work actually means.

Replies are listed 'Best First'.
Re^2: SNMP get request error
by thanos1983 (Parson) on Mar 22, 2014 at 18:05 UTC

    Thank you for the advices, I am new to the area of programming so maybe I did not explain my problem. When I am executing my code it prints on the terminal:

    Problem with session get request: The OBJECT IDENTIFIER value "ARRAY(0 +x942c50)" is expected in dotted decimal notation.

    While I was trying to debug my code, I put a print Dumper(\$session); so I could actually see in further analysis what is happenning. When I did that I saw on the terminal:

    $VAR1 = \bless( { '_translate' => 0, '_security' => bless( { '_error' => undef, '_community' => 'public', '_version' => 0 }, 'Net::SNMP::Security::Comm +unity' ), '_transport_argv' => [ '-retries', '2', '-hostname', '127.0.0.1', '-port', '161', '-maxmsgsize', '1472', '-domain', 'udp/ipv4', '-timeout', '3' ], '_pdu' => undef, '_callback' => undef, '_nonblocking' => 0, '_version' => 0, '_transport' => bless( { '_dest_name' => '� +', '_max_msg_size' => 1472, '_sock_name' => '', '_timeout' => 3, '_error' => undef, '_sock_hostname' => '', '_dest_hostname' => '127.0 +.0.1', '_socket' => bless( \*Symb +ol::GEN0, 'IO::Socket' ), '_retries' => 2 }, 'Net::SNMP::Transport::IP +v4::UDP' ), '_error' => undef, '_context_engine_id' => undef, '_context_name' => undef, '_delay' => 0, '_discovery_queue' => [], '_hostname' => '127.0.0.1' }, 'Net::SNMP' );

    At this point I saw the funny characters. Based on experimentation I found the error. I did not know include the request:

    push (@request, ($sysDescr,$sysUpTime)); $output = $session->get_request( -varbindlist => [\@request] , );

    When I removed the "\" it works just fine. I can not exaclty understand the error or the reason but based on what I have read is the reference on the hash.

    Based on the documentation from CPAN

    "This list is passed to the method as an array reference using the -varbindlist argument."

    But I can not completely understand why if I remove the "\" it works.

    Thanks in advance for your time,advices and assistance to my query

      "When I removed the "\" it works just fine. I can not exaclty (sic) understand the error or the reason...."

      The backslash "\" you removed was escaping the "@" sigil, identifying your variable. That prevented Perl from understanding what you wanted.

      Without getting into referencing and dereferencing, observe what happens with a simple array:

      #!/usr/bin/perl use 5.016; use strict; use warnings; my @foo = ("bar", "baz", "bat"); say "\@foo with the backslash is: \@foo"; say "\@foo without the slash is @foo"; =head C:\>thanos.pl @foo with the backslash is: @foo # i.e., the escape makes it print as + a literal "@" here @foo without the slash is bar baz bat # but here, Perl gives you the +values in @foo! =cut

      In other words, be alert to the different uses of the "\" and the "/".

      For your precise case (and you seem to have done most of your homework here), see:

      1. perldoc perlref read down to referencing and dereferencing.
      2. References quick reference and look for the slash

      Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
      1. code
      2. verbatim error and/or warning messages
      3. a coherent explanation of what "doesn't work actually means.

        To: ww

        I got it, thanks again for pointing out all this information and for you effort to assist me.