summaryrefslogtreecommitdiff
path: root/fml
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-04-06 01:30:37 +0000
committerfukachan <fukachan>2002-04-06 01:30:37 +0000
commit7d7a6395aca56b967aff6ae10cd250dbc24ac349 (patch)
tree38eb5270143e3c5b76fee606d859989f46fa9cd5 /fml
parent37458e2669a9837fb6610c98a25c0e8ef0743d28 (diff)
downloadfml8-7d7a6395aca56b967aff6ae10cd250dbc24ac349.tar.gz
fml8-7d7a6395aca56b967aff6ae10cd250dbc24ac349.tar.bz2
fml8-7d7a6395aca56b967aff6ae10cd250dbc24ac349.zip
define dirpath()
Diffstat (limited to 'fml')
-rw-r--r--fml/lib/Mail/Message/Spool.pm35
1 files changed, 34 insertions, 1 deletions
diff --git a/fml/lib/Mail/Message/Spool.pm b/fml/lib/Mail/Message/Spool.pm
index 43ad7f17..a901649b 100644
--- a/fml/lib/Mail/Message/Spool.pm
+++ b/fml/lib/Mail/Message/Spool.pm
@@ -2,7 +2,7 @@
#
# Copyright (C) 2002 Ken'ichi Fukamachi
#
-# $FML: Spool.pm,v 1.3 2002/03/31 09:42:36 fukachan Exp $
+# $FML: Spool.pm,v 1.4 2002/04/03 11:33:00 fukachan Exp $
#
package Mail::Message::Spool;
@@ -97,6 +97,39 @@ sub filepath
}
+# Descriptions: return article dirpath with subdir if needed
+# Arguments: OBJ($self) HASH_REF($args)
+# Side Effects: none
+# Return Value: STR(dir path)
+sub dirpath
+{
+ my ($self, $args) = @_;
+
+ if (defined $args->{ base_dir } && defined $args->{ id }) {
+ my $base_dir = $args->{ base_dir };
+ my $id = $args->{ id };
+ my $is_hash = 0;
+ my $dir = '';
+ my $unit = 1000;
+ my $subdir = int($id/$unit);
+
+ if (defined $args->{ use_subdir }) {
+ $is_hash = 1;
+ use File::Spec;
+ $dir = File::Spec->catfile($base_dir, $subdir);
+ }
+ else {
+ $dir = $base_dir;
+ }
+
+ return $dir;
+ }
+ else {
+ croak("filepath: invalid input");
+ }
+}
+
+
#
# test
#