File Coverage

blib/lib/App/mkpkgconfig/PkgConfig/Entry.pm
Criterion Covered Total %
statement 29 29 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod 4 4 100.0
total 44 44 100.0


line stmt bran cond sub pod time code
1             package App::mkpkgconfig::PkgConfig::Entry;
2 3     3   226458 use strict;
  3         11  
  3         98  
3 3     3   17 use warnings;
  3         8  
  3         107  
4              
5             # ABSTRACT: Base class for PkgConfig Keywords and Variables
6              
7 3     3   1671 use Syntax::Construct qw( non-destructive-subst );
  3         8585  
  3         18  
8              
9             our $VERSION = 'v2.0.1';
10              
11 3     3   826 use Regexp::Common 'balanced';
  3         2638  
  3         19  
12              
13              
14              
15              
16              
17              
18              
19              
20              
21             sub new {
22 182     182 1 11565 my ( $class, $name, $value ) = @_;
23              
24 182         357 bless { name => $name,
25             value => $value,
26             depends => _parse_dependencies( $value ),
27             }, $class;
28             }
29              
30              
31              
32              
33              
34              
35              
36 343     343 1 82331 sub name { return $_[0]->{name} }
37              
38              
39              
40              
41              
42              
43              
44 303     303 1 47496 sub value { return $_[0]->{value} }
45              
46              
47              
48              
49              
50              
51              
52              
53              
54 202     202 1 1334 sub depends { return @{ $_[0]->{depends} } }
  202         606  
55              
56             sub _parse_dependencies {
57             my @depends =
58 182     182   712 map { s/(?:^[{])|(?:[}]$)//gr }
  151         14742  
59             $_[0] =~ /(? '{}'}/g;
60              
61 182         9585 my %depends;
62 182         393 @depends{@depends} = ();
63              
64 182         2805 return [ keys %depends ];
65             }
66              
67             package App::mkpkgconfig::PkgConfig::Entry::Variable;
68              
69 3     3   3671 use parent -norequire => 'App::mkpkgconfig::PkgConfig::Entry';
  3         584  
  3         22  
70              
71             package App::mkpkgconfig::PkgConfig::Entry::Keyword;
72              
73 3     3   207 use parent -norequire => 'App::mkpkgconfig::PkgConfig::Entry';
  3         6  
  3         13  
74              
75             1;
76              
77             #
78             # This file is part of App-mkpkgconfig
79             #
80             # This software is Copyright (c) 2020 by Smithsonian Astrophysical Observatory.
81             #
82             # This is free software, licensed under:
83             #
84             # The GNU General Public License, Version 3, June 2007
85             #
86              
87             __END__