File Coverage

lib/Perl/PrereqScanner/NotQuiteLite/Parser/MojoBase.pm
Criterion Covered Total %
statement 26 27 96.3
branch 6 8 75.0
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 37 42 88.1


line stmt bran cond sub pod time code
1             package Perl::PrereqScanner::NotQuiteLite::Parser::MojoBase;
2              
3 82     82   71544 use strict;
  82         330  
  82         2044  
4 82     82   344 use warnings;
  82         249  
  82         1715  
5 82     82   674 use Perl::PrereqScanner::NotQuiteLite::Util;
  82         168  
  82         27399  
6              
7             my @MojoBaseLike = qw/
8             Mojo::Base
9             Mojo::Weixin::Base Mojo::Webqq::Base
10             Kelp::Base Rethinkdb::Base PMLTQ::Base
11             /;
12              
13             sub register {
14 81     81 0 362 my ($class, %args) = @_;
15 81 50       186 my %mojo_base_like = map {$_ => 1} (@MojoBaseLike, @{$args{mojo_base_like} || []});
  486         1033  
  81         500  
16 81         223 my %mapping;
17 81         275 for my $module (keys %mojo_base_like) {
18 486         837 $mapping{use}{$module} = 'parse_mojo_base_args';
19             }
20 81         377 return \%mapping;
21             }
22              
23             sub parse_mojo_base_args {
24 12     12 0 25 my ($class, $c, $used_module, $raw_tokens) = @_;
25              
26 12         28 my $tokens = convert_string_tokens($raw_tokens);
27 12 50       27 if (is_version($tokens->[0])) {
28 0         0 $c->add($used_module => shift @$tokens);
29             }
30 12         33 my $module = $tokens->[0];
31 12 100       24 if (ref $module) {
32 2         4 $module = $module->[0];
33             }
34 12 100       27 if (is_module_name($module)) {
35 8         23 $module =~ s|'|::|g;
36 8         20 $c->add($module => 0);
37             }
38             }
39              
40             1;
41              
42             __END__