[prev] [thread] [next] [lurker] [Date index for 2003/08/11]
Author: richardc Date: 2003-08-11 07:18:45 +0100 (Mon, 11 Aug 2003) New Revision: 1303 Modified: trunk/Email-FolderType/Changes trunk/Email-FolderType/lib/Email/FolderType.pm Log: add ezmlm. rewrite docs Modified: trunk/Email-FolderType/Changes =================================================================== --- trunk/Email-FolderType/Changes 2003-08-10 17:38:52 UTC (rev 1302) +++ trunk/Email-FolderType/Changes 2003-08-11 06:18:45 UTC (rev 1303) @@ -1,3 +1,6 @@ +0.6 Monday 11th August, 2003 + added Ezmlm support (//) and rewrote the documentation + 0.5 Monday 22nd July 2003 update the docs and other minor tweaks Modified: trunk/Email-FolderType/lib/Email/FolderType.pm =================================================================== --- trunk/Email-FolderType/lib/Email/FolderType.pm 2003-08-10 17:38:52 UTC (rev 1302) +++ trunk/Email-FolderType/lib/Email/FolderType.pm 2003-08-11 06:18:45 UTC (rev 1303) @@ -1,68 +1,79 @@ +use strict; package Email::FolderType; - -use strict; use vars qw($VERSION @ISA @EXPORT_OK); require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(folder_type); -$VERSION = '0.5'; +$VERSION = '0.6'; =head1 NAME -Email::FolderType - return type of a mail folder +Email::FolderType - determine the type of a mail folder =head1 SYNOPSIS use Email::FolderType qw(folder_type); - print folder_type "~/mymbox"; # prints 'Mbox' print folder_type "~/a_maildir/"; # prints 'Maildir' print folder_type "some_mh/."; # prints 'MH' + print folder_type "an_archive//"; # prints 'Ezmlm' +=head1 DESCRIPTION +Provides a utility subroutine for detecting the type of a given mail +folder. + =head1 SUBROUTINES -=head2 folder_type <file path> +=head2 folder_type <path> -Automatically detects what type of mail archive the -file path is and returns the name. +Automatically detects what type of mail folder the path refers to and +returns the name of that type. +It primarily bases the type on the suffix of the path given. + + Suffix | Type + --------+--------- + / | Maildir + /. | MH + // | Ezmlm + +In case of no known suffix it checks for a known file structure. If +that doesn't work out it defaults to C<Mbox>. + =cut -sub folder_type ($) -{ +sub folder_type ($) { my $folder = shift; + + return "Ezmlm" if $folder =~ m{//$}; return "Maildir" if $folder =~ m{/$}; return "MH" if $folder =~ m{/\.$}; - return "Maildir" if -d $folder; + return "Maildir" if -d "$folder/cur"; + return "Ezmlm" if -d "$folder/archive"; + # XXX return "MH" if -e WHAT?; return "Mbox"; } -=head1 DESCRIPTION +1; +__END__ -Provides a utility module for detecting the type of -a given mail box. - -=head1 BUGS - -Currently only handles mh, mbox and maildir - =head1 AUTHOR Simon Wistow <simon@xxxxxxxxxx.xxx> =head1 COPYING -(C)opyright 2003, Simon Wistow +(C) Copyright 2003, Simon Wistow Distributed under the same terms as Perl itself. -This software is under no warranty and will probably ruin your life, kill your friends, burn your house and bring about the apocalypse +This software is under no warranty and will probably ruin your life, +kill your friends, burn your house and bring about the apocalypse. - =head1 SEE ALSO L<Email::LocalDelivery>, L<Email::Folder>
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52