| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Perl::PrereqScanner::NotQuiteLite::Parser::PackageVariant; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 83 |  |  | 83 |  | 1425 | use strict; | 
|  | 83 |  |  |  |  | 185 |  | 
|  | 83 |  |  |  |  | 2242 |  | 
| 4 | 83 |  |  | 83 |  | 404 | use warnings; | 
|  | 83 |  |  |  |  | 173 |  | 
|  | 83 |  |  |  |  | 1923 |  | 
| 5 | 83 |  |  | 83 |  | 429 | use Perl::PrereqScanner::NotQuiteLite::Util; | 
|  | 83 |  |  |  |  | 178 |  | 
|  | 83 |  |  |  |  | 41506 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | sub register {{ | 
| 8 | 82 |  |  | 82 | 0 | 489 | use => { | 
| 9 |  |  |  |  |  |  | 'Package::Variant' => 'parse_package_variant_args', | 
| 10 |  |  |  |  |  |  | }, | 
| 11 |  |  |  |  |  |  | }} | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub parse_package_variant_args { | 
| 14 | 7 |  |  | 7 | 0 | 17 | my ($class, $c, $used_module, $raw_tokens) = @_; | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 7 |  |  |  |  | 23 | my $tokens = convert_string_tokens($raw_tokens); | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 7 |  |  |  |  | 22 | while(my $token = shift @$tokens) { | 
| 19 | 21 | 100 | 100 |  |  | 116 | if (ref $token and $token->[0] eq 'importing') { | 
|  |  | 100 | 100 |  |  |  |  | 
|  |  |  | 100 |  |  |  |  | 
| 20 | 5 | 50 | 33 |  |  | 130 | shift @$tokens if @$tokens && $tokens->[0][1] eq 'COMMA'; | 
| 21 | 5 | 50 |  |  |  | 16 | my $next_token = shift @$tokens or last; | 
| 22 | 5 | 100 |  |  |  | 21 | if (!ref $next_token) { | 
|  |  | 100 |  |  |  |  |  | 
|  |  | 50 |  |  |  |  |  | 
| 23 | 1 |  |  |  |  | 3 | my $module = $next_token; | 
| 24 | 1 | 50 |  |  |  | 5 | if (is_module_name($module)) { | 
| 25 | 1 |  |  |  |  | 5 | $c->add($module); | 
| 26 | 1 | 50 |  |  |  | 99 | if ($c->has_callback_for(use => $module)) { | 
| 27 | 0 |  |  |  |  | 0 | $c->run_callback_for('use', $module, [["use", "KEYWORD"], [$module, "WORD"], [";", ";"]]); | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  | elsif ($next_token->[1] eq '[]') { | 
| 32 | 3 |  |  |  |  | 11 | my $modules = convert_string_token_list($next_token->[0]); | 
| 33 | 3 |  |  |  |  | 10 | while(my $module = shift @$modules) { | 
| 34 | 5 | 100 |  |  |  | 16 | next unless is_module_name($module); | 
| 35 | 4 |  |  |  |  | 16 | $c->add($module); | 
| 36 | 4 | 100 |  |  |  | 139 | if ($c->has_callback_for(use => $module)) { | 
| 37 | 2 |  |  |  |  | 16 | $c->run_callback_for('use', $module, [["use", "KEYWORD"], [$module, "WORD"], [";", ";"]]); | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  | } elsif ($next_token->[1] eq '{}') { | 
| 41 | 1 |  |  |  |  | 4 | my $hash_tokens = convert_string_token_list($next_token->[0]); | 
| 42 | 1 |  |  |  |  | 5 | while(my $module = shift @$hash_tokens) { | 
| 43 | 1 |  |  |  |  | 14 | my $arg = shift @$hash_tokens; | 
| 44 | 1 | 50 |  |  |  | 7 | my @args = $arg->[1] eq '[]' ? @{$arg->[0]} : $arg; | 
|  | 0 |  |  |  |  | 0 |  | 
| 45 | 1 |  |  |  |  | 5 | $c->add($module); | 
| 46 | 1 | 50 |  |  |  | 38 | if ($c->has_callback_for(use => $module)) { | 
| 47 | 1 |  |  |  |  | 20 | $c->run_callback_for('use', $module, [["use", "KEYWORD"], [$module, "WORD"], @args, [";", ";"]]); | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  | } | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  | elsif (ref $token && !ref $token->[0] && $token->[1] eq 'WORD') { | 
| 53 | 4 | 50 | 33 |  |  | 18 | shift @$tokens if @$tokens && $tokens->[0][1] eq 'COMMA'; | 
| 54 | 4 | 50 |  |  |  | 10 | shift @$tokens if @$tokens; | 
| 55 |  |  |  |  |  |  | } | 
| 56 | 21 | 100 | 66 |  |  | 131 | shift @$tokens if @$tokens && ref $tokens->[0] && $tokens->[0][1] eq 'COMMA'; | 
|  |  |  | 100 |  |  |  |  | 
| 57 |  |  |  |  |  |  | } | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | 1; | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | __END__ |