… | |
… | |
56 | require Term::ReadLine::Gnu; |
56 | require Term::ReadLine::Gnu; |
57 | } |
57 | } |
58 | |
58 | |
59 | use base Term::ReadLine::; |
59 | use base Term::ReadLine::; |
60 | |
60 | |
61 | our $VERSION = '0.2'; |
61 | our $VERSION = '1.1'; |
62 | |
62 | |
63 | =item $rl = new AnyEvent::ReadLine::Gnu key => value... |
63 | =item $rl = new AnyEvent::ReadLine::Gnu key => value... |
64 | |
64 | |
65 | Creates a new AnyEvent::ReadLine object. |
65 | Creates a new AnyEvent::ReadLine object. |
66 | |
66 | |
… | |
… | |
72 | methods that are documented (or working) for that module should work on |
72 | methods that are documented (or working) for that module should work on |
73 | this object. |
73 | this object. |
74 | |
74 | |
75 | Once initialised, this module will also restore the terminal settings on a |
75 | Once initialised, this module will also restore the terminal settings on a |
76 | normal program exit. |
76 | normal program exit. |
|
|
77 | |
|
|
78 | The callback will be installed with the C<CallbackHandlerInstall>, which |
|
|
79 | means it handles history expansion and history, among other things. |
77 | |
80 | |
78 | The following key-value pairs are supported: |
81 | The following key-value pairs are supported: |
79 | |
82 | |
80 | =over 4 |
83 | =over 4 |
81 | |
84 | |
… | |
… | |
133 | sub new { |
136 | sub new { |
134 | my ($class, %arg) = @_; |
137 | my ($class, %arg) = @_; |
135 | |
138 | |
136 | $in = $arg{in} || *STDIN; |
139 | $in = $arg{in} || *STDIN; |
137 | $out = $arg{out} || *STDOUT; |
140 | $out = $arg{out} || *STDOUT; |
138 | $prompt = $arg{prompt} || "> "; |
141 | $prompt = $arg{prompt} // "> "; |
139 | $cb = $arg{on_line} || $arg{cb} |
142 | $cb = $arg{on_line} || $arg{cb} |
140 | or do { require Carp; Carp::croak ("AnyEvent::ReadLine::Gnu->new on_line callback argument mandatry, but missing") }; |
143 | or do { require Carp; Carp::croak ("AnyEvent::ReadLine::Gnu->new on_line callback argument mandatry, but missing") }; |
141 | |
144 | |
142 | $self = $class->SUPER::new ($arg{name} || $0, $in, $out); |
145 | $self = $class->SUPER::new ($arg{name} || $0, $in, $out); |
143 | |
146 | |
|
|
147 | $Term::ReadLine::Gnu::Attribs{term_set} = ["", "", "", ""]; |
144 | $self->CallbackHandlerInstall ($prompt, \&on_line); |
148 | $self->CallbackHandlerInstall ($prompt, \&on_line); |
145 | # set the unadorned prompt |
|
|
146 | $self->rl_set_prompt ($prompt); |
|
|
147 | |
149 | |
148 | $hidden = 1; |
150 | $hidden = 1; |
149 | $self->show; |
151 | $self->show; |
150 | |
152 | |
151 | $self |
153 | $self |
… | |
… | |
258 | =item unexpected disk I/O |
260 | =item unexpected disk I/O |
259 | |
261 | |
260 | By default, readline does filename completion on TAB, and reads its |
262 | By default, readline does filename completion on TAB, and reads its |
261 | config files. |
263 | config files. |
262 | |
264 | |
|
|
265 | Tab completion can be disabled by calling C<< $rl->unbind_key (9) >>. |
|
|
266 | |
263 | =item tty settings |
267 | =item tty settings |
264 | |
268 | |
265 | After readline has been initialised, it will mangle the termios tty |
269 | After readline has been initialised, it will mangle the termios tty |
266 | settings. This does not normally affect output very much, but should be |
270 | settings. This does not normally affect output very much, but should be |
267 | taken into consideration. |
271 | taken into consideration. |
… | |
… | |
277 | Oh, and the above list is probably not complete. |
281 | Oh, and the above list is probably not complete. |
278 | |
282 | |
279 | =head1 AUTHOR, CONTACT, SUPPORT |
283 | =head1 AUTHOR, CONTACT, SUPPORT |
280 | |
284 | |
281 | Marc Lehmann <schmorp@schmorp.de> |
285 | Marc Lehmann <schmorp@schmorp.de> |
282 | http://software.schmorp.de/pkg/AnyEvent-Readline-Gnu.html |
286 | http://software.schmorp.de/pkg/AnyEvent-ReadLine-Gnu.html |
283 | |
287 | |
284 | =cut |
288 | =head1 SEE ALSO |
285 | |
289 | |
|
|
290 | L<rltelnet> - a simple tcp_connect-with-readline program using this module. |
|
|
291 | |
|
|
292 | =cut |
|
|
293 | |