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

NAME

Test::AskAnExpert::Interface::File - File based human interface layer for Test::AskAnExpert

SYNOPSIS

In the test:

  use Test::AskAnExpert import => [qw(is_yes)],plan => 2;

  Test::AskAnExpert->initialize('Test::AskAnExpert::Interface::File',directory => '/home/tester');

  is_yes("Does the source code of Foo::Bar conform to in house style spec 7.9 subsection a?","style");
  is_yes("Could a child understand the underlying algorithm of Foo::Bar?","simple");

For the expert:

  # This assumes *nix, because thats what experts use, right?
  % cd /home/tester
  % cat 1.q
  style
  ----------
  Does the source code of Foo::Bar conform to in house style spec 7.9 subsection a?
  % touch 1.y # The test will recieve an answer of yes, passing in this case.
  % cat 2.q
  simple
  ----------
  Could a child understand the underlying algorithm of Foo::Bar?
  % echo "A child would not understand the sexual innuendo used in the variable \
  % names. Please consider being more professional to conform to company expectations." \
  % > 2.n # The test will recieve an answer of no, failing in this case and 
          # providing the message in the file as diagnostics.

DESCRIPTION

Test::AskAnExpert::Interface::File creates files containing the asked questions and recieves the answer by checking for similarly named files to receive answers.

initialize arguments

Test::AskAnExpert::Interface::File takes its initializing agruments in a hash passed to Test::AskAnExpert::initialize after the interface name.

directory

Path to the directory (relative or absolute) in which to place the question files and search for the answer files. If it does not exist it will be created during the test and destroyed afterward.

If no directory is specified it defaults to the current working directory.

Question Files

When the test asks a question (through any of is_yes,is_no, or ask) Test::AskAnExpert::Interface::File creates a file with the name $question_id.q contaning the test name and question being asked. The expert is expected to read the question and create one of the three types of answer files specified in the section "Answer Files".

These will be deleted after the test.

Answer Files

There are three types of answer file: a yes file, a no file, and a skip file, and their names suggest the type of answer provided to the test.

These files should be placed in the same directory as the question files by the expert answering the questions. The $question_id is the name of the question file before the '.q' extension.

yes file

Yes files have the name $question_id.y and optionally contain commentary about the reason for the answer being yes.

no file

No files are like yes files except they indicate a no answer, contain reasons for the answer being no, and are named $question_id.n .

skip file

Skip files indicate the test should be skipped and contain a reason for the skip (experts caught outside their expertise should use these). They are named expectedly $question_id.s .

All answer files are cleaned up after the test.

TODO

Add a preserve option that prevents cleanup of answers to leave an auditable trail.

AUTHOR

Edgar A. Bering, <trizor@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2007 by Edgar A. Bering

This library is free software; you can redistribute it and/or modify it under the terms of the Artistic 2.0 liscence as provided in the LICENSE file of this distribution.