File Coverage

blib/lib/WebEditor/OldFeatures/HTMLFilterHack.pm
Criterion Covered Total %
statement 15 16 93.7
branch n/a
condition n/a
subroutine 5 6 83.3
pod n/a
total 20 22 90.9


line stmt bran cond sub pod time code
1             # -*- perl -*-
2              
3             #
4             # $Id: HTMLFilterHack.pm,v 1.1 2004/12/09 17:36:29 eserte Exp $
5             # Author: Slaven Rezic
6             #
7             # Copyright (C) 2004 Slaven Rezic. All rights reserved.
8             # This package is free software; you can redistribute it and/or
9             # modify it under the same terms as Perl itself.
10             #
11             # Mail: slaven@rezic.de
12             # WWW: http://www.rezic.de/eserte/
13             #
14              
15             package WebEditor::OldFeatures::HTMLFilterHack;
16              
17             =head1 NAME
18              
19             WebEditor::OldFeatures::HTMLFilterHack - replace the TT html filter
20              
21             =head1 SYNOPSIS
22              
23             In .../OldController.pm:
24              
25             use WebEditor::OldFeatures::HTMLFilterHack;
26              
27             In the templates:
28              
29             [% variable | html %]
30              
31             =head1 DESCRIPTION
32              
33             This is a untested hack to replace the standard "html" filter with a
34             version creating numeric entities.
35              
36             =cut
37              
38 1     1   1197 use strict;
  1         2  
  1         28  
39 1     1   4 use vars qw($VERSION);
  1         3  
  1         65  
40             $VERSION = sprintf("%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/);
41              
42 1     1   1658 use Template::Filters qw();
  1         4464  
  1         19  
43 1     1   8 use HTML::Entities qw();
  1         2  
  1         15  
44              
45 1     1   5 no warnings 'redefine'; # XXX 5.005 compat missing
  1         2  
  1         71  
46              
47             *Template::Filters::html_filter = sub {
48 0     0     HTML::Entities::encode_entities_numeric($_[0]);
49             };