/usr/share/perl5/Mail/Box/Dir.pm is in libmail-box-perl 2.118-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | # Copyrights 2001-2015 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
package Mail::Box::Dir;
use vars '$VERSION';
$VERSION = '2.118';
use base 'Mail::Box';
use strict;
use filetest 'access';
use Mail::Box::Dir::Message;
use Mail::Message::Body::Lines;
use Mail::Message::Body::File;
use Mail::Message::Body::Delayed;
use Mail::Message::Body::Multipart;
use Mail::Message::Head;
use Mail::Message::Head::Delayed;
use Carp;
use File::Copy;
use File::Spec;
use File::Basename;
sub init($)
{ my ($self, $args) = @_;
$args->{body_type} ||= sub {'Mail::Message::Body::Lines'};
return undef
unless $self->SUPER::init($args);
my $class = ref $self;
my $directory = $self->{MBD_directory}
= $args->{directory} || $self->directory;
if(-d $directory) {;}
elsif($args->{create} && $class->create($directory, %$args)) {;}
else
{ $self->log(NOTICE => "No directory $directory for folder of $class");
return undef;
}
# About locking
for($args->{lock_file})
{ $self->locker->filename
( !defined $_ ? File::Spec->catfile($directory, '.lock') # default
: File::Spec->file_name_is_absolute($_) ? $_ # absolute
: File::Spec->catfile($directory, $_) # relative
);
}
# Check if we can write to the folder, if we need to.
{ # filetest 'access' is slower, but works correctly if we have a
# filesystem with ACLs
use filetest 'access';
if($self->writable && -e $directory && ! -w $directory)
{ $self->log(WARNING=> "Folder directory $directory is write-protected.");
$self->{MB_access} = 'r';
}
}
$self;
}
#-------------------------------------------
sub organization() { 'DIRECTORY' }
#-------------------------------------------
sub directory()
{ my $self = shift;
$self->{MBD_directory}
||= $self->folderToDirectory($self->name, $self->folderdir);
}
#-------------------------------------------
sub nameOfSubFolder($;$)
{ my ($thing, $name) = (shift, shift);
my $parent = @_ ? shift : ref $thing ? $thing->directory : undef;
defined $parent ? "$parent/$name" : $name;
}
#-------------------------------------------
sub folderToDirectory($$)
{ my ($class, $name, $folderdir) = @_;
my $dir = ( $name =~ m#^=\/?(.*)# ? "$folderdir/$1" : $name);
$dir =~ s!/$!!;
$dir;
}
#-------------------------------------------
sub readMessageFilenames() {shift->notImplemented}
#-------------------------------------------
1;
|