root/Apache-AntiSpam/trunk/lib/Apache/AntiSpam/HTMLEncode.pm

Revision 90 (checked in by miyagawa, 19 years ago)

make subclassing possible
added FilterTest?

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 package Apache::AntiSpam::HTMLEncode;
2
3 use strict;
4 use vars qw($VERSION);
5 $VERSION = '0.01';
6
7 use base qw(Apache::AntiSpam);
8 use HTML::Entities;
9
10 sub antispamize {
11     my($class, $email, $orig) = @_;
12     return encode_entities($orig, '\x00-\xff');
13 }   
14
15 1;
16 __END__
17
18 =head1 NAME
19
20 Apache::AntiSpam::HTMLEncode - Encodes E-mail addresses with HTML
21
22 =head1 SYNOPSIS
23
24   # in httpd.conf
25   <Location /antispam>
26   SetHandler perl-script
27   PerlHandler Apache::AntiSpam::HTMLEncode
28   </Location>
29
30   # filter aware
31   PerlModule Apache::Filter
32   SetHandler perl-script
33   PerlSetVar Filter On
34   PerlHandler Apache::RegistryFilter Apache::AntiSpam::HTMLEncode Apache::Compress
35
36 =head1 DESCRIPTION
37
38 Apache::AntiSpam::Heurisitc is a subclass of Apache::AntiSpam, filter
39 module to prevent e-mail addresses exposed as is on web pages. This
40 module encodes e-mail addresses with HTML.
41
42 For example, C<miyagawa@cpan.org> will be filtered to
43 C<&#109;&#105;&#121;&#97;&#103;&#97;&#119;&#97;&#64;&#99;&#112;&#97;&#110;&#46;&#111;&#114;&#103>.
44
45 This won't affect anything on your favourite browsers, but spammers
46 with crawling-robot plus pattern matching technique won't be able to
47 extract addresses from this kind of format.
48
49 This module is Filter aware, meaning that it can work within
50 Apache::Filter framework without modification.
51
52 =head1 ACKNOWLEDGEMENT
53
54 The idea to encode E-mail address with HTML is stolen from
55 http://perlmonks.org/?node_id=89810
56
57 =head1 AUTHOR
58
59 Tatsuhiko Miyagawa <miyagawa@bulknews.net>
60
61 This library is free software; you can redistribute it and/or modify
62 it under the same terms as Perl itself.
63
64 =head1 SEE ALSO
65
66 L<Apache::AntiSpam>
67
68 =cut
Note: See TracBrowser for help on using the browser.