summaryrefslogtreecommitdiff
path: root/fml/lib/Mail/Message.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-05-18 03:50:16 +0000
committerfukachan <fukachan>2001-05-18 03:50:16 +0000
commit32706d34eda4bc289364b64ae3f577def4b0d366 (patch)
tree9119326d719427c6a6bb0ce0460e1582d4f3450f /fml/lib/Mail/Message.pm
parent93090585fd3bc102172b2fde9c0063a364161a65 (diff)
downloadfml8-32706d34eda4bc289364b64ae3f577def4b0d366.tar.gz
fml8-32706d34eda4bc289364b64ae3f577def4b0d366.tar.bz2
fml8-32706d34eda4bc289364b64ae3f577def4b0d366.zip
parse() can accpet either file or fd (file descriptor).
Diffstat (limited to 'fml/lib/Mail/Message.pm')
-rw-r--r--fml/lib/Mail/Message.pm24
1 files changed, 21 insertions, 3 deletions
diff --git a/fml/lib/Mail/Message.pm b/fml/lib/Mail/Message.pm
index 0e3c2f29..7ad06f61 100644
--- a/fml/lib/Mail/Message.pm
+++ b/fml/lib/Mail/Message.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Message.pm,v 1.22 2001/05/06 02:37:53 fukachan Exp $
+# $FML: Message.pm,v 1.23 2001/05/06 08:19:11 fukachan Exp $
#
package Mail::Message;
@@ -394,17 +394,35 @@ sub dup_header
=head1 METHODS to parse
-=head2 C<parse($fd)>
+=head2 C<parse($args)>
read data from file descriptor C<$fd> and parse it to the mail header
and the body.
+ parse({
+ fd => $fd,
+ });
+
+You can specify file not file descriptor.
+
+ parse({
+ file => $file,
+ });
+
=cut
sub parse
{
my ($self, $args) = @_;
- my $fd = $args->{ fd } || \*STDIN;
+ my $fd;
+
+ if (defined($args->{ 'file' })) {
+ use FileHandle;
+ $fd = new FileHandle $args->{ 'file' };
+ }
+ else {
+ $fd = $args->{ fd } || \*STDIN;
+ }
# make an object
my ($type) = ref($self) || $self;