File Coverage

blib/lib/Dotiac/DTL/Comment.pm
Criterion Covered Total %
statement 54 58 93.1
branch n/a
condition n/a
subroutine 11 13 84.6
pod 10 10 100.0
total 75 81 92.5


line stmt bran cond sub pod time code
1             ###############################################################################
2             #Comment.pm
3             #Last Change: 2009-01-19
4             #Copyright (c) 2009 Marc-Seabstian "Maluku" Lucksch
5             #Version 0.8
6             ####################
7             #This file is part of the Dotiac::DTL project.
8             #http://search.cpan.org/perldoc?Dotiac::DTL
9             #
10             #Comment.pm is published under the terms of the MIT license, which basically
11             #means "Do with it whatever you want". For more information, see the
12             #license.txt file that should be enclosed with libsofu distributions. A copy of
13             #the license is (at the time of writing) also available at
14             #http://www.opensource.org/licenses/mit-license.php .
15             ###############################################################################
16            
17            
18             package Dotiac::DTL::Comment;
19 11     11   60 use strict;
  11         23  
  11         363  
20 11     11   58 use warnings;
  11         18  
  11         303  
21 11     11   56 use base qw/Dotiac::DTL::Tag/;
  11         28  
  11         7370  
22            
23             our $VERSION = 0.8;
24            
25            
26            
27             sub new {
28 6     6 1 10 my $class=shift;
29 6         17 my $self={p=>shift()};
30 6         15 bless $self,$class;
31 6         23 $self->{comment}=shift();
32 6         11 $self->{n}=shift;
33 6         37 return $self;
34             }
35             sub print {
36 3     3 1 5 my $self=shift;
37 3         21 print $self->{p};
38 3         13 $self->{n}->print(@_);
39             }
40             sub string {
41 9     9 1 12 my $self=shift;
42 9         33 return $self->{p}.$self->{n}->string(@_);
43             }
44             sub perl {
45 3     3 1 5 my $self=shift;
46 3         5 my $fh=shift;
47 3         4 my $id=shift;
48 3         5 print $fh "my ";
49 3         20 print $fh (Data::Dumper->Dump([$self->{p}],["\$text$id"]));
50 3         138 return $self->{n}->perl($fh,$id+1,@_);
51             }
52             sub perlinit {
53 3     3 1 7 my $self=shift;
54 3         5 my $fh=shift;
55 3         4 my $id=shift;
56 3         12 return $self->{n}->perlinit($fh,$id+1,@_);
57             }
58             sub perlprint {
59 3     3 1 6 my $self=shift;
60 3         2 my $fh=shift;
61 3         5 my $id=shift;
62 3         4 my $level=shift;
63 3         7 my $in="\t" x $level;
64 3         9 print $fh $in,"print \$text$id;\n";
65 3         6 my $c=$self->{comment};
66 3         8 $c=~s/\n/\n$in#/g;
67 3         6 print $fh "$in# $c\n";
68 3         21 return $self->{n}->perlprint($fh,$id+1,$level,@_);
69             }
70             sub perlstring {
71 3     3 1 4 my $self=shift;
72 3         4 my $fh=shift;
73 3         4 my $id=shift;
74 3         5 my $level=shift;
75 3         9 my $in="\t" x $level;
76 3         9 print $fh $in,"\$r.=\$text$id;\n";
77 3         8 my $c=$self->{comment};
78 3         11 $c=~s/\n/\n$in#/g;
79 3         8 print $fh "$in# $c\n";
80 3         29 return $self->{n}->perlstring($fh,$id+1,$level,@_);
81             }
82             sub perleval {
83 3     3 1 6 my $self=shift;
84 3         5 my $fh=shift;
85 3         4 my $id=shift;
86 3         14 return $self->{n}->perleval($fh,$id+1,@_);
87             }
88             sub perlcount {
89 0     0 1   my $self=shift;
90 0           my $id=shift;
91 0           return $self->{n}->perlcount($id+1);
92             }
93             sub eval {
94 0     0 1   return;
95             }
96             1;
97             __END__