File Coverage

blib/lib/Dotiac/DTL/Tag.pm
Criterion Covered Total %
statement 45 48 93.7
branch 2 4 50.0
condition n/a
subroutine 13 14 92.8
pod 11 11 100.0
total 71 77 92.2


line stmt bran cond sub pod time code
1             ###############################################################################
2             #Tag.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             #Addon.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             package Dotiac::DTL::Tag;
18             #Default Tags
19 11     11   31970 use strict;
  11         22  
  11         342  
20 11     11   54 use warnings;
  11         19  
  11         2487  
21            
22             our $VERSION = 0.8;
23            
24             sub new {
25 389     389 1 644 my $class=shift;
26 389         1315 my $self={p=>shift()};
27 389         3919 bless $self,$class;
28             }
29             sub print {
30 437     437 1 2032 print $_[0]->{p};
31             }
32             sub string {
33 494     494 1 3927 return $_[0]->{p};
34             }
35             sub perl {
36 514     514 1 1200 my $self=shift;
37 514         663 my $fh=shift;
38 514         662 my $id=shift;
39 514         878 print $fh "my ";
40 514         2839 print $fh (Data::Dumper->Dump([$self->{p}],["\$text$id"]));
41 514         27884 return $id;
42            
43             }
44             sub perlinit {
45 318     318 1 490 my $self=shift;
46 318         370 my $fh=shift;
47 318         407 my $id=shift;
48 318         840 return $id;
49             }
50             sub perlprint {
51 483     483 1 732 my $self=shift;
52 483         565 my $fh=shift;
53 483         635 my $id=shift;
54 483         550 my $level=shift;
55 11 50   11   74 use Carp;confess unless int $level;
  11         18  
  11         2969  
  483         1013  
56 483         1118 print $fh "\t" x $level,"print \$text$id;\n";
57 483         1370 return $id;
58             }
59             sub perlstring {
60 509     509 1 761 my $self=shift;
61 509         624 my $fh=shift;
62 509         844 my $id=shift;
63 509         614 my $level=shift;
64 509         1321 print $fh "\t" x $level,"\$r.=\$text$id;\n";
65 509         1600 return $id;
66             }
67             sub perleval {
68 348     348 1 507 my $self=shift;
69 348         415 my $fh=shift;
70 348         392 my $id=shift;
71             #return $self->{n}->perleval(@_) if $self->{n};
72 348         1043 return $id;
73             }
74             sub perlcount {
75 0     0 1 0 my $self=shift;
76 0         0 my $id=shift;
77 0         0 return $id;
78             }
79             sub eval {
80 10     10 1 17 my $self=shift;
81 10 50       48 $self->{n}->eval(@_) if $self->{n};
82             }
83             sub next {
84 1     1 1 2 my $self=shift;
85 1         5 $self->{n}=shift;
86             }
87             1;
88            
89             __END__