|
NAMEPOE::Filter::Transparent::SMTP - Make SMTP transparency a breeze :)VERSIONVERSION: 0.2SYNOPSISuse POE::Filter::Transparent::SMTP; my @array_of_things = ( q{.first thing(no new line)}, qq{.second thing (with new line)\n}, q{.third thing (no new line}, q{.}, # this is the message terminator, so it shouldn't be # prepended with an extra dot ); my $filter = POE::Filter::Transparent::SMTP->new( ); my $lines = $filter->put( \@array_of_things ); DESCRIPTIONThe filter aims to make SMTP data transparent just before going onto the wire as per RFC 821 Simple Mail Transfer Protocol Section 4.5.2. TRANSPARENCY. See <http://www.faqs.org/rfcs/rfc821.html> for details.Conversely the filter takes transparent data from the wire and converts it to the original format. The main purpose of this filter is to help POE::Component::Client::SMTP create transparent messages when comunicating with an SMTP server. However the filter can be used by any Perl SMTP client or server. Internally it uses POE::Filter::Line in order to split messages into lines. Also as stated in the RFC every line it puts on the wire is ended by <CRLF>. When receiving data from the wire (as it is the case for an SMTP server), lines should be separated with <CRLF> as the RFC specifies. However this is not always true as some SMTP clients are broken. So if you are using the filter on the receiving end maybe you would like to specify a regular expression that is more flexible for the line terminator. METHODSAll methods are conforming to POE::Filter specs. For more details have a look at POE::Filter documentation.new HASHREF_OF_PARAMETERSmy $filter = POE::Filter::Transparent::SMTP->new( InputLiteral => qq{\015\012}, OutputLiteral => qq{\015\012}, ); Creates a new filter. It accepts four optional arguments:
get_one_start ARRAYREF$filter->get_one_start( $array_ref_of_formatted_lines ); Accepts an array reference to a list of unprocessed chunks and adds them to the buffer in order to be processed. get_onemy $array_ref = $filter->get_one(); my $line = $array_ref->[0]; Returns zero or one processed record from the raw data buffer. The method is not greedy and is the preffered method you should use to get processed records. get ARRAY_REFmy $lines = $filter->get( $array_ref_of_formatted_lines ); for (my $i = 0; $i < scalar @{$lines}; $i++ ) { # do something with $lines->[$i]; } "get" is the greedy form of "get_one" and internally is implemented as one call of "get_one_start" and a loop of "get_one". Normally you shouldn't use this as using "get_one_start" and "get_one" would make filter swapping easyer. put ARRAYREFmy @array_of_things = ( q{.first thing(no new line)}, qq{.second thing (with new line)\n}, q{.third thing (no new line}, q{.}, ); my $lines = $filter->put( \@array_of_things ); print Dumper( $lines ); would return something similar as below $VAR1 = [ '..first thing(no new line) ', '..second thing (with new line) ', '..third thing (no new line ', '. ' ]; "put" takes an array ref of unprocessed records and prepares them to be put on the wire making the records SMTP Transparent. get_pendingReturns a list of data that is in the buffer (without clearing it) or undef in case there is nothing in the buffer.clonemy $new_filter = $filter->clone(); Clones the current filter keeping the same parameters, but with an empty buffer. SEE ALSOPOE POE::Filter POE::Filter::Line POE::Component::Client::SMTP POE::Component::Server::SimpleSMTPKNOWN ISSUESBy default, InputLiteral is set to the default POE::Filter::Line which can become an issue if you are using the filter on the receiving end.BUGSPlease report any bugs or feature requests to "bug-poe-filter-transparent-smtp at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Filter-Transparent-SMTP>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.SUPPORTYou can find documentation for this module with the perldoc command.perldoc POE::Filter::Transparent::SMTP You can also look for information at:
ACKNOWLEDGMENTSThanks to Jay Jarvinen who pointed out that POE::Component::Client::SMTP is not doing SMTP transparency as it should (RFC 821, Section 4.5.2. TRANSPARENCY)AUTHORGeorge Nistorica, ultradm __at cpan __dot orgCOPYRIGHT & LICENSECopyright 2008-2009 George Nistorica, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |