FastPack/App.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 48 CC 2 SCAR 10.3
CC
2
Cov
0%
add_to_jpack_container
6.0
js_paths
2.0
BEGIN
2.0
CRAP 2.8
1 # FastPack application (web client)
2 package Data::FastPack::App;
3 use strict;
4 use warnings;
5  
6 use feature ":all";
7 our $VERSION="v0.1.1";
8  
9  
10 use Data::JPack;
11  
12 use File::ShareDir ":ALL";
13  
14 use File::Path qw<make_path>;
15 use File::Basename qw<dirname>;
16  
17 my $share_dir=dist_dir "Data-FastPack";
18  
19  
20 sub js_paths {
21 grep !/test/, <$share_dir/js/*>;
22 }
23  
24 sub add_to_jpack_container {
25 my $html_container=shift;
26 # Given the html_container encode the js and resource files into the next available position
27 #
28 my $jpack=Data::JPack->new(jpack_compression=>"DEFLATE", jpack_type=>"app", html_container=>$html_container);
29  
30  
31 $jpack->set_prefix("app/jpack/main");
32  
33 my @outputs;
34 for(js_paths){
35 my $out_path=$jpack->next_file_name($_);
36 next unless $out_path;
37  
38 say STDERR "OUTPUT PATH IS $out_path";
39  
40 $jpack->encode_file($_,$out_path);
41 push @outputs, $out_path; #
42 }
43  
44 ##################################
45 # my $data=do { #
46 # local $/=undef; #
47 # open my $fh,"<", $_; #
48 # <$fh> #
49 # }; #
50 # $data=$jpack->encode($data); #
51 # #
52 # #
53 # my $dir=dirname $out_path; #
54 # make_path $dir; #
55 # open my $fh, ">", $out_path; #
56 # print $fh $data; #
57 # push @outputs, $out_path; #
58 # } #
59 ##################################
60 #
61 @outputs;
62 }
63  
64 1;