App-Raps2
view release on metacpan or search on metacpan
lib/App/Raps2/UI.pm view on Meta::CPAN
App::Raps2::UI is used by App::Raps2 to interface with the user, i.e. do input
and output on the terminal.
=head1 METHODS
=over
=item $ui = App::Raps2::UI->new()
Returns a new App::Raps2::UI object.
=item $ui->list(I<\@item1>, I<\@item2>, I<\@item3>)
Print the list items neatly formatted to stdout. Each I<item> looks like B<[>
I<key>, I<value> B<]>. When B<list> is called for the first time, it will
print the keys as well as the values.
=item $ui->read_line(I<$question>, [I<$prefill>])
Print "I<question>: " to stdout and wait for the user to input text followed
by a newline. I<prefill> sets the default content of the answer field.
Returns the user's reply, excluding the newline.
=item $ui->read_multiline(I<$message>)
Like B<read_line>, but repeats I<message> each time the user hits return.
Input is terminated by EOF (Ctrl+D). Returns a string concatenation of all
lines (including newlines).
=item $ui->read_pw(I<$message>, I<$verify>)
Prompt the user for a password. I<message> is displayed, the user's input is
noch echoed. If I<verify> is set, the user has to enter the same input twice,
otherwise B<read_pw> dies. Returns the input.
=item $ui->to_clipboard(I<$string>, [I<command>])
Call I<command> to place I<string> in the primary X Clipboard. I<command>
defaults to C<< xclip -l 1 >>.
Returns true upon success, undef if the operation failed. Use $! to get the
error message.
=item $ui->output(I<\@pair>, I<...>)
I<pair> consinsts of B<[> I<key>, I<value> B<]>. For each I<pair>, prints
" key : value" to stdout.
=back
=head1 DIAGNOSTICS
When App::Raps2::UI encounters an error, it uses Carp(3pm)'s B<confess>
function to die with a backtrace.
=head1 DEPENDENCIES
This module requires B<Term::ReadLine> and the B<xclip> executable.
=head1 BUGS AND LIMITATIONS
Unknown.
=head1 SEE ALSO
App::Raps2(3pm).
=head1 AUTHOR
Copyright (C) 2011-2015 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt>
=head1 LICENSE
0. You just DO WHAT THE FUCK YOU WANT TO.
( run in 0.529 second using v1.01-cache-2.11-cpan-39bf76dae61 )