NAME

App::Raps2::UI - App::Raps2 User Interface

SYNOPSIS

my $ui = App::Raps2::UI->new();

my $input = $ui->read_line('Say something');

my $password = $ui->read_pw('New password', 1);

$ui->to_clipboard('stuff!');

VERSION

This manual documents App::Raps2::UI version 0.54

DESCRIPTION

App::Raps2::UI is used by App::Raps2 to interface with the user, i.e. do input and output on the terminal.

METHODS

$ui = App::Raps2::UI->new()

Returns a new App::Raps2::UI object.

$ui->list(\@item1, \@item2, \@item3)

Print the list items neatly formatted to stdout. Each item looks like [ key, value ]. When list is called for the first time, it will print the keys as well as the values.

$ui->read_line($question, [$prefill])

Print "question: " to stdout and wait for the user to input text followed by a newline. prefill sets the default content of the answer field.

Returns the user's reply, excluding the newline.

$ui->read_multiline($message)

Like read_line, but repeats message each time the user hits return. Input is terminated by EOF (Ctrl+D). Returns a string concatenation of all lines (including newlines).

$ui->read_pw($message, $verify)

Prompt the user for a password. message is displayed, the user's input is noch echoed. If verify is set, the user has to enter the same input twice, otherwise read_pw dies. Returns the input.

$ui->to_clipboard($string, [command])

Call command to place string in the primary X Clipboard. command defaults to xclip -l 1.

Returns true upon success, undef if the operation failed. Use $! to get the error message.

$ui->output(\@pair, ...)

pair consinsts of [ key, value ]. For each pair, prints " key : value" to stdout.

DIAGNOSTICS

When App::Raps2::UI encounters an error, it uses Carp(3pm)'s confess function to die with a backtrace.

DEPENDENCIES

This module requires Term::ReadLine and the xclip executable.

BUGS AND LIMITATIONS

Unknown.

SEE ALSO

App::Raps2(3pm).

AUTHOR

Copyright (C) 2011-2015 by Daniel Friesel <derf@finalrewind.org>

LICENSE

0. You just DO WHAT THE FUCK YOU WANT TO.