Ricardo SIGNES > App-Cmd-Plugin-Prompt-1.003 > App::Cmd::Plugin::Prompt

Download:
App-Cmd-Plugin-Prompt-1.003.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.003   Source   Latest Release: App-Cmd-Plugin-Prompt-1.005

NAME ^

App::Cmd::Plugin::Prompt - plug prompting routines into your commands

SYNOPSIS ^

In your app:

  package MyApp;
  use App::Cmd::Setup -app => {
    plugins => [ qw(Prompt) ],
  };

In your command:

  package MyApp::Command::dostuff;
  use MyApp -command;

  sub run {
    my ($self, $opt, $args) = @_;

    return unless prompt_yn('really do stuff?', { default => 1 });

    ...
  }

SUBROUTINES ^

prompt_str

  my $input = prompt_str($prompt, \%opt)

This prompts a user for string input. It can be directed to persist until input is 'acceptable'.

Valid options are:

prompt_yn

  my $bool = prompt_yn($prompt, \%opt);

This prompts the user for a yes or no response and won't give up until it gets one. It returns true for yes and false for no.

Valid options are:

 default: may be yes or no, indicating how to interpret an empty response;
          if empty, require an explicit answer; defaults to empty

prompt_any_key($prompt)

  my $input = prompt_any_key($prompt);

This routine prompts the user to "press any key to continue." ($prompt, if supplied, is the text to prompt with.

SEE ALSO ^

App::Cmd

AUTHOR ^

Ricardo SIGNES, <rjbs@cpan.org>

COPYRIGHT ^

Copyright 2004-2006 Ricardo SIGNES. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: