| 1 | # | ||
| 2 | # AI::ExpertSystem::Advanced::Viewer::Base | ||
| 3 | # | ||
| 4 | # Author(s): Pablo Fischer (pfischer@cpan.org) | ||
| 5 | # Created: 12/13/2009 15:23:47 PST 15:23:47 | ||
| 6 | package AI::ExpertSystem::Advanced::Viewer::Base; | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | AI::ExpertSystem::Advanced::Viewer::Base - Base class for all views. | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | All views that L<AI::ExpertSystem::Advanced> can use should extend from this | ||
| 15 | class (or from parents that extend from it). | ||
| 16 | |||
| 17 | Please note that the methods of this class should not be called in an abstract | ||
| 18 | context cause otherwise L<AI::ExpertSystem::Advanced> will die. | ||
| 19 | |||
| 20 | =cut | ||
| 21 | use Moose; | ||
| 22 | |||
| 23 | our $VERSION = '0.02'; | ||
| 24 | |||
| 25 | use constant NO_ABSTRACT_CLASS_MSG => | ||
| 26 | qq#Sorry, you can't call the abstract class!#; | ||
| 27 | |||
| 28 | =head2 B<debug($msg)> | ||
| 29 | |||
| 30 | Will be used to debug any task done by L<AI::ExpertSystem::Advanced>. It only | ||
| 31 | receives one parameter that is the message to print. | ||
| 32 | |||
| 33 | =cut | ||
| 34 | sub debug { | ||
| 35 | confess NO_ABSTRACT_CLASS_MSG; | ||
| 36 | } | ||
| 37 | |||
| 38 | =head2 B<print($msg)> | ||
| 39 | |||
| 40 | Will be used to print anything that is not a debug messages. It only receives | ||
| 41 | one parameter that is the message to print. | ||
| 42 | |||
| 43 | =cut | ||
| 44 | sub print { | ||
| 45 | confess NO_ABSTRACT_CLASS_MSG; | ||
| 46 | } | ||
| 47 | |||
| 48 | =head2 B<print_error($msg)> | ||
| 49 | |||
| 50 | Will be used to print any error of L<AI::ExpertSystem::Advanced>. It only | ||
| 51 | receives one parameter that is the message to print. | ||
| 52 | |||
| 53 | =cut | ||
| 54 | sub print_error { | ||
| 55 | confess NO_ABSTRACT_CLASS_MSG; | ||
| 56 | } | ||
| 57 | |||
| 58 | =head2 B<ask($message, @options)> | ||
| 59 | |||
| 60 | Will be used to ask the user for some information. It will receive a string, | ||
| 61 | the question to ask and an array of all the possible options. | ||
| 62 | |||
| 63 | Please return only one option and this should be any of the ones listed in | ||
| 64 | C<@options> cause otherwise L<AI::ExpertSystem::Advanced> will die. | ||
| 65 | |||
| 66 | =cut | ||
| 67 | sub ask { | ||
| 68 | confess NO_ABSTRACT_CLASS_MSG; | ||
| 69 | } | ||
| 70 | |||
| 71 | =head2 B<explain($yaml_summary)> | ||
| 72 | |||
| 73 | Used to explain what happened. The passed argument is a YAML string that has | ||
| 74 | all the information required to make a good explanation. | ||
| 75 | |||
| 76 | =cut | ||
| 77 | sub explain { | ||
| 78 | confess NO_ABSTRACT_CLASS_MSG; | ||
| 79 | } | ||
| 80 | |||
| 81 | =head1 AUTHOR | ||
| 82 | |||
| 83 | Pablo Fischer (pablo@pablo.com.mx). | ||
| 84 | |||
| 85 | =head1 COPYRIGHT | ||
| 86 | |||
| 87 | Copyright (C) 2010 by Pablo Fischer. | ||
| 88 | |||
| 89 | This library is free software; you can redistribute it and/or modify | ||
| 90 | it under the same terms as Perl itself. | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | 1; | ||
| 95 |