File Coverage

blib/lib/App/revealup/cli.pm
Criterion Covered Total %
statement 20 20 100.0
branch 6 6 100.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 29 30 96.6


line stmt bran cond sub pod time code
1             package App::revealup::cli;
2 4     4   285029 use App::revealup::base;
  4         9  
  4         19  
3              
4             # For compatibility.
5             has 'command_map' => {
6             server => 'serve',
7             theme => 'export',
8             };
9              
10             sub run {
11 5     5 0 9802 my ($self, @args) = @_;
12              
13 5         18 local @ARGV = @args;
14 5         8 my @commands;
15 5         10 push @commands, @ARGV;
16 5         8 my $command = shift @commands;
17              
18 5 100       15 if($command) {
19 4         18 my $new_command = $self->command_map->{$command};
20 4 100       17 $command = $new_command if $new_command;
21 4         21 my $klass = sprintf("App::revealup::cli::%s", lc($command));
22 4     4   23 no warnings 'ambiguous';
  4         11  
  4         376  
23 4 100       277 if(eval "require $klass;1;"){
24 3         14 my $instance = $klass->new();
25 3         11 $instance->run(@commands);
26 3         19 return;
27             }
28             }
29 2         97344 system "perldoc App::revealup";
30             }
31              
32             1;