Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37385763
en ru br
ALT Linux repos
S:0.005001-alt1

Group :: Development/Perl
RPM: perl-IO-Prompter

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Current version: 0.005001-alt1
Build date: 28 july 2023, 15:22 ( 37.9 weeks ago )
Size: 52.74 Kb

Home page:   http://search.cpan.org/dist/IO-Prompter/

License: perl
Summary: Prompt for input, read it, clean it, return it.
Description:

IO::Prompter exports a single subroutine, `prompt', that prints a.prompt (but only if the program's selected input and output streams are
connected to a terminal), then reads some input, then chomps it, and
finally returns an object representing that text.

The `prompt()' subroutine expects zero-or-more arguments.

Any argument that starts with a hyphen (`-') is treated as a named
option (many of which require an associated value, that may be passed as
the next argument). See the section on "Summary of options" and the section on "Options reference" for details of the available options.

Any other argument that is a string is treated as (part of) the prompt
to be displayed. All such arguments are concatenated together before the
prompt is issued. If no prompt string is provided, the string
`'> '' is used instead.

Normally, when `prompt()' is called in either list or scalar context,
it returns an opaque object that autoconverts to a string. In scalar
boolean contexts this return object evaluates true if the input
operation succeeded. In list contexts, if the input operation fails
`prompt()' returns an empty list instead of a return object. This
allows failures in list context to behave correctly (i.e. be false).

If you particularly need a list-context call to `prompt()' to always
return a value (i.e. even on failure), prefix the call with `scalar':

   
   
   my @data = (
       prompt('Name:'),
       prompt(' Age:'),
       prompt(' Sex:'),
   );

   
   
   my @data = (
       scalar prompt('Name:'),
       scalar prompt(' Age:'),
       scalar prompt(' Sex:'),
   );

In void contexts, `prompt()' still requests input, but also issues a
warning about the general uselessness of performing an I/O operation
whose results are then immediately thrown away.
See the section on "Useful useless uses of `prompt()'" for an exception to this.

The `prompt()' function also sets `$_' if it is called in a boolean
context but its return value is not assigned to a variable. Hence, it is
designed to be a drop-in replacement for `readline' or `<>'.

Current maintainer: Igor Vlasenko

List of contributors

List of rpms provided by this srpm:

  • perl-IO-Prompter
ACL:
     
    design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
    current maintainer: Michael Shigorin