$VERSION
=
'2.067'
;
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
;
}
for
(
$args
->{lock_file})
{
$self
->locker->filename
( !
defined
$_
? File::Spec->catfile(
$directory
,
'.lock'
)
: File::Spec->file_name_is_absolute(
$_
) ?
$_
: File::Spec->catfile(
$directory
,
$_
)
);
}
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
$dir
=~ s!/$!!;
$dir
;
}
sub
readMessageFilenames() {
shift
->notImplemented}
1;