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   343159 use App::revealup::base;
  4         9  
  4         23  
3              
4             # For compatibility.
5             has 'command_map' => {
6             server => 'serve',
7             theme => 'export',
8             };
9              
10             sub run {
11 5     5 0 11980 my ($self, @args) = @_;
12              
13 5         21 local @ARGV = @args;
14 5         8 my @commands;
15 5         13 push @commands, @ARGV;
16 5         9 my $command = shift @commands;
17              
18 5 100       17 if($command) {
19 4         30 my $new_command = $self->command_map->{$command};
20 4 100       21 $command = $new_command if $new_command;
21 4         76 my $klass = sprintf("App::revealup::cli::%s", lc($command));
22 4     4   38 no warnings 'ambiguous';
  4         7  
  4         441  
23 4 100       310 if(eval "require $klass;1;"){
24 3         19 my $instance = $klass->new();
25 3         13 $instance->run(@commands);
26 3         27 return;
27             }
28             }
29 2         109267 system "perldoc App::revealup";
30             }
31              
32             1;