line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::PORE;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1090
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter;
|
7
|
1
|
|
|
1
|
|
856
|
use AutoLoader qw(AUTOLOAD);
|
|
1
|
|
|
|
|
1584
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
37
|
use Carp;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
97
|
|
9
|
1
|
|
|
1
|
|
650
|
use Text::PORE::Globals;
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
374
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
@Text::PORE::ISA = qw(Exporter);
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$Text::PORE::VERSION = '1.02';
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
##########################################
|
17
|
|
|
|
|
|
|
# render($object, $template, $file_handle)
|
18
|
|
|
|
|
|
|
##########################################
|
19
|
|
|
|
|
|
|
sub render($$$) {
|
20
|
6
|
|
|
6
|
1
|
78579
|
my ($obj, $tpl, $target) = @_;
|
21
|
6
|
|
|
|
|
16
|
my @errors = ();
|
22
|
6
|
50
|
|
|
|
35
|
if (ref($obj) ne 'Text::PORE::Object') {
|
23
|
0
|
|
|
|
|
0
|
push (@errors, "The first parameter must be type of Text::PORE::Object.");
|
24
|
|
|
|
|
|
|
}
|
25
|
6
|
50
|
|
|
|
27
|
if (ref($tpl) ne 'Text::PORE::Template') {
|
26
|
0
|
|
|
|
|
0
|
push (@errors, "The second parameter must be type of Text::PORE::Template.");
|
27
|
|
|
|
|
|
|
}
|
28
|
6
|
50
|
|
|
|
22
|
if (ref($target) ne 'FileHandle') {
|
29
|
0
|
|
|
|
|
0
|
push (@errors, "The third parameter must be type of FileHandle.");
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
|
32
|
6
|
50
|
|
|
|
25
|
if ($#errors >=0) {
|
33
|
0
|
|
|
|
|
0
|
my $error;
|
34
|
0
|
|
|
|
|
0
|
foreach $error (@errors) {
|
35
|
0
|
|
|
|
|
0
|
carp("$error");
|
36
|
|
|
|
|
|
|
}
|
37
|
0
|
|
|
|
|
0
|
return -1;
|
38
|
|
|
|
|
|
|
} else {
|
39
|
6
|
|
|
|
|
35
|
$tpl->render($obj, $target);
|
40
|
|
|
|
|
|
|
}
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
##########################################
|
44
|
|
|
|
|
|
|
# setTemplateRootDir($templateRoot)
|
45
|
|
|
|
|
|
|
##########################################
|
46
|
|
|
|
|
|
|
sub setTemplateRootDir($) {
|
47
|
1
|
|
|
1
|
1
|
1369
|
my ($templateRootDir) = shift;
|
48
|
1
|
|
|
|
|
6
|
Text::PORE::Globals::setTemplateRootDir($templateRootDir);
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1;
|
53
|
|
|
|
|
|
|
__END__
|