User since
2006-01-27
91
Artikel
BenutzerIn
so habe jetzt folgendes probiert.
$session->waitfor('/deleting RIP instance, are you sure\? y\/\[n\]/') or die " Error getting \"deleting RIP instance, are you sure? y/[n]\" prompt: $!";
$session->waitfor('/deleting RIP instance, are you sure? y\/[n]/') or die " Error getting \"deleting RIP instance, are you sure? y/[n]\" prompt: $!";
$session->waitfor('/deleting RIP instance, are you sure\? y\/\[n\] /') or die " Error getting \"deleting RIP instance, are you sure? y/[n]\" prompt: $!";
$session->waitfor('/deleting RIP instance, are you sure? y\/[n] /') or die " Error getting \"deleting RIP instance, are you sure? y/[n]\" prompt: $!";
aber alles scheint nicht zu funtzen. *kopf kratz*
User since
2003-08-04
14371
Artikel
ModeratorIn
Bekommst Du eine Fehlermeldung??
Lass Dir mal mit
$session->lastPrompt() immer wieder den letzten Prompt anzeigen. Das Entscheidende ist, dass Du dahinterkommst, an welcher Zeile es "nicht mehr klappt". Irgendwelche Fehlermeldungen waeren naetuerlich sehr hilfreich, sonst artet das hier noch in richtige Raterei aus...
User since
2006-01-27
91
Artikel
BenutzerIn
so habe deine Rat befolgt und folgende Ausgabe bekommen:
suse:~/Desktop/RIP # ./norip.pl
DEBUG: 9999999999, 1.1.1.1
DEBUG: (ping): 0
Net::Telnet::Netscreen=GLOB(0x83b7548) is an [unexpected] object, aborting at ./norip.pl line 55
(in cleanup) Last command and firewall error:
9999999999-> save
save
Unknown Keyword:save at ./norip.pl line 0
suse:~/Desktop/RIP #
Zeile 55 ist übrigens
ist der Code überhaupt so richtig?
$session->cmd($command1) or die " Error giving \"set vrouter trust-vr\" command: $!";
$session->lastPrompt();
$session->cmd($command2) or die " Error giving \"unset protocol rip\" command: $!";
$session->lastPrompt();
usw.\n\n
<!--EDIT|krusty|1138364006-->
User since
2003-08-04
14371
Artikel
ModeratorIn
statt
$! solltest Du besser
$session->error verwenden...
hast Du irgendwo noch ein 'save' ohne Anfuehrungszeichen rumliegen??
Hast Du
use strict und
use warnings benutzt??
User since
2006-01-27
91
Artikel
BenutzerIn
nein hatte ich nicht verwendet. Habe ich jetzt aber und folgende Ausgabe auf der Konsole bekommen.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
suse:~/Desktop/RIP # ./norip.pl
Global symbol "$host" requires explicit package name at ./norip.pl line 19.
Global symbol "$wan" requires explicit package name at ./norip.pl line 20.
Global symbol "$host" requires explicit package name at ./norip.pl line 21.
Global symbol "$wan" requires explicit package name at ./norip.pl line 21.
Global symbol "$wan" requires explicit package name at ./norip.pl line 22.
Global symbol "$host" requires explicit package name at ./norip.pl line 26.
Global symbol "$wan" requires explicit package name at ./norip.pl line 26.
Global symbol "$host" requires explicit package name at ./norip.pl line 30.
Global symbol "$wan" requires explicit package name at ./norip.pl line 30.
Global symbol "$host" requires explicit package name at ./norip.pl line 39.
Global symbol "$wan" requires explicit package name at ./norip.pl line 39.
Global symbol "$host" requires explicit package name at ./norip.pl line 40.
Global symbol "$wan" requires explicit package name at ./norip.pl line 40.
Global symbol "$wan" requires explicit package name at ./norip.pl line 43.
Global symbol "$command1" requires explicit package name at ./norip.pl line 50.
Global symbol "$command2" requires explicit package name at ./norip.pl line 51.
Global symbol "$command3" requires explicit package name at ./norip.pl line 52.
Global symbol "$command4" requires explicit package name at ./norip.pl line 53.
Global symbol "$command5" requires explicit package name at ./norip.pl line 54.
Global symbol "$command6" requires explicit package name at ./norip.pl line 55.
Global symbol "$command1" requires explicit package name at ./norip.pl line 56.
Global symbol "$command2" requires explicit package name at ./norip.pl line 58.
Global symbol "$command3" requires explicit package name at ./norip.pl line 62.
Global symbol "$command4" requires explicit package name at ./norip.pl line 65.
Global symbol "$command5" requires explicit package name at ./norip.pl line 67.
Global symbol "$command6" requires explicit package name at ./norip.pl line 69.
Execution of ./norip.pl aborted due to compilation errors.
suse:~/Desktop/RIP #
Ein save ohne Anführungszeichen habe ich auch nicht mehr drin.
User since
2003-08-04
14371
Artikel
ModeratorIn
Wegen dieser Fehlermeldungen hatte ich Dir den Wiki-Artikel verlinkt. Den solltest Du auf jeden Fall mal lesen!
User since
2006-01-27
91
Artikel
BenutzerIn
bin dabei :D
ich habe aber in meinem Script Variablen die Global gültig sein sollen. Wie werden diese deklariert. Habe ich in dem Wiki nicht gefunden.\n\n
<!--EDIT|krusty|1138359357-->
User since
2003-08-04
14371
Artikel
ModeratorIn
Was global gueltig sein "muss", schreibst Du am Anfang vom Skript, z.B.
#!/usr/bin/perl
use strict;
use warnings;
my $global = "globale Variable";
test();
sub test{
print $global;
}
User since
2006-01-27
91
Artikel
BenutzerIn
DANKE, hatte ich gerade im Moment auch herausgefunden. *upps*
Naja, zurück zum eigentlichen Problem. Kann es sein, das das Module Net::Telnet::Netscreen die Option lastprompt nicht kennt. Habe zumindest unter Cpan nichts dergleichen bei dem Modul gefunden. Script läuft jetzt auch wieder mit der letzten Fehlermeldung zu lastprompt durch, bzw. bricht dann halt ab.
Vergiss das was ich gerade geschrieben hatte.
War ein Tippfehler drin.
NICHT: lastPrompt();
SONDERN: last_prompt;
;) ich hasse Tippfehler ;)\n\n
<!--EDIT|krusty|1138360117-->
User since
2003-08-04
5878
Artikel
ModeratorIn
diese globalen Variablen
a) sparsam (bis gar nicht) verwenden
b) ersten Buchstaben groß schreiben
s--Pevna-;s.([a-z]).chr((ord($1)-84)%26+97).gee; s^([A-Z])^chr((ord($1)-52)%26+65)^gee;print;
use strict; use warnings; Link zu meiner Perlseite