P
peter_de_groot_1966
Hi all,
I have a problem with changing the telnet prompt durring runtime.
My program has to connect to for me at the writing unknow unix machines
with command prompts not know to me.
To be able todo this I tought in updating the telnet prompt by reading
a value from a file and then changing the prompt.
My standard setting for the prompt is
my $unix_cmd_prompt = '/[\$%#>:=]\s?$|term/i';
I then add to the prompt with the sub
add_system_prompt();
sub add_system_prompt
{
my $customerprompt;
my $promptfile = "custprompt.txt";
if(-e $promptfile) {
open(FH,"<$promptfile");
while (defined ($customerprompt = <FH>)) {
chomp $customerprompt;
$customerprompt =~ s/^\s+//;
if (length($customerprompt) gt 0) {
$unix_cmd_prompt = $unix_cmd_prompt.'|'.$customerprompt;
}
}
close(FH);
}
}
and then set the prompt
$t->prompt($unix_cmd_prompt);
and offcourse I first devine the $t
my $t = new Net::Telnet (
Timeout => 240,
Cmd_remove_mode => 0,
Errmode => \&whinge,
Output_record_separator => '',
#Dump_log => 'dump.txt',
);
The login works fine until I add something to the prompt via the
add_system_prompt adds something to the prompt.
The documentation for net:telnet states that you have to single quote
the regular expression.
Is this where my problem is and if so what is the way around this
I have a problem with changing the telnet prompt durring runtime.
My program has to connect to for me at the writing unknow unix machines
with command prompts not know to me.
To be able todo this I tought in updating the telnet prompt by reading
a value from a file and then changing the prompt.
My standard setting for the prompt is
my $unix_cmd_prompt = '/[\$%#>:=]\s?$|term/i';
I then add to the prompt with the sub
add_system_prompt();
sub add_system_prompt
{
my $customerprompt;
my $promptfile = "custprompt.txt";
if(-e $promptfile) {
open(FH,"<$promptfile");
while (defined ($customerprompt = <FH>)) {
chomp $customerprompt;
$customerprompt =~ s/^\s+//;
if (length($customerprompt) gt 0) {
$unix_cmd_prompt = $unix_cmd_prompt.'|'.$customerprompt;
}
}
close(FH);
}
}
and then set the prompt
$t->prompt($unix_cmd_prompt);
and offcourse I first devine the $t
my $t = new Net::Telnet (
Timeout => 240,
Cmd_remove_mode => 0,
Errmode => \&whinge,
Output_record_separator => '',
#Dump_log => 'dump.txt',
);
The login works fine until I add something to the prompt via the
add_system_prompt adds something to the prompt.
The documentation for net:telnet states that you have to single quote
the regular expression.
Is this where my problem is and if so what is the way around this