tt.pl untested

filter: Statementstmt 0.0% 0 / 24 Branchbran n/a Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 45 CC 1 SCAR 6.9
CC
1
Cov
0%
pod_include
2.0
pod_code
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/perl
2  
3  
4  
5 use Text::Template;
6 use strict;
7 our $OUT;
8  
9 my $file = shift or die 'file name not supplied';
10 my $out = "${file}-out";
11  
12 my $template = Text::Template->new
13 (TYPE => 'FILE', SOURCE => $file, DELIMITERS => [ '<tt>', '</tt>' ]);
14
15 sub pod_include {
16 my ($file, $indent) = @_;
17  
18 open F, $file or die "couldnt open file : $!";
19  
20 $indent ||= 4;
21  
22 $OUT = '';
23  
24 my $spaces = " " x $indent;
25  
26 while (<F>) {
27 $OUT .= "$spaces$_";
28 }
29 $OUT;
30 }
31  
32 sub pod_code {
33
34 my $file = shift or die "NO FILE SUPPLIED";
35 pod_include($file, 1);
36  
37 }
38  
39 open O, ">$out" or die "couldnt open $out: $!";
40  
41 print O $template->fill_in;
42  
43 close(O);
44