blib/lib/PkgConfig/LibPkgConf/Fragment.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 100% 30 / 30 CC 2 SCAR 2.2
CC
2
Cov
100%
to_string
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/PkgConfig/LibPkgConf/Client.pm ↑ Summary blib/lib/PkgConfig/LibPkgConf.pm »
1 package PkgConfig::LibPkgConf::Fragment;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use overload '""' => sub { shift->to_string };
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '0.11';
8  
9 =head1 NAME
10  
11 PkgConfig::LibPkgConf::Fragment - Single compiler or linker flag
12  
13 =head1 SYNOPSIS
14  
15 use PkgConfig::LibPkgConf::Client;
16
17 my $client = PkgConfig::LibPkgConf::Client->new;
18 $client->scan_all(sub {
19 my($client, $package) = @_;
20 # $package isa PkgConfig::LibPkgConf::Package
21 foreach my $frag ($package->list_libs)
22 {
23 # $frag isa PkgConfig::LibPkgConf::Fragment
24 if($frag->type eq 'L')
25 {
26 say "Library directory: ", $frag->data;
27 }
28 elsif($frag->type eq 'l')
29 {
30 say "Library name: ", $frag->data;
31 }
32 }
33 });
34
35 =head1 DESCRIPTION
36  
37 TODO
38  
39 =head1 ATTRIBUTES
40  
41 =head2 type
42  
43 my $type = $frag->type;
44  
45 The type of the flag. This may be C<undef> if there is no type.
46  
47 =cut
48  
49 39 ▶sub type { shift->{type} }
Subroutine type: called CC=1 SCAR=0.0
Pod documented
50  
51 =head2 data
52  
53 my $data = $frag->data;
54  
55 The data for the fragment.
56  
57 =cut
58  
59 39 ▶sub data { shift->{data} }
Subroutine data: called CC=1 SCAR=0.0
Pod documented
60  
61 =head2 to_string
62  
63 my $string = $frag->to_string;
64 my $string = "$frag";
65  
66 The string representation of the fragment. You may also interpolate the
67 fragment object inside a string to convert it into a string.
68  
69 =cut
70  
71 sub to_string
72 26 ▶{
Subroutine to_string: called CC=2 SCAR=6.9
Pod documented
73 26 my($self) = @_;
74 26 my($type, $data) = ($self->type, $self->data);
75 26 $data =~ s/\\(\s)/$1/g;
76 26 ▶ $type ? "-$type$data" : $data;
Branch: 1 branch
BranchTrueFalseTotal
$type ? : 24 2 26
77 }
78  
79 =head1 SUPPORT
80  
81 IRC #native on irc.perl.org
82  
83 Project GitHub tracker:
84  
85 L<https://github.com/plicease/PkgConfig-LibPkgConf/issues>
86  
87 If you want to contribute, please open a pull request on GitHub:
88  
89 L<https://github.com/plicease/PkgConfig-LibPkgConf/pulls>
90  
91 =head1 SEE ALSO
92  
93 For additional related modules, see L<PkgConfig::LibPkgConf>
94  
95 =head1 AUTHOR
96  
97 Graham Ollis
98  
99 For additional contributors see L<PkgConfig::LibPkgConf>
100  
101 =head1 COPYRIGHT AND LICENSE
102  
103 This software is copyright (c) 2016 Graham Ollis.
104  
105 This is free software; you may redistribute it and/or modify it under
106 the same terms as the Perl 5 programming language system itself.
107  
108 =cut
109  
110 3 1;
« blib/lib/PkgConfig/LibPkgConf/Client.pm ↑ Summary blib/lib/PkgConfig/LibPkgConf.pm »