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