File Coverage

blib/lib/RFC/RFC822/Address.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 22 23 95.6


line stmt bran cond sub pod time code
1             package RFC::RFC822::Address;
2              
3             require 5.006;
4              
5 1     1   13961 use strict;
  1         3  
  1         43  
6 1     1   6 use warnings;
  1         2  
  1         40  
7 1     1   5 no warnings 'syntax';
  1         6  
  1         56  
8 1     1   5 use Exporter ();
  1         2  
  1         17  
9 1     1   2769 use Parse::RecDescent;
  1         108898  
  1         8  
10              
11             our @ISA = qw /Exporter/;
12             our @EXPORT = qw //;
13             our @EXPORT_OK = qw /valid/;
14             our %EXPORT_TAGS = ();
15              
16             our $VERSION = '2009110702';
17              
18             my $CRLF = '\x0D\x0A';
19             $Parse::RecDescent::skip = "((?:$CRLF)?[ \t])*";
20             local $/;
21              
22             # Now, pay attention. There are only 2 important lines of Perl in this
23             # module, and they follow now. ;-)
24             my $parser = Parse::RecDescent -> new () or die "Compilation error.\n";
25 67     67 0 1362789 sub valid ($) {$parser -> valid (shift)}
26              
27             # That's it. The rest is just data....
28              
29             1;
30              
31             =pod
32              
33             =head1 NAME
34              
35             RFC::RFC822::Address - RFC 822 style address validation.
36              
37             =head1 SYNOPSIS
38              
39             use RFC::RFC822::Address qw /valid/;
40              
41             print "Valid\n" if valid 'abigail@example.com';
42              
43             =head1 DESCRIPTION
44              
45             This module checks strings to see whether they are have the valid
46             syntax, as defined in RFC 822 [1]. One subroutine, C, can
47             be imported, which takes a single string as argument. If the string
48             is valid according to RFC 822, a true value is returned, else a
49             false value is returned.
50              
51             =head1 REFERENCES
52              
53             =over 4
54              
55             =item [1]
56              
57             David H. Crocker (revisor): "STANDARD FOR THE FORMAT OF ARPA INTERNET
58             TEXT MESSAGES". RFC 822. 13 August 1982.
59              
60             =back
61              
62             =head1 CAVEATS and BUGS
63              
64             This module sets the variable C<$Parse::RecDescent::skip>. This will
65             influence all other C parsers. And this parser will
66             break if you set C<$Parse::RecDescent::skip> to another value. It doesn't
67             look that it is possible to set an alternative skip value for each parser,
68             other than setting the skip value on each production.
69              
70             Example A.1.5 in RFC 822 is wrong. It should use
71             I>.
72              
73             This module should have been named C. However, perl
74             5.004 doesn't like the C<822> part, and at the time of this writing
75             MacPerl is still at 5.004.
76              
77             This module is slow.
78              
79             =head1 DEVELOPMENT
80            
81             The current sources of this module are found on github,
82             L<< git://github.com/Abigail/rfc--rfc822--address.git >>.
83              
84             =head1 AUTHOR
85              
86             Abigail L<< mailto:cpan@abigail.be >>.
87              
88             =head1 COPYRIGHT and LICENSE
89              
90             This program is copyright 1999, 2000, 2009 by Abigail.
91              
92             Permission is hereby granted, free of charge, to any person obtaining a
93             copy of this software and associated documentation files (the "Software"),
94             to deal in the Software without restriction, including without limitation
95             the rights to use, copy, modify, merge, publish, distribute, sublicense,
96             and/or sell copies of the Software, and to permit persons to whom the
97             Software is furnished to do so, subject to the following conditions:
98              
99             The above copyright notice and this permission notice shall be included
100             in all copies or substantial portions of the Software.
101            
102             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
103             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
104             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
105             THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
106             WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
107             OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
108             THE SOFTWARE.
109              
110             =cut
111              
112             __DATA__