File Coverage

lib/Cache/Static/XML_Comma_Util.pm
Criterion Covered Total %
statement 6 20 30.0
branch 0 4 0.0
condition n/a
subroutine 2 5 40.0
pod 0 2 0.0
total 8 31 25.8


line stmt bran cond sub pod time code
1             ##
2             #
3             # Copyright 2005-2006, Brian Szymanski
4             #
5             # This file is part of Cache::Static
6             #
7             # Cache::Static is free software; you can redistribute it and/or modify
8             # it under the terms of the GNU General Public License as published by
9             # the Free Software Foundation; either version 2 of the License, or
10             # any later version.
11             #
12             # This program is distributed in the hope that it will be useful,
13             # but WITHOUT ANY WARRANTY; without even the implied warranty of
14             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15             # GNU General Public License for more details.
16             #
17             # For more information about Cache::Static, point a web browser at
18             # http://chronicle.allafrica.com/scache/ or read the
19             # documentation included with the Cache::Static distribution in the
20             # doc/ directory
21             #
22             ##
23              
24              
25             package Cache::Static::XML_Comma_Util;
26              
27 1     1   1458 use strict;
  1         2  
  1         68  
28 1     1   7 use warnings;
  1         2  
  1         751  
29             require Cache::Static;
30              
31             sub _get_timestamp_file {
32 0     0     my ($type, $spec) = @_;
33 0           Cache::Static::_log(4, "XML_Comma_Util: in get_timestamp_file for $type $spec");
34 0           return $Cache::Static::ROOT.'/timestamps/'.
35             Cache::Static::md5_path("XML::Comma|$type|$spec").'.ts';
36             }
37              
38             sub modtime {
39 0     0 0   my $file = _get_timestamp_file(@_);
40 0           my @t = stat($file);
41 0 0         die "XML_Comma_Util couldn't get modtime for $file (@_): $!" unless(@t);
42 0 0         return @t ? $t[9] : 0;
43             }
44              
45             #bummer, this takes 0.02 seconds... too slow...
46             # we could cache the spec lookup...
47             sub get_extra_deps {
48 0     0 0   my ($type, $spec) = @_;
49              
50 0           my @t = split(/\|/, $spec, 1);
51 0           my $def_spec = $t[0];
52 0           my $def = XML::Comma::Def->$def_spec;
53 0           my $ff = $def->{_from_file};
54 0           print "extra dep for XML::Comma|$type : $ff\n";
55 0           return ( "file|$ff" );
56             }
57              
58             1;
59