The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::GHPT::WorkSubmitter::Role::Question - Role for writing interactive questions about the commits

VERSION

version 1.000011

SYNOPSIS

    package App::GHPT::WorkSubitter::Question::WarnAboutPasswordFile;
    use App::GHPT::Wrapper::OurMoose;
    with 'App::GHPT::WorkSubmitter::Role::Question';

    sub ask($self) {
        # skip the question unless there's a password file
        return unless $self->changed_files->changed_files_match(qr/password/);

        # ask the user if that's okay
        return $self->ask_question(<<'ENDOFTEXT',"I'm okay with the risk");
    You've committed a file with a name matching 'password'.  Are you nuts?
    ENDOFTEXT
    }

    __PACKAGE__->meta->make_immutable;
    1;

DESCRIPTION

This role allows you to write questions to ask someone when creating pull request.

You want to create these questions classes in the App::GHPT::WorkSubmitter::Question::* namespace where App::GHPT::WorkSubmitter::Questioner will automatically detect them and ask them each time gh-pt.pl is run.

Each class must supply an ask method which should prompt the user as needed and return any markdown to be placed in the pull request body.

ATTRIBUTES

changed_files

The files that have changed in this branch. This is the primary attribute you want to examine.

METHODS

$question->ask_question($question, @optional_responses)

Interactively ask a question and return markdown suitable for including in the pull request body.

The question that should be asked must be passed as the first argument, and all other arguments are treated as stock answers the user can select when asked the question. The user will also have a final option Launch Editor which will launch their editor and allow them free-form text input.

SUPPORT

Bugs may be submitted through https://github.com/maxmind/App-GHPT/issues.

AUTHORS

  • Mark Fowler <mark@twoshortplanks.com>

  • Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2019 by MaxMind, Inc.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)