File Coverage

blib/lib/CGI/Pretty.pm
Criterion Covered Total %
statement 37 37 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 47 47 100.0


line stmt bran cond sub pod time code
1             package CGI::Pretty;
2              
3 1     1   13056 use strict;
  1         1  
  1         24  
4 1     1   3 use warnings;
  1         1  
  1         30  
5              
6 1     1   474 use if $] >= 5.019, 'deprecate';
  1         7  
  1         4  
7 1     1   1353 use CGI ();
  1         3  
  1         86  
8              
9             $CGI::Pretty::VERSION = '4.35_01';
10             $CGI::DefaultClass = __PACKAGE__;
11             @CGI::Pretty::ISA = qw( CGI );
12              
13             sub new {
14 1     1 1 1 my $class = shift;
15 1         8 my $this = $class->SUPER::new( @_ );
16 1         3 return bless $this, $class;
17             }
18              
19             sub import {
20              
21 1     1   43 warn "CGI::Pretty is DEPRECATED and will be removed in a future release. Please see https://github.com/leejo/CGI.pm/issues/162 for more information";
22              
23 1         2 my $self = shift;
24 1     1   5 no strict 'refs';
  1         0  
  1         160  
25              
26             # This causes modules to clash.
27 1         2 undef %CGI::EXPORT;
28 1         1 undef %CGI::EXPORT;
29              
30 1         6 $self->_setup_symbols(@_);
31 1         3 my ($callpack, $callfile, $callline) = caller;
32              
33             # To allow overriding, search through the packages
34             # Till we find one in which the correct subroutine is defined.
35 1         1 my @packages = ($self,@{"$self\:\:ISA"});
  1         4  
36 1         15 foreach my $sym (keys %CGI::EXPORT) {
37 172         80 my $pck;
38 172         113 my $def = $CGI::DefaultClass;
39 172         102 foreach $pck (@packages) {
40 344 100       210 if (defined(&{"$pck\:\:$sym"})) {
  344         644  
41 172         111 $def = $pck;
42 172         108 last;
43             }
44             }
45 172         84 *{"${callpack}::$sym"} = \&{"$def\:\:$sym"};
  172         1587  
  172         160  
46             }
47             }
48              
49             1;
50              
51             =head1 NAME
52              
53             CGI::Pretty - module to produce nicely formatted HTML code
54              
55             =head1 CGI::Pretty IS DEPRECATED
56              
57             It will be removed from the CGI distribution in a future release, so you
58             should no longer use it and remove it from any code that currently uses it.
59              
60             For now it has been reduced to a shell to prevent your code breaking, but
61             the "pretty" functions will no longer output "pretty" HTML.
62              
63             =head1 Alternatives
64              
65             L + L + L:
66              
67             print HTML::HTML5::Writer->new(
68             start_tags => 'force',
69             end_tags => 'force',
70             )->document(
71             XML::LibXML::PrettyPrint->new_for_html( indent_string => "\t" )
72             ->pretty_print(
73             HTML::HTML5::Parser->new->parse_string( $html_string )
74             )
75             );
76              
77             L (see the html_fmt script for examples)
78              
79             L
80              
81             L
82              
83             =cut