Toby Inkster > Ask-0.006 > Ask::API

Download:
Ask-0.006.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.006   Source   Latest Release: Ask-0.007

NAME ^

Ask::API - an API to ask users things

SYNOPSIS ^

        {
                package Ask::AwesomeWidgets;
                use Moo;
                with 'Ask::API';
                sub info {
                        my ($self, %arguments) = @_;
                        ...
                }
                sub entry {
                        my ($self, %arguments) = @_;
                        ...
                }
        }

DESCRIPTION ^

Ask::API is a Moo role. This means that you can write your implementation as either a Moo or Moose class.

The only two methods that you absolutely must implement are info and entry.

Ask::API provides default implementations of warning, error, question, file_selection, multiple_choice and single_choice methods, but they're not espcially good, so you probably want to implement most of those too.

If you name your package Ask::Something then Ask->detect will find it (via [mod://Module::Pluggable]).

Methods used during detection are is_usable which is called as an object method, and should return a boolean indicating its usability (for example, if STDIN is not connected to a terminal, Ask::STDIO returns false), and quality which is called as a class method and should return a number between 0 and 100, 100 being a high-quality backend, 0 being low-quality.

Ask->detect returns the highest quality module that it can load, instantiate and claims to be usable.

BUGS ^

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Ask.

SEE ALSO ^

Ask.

AUTHOR ^

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE ^

This software is copyright (c) 2012-2013 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES ^

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: