File Coverage

blib/lib/App/hopen/H.pm
Criterion Covered Total %
statement 42 42 100.0
branch n/a
condition n/a
subroutine 14 14 100.0
pod n/a
total 56 56 100.0


line stmt bran cond sub pod time code
1             # App::hopen::H - H:: namespace for use in hopen files
2             package App::hopen::H;
3 2     2   136821 use strict; use warnings;
  2     2   16  
  2         63  
  2         13  
  2         7  
  2         50  
4 2     2   11 use Data::Hopen::Base;
  2         4  
  2         13  
5              
6             our $VERSION = '0.000013'; # TRIAL
7              
8 2     2   2552 use parent 'Exporter';
  2         5  
  2         12  
9 2     2   552 use vars::i '@EXPORT' => [];
  2         1005  
  2         19  
10 2     2   186 use vars::i '@EXPORT_OK' => qw(files);
  2         10  
  2         7  
11 2         11 use vars::i '%EXPORT_TAGS' => (
12             default => [@EXPORT],
13             all => [@EXPORT, @EXPORT_OK]
14 2     2   176 );
  2         5  
15              
16 2     2   552 use App::hopen::BuildSystemGlobals;
  2         7  
  2         227  
17 2     2   957 use App::hopen::G::FilesCmd;
  2         8  
  2         97  
18 2     2   555 use App::hopen::Util::BasedPath;
  2         5  
  2         115  
19 2     2   12 use Data::Hopen qw(hlog getparameters);
  2         8  
  2         95  
20 2     2   1022 use Data::Hopen::G::GraphBuilder;
  2         5830  
  2         106  
21 2     2   14 use Data::Hopen::Util::Data qw(forward_opts);
  2         4  
  2         87  
22 2     2   12 use Path::Class;
  2         4  
  2         527  
23              
24             # Docs {{{1
25              
26             =head1 NAME
27              
28             App::hopen::H - H:: namespace for use in hopen files
29              
30             =head1 SYNOPSIS
31              
32             This module is loaded as C<H::*> into hopen files by
33             L<App::hopen::HopenFileKit>.
34              
35             =head1 FUNCTIONS
36              
37             =cut
38              
39             # }}}1
40              
41             =head2 files
42              
43             Creates a command-graph node representing a set of input files.
44             Example usage:
45              
46             $Build->H::files('foo.c')->C::compile->C::link('foo')->default_goal;
47              
48             The node is an L<App::hopen::G::FilesCmd>.
49              
50             The file path is assumed to be relative to the current project directory.
51             TODO handle subdirectories.
52              
53             Adds each specified file as a separate node in the asset graph.
54              
55             =cut
56              
57             sub files {
58             my ($builder, %args) = getparameters('self', ['*'], @_);
59             hlog { __PACKAGE__, 'files:', Dumper(\%args) } 3;
60             my $lrFiles = $args{'*'} // [];
61             my @files = map { based_path(path => file($_), base => $ProjDir) } @$lrFiles;
62             hlog { __PACKAGE__, 'file objects:', @files } 3;
63             my $files_op = App::hopen::G::FilesCmd->new(
64             files => [ @files ],
65             forward_opts(\%args, 'name')
66             );
67              
68             return $files_op;
69             } #files()
70              
71             make_GraphBuilder 'files';
72              
73             1;
74             __END__
75             # vi: set fdm=marker: #