| 1 | package Test::Smoke::App::RunApp; | ||
| 2 | use warnings; | ||
| 3 | use strict; | ||
| 4 | |||
| 5 | our $VERSION = '0.001'; | ||
| 6 | |||
| 7 | use Test::Smoke::App::Options; | ||
| 8 | |||
| 9 | use Exporter 'import'; | ||
| 10 | our @EXPORT = qw( run_smoke_app ); | ||
| 11 | |||
| 12 | sub run_smoke_app { | ||
| 13 | my ($app_name) = @_; | ||
| 14 | my $app_config = sprintf("%s_config", lc($app_name)); | ||
| 15 | |||
| 16 | my $module = "Test::Smoke::App::$app_name"; | ||
| 17 | eval qq{ use $module; }; | ||
| 18 | if (my $error = $@) { die "$error\n" } | ||
| 19 | |||
| 20 | my $app = $module->new(Test::Smoke::App::Options->$app_config); | ||
| 21 | if (my $error = $app->configfile_error) { die "$error\n"; } | ||
| 22 | $app->run; | ||
| 23 | }; | ||
| 24 | |||
| 25 | 1; | ||
| 26 | |||
| 27 | =head1 NAME | ||
| 28 | |||
| 29 | Test::Smoke::App::RunApp - Run a Test::Smoke::App applet. | ||
| 30 | |||
| 31 | =head1 DESCRIPTION | ||
| 32 | |||
| 33 | Runs the applet... | ||
| 34 | |||
| 35 | =head2 run_smoke_app($app_name) | ||
| 36 | |||
| 37 | Load the module, instantiate the applet with the correct Options and run. | ||
| 38 | |||
| 39 | =head1 COPYRIGHT | ||
| 40 | |||
| 41 | (c) 2020, All rights reserved. | ||
| 42 | |||
| 43 | * Abe Timmerman <abeltje@cpan.org> | ||
| 44 | |||
| 45 | This library is free software; you can redistribute it and/or modify | ||
| 46 | it under the same terms as Perl itself. | ||
| 47 | |||
| 48 | See: | ||
| 49 | |||
| 50 | =over 4 | ||
| 51 | |||
| 52 | =item * L<http://www.perl.com/perl/misc/Artistic.html> | ||
| 53 | |||
| 54 | =item * L<http://www.gnu.org/copyleft/gpl.html> | ||
| 55 | |||
| 56 | =back | ||
| 57 | |||
| 58 | This program is distributed in the hope that it will be useful, | ||
| 59 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 60 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 61 | |||
| 62 | =cut | ||
| 63 |