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 94     94   2417 use strict;
  94         335  
  94         3366  
4 94     94   429 use warnings;
  94         176  
  94         3906  
5 94     94   395 use Perl::PrereqScanner::NotQuiteLite::Util;
  94         154  
  94         33908  
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 93     93 0 368 my ($class, %args) = @_;
15 93 50       172 my %mojo_base_like = map {$_ => 1} (@MojoBaseLike, @{$args{mojo_base_like} || []});
  558         1267  
  93         565  
16 93         229 my %mapping;
17 93         307 for my $module (keys %mojo_base_like) {
18 558         991 $mapping{use}{$module} = 'parse_mojo_base_args';
19             }
20 93         503 return \%mapping;
21             }
22              
23             sub parse_mojo_base_args {
24 12     12 0 22 my ($class, $c, $used_module, $raw_tokens) = @_;
25              
26 12         26 my $tokens = convert_string_tokens($raw_tokens);
27 12 50       24 if (is_version($tokens->[0])) {
28 0         0 $c->add($used_module => shift @$tokens);
29             }
30 12         19 my $module = $tokens->[0];
31 12 100       31 if (ref $module) {
32 2         3 $module = $module->[0];
33             }
34 12 100       21 if (is_module_name($module)) {
35 8         146 $module =~ s|'|::|g;
36 8         19 $c->add($module => 0);
37             }
38             }
39              
40             1;
41              
42             __END__