• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/CPANInternal-140/Net-Telnet/lib/Net/

Lines Matching +defs:new +defs:prompt

62 sub new {
73 ## Create a new object with defaults.
74 $self = $class->SUPER::new;
167 elsif (/^-?prompt$/i) {
168 $self->prompt($args{$_});
178 "to " . ref($self) . "::new()");
198 } # end sub new
282 $prompt,
302 $prompt = $self->prompt;
334 elsif (/^-?prompt$/i) {
335 $prompt = &_parse_prompt($self, $args{$_});
355 ## Send command and wait for the prompt.
357 and ($lines, $last_prompt) = $self->waitfor($prompt);
364 ## Save the most recently matched prompt.
1009 $prompt,
1023 $prompt = $self->prompt;
1058 elsif (/^-?prompt$/i) {
1059 $prompt = &_parse_prompt($self, $args{$_});
1103 ## Wait for login prompt.
1108 return &$error("eof read waiting for login prompt")
1110 return &$error("timed-out waiting for login prompt");
1121 ## Wait for password prompt.
1125 return &$error("eof read waiting for password prompt")
1127 return &$error("timed-out waiting for password prompt");
1138 ## Wait for command prompt or another login prompt.
1141 Match => $prompt,
1144 return &$error("eof read waiting for command prompt")
1146 return &$error("timed-out waiting for command prompt");
1149 ## It's a bad login if we got another login prompt.
1153 ## Save the most recently matched command prompt.
1647 sub prompt {
1648 my ($self, $prompt) = @_;
1659 $s->{cmd_prompt} = &_parse_prompt($self, $prompt);
1663 } # end sub prompt
2230 ## Open a new filehandle if input is a filename.
2767 return IO::Handle->new;
2771 return FileHandle->new;
2909 my ($self, $prompt) = @_;
2911 unless (defined $prompt) {
2912 $prompt = "";
2915 unless ($prompt =~ m(^\s*/) or $prompt =~ m(^\s*m\s*\W)) {
2916 &_carp($self, "ignoring bad Prompt argument \"$prompt\": " .
2918 $prompt = *$self->{net_telnet}{cmd_prompt};
2921 $prompt;
3353 stream, such as the prompt from a shell.
3379 the user's shell prompt, which for this example is C<bash$>
3382 $t = new Net::Telnet (Timeout => 10,
3415 The methods C<login()> and C<cmd()> use the I<prompt> setting in the
3417 methods will fail with a time-out if you don't set the prompt
3434 When constructing the match operator argument for C<prompt()> or
3443 To avoid matching characters read that look like a prompt, it's a good
3444 idea to end your prompt pattern with the C<$> anchor. That way the
3445 prompt will only match if it's the last thing read.
3497 Net::Telnet->new(Timeout => 20);
3501 Net::Telnet->new(-timeout => 20);
3512 control characters carriage-return and line-feed to start a new line
3535 =item B<new> - create a new Net::Telnet object
3537 $obj = new Net::Telnet ([$host]);
3539 $obj = new Net::Telnet ([Binmode => $mode,]
3557 This is the constructor for Net::Telnet objects. A new object is
3563 connecting to TCP I<$port> on I<$host>. Also see C<open()>. The new
3734 sent back by the command up until and including the matching prompt.
3749 between the echoed back command string and the prompt are returned.
3755 The characters that matched the prompt may be retrieved using
3780 output_record_separator, prompt, rs, and timeout. Rs is synonymous
3955 to a TCP port by using C<open()> or C<new()>, call this method
4070 or C<new()>.
4129 =item B<last_prompt> - last prompt read
4135 With no argument this method returns the last prompt read by cmd() or
4136 login(). See C<prompt()>. With an argument it sets the last prompt
4138 internal methods set the last prompt.
4176 This method performs a standard login by waiting for a login prompt
4177 and responding with I<$username>, then waiting for the password prompt
4179 interpreter prompt. If any of those prompts sent by the remote side
4183 Login prompt must match either of these case insensitive patterns:
4188 Password prompt must match this case insensitive pattern:
4192 The command interpreter prompt must match the current setting of
4193 prompt. See C<prompt()>.
4200 remote host doesn't prompt for a username.
4206 settings of errmode, prompt, and timeout.
4689 C<new()>.
4741 =item B<prompt> - pattern to match a prompt
4743 $matchop = $obj->prompt;
4745 $prev = $obj->prompt($matchop);
4747 This method sets the pattern used to find a prompt in the input
4750 matching the prompt. They will fail with a time-out error if the
4753 With no argument this method returns the prompt set in the object.
4754 With an argument it sets the prompt to I<$matchop> and returns the
4757 The default prompt is C<'/[\$%#E<gt>] $/'>
4936 C<prompt()> and C<waitfor()> (e.g. C<'/bash\$ $/'>). If you're
4980 $t = new Net::Telnet;
4983 ## Wait for first prompt and "hit return".
4987 ## Wait for second prompt and respond with city code.
5007 $pop = new Net::Telnet (Telnetmode => 0);
5036 terminal, the IO::Pty module is used to create a new pseudo terminal
5037 for use by ssh. A new Net::Telnet object is then created to read and
5039 "changeme" with the actual host, user, password, and command prompt.
5047 my $prompt = '/changeme:~> $/';
5054 $ssh = new Net::Telnet (-fhopen => $pty,
5055 -prompt => $prompt,
5065 $ssh->waitfor(-match => $ssh->prompt,
5080 ## Create a new pseudo terminal.
5082 $pty = new IO::Pty
5094 ## Associate process with a new controlling terminal.
5099 ## Make stdio use the new controlling terminal.
5116 terminal, the IO::Pty module is used to create a new pseudo terminal
5117 for use by passwd. A new Net::Telnet object is then created to read
5119 "changeme" with the actual old and new passwords.
5130 $passwd = new Net::Telnet (-fhopen => $pty,
5139 or die "no old password prompt: ", $passwd->lastline;
5142 ## Send new password.
5143 $passwd->waitfor('/new password: ?$/i')
5147 ## Send new password verification.
5148 $passwd->waitfor('/new password: ?$/i')
5149 or die "bad new password: ", $passwd->lastline;
5154 or die "bad new password: ", $passwd->lastline;
5169 $num_read, $passwd, $prevblock, $prompt, $size, $size_bsd,
5179 $host = new Net::Telnet (Timeout => 30,
5184 ## Make sure prompt won't match anything in send data.
5185 $prompt = "_funkyPrompt_";
5186 $host->prompt("/$prompt\$/");
5187 $host->cmd("set prompt = '$prompt'");
5212 while (($block = $host->get) and ($block !~ /$prompt$/o)) {
5213 if (length $block >= length $prompt) {
5225 ## Print last block without trailing prompt.
5227 $prevblock =~ s/$prompt$//;