blib/lib/auto/share/dist/Amon2/flavor/Large/lib/__PATH__/__MONIKER__/ViewFunctions.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 57 CC 2 SCAR 9.8
CC
2
Cov
0%
static_file
6.0
commify
2.0
c
2.0
CRAP 2.7
1 package <% $module %>::<% $moniker %>::ViewFunctions;
2 use strict;
3 use warnings;
4 use utf8;
5 use parent qw(Exporter);
6 use Module::Functions;
7 use File::Spec;
8  
9 our @EXPORT = get_public_functions();
10  
11 sub commify {
12 local $_ = shift;
13 1 while s/((?:\A|[^.0-9])[-+]?\d+)(\d{3})/$1,$2/s;
14 return $_;
15 }
16  
17 sub c { <% $module %>->context() }
18 sub uri_with { <% $module %>->context()->req->uri_with(@_) }
19 sub uri_for { <% $module %>->context()->uri_for(@_) }
20  
21 {
22 my %static_file_cache;
23 sub static_file {
24 my $fname = shift;
25 (my $relpath = $fname) =~ s!static!static/<% $lc_moniker %>!;
26 my $c = <% $module %>->context;
27 if (not exists $static_file_cache{$relpath}) {
28 my $fullpath = File::Spec->catfile($c->base_dir(), $relpath);
29 $static_file_cache{$relpath} = (stat $fullpath)[9];
30 }
31 return $c->uri_for(
32 $fname, {
33 't' => $static_file_cache{$relpath} || 0
34 }
35 );
36 }
37 }
38  
39 1;