CGI/Pretty.pm

filter: Statementstmt 100% 38 / 38 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 47 / 47 CC 4 SCAR 8.5
CC
4
Cov
100%
import
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« CGI/Cookie.pm ↑ Summary CGI/HTML/Functions.pm »
1 package CGI::Pretty;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use CGI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 $CGI::Pretty::VERSION = '5.02';
9 1 $CGI::DefaultClass = __PACKAGE__;
10 1 @CGI::Pretty::ISA = qw( CGI );
11  
12 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
13 1 my $class = shift;
14 1 my $this = $class->SUPER::new( @_ );
15 1 return bless $this, $class;
16 }
17  
18 1 ▶sub import {
Subroutine import: called CC=4 SCAR=13.9
19  
20 1 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";
21  
22 1 my $self = shift;
23 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 # This causes modules to clash.
26 1 undef %CGI::EXPORT;
27 1 undef %CGI::EXPORT;
28  
29 1 $self->_setup_symbols(@_);
30 1 my ($callpack, $callfile, $callline) = caller;
31  
32 # To allow overriding, search through the packages
33 # Till we find one in which the correct subroutine is defined.
34 1 my @packages = ($self,@{"$self\:\:ISA"});
35 1 foreach my $sym (keys %CGI::EXPORT) {
36 172 my $pck;
37 172 my $def = $CGI::DefaultClass;
38 172 foreach $pck (@packages) {
39 344 ▶ if (defined(&{"$pck\:\:$sym"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &{"${pck}::$sym";}) 172 172 344
40 172 $def = $pck;
41 172 last;
42 }
43 }
44 172 *{"${callpack}::$sym"} = \&{"$def\:\:$sym"};
45 }
46 }
47  
48 1 1;
49  
50 =head1 NAME
51  
52 CGI::Pretty - module to produce nicely formatted HTML code
53  
54 =head1 CGI::Pretty IS DEPRECATED
55  
56 It will be removed from the CGI distribution in a future release, so you
57 should no longer use it and remove it from any code that currently uses it.
58  
59 For now it has been reduced to a shell to prevent your code breaking, but
60 the "pretty" functions will no longer output "pretty" HTML.
61  
62 =head1 Alternatives
63  
64 L<HTML::HTML5::Parser> + L<HTML::HTML5::Writer> + L<XML::LibXML::PrettyPrint>:
65  
66 print HTML::HTML5::Writer->new(
67 start_tags => 'force',
68 end_tags => 'force',
69 )->document(
70 XML::LibXML::PrettyPrint->new_for_html( indent_string => "\t" )
71 ->pretty_print(
72 HTML::HTML5::Parser->new->parse_string( $html_string )
73 )
74 );
75  
76 L<Marpa::R2::HTML> (see the html_fmt script for examples)
77  
78 L<HTML::Tidy>
79  
80 L<HTML::Parser>
81  
82 =cut
« CGI/Cookie.pm ↑ Summary CGI/HTML/Functions.pm »