r27159 - in /branches/upstream/libmime-lite-perl/current: META.yml changes.pod lib/MIME/Lite.pm
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Sat Nov 22 19:03:36 UTC 2008
Author: dmn
Date: Sat Nov 22 19:03:34 2008
New Revision: 27159
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27159
Log:
[svn-upgrade] Integrating new upstream version, libmime-lite-perl (3.023)
Modified:
branches/upstream/libmime-lite-perl/current/META.yml
branches/upstream/libmime-lite-perl/current/changes.pod
branches/upstream/libmime-lite-perl/current/lib/MIME/Lite.pm
Modified: branches/upstream/libmime-lite-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmime-lite-perl/current/META.yml?rev=27159&op=diff
==============================================================================
--- branches/upstream/libmime-lite-perl/current/META.yml (original)
+++ branches/upstream/libmime-lite-perl/current/META.yml Sat Nov 22 19:03:34 2008
@@ -1,13 +1,25 @@
--- #YAML:1.0
-name: MIME-Lite
-version: 3.021
-abstract: ~
-license: perl
-generated_by: ExtUtils::MakeMaker version 6.36_01
-distribution_type: module
-requires:
- Email::Date::Format: 1.000
- File::Spec: 0
+name: MIME-Lite
+version: 3.023
+abstract: ~
+author: []
+license: perl
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+requires:
+ Email::Date::Format: 1.000
+ File::Basename: ~
+ File::Spec: 0
+ Mail::Address: 1.62
+ MIME::Base64: ~
+ MIME::QuotedPrint: ~
+ MIME::Types: 1.13
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.48
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.2.html
- version: 1.2
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: branches/upstream/libmime-lite-perl/current/changes.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmime-lite-perl/current/changes.pod?rev=27159&op=diff
==============================================================================
--- branches/upstream/libmime-lite-perl/current/changes.pod (original)
+++ branches/upstream/libmime-lite-perl/current/changes.pod Sat Nov 22 19:03:34 2008
@@ -1,6 +1,29 @@
=head1 CHANGE LOG
=over 4
+
+=item Version 3.023
+
+Correct erroneous changelog entry
+
+Fix typo in perldoc: utf-8, not utf8
+
+=item Version 3.022
+
+Behave on Cygwin as on Win32 with regard to defaulting to SMTP sending.
+
+Respect crazy people who put multiple Cc or Bcc headers in message (#30574,
+thanks Pavel V. Rochnyack!)
+
+We no longer rewrite array and hash refs in the send_by_sendmail args so
+aggressively.
+
+Cope with missing local sendmail (thanks to Debian for patching for this, and
+for putting up with me (rjbs) being an insufferable jerk!)
+
+Fix weird unicode-in-$1 bug (thanks SREZIC!)
+
+Other minor bug fixes.
=item Version 3.021
Modified: branches/upstream/libmime-lite-perl/current/lib/MIME/Lite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmime-lite-perl/current/lib/MIME/Lite.pm?rev=27159&op=diff
==============================================================================
--- branches/upstream/libmime-lite-perl/current/lib/MIME/Lite.pm (original)
+++ branches/upstream/libmime-lite-perl/current/lib/MIME/Lite.pm Sat Nov 22 19:03:34 2008
@@ -1,5 +1,6 @@
package MIME::Lite;
-
+use strict;
+require 5.004; ### for /c modifier in m/\G.../gc modifier
=head1 NAME
@@ -11,6 +12,98 @@
use MIME::Lite;
### Create a new single-part message, to send a GIF file:
+ $msg = MIME::Lite->new(
+ From => 'me at myhost.com',
+ To => 'you at yourhost.com',
+ Cc => 'some at other.com, some at more.com',
+ Subject => 'Helloooooo, nurse!',
+ Type => 'image/gif',
+ Encoding => 'base64',
+ Path => 'hellonurse.gif'
+ );
+ $msg->send; # send via default
+
+Create a multipart message (i.e., one with attachments) and send it SMTP
+
+ ### Create a new multipart message:
+ $msg = MIME::Lite->new(
+ From => 'me at myhost.com',
+ To => 'you at yourhost.com',
+ Cc => 'some at other.com, some at more.com',
+ Subject => 'A message with 2 parts...',
+ Type => 'multipart/mixed'
+ );
+
+ ### Add parts (each "attach" has same arguments as "new"):
+ $msg->attach(
+ Type => 'TEXT',
+ Data => "Here's the GIF file you wanted"
+ );
+ $msg->attach(
+ Type => 'image/gif',
+ Path => 'aaa000123.gif',
+ Filename => 'logo.gif',
+ Disposition => 'attachment'
+ );
+ ### use Net:SMTP to do the sending
+ $msg->send('smtp','some.host', Debug=>1 );
+
+Output a message:
+
+ ### Format as a string:
+ $str = $msg->as_string;
+
+ ### Print to a filehandle (say, a "sendmail" stream):
+ $msg->print(\*SENDMAIL);
+
+Send a message:
+
+ ### Send in the "best" way (the default is to use "sendmail"):
+ $msg->send;
+ ### Send a specific way:
+ $msg->send('type', at args);
+
+Specify default send method:
+
+ MIME::Lite->send('smtp','some.host',Debug=>0);
+
+with authentication
+
+ MIME::Lite->send('smtp','some.host',
+ AuthUser=>$user, AuthPass=>$pass);
+
+=head1 DESCRIPTION
+
+In the never-ending quest for great taste with fewer calories,
+we proudly present: I<MIME::Lite>.
+
+MIME::Lite is intended as a simple, standalone module for generating
+(not parsing!) MIME messages... specifically, it allows you to
+output a simple, decent single- or multi-part message with text or binary
+attachments. It does not require that you have the Mail:: or MIME::
+modules installed, but will work with them if they are.
+
+You can specify each message part as either the literal data itself (in
+a scalar or array), or as a string which can be given to open() to get
+a readable filehandle (e.g., "<filename" or "somecommand|").
+
+You don't need to worry about encoding your message data:
+this module will do that for you. It handles the 5 standard MIME encodings.
+
+=head1 EXAMPLES
+
+=head2 Create a simple message containing just text
+
+ $msg = MIME::Lite->new(
+ From =>'me at myhost.com',
+ To =>'you at yourhost.com',
+ Cc =>'some at other.com, some at more.com',
+ Subject =>'Helloooooo, nurse!',
+ Data =>"How's it goin', eh?"
+ );
+
+=head2 Create a simple message containing just an image
+
$msg = MIME::Lite->new(
From =>'me at myhost.com',
To =>'you at yourhost.com',
@@ -20,98 +113,6 @@
Encoding =>'base64',
Path =>'hellonurse.gif'
);
- $msg->send; # send via default
-
-Create a multipart message (i.e., one with attachments) and send it SMTP
-
- ### Create a new multipart message:
- $msg = MIME::Lite->new(
- From =>'me at myhost.com',
- To =>'you at yourhost.com',
- Cc =>'some at other.com, some at more.com',
- Subject =>'A message with 2 parts...',
- Type =>'multipart/mixed'
- );
-
- ### Add parts (each "attach" has same arguments as "new"):
- $msg->attach(
- Type =>'TEXT',
- Data =>"Here's the GIF file you wanted"
- );
- $msg->attach(
- Type =>'image/gif',
- Path =>'aaa000123.gif',
- Filename =>'logo.gif',
- Disposition => 'attachment'
- );
- ### use Net:SMTP to do the sending
- $msg->send('smtp','some.host', Debug=>1 );
-
-Output a message:
-
- ### Format as a string:
- $str = $msg->as_string;
-
- ### Print to a filehandle (say, a "sendmail" stream):
- $msg->print(\*SENDMAIL);
-
-Send a message:
-
- ### Send in the "best" way (the default is to use "sendmail"):
- $msg->send;
- ### Send a specific way:
- $msg->send('type', at args);
-
-Specify default send method:
-
- MIME::Lite->send('smtp','some.host',Debug=>0);
-
-with authentication
-
- MIME::Lite->send('smtp','some.host',
- AuthUser=>$user, AuthPass=>$pass);
-
-=head1 DESCRIPTION
-
-In the never-ending quest for great taste with fewer calories,
-we proudly present: I<MIME::Lite>.
-
-MIME::Lite is intended as a simple, standalone module for generating
-(not parsing!) MIME messages... specifically, it allows you to
-output a simple, decent single- or multi-part message with text or binary
-attachments. It does not require that you have the Mail:: or MIME::
-modules installed, but will work with them if they are.
-
-You can specify each message part as either the literal data itself (in
-a scalar or array), or as a string which can be given to open() to get
-a readable filehandle (e.g., "<filename" or "somecommand|").
-
-You don't need to worry about encoding your message data:
-this module will do that for you. It handles the 5 standard MIME encodings.
-
-=head1 EXAMPLES
-
-=head2 Create a simple message containing just text
-
- $msg = MIME::Lite->new(
- From =>'me at myhost.com',
- To =>'you at yourhost.com',
- Cc =>'some at other.com, some at more.com',
- Subject =>'Helloooooo, nurse!',
- Data =>"How's it goin', eh?"
- );
-
-=head2 Create a simple message containing just an image
-
- $msg = MIME::Lite->new(
- From =>'me at myhost.com',
- To =>'you at yourhost.com',
- Cc =>'some at other.com, some at more.com',
- Subject =>'Helloooooo, nurse!',
- Type =>'image/gif',
- Encoding =>'base64',
- Path =>'hellonurse.gif'
- );
=head2 Create a multipart message
@@ -171,7 +172,7 @@
Type =>'text/html',
Data =>'<H1>Hello</H1>',
);
- $part->attr('content-type.charset' => 'UTF8');
+ $part->attr('content-type.charset' => 'UTF-8');
$part->add('X-Comment' => 'A message for you');
### Attach it to any message:
@@ -326,13 +327,9 @@
=cut
-
-require 5.004; ### for /c modifier in m/\G.../gc modifier
-
-use Carp();
+use Carp ();
use FileHandle;
-use strict;
use vars qw(
$AUTO_CC
$AUTO_CONTENT_TYPE
@@ -346,44 +343,41 @@
);
+# GLOBALS, EXTERNAL/CONFIGURATION...
+$VERSION = '3.023';
+
+### Automatically interpret CC/BCC for SMTP:
+$AUTO_CC = 1;
+
+### Automatically choose content type from file name:
+$AUTO_CONTENT_TYPE = 0;
+
+### Automatically choose encoding from content type:
+$AUTO_ENCODE = 1;
+
+### Check paths right before printing:
+$AUTO_VERIFY = 1;
+
+### Set this true if you don't want to use MIME::Base64/QuotedPrint/Types:
+$PARANOID = 0;
+
+### Don't warn me about dangerous activities:
+$QUIET = undef;
+
+### Unsupported (for tester use): don't qualify boundary with time/pid:
+$VANILLA = 0;
+
+$MIME::Lite::DEBUG = 0;
+
#==============================
#==============================
#
-# GLOBALS, EXTERNAL/CONFIGURATION...
-$VERSION = '3.021';
-
-### Automatically interpret CC/BCC for SMTP:
-$AUTO_CC = 1;
-
-### Automatically choose content type from file name:
-$AUTO_CONTENT_TYPE = 0;
-
-### Automatically choose encoding from content type:
-$AUTO_ENCODE = 1;
-
-### Check paths right before printing:
-$AUTO_VERIFY = 1;
-
-### Set this true if you don't want to use MIME::Base64/QuotedPrint/Types:
-$PARANOID = 0;
-
-### Don't warn me about dangerous activities:
-$QUIET = undef;
-
-### Unsupported (for tester use): don't qualify boundary with time/pid:
-$VANILLA = 0;
-
-$MIME::Lite::DEBUG = 0;
-
-#==============================
-#==============================
-#
# GLOBALS, INTERNAL...
my $Sender = "";
my $SENDMAIL = "";
-if ( $^O =~ /win32/i ) {
+if ( $^O =~ /win32|cygwin/i ) {
$Sender = "smtp";
} else {
### Find sendmail:
@@ -401,13 +395,13 @@
}
}
unless (-x $SENDMAIL) {
- Carp::croak "can't find an executable sendmail"
+ undef $SENDMAIL;
}
}
### Our sending facilities:
my %SenderArgs = (
- sendmail => ["$SENDMAIL -t -oi -oem"],
+ sendmail => [$SENDMAIL ? "$SENDMAIL -t -oi -oem" : undef],
smtp => [],
sub => [],
);
@@ -503,12 +497,13 @@
my $LOCALPART = '(?:' . $WORD . '(?:' . '\\.' . $WORD . ')*' . ')';
my $ADDR = '(?:' . $LOCALPART . '@' . $DOMAIN . ')';
my $PHRASE = '(?:' . $WORD . ')+';
- my $SEP = "(?:^\\s*|\\s*,\\s*)"; ### before elems in a list
+ my $SEP = "(?:^\\s*|\\s*,\\s*)"; ### before elems in a list
sub my_extract_full_addrs {
my $str = shift;
+ return unless $str;
my @addrs;
- $str =~ s/\s/ /g; ### collapse whitespace
+ $str =~ s/\s/ /g; ### collapse whitespace
pos($str) = 0;
while ( $str !~ m{\G\s*\Z}gco ) {
@@ -2259,7 +2254,9 @@
### Encode it line by line:
while ( $untainted =~ m{^(.*[\r\n]*)}smg ) {
- $out->print( encode_qp($1) ); ### have to do it line by line...
+ ### have to do it line by line...
+ my $line = $1; # copy to avoid weird bug; rt 39334
+ $out->print( encode_qp($line) );
}
last DATA;
};
@@ -2659,6 +2656,25 @@
=cut
+sub _unfold_stupid_params {
+ my $self = shift;
+
+ my %p;
+ STUPID_PARAM: for (my $i = 0; $i < @_; $i++) { ## no critic Loop
+ my $item = $_[$i];
+ if (not ref $item) {
+ $p{ $item } = $_[ ++$i ];
+ } elsif (UNIVERSAL::isa($item, 'HASH')) {
+ $p{ $_ } = $item->{ $_ } for keys %$item;
+ } elsif (UNIVERSAL::isa($item, 'ARRAY')) {
+ for (my $j = 0; $j < @$item; $j += 2) {
+ $p{ $item->[ $j ] } = $item->[ $j + 1 ];
+ }
+ }
+ }
+
+ return %p;
+}
sub send_by_sendmail {
my $self = shift;
@@ -2666,6 +2682,7 @@
if ( @_ == 1 and !ref $_[0] ) {
### Use the given command...
my $sendmailcmd = shift @_;
+ Carp::croak "No sendmail command available" unless $sendmailcmd;
### Do it:
local *SENDMAIL;
@@ -2674,10 +2691,7 @@
close SENDMAIL;
$return = ( ( $? >> 8 ) ? undef: 1 );
} else { ### Build the command...
- my %p = map { UNIVERSAL::isa( $_, 'ARRAY' ) ? @$_
- : UNIVERSAL::isa( $_, 'HASH' ) ? %$_
- : $_
- } @_;
+ my %p = $self->_unfold_stupid_params(@_);
$p{Sendmail} = $SENDMAIL unless defined $p{Sendmail};
@@ -2831,9 +2845,7 @@
my @hdr_to = extract_only_addrs( scalar $self->get('To') );
if ($AUTO_CC) {
foreach my $field (qw(Cc Bcc)) {
- my $value = $self->get($field);
- push @hdr_to, extract_only_addrs($value)
- if defined($value);
+ push @hdr_to, extract_only_addrs($_) for $self->get($field);
}
}
Carp::croak "send_by_smtp: nobody to send to for host '$hostname'?!\n"
More information about the Pkg-perl-cvs-commits
mailing list