NAME IO::Prompt::I18N - Prompt user question, with some options (including I18N) VERSION This document describes version 0.79 of IO::Prompt::I18N (from Perl distribution IO-Prompt-I18N), released on 2014-12-11. SYNOPSIS use IO::Prompt::I18N qw(prompt confirm); use Text::LocaleDomain 'My-App'; my $file = prompt(__"Enter filename"); if (confirm(__"Really delete filename", {lang=>"id", default=>0})) { unlink $file; } DESCRIPTION This module provides the "prompt" function to ask for a value from STDIN. It features prompt text, default value, validation (using regex), optional/required. It also provides "confirm" wrapper to ask yes/no, with localizable text. FUNCTIONS prompt([ $text[, \%opts] ]) => val Display $text and ask value from STDIN. Will re-ask if value is not valid. Return the chomp-ed value. Options: * var => \$var * required => bool If set to true then will require that value is not empty (zero-length). * default => VALUE Set default value. * show_default => bool (default: 1) Whether to show default value if defined. * regex => REGEX Validate using regex. confirm([ $text, [\%opts] ]) => bool Display $text (defaults to "Confirm" in English) and ask for yes or no. Will return bool. Basically a convenient wrapper around "prompt". Options: * lang => str Support several languages ("id", "en", "fr"). Default to using LANG/LANGUAGE or English. Will preset "yes_words" and "no_words" and adds the choice of words to $text. Will die if language is not supported. Here are the supported languages: lang yes_words no_regex default text ---- --------- -------- ------------ en y, yes n, no Confirm fr o, oui n, non Confirmer id y, ya t, tidak Konfirmasi * yes_words => array Overrides preset from "lang". * no_words => array Overrides preset from "lang". * default => bool Set default value. TODO Option to stty off (e.g. when prompting password). Validation using coderef (probably with a "validation" key which can be regex or coderef, and then deprecate "regex"). Timeout, like Prompt::Timeout. SEE ALSO IO::Prompt, IO::Prompt::Tiny, Term::Prompt, Prompt::Timeout HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHOR perlancar COPYRIGHT AND LICENSE This software is copyright (c) 2014 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.