blib/lib/auto/share/dist/Amon2/flavor/Minimum/lib/__PATH__/Web/ViewFunctions.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 60 CC 2 SCAR 9.8
CC
2
Cov
0%
static_file
6.0
commify
2.0
c
2.0
CRAP 2.7
1 package <% $package // $module ~ "::Web::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 $c = <% $module %>->context;
26 if (not exists $static_file_cache{$fname}) {
27 my $fullpath = File::Spec->catfile($c->base_dir(), $fname);
28 $static_file_cache{$fname} = (stat $fullpath)[9];
29 }
30 return $c->uri_for(
31 $fname, {
32 't' => $static_file_cache{$fname} || 0
33 }
34 );
35 }
36 }
37  
38 1;