blib/lib/Linux/Perl/ParseFlags.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 13 | 14 | 92.8 |
branch | 3 | 4 | 75.0 |
condition | n/a | ||
subroutine | 3 | 3 | 100.0 |
pod | 0 | 1 | 0.0 |
total | 19 | 22 | 86.3 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Linux::Perl::ParseFlags; | ||||||
2 | |||||||
3 | 11 | 11 | 69 | use strict; | |||
11 | 19 | ||||||
11 | 289 | ||||||
4 | 11 | 11 | 56 | use warnings; | |||
11 | 15 | ||||||
11 | 2568 | ||||||
5 | |||||||
6 | sub parse { | ||||||
7 | 46 | 46 | 0 | 213 | my ($arch_module, $flags_ar) = @_; | ||
8 | |||||||
9 | 46 | 93 | my $flags = 0; | ||||
10 | 46 | 100 | 145 | if ( $flags_ar ) { | |||
11 | 16 | 248 | for my $fl ( @$flags_ar ) { | ||||
12 | 18 | 50 | 448 | my $val_cr = $arch_module->can("_flag_$fl") or do { | |||
13 | 0 | 0 | die "unknown flag: “$fl”"; | ||||
14 | }; | ||||||
15 | 18 | 314 | $flags |= $val_cr->(); | ||||
16 | } | ||||||
17 | } | ||||||
18 | |||||||
19 | 46 | 405 | return $flags; | ||||
20 | } | ||||||
21 | |||||||
22 | 1; |