File Coverage

blib/lib/WE/DB/ComplexUser/AuthPOP3.pm
Criterion Covered Total %
statement 9 18 50.0
branch 0 4 0.0
condition 0 3 0.0
subroutine 3 4 75.0
pod 0 1 0.0
total 12 30 40.0


line stmt bran cond sub pod time code
1             # -*- perl -*-
2              
3             #
4             # $Id: AuthPOP3.pm,v 1.3 2005/05/11 09:28:27 eserte Exp $
5             # Author: Slaven Rezic
6             #
7             # Copyright (C) 2004 Slaven Rezic.
8             # This is free software; you can redistribute it and/or modify it under the
9             # terms of the GNU General Public License, see the file COPYING.
10              
11             #
12             # Mail: slaven@rezic.de
13             # WWW: http://we-framework.sourceforge.net
14             #
15              
16             package WE::DB::ComplexUser::AuthPOP3;
17              
18 1     1   919 use strict;
  1         2  
  1         28  
19 1     1   9 use vars qw($VERSION $DEBUG);
  1         2  
  1         69  
20             $VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
21              
22 1     1   728 use mixin::with 'WE::DB::ComplexUser';
  1         239  
  1         5  
23              
24             sub identify_POP3 {
25 0     0 0   my($self, $user, $password) = @_;
26              
27 0           my $host = $user->{Auth_POP3_Host}; # XXX || $self->default_pop3_host;
28 0   0       my $pop_user = $user->{Auth_POP3_User} || $user->Username;
29              
30 0 0         warn "Try pop3 with host=$host and user=$pop_user...\n" if $DEBUG;
31              
32 0           require Net::POP3;
33 0           my $pop = Net::POP3->new($host, Timeout => 10);
34 0 0         my $ret = $pop->login($pop_user, $password) ? 1 : 0;
35 0           $pop->quit;
36 0           $ret;
37             }
38              
39             1;
40              
41             __END__