Email::FolderType::Net - Recognize folder types for network based message protocols.


Email-FolderType-Net documentation Contained in the Email-FolderType-Net distribution.

Index


Code Index:

NAME

Top

Email::FolderType::Net - Recognize folder types for network based message protocols.

SYNOPSIS

Top

  use Email::FolderType qw[folder_type];

  my $type = folder_type($folder) || 'unknown';
  print "$folder is type $type.\n";

DESCRIPTION

Registers several mail folder types that are known as network based messaging protocols. Folder names for these protocols should be specified using a URI syntax.

IMAP

  print 'IMAP' if folder_type('imap://foo.com/folder') eq 'IMAP';

Returns this folder type if the scheme is imap.

IMAPS

  print 'IMAPS' if folder_type('imaps://example.com') eq 'IMAPS';

Returns this folder type if the scheme is imaps.

POP3

  print 'POP3' if folder_type('pop3://example.com:110') eq 'POP3';

Returns this folder type if the schem is pop or pop3.

POP3S

  print 'POP3S' if folder_type('pops://foo.com') eq 'POP3S';

returns this folder type if the scheme is pops or pop3s.

SEE ALSO

Top

Email::FolderType, Email::FolderType::Local, URI.

PERL EMAIL PROJECT

Top

This module is maintained by the Perl Email Project

http://emailproject.perl.org/wiki/Email::FolderType::Net

AUTHOR

Top

Casey West <casey@geeknest.com>.

COPYRIGHT

Top


Email-FolderType-Net documentation Contained in the Email-FolderType-Net distribution.
package Email::FolderType::Net;
# $Id: Net.pm,v 1.4 2005/05/04 02:13:08 cwest Exp $
use strict;

use vars qw[$VERSION];
$VERSION = '1.041';

use URI;

sub _from_scheme {
    my $scheme = shift;
    my $uri    = URI->new(shift);
    return 1 if lc($uri->scheme) eq $scheme;
    return;
}

sub _create_match {
    my (@schemes) = @_;
    return sub {
        Email::FolderType::Net::_from_scheme($_,@_)
          and return(1)
            for @schemes;
        return;
    };
}

package Email::FolderType::IMAP;
*match = Email::FolderType::Net::_create_match(qw[imap]);
package Email::FolderType::IMAPS;
*match = Email::FolderType::Net::_create_match(qw[imaps]);
package Email::FolderType::POP3;
*match = Email::FolderType::Net::_create_match(qw[pop pop3]);
package Email::FolderType::POP3S;
*match = Email::FolderType::Net::_create_match(qw[pops pop3s]);

__END__