Find/addrspec.pm

filter: Statementstmt 100% 33 / 33 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 36 / 36 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Find.pm ↑ Summary
1 package Email::Find::addrspec;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use vars qw($VERSION @EXPORT $Addr_spec_re);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 $VERSION = 0.09;
6  
7 4 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 @EXPORT = qw($Addr_spec_re);
9  
10 # This is the BNF from RFC 822
11 4 my $esc = '\\\\';
12 4 my $period = '\.';
13 4 my $space = '\040';
14 4 my $open_br = '\[';
15 4 my $close_br = '\]';
16 4 my $nonASCII = '\x80-\xff';
17 4 my $ctrl = '\000-\037';
18 4 my $cr_list = '\n\015';
19 4 my $qtext = qq/[^$esc$nonASCII$cr_list\"]/; #"
20 4 my $dtext = qq/[^$esc$nonASCII$cr_list$open_br$close_br]/;
21 4 my $quoted_pair = qq<$esc>.qq<[^$nonASCII]>;
22 4 my $atom_char = qq/[^($space)<>\@,;:\".$esc$open_br$close_br$ctrl$nonASCII]/; #"
23 4 my $atom = qq<$atom_char+(?!$atom_char)>;
24 4 my $quoted_str = qq<\"$qtext*(?:$quoted_pair$qtext*)*\">; #"
25 4 my $word = qq<(?:$atom|$quoted_str)>;
26 4 my $local_part = qq<$word(?:$period$word)*>;
27  
28 # This is a combination of the domain name BNF from RFC 1035 plus the
29 # domain literal definition from RFC 822, but allowing domains starting
30 # with numbers.
31 4 my $label = q/[A-Za-z\d](?:[A-Za-z\d-]*[A-Za-z\d])?/;
32 4 my $domain_ref = qq<$label(?:$period$label)*>;
33 4 my $domain_lit = qq<$open_br(?:$dtext|$quoted_pair)*$close_br>;
34 4 my $domain = qq<(?:$domain_ref|$domain_lit)>;
35  
36 # Finally, the address-spec regex (more or less)
37 4 $Addr_spec_re = qr<$local_part\s*\@\s*$domain>;
38  
39 4 1;
40 __END__
« Find.pm ↑ Summary