ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-ReadLine-Gnu/Gnu.pm
(Generate patch)

Comparing AnyEvent-ReadLine-Gnu/Gnu.pm (file contents):
Revision 1.2 by root, Thu May 10 21:53:03 2012 UTC vs.
Revision 1.7 by root, Fri May 11 15:38:02 2012 UTC

56 require Term::ReadLine::Gnu; 56 require Term::ReadLine::Gnu;
57} 57}
58 58
59use base Term::ReadLine::; 59use base Term::ReadLine::;
60 60
61our $VERSION = '0.2'; 61our $VERSION = '1.0';
62 62
63=item $rl = new AnyEvent::ReadLine::Gnu key => value... 63=item $rl = new AnyEvent::ReadLine::Gnu key => value...
64 64
65Creates a new AnyEvent::ReadLine object. 65Creates a new AnyEvent::ReadLine object.
66 66
72methods that are documented (or working) for that module should work on 72methods that are documented (or working) for that module should work on
73this object. 73this object.
74 74
75Once initialised, this module will also restore the terminal settings on a 75Once initialised, this module will also restore the terminal settings on a
76normal program exit. 76normal program exit.
77
78The callback will be installed with the C<CallbackHandlerInstall>, which
79means it handles history expansion and history, among other things.
77 80
78The following key-value pairs are supported: 81The following key-value pairs are supported:
79 82
80=over 4 83=over 4
81 84
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
240 242
2411; 2431;
242 244
243=back 245=back
244 246
247=head1 CAVEATS
248
249There are some issues with readline that can be problematic in event-based
250programs:
251
252=over 4
253
254=item blocking I/O
255
256Readline uses blocking terminal I/O. Under most circumstances, this does
257not cause big delays, but ttys have the potential to block programs
258indefinitely (e.g. on XOFF).
259
260=item unexpected disk I/O
261
262By default, readline does filename completion on TAB, and reads its
263config files.
264
265Tab completion can be disabled by calling C<< $rl->unbind_key (9) >>.
266
267=item tty settings
268
269After readline has been initialised, it will mangle the termios tty
270settings. This does not normally affect output very much, but should be
271taken into consideration.
272
273=item output intermixing
274
275Your program might wish to print messages (for example, log messages) to
276STDOUT or STDERR. This will usually cause confusion, unless readline is
277hidden with the hide method.
278
279=back
280
281Oh, and the above list is probably not complete.
282
245=head1 AUTHOR, CONTACT, SUPPORT 283=head1 AUTHOR, CONTACT, SUPPORT
246 284
247 Marc Lehmann <schmorp@schmorp.de> 285 Marc Lehmann <schmorp@schmorp.de>
248 http://software.schmorp.de/pkg/AnyEvent-Readline-Gnu.html 286 http://software.schmorp.de/pkg/AnyEvent-ReadLine-Gnu.html
249 287
250=cut 288=head1 SEE ALSO
251 289
290L<rltelnet> - a simple tcp_connect-with-readline program using this module.
291
292=cut
293

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines