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   228563 use strict;
  3         13  
  3         91  
3 3     3   15 use warnings;
  3         8  
  3         100  
4              
5             # ABSTRACT: Base class for PkgConfig Keywords and Variables
6              
7 3     3   1612 use Syntax::Construct qw( non-destructive-subst );
  3         8447  
  3         21  
8              
9             our $VERSION = 'v2.0.0';
10              
11 3     3   803 use Regexp::Common 'balanced';
  3         2684  
  3         18  
12              
13              
14              
15              
16              
17              
18              
19              
20              
21             sub new {
22 182     182 1 11481 my ( $class, $name, $value ) = @_;
23              
24 182         393 bless { name => $name,
25             value => $value,
26             depends => _parse_dependencies( $value ),
27             }, $class;
28             }
29              
30              
31              
32              
33              
34              
35              
36 334     334 1 79989 sub name { return $_[0]->{name} }
37              
38              
39              
40              
41              
42              
43              
44 294     294 1 45905 sub value { return $_[0]->{value} }
45              
46              
47              
48              
49              
50              
51              
52              
53              
54 202     202 1 1371 sub depends { return @{ $_[0]->{depends} } }
  202         618  
55              
56             sub _parse_dependencies {
57             my @depends =
58 182     182   711 map { s/(?:^[{])|(?:[}]$)//gr }
  151         14565  
59             $_[0] =~ /(? '{}'}/g;
60              
61 182         9574 my %depends;
62 182         385 @depends{@depends} = ();
63              
64 182         2713 return [ keys %depends ];
65             }
66              
67             package App::mkpkgconfig::PkgConfig::Entry::Variable;
68              
69 3     3   3669 use parent -norequire => 'App::mkpkgconfig::PkgConfig::Entry';
  3         600  
  3         21  
70              
71             package App::mkpkgconfig::PkgConfig::Entry::Keyword;
72              
73 3     3   213 use parent -norequire => 'App::mkpkgconfig::PkgConfig::Entry';
  3         7  
  3         12  
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__