| 1 | # | ||
| 2 | # AI::ExpertSystem::Advanced::Viewer::Factory | ||
| 3 | # | ||
| 4 | # Author(s): Pablo Fischer (pfischer@cpan.org) | ||
| 5 | # Created: 11/29/2009 19:12:25 PST 19:12:25 | ||
| 6 | package AI::ExpertSystem::Advanced::Viewer::Factory; | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | AI::ExpertSystem::Advanced::Viewer::Factory - Viewer factory | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | Uses the factory pattern to create viewer instances. The viewer instances are | ||
| 15 | useful (and required) to show data to the user. | ||
| 16 | |||
| 17 | =cut | ||
| 18 | use strict; | ||
| 19 | use warnings; | ||
| 20 | use Class::Factory; | ||
| 21 | use base qw(Class::Factory); | ||
| 22 | |||
| 23 | our $VERSION = '0.01'; | ||
| 24 | |||
| 25 | sub new { | ||
| 26 | my ($pkg, $type, @params) = @_; | ||
| 27 | my $class = $pkg->get_factory_class($type); | ||
| 28 | return undef unless ($class); | ||
| 29 | my $self = "$class"->new(@params); | ||
| 30 | return $self; | ||
| 31 | } | ||
| 32 | |||
| 33 | __PACKAGE__->register_factory_type(terminal => | ||
| 34 | 'AI::ExpertSystem::Advanced::Viewer::Terminal'); | ||
| 35 | |||
| 36 | =head1 AUTHOR | ||
| 37 | |||
| 38 | Pablo Fischer (pablo@pablo.com.mx). | ||
| 39 | |||
| 40 | =head1 COPYRIGHT | ||
| 41 | |||
| 42 | Copyright (C) 2010 by Pablo Fischer. | ||
| 43 | |||
| 44 | This library is free software; you can redistribute it and/or modify | ||
| 45 | it under the same terms as Perl itself. | ||
| 46 | |||
| 47 | =cut | ||
| 48 | |||
| 49 | 1; | ||
| 50 |