in reply to Re^2: Broken Net::Telnet::Netscreen module?
in thread Broken Net::Telnet::Netscreen module?

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);

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

    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:

      Too bad, I thought I had the right idea

      You are not very clear about whether you get error messages or not. If you get any, please post them. Otherwise you could repeat the trace and show that output if it changed.

      I don't remember the regex syntax $result=\/^-/. Shouldn't the \ be ~ ?

      UPDATE: Also you might use Data::Dumper to print out everything in @result, just to be sure what you get back

        Well, we did fix another problem. Errors would have been returned incorrectly by the module with out revising the regex.

        =~/\^-/ works too.

        Data::Dumper returns what I expected, the command sent to the firewall. I tried commenting out the error check as well with the same results. The script exits silently, no warnings, no errors.