in reply to Broken Net::Telnet::Netscreen module?

My first idea was that you had overridden an internal sub unsetValue, but I checked that and there is none

I can't think of any other reason why your addition should break anything. Maybe someone else can??

So my guess is that this either has nothing to do with the malfunction or you changed code somewhere else too (maybe by mistake). Did you check that reverting the module to its old state also changes its behaviour to normal?

But I think the best source of information for you would be to use the perl debugger with trace or single step to find out why it stops prematurely.

  • Comment on Re: Broken Net::Telnet::Netscreen module?

Replies are listed 'Best First'.
Re^2: Broken Net::Telnet::Netscreen module?
by spivey49 (Monk) on Aug 13, 2008 at 17:43 UTC

    I tried reverting the module with the same results, so it appears the problem is in the script.

    Here's the debug output:

    I'm not entirely sure how to interpret this. Any thoughts?

      This means the error function gets called in your method unsetValue. Since the parameters are definitely not empty the call is probably because of this line

      if ($result =~ /\w+/) { return $self->error($result); }

      this line should be on line 150 of your changed Netscreen.pm. I don't know what is in $result, but normally you should get some error message while running the script and that return value is probably what the telnet session answered when the unset command was issued to the netscreen machine. Noticing (and reporting) that error message would have made things much easier

      If you don't see this error message, you might put something like  print STDERR "<<$result>>\n"; between line 149 and 150 into Netscreen.pm.

      The probable cause of that error is that the unset command on the netscreen machine doesn't need/want/allow a parameter $value, because you are UNSETTING and not setting a value. So you might try the following line in your unsetValue method

      my @results=$self->cmd("unset ".$setting);

        The $value in unsetValue is ok. The command sent to the firewall will end up being <unset object name> or something like "unset address Autogen_x".

        The regex used to check for the error is a little flawed though, it should be looking for "^-". I updated the methods with this, but the script still exits after the first command. The module does report errors correctly now though.

        I've tried die, eval, and even clucking exit, at tye's suggestion. The script just exits silently.

        Updated methods for Net::Telnet::Netscreen: