File Coverage

blib/lib/App/revealup/cli.pm
Criterion Covered Total %
statement 19 20 95.0
branch 4 6 66.6
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 26 30 86.6


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