Xrepo/PackageInfo.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 68 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use v5.40;
2 use feature 'class';
3 no warnings 'experimental::class';
4 #
5 class Alien::Xrepo::PackageInfo v1.0.10 {
6 use Path::Tiny;
7 field $includedirs : param : reader;
8 field $libfiles : param : reader;
9 field $license : param : reader;
10 field $linkdirs : param : reader;
11 field $links : param : reader;
12 field $shared : param : reader;
13 field $static : param : reader;
14 field $version : param : reader;
15 field $libpath : param : reader //= ();
16 field $bindirs : param : reader //= [];
17 field $installdir : param : reader;
18 field $deps : param : reader //= [];
19 field $runtime_deps : param : reader //= [];
20 field $kind : param : reader //= ();
21  
22 # Helper to find a specific header inside the includedirs
23 method find_header ($filename) {
24 for my $dir (@$includedirs) {
25 my $p = path($dir)->child($filename);
26 return $p->stringify if $p->exists;
27 }
28  
29 # Fallback check: sometimes xrepo returns the generic include root, and the file is in a subdir (e.g. GL/gl.h)
30 warn "Header '$filename' not found in package include directories:\n" . join( "\n", @$includedirs ) . "\n";
31 return;
32 }
33 method bin_dir {@$bindirs}
34  
35 # Rebuild with a discovered runtime dependency list attached. A consumer that has to dlopen C<libpath>
36 # needs to know which *other* shared libraries must be findable first (the dynamic linker resolves them
37 # before our symbols are usable); this is where that list lands.
38 method with_runtime_deps ($list) {
39 return $self if @{ $runtime_deps // [] };
40 return Alien::Xrepo::PackageInfo->new(
41 includedirs => $includedirs,
42 libfiles => $libfiles,
43 license => $license,
44 linkdirs => $linkdirs,
45 links => $links,
46 shared => $shared,
47 static => $static,
48 version => $version,
49 libpath => $libpath,
50 bindirs => $bindirs,
51 deps => $deps,
52 runtime_deps => $list,
53 installdir => $installdir,
54 kind => $kind
55 );
56 }
57  
58 method _data_printer ($ddp) {
59 { includedirs => $includedirs,
60 libfiles => $libfiles,
61 license => $license,
62 linkdirs => $linkdirs,
63 links => $links,
64 shared => $shared,
65 static => $static,
66 version => $version,
67 libpath => $libpath,
68 bindirs => $bindirs,
69 deps => $deps,
70 runtime_deps => $runtime_deps,
71 installdir => $installdir,
72 kind => $kind
73 }
74 }
75 };
76 #
77 1;