File Coverage

blib/lib/Error/Pure/Output/Tags/HTMLCustomPage.pm
Criterion Covered Total %
statement 15 35 42.8
branch 0 4 0.0
condition n/a
subroutine 5 6 83.3
pod 1 1 100.0
total 21 46 45.6


line stmt bran cond sub pod time code
1             package Error::Pure::Output::Tags::HTMLCustomPage;
2              
3 2     2   115555 use base qw(Exporter);
  2         5  
  2         376  
4 2     2   16 use strict;
  2         5  
  2         79  
5 2     2   10 use warnings;
  2         5  
  2         137  
6              
7 2     2   1432 use HTTP::Headers::Fast;
  2         16334  
  2         116  
8 2     2   1831 use Readonly;
  2         11443  
  2         1018  
9              
10             # Constants.
11             Readonly::Array our @EXPORT_OK => qw(err_pretty);
12             Readonly::Scalar my $EMPTY_STR => q{};
13             Readonly::Scalar my $SPACE => q{ };
14              
15             our $VERSION = 0.04;
16              
17             # Pretty print.
18             sub err_pretty {
19 0     0 1   my ($tags_obj, $encoding, $content_type, $xml_version,
20             $tags_structure_ar) = @_;
21              
22             # Reset.
23 0           $tags_obj->reset;
24              
25 0           my $header = HTTP::Headers::Fast->new;
26 0           $header->header(
27             'Cache-Control' => 'no-cache',
28             'Content-Type' => $content_type,
29             );
30 0           $header->date(time);
31 0           $tags_obj->put(['r', $header->as_string."\n"]);
32              
33             # Debug from Tags object.
34 0           my $debug = $tags_obj->{'set_indent'};
35              
36             # XML tag.
37 0           $tags_obj->put(
38             ['i', 'xml', 'version="'.$xml_version.'" encoding="'.$encoding.
39             '" standalone="no"'],
40             );
41 0 0         if ($debug) {
42 0           $tags_obj->put(['r', "\n"]);
43             }
44              
45             # DTD.
46 0           my @dtd = (
47             '
48             'PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"',
49             '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
50             );
51 0           my ($separator, $linebreak) = ($SPACE, $EMPTY_STR);
52 0 0         if ($debug) {
53 0           $separator = "\n".$tags_obj->{'next_indent'};
54 0           $linebreak = "\n";
55             }
56 0           $tags_obj->put(['r', (join $separator, @dtd).$linebreak]);
57              
58             # Main page.
59 0           my @tmp = @{$tags_structure_ar};
  0            
60 0           $tags_obj->put(@tmp);
61              
62             # Ok.
63 0           return 1;
64             }
65              
66             1;
67              
68             __END__