GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  EMAIL::SIMPLE::FROMHANDLE (3)

.ds Aq ’

NAME

Email::Simple::FromHandle - an Email::Simple but from a handle

CONTENTS

VERSION

version 0.054

SYNOPSIS



  use Email::Simple::FileHandle;

  open my $fh, "<", "email.msg";

  my $email = Email::Simple::FromHandle->new($fh);

  print $email->as_string;
  # or
  $email->stream_to(\*STDOUT);



DESCRIPTION

This is a subclass of Email::Simple which can accept filehandles as the source of an email. It will keep a reference to the filehandle and read from it when it needs to access the body. It does not load the entire body into memory and keep it there.

METHODS

In addition to the standard Email::Simple interface, the following methods are provided:

    handle

This returns the handle given to construct the message. If the message was constructed with a string instead, it returns an IO::String object.

    body_pos

This method returns the position in the handle at which the body begins. This is used for seeking when re-reading the body.

    reset_handle

This method seeks the handle to the body position and resets the header-line iterator.

For unseekable handles (pipes, sockets), this will die.

    getline



  $str = $email->getline;



This method returns either the next line from the headers or the next line from the underlying filehandle. It only returns a single line, regardless of context. Returns undef on EOF.

    stream_to



  $email->stream_to($fh, [ \%arg ]);



This method efficiently writes the message to the passed-in filehandle.

The second argument may be a hashref of options:
<B>reset_handle:B> Whether or not to call $self->reset_handle before reading the message (default true).
<B>chunk_size:B> Number of bytes to read from $self->handle at once (default 65536).
<B>write:B> Coderef to use to print instead of print $fh $chunk. This coderef will receive two arguments, the ’filehandle’ (which need not be a real filehandle at all) and the current chunk of data.

CREDITS

Ricardo SIGNES wrote Email::Simple.

Numerous improvement, especially streamability the handling of pipes, were made by Hans Dieter Pearcey.

AUTHOR

Ricardo SIGNES <rjbs@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2006 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 EMAIL::SIMPLE::FROMHANDLE (3) 2013-09-25

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.