File Coverage

blib/lib/Email/FolderType/Net.pm
Criterion Covered Total %
statement 18 18 100.0
branch 3 4 75.0
condition 2 2 100.0
subroutine 6 6 100.0
pod n/a
total 29 30 96.6


line stmt bran cond sub pod time code
1 1     1   1687 use strict;
  1         2  
  1         36  
2 1     1   6 use warnings;
  1         1  
  1         67  
3             package Email::FolderType::Net;
4             {
5             $Email::FolderType::Net::VERSION = '1.043';
6             }
7             # ABSTRACT: Recognize folder types for network based message protocols.
8              
9 1     1   776 use URI 1.35;
  1         4942  
  1         350  
10              
11              
12             sub _from_scheme {
13 11     11   33 my $scheme = shift;
14 11         57 my $uri = URI->new(shift);
15 11 50       26282 return unless $uri->scheme;
16 11 100       553 return 1 if lc($uri->scheme) eq $scheme;
17 7         120 return;
18             }
19              
20             sub _create_match {
21 4     4   10 my (@schemes) = @_;
22             return sub {
23             Email::FolderType::Net::_from_scheme($_,@_)
24             and return(1)
25 10   100 10   40030 for @schemes;
26 6         21 return;
27 4         40 };
28             }
29              
30             package Email::FolderType::IMAP;
31             {
32             $Email::FolderType::IMAP::VERSION = '1.043';
33             }
34             *match = Email::FolderType::Net::_create_match(qw[imap]);
35             package Email::FolderType::IMAPS;
36             {
37             $Email::FolderType::IMAPS::VERSION = '1.043';
38             }
39             *match = Email::FolderType::Net::_create_match(qw[imaps]);
40             package Email::FolderType::POP3;
41             {
42             $Email::FolderType::POP3::VERSION = '1.043';
43             }
44             *match = Email::FolderType::Net::_create_match(qw[pop pop3]);
45             package Email::FolderType::POP3S;
46             {
47             $Email::FolderType::POP3S::VERSION = '1.043';
48             }
49             *match = Email::FolderType::Net::_create_match(qw[pops pop3s]);
50              
51             __END__