r52514 - in /trunk/libemail-mime-createhtml-perl: Changes META.yml Makefile.PL README debian/changelog lib/Email/MIME/CreateHTML.pm t/Email-MIME-CreateHTML.t t/data/CreateHTML_01.html t/data/CreateHTML_02a.html t/data/CreateHTML_02b.html

carnil-guest at users.alioth.debian.org carnil-guest at users.alioth.debian.org
Thu Feb 11 07:07:16 UTC 2010


Author: carnil-guest
Date: Thu Feb 11 07:07:00 2010
New Revision: 52514

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=52514
Log:
New upstream release

Modified:
    trunk/libemail-mime-createhtml-perl/Changes
    trunk/libemail-mime-createhtml-perl/META.yml
    trunk/libemail-mime-createhtml-perl/Makefile.PL
    trunk/libemail-mime-createhtml-perl/README
    trunk/libemail-mime-createhtml-perl/debian/changelog
    trunk/libemail-mime-createhtml-perl/lib/Email/MIME/CreateHTML.pm
    trunk/libemail-mime-createhtml-perl/t/Email-MIME-CreateHTML.t
    trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_01.html
    trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02a.html
    trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02b.html

Modified: trunk/libemail-mime-createhtml-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/Changes?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/Changes (original)
+++ trunk/libemail-mime-createhtml-perl/Changes Thu Feb 11 07:07:00 2010
@@ -1,3 +1,8 @@
+Wed Feb 10 13:33:01 2010 - 1.029
+    Add Carp to fix warnings (CPAN RT51208)
+    Insist on 3.15 of HTML::TokeParser::Simple (CPAN RT 28788)
+    POD Syntax fix
+
 Thu Oct 26 10:25:31 2006 - 1.026
     * General bug-avoidance changes
     * Update for PEP website

Modified: trunk/libemail-mime-createhtml-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/META.yml?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/META.yml (original)
+++ trunk/libemail-mime-createhtml-perl/META.yml Thu Feb 11 07:07:00 2010
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Email-MIME-CreateHTML
-version:      1.026
+version:      1.029
 version_from: lib/Email/MIME/CreateHTML.pm
 installdirs:  site
 requires:
@@ -9,11 +9,11 @@
     Email::MIME::Creator:          0
     File::Slurp::WithinPolicy:     0
     HTML::Tagset:                  0
-    HTML::TokeParser::Simple:      0
+    HTML::TokeParser::Simple:      3.15
     Log::Trace:                    0
     MIME::Types:                   0
     Test::Assertions:              0
     Test::Assertions::TestScript:  0
 
 distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+generated_by: ExtUtils::MakeMaker version 6.30

Modified: trunk/libemail-mime-createhtml-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/Makefile.PL?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/Makefile.PL (original)
+++ trunk/libemail-mime-createhtml-perl/Makefile.PL Thu Feb 11 07:07:00 2010
@@ -8,7 +8,7 @@
                 Test::Assertions => 0,
                 Test::Assertions::TestScript => 0,
                 Email::MIME::Creator => 0,
-                HTML::TokeParser::Simple => 0,
+                HTML::TokeParser::Simple => 3.15,
                 HTML::Tagset => 0,
                 File::Slurp::WithinPolicy => 0,
                 MIME::Types => 0,

Modified: trunk/libemail-mime-createhtml-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/README?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/README (original)
+++ trunk/libemail-mime-createhtml-perl/README Thu Feb 11 07:07:00 2010
@@ -1,4 +1,4 @@
-Email::MIME::CreateHTML v1.026
+Email::MIME::CreateHTML v1.029
 
 (c) BBC 2006. This program is free software; you can redistribute it and/or modify it under the GNU GPL.
 

Modified: trunk/libemail-mime-createhtml-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/debian/changelog?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/debian/changelog (original)
+++ trunk/libemail-mime-createhtml-perl/debian/changelog Thu Feb 11 07:07:00 2010
@@ -1,3 +1,9 @@
+libemail-mime-createhtml-perl (1.029-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Salvatore Bonaccorso <salvatore.bonaccorso at gmail.com>  Thu, 11 Feb 2010 08:06:30 +0100
+
 libemail-mime-createhtml-perl (1.026-3) unstable; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/libemail-mime-createhtml-perl/lib/Email/MIME/CreateHTML.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/lib/Email/MIME/CreateHTML.pm?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/lib/Email/MIME/CreateHTML.pm (original)
+++ trunk/libemail-mime-createhtml-perl/lib/Email/MIME/CreateHTML.pm Thu Feb 11 07:07:00 2010
@@ -2,7 +2,7 @@
 # Purpose : Build HTML emails
 # Author  : Tony Hennessy
 # Created : Aug 2006
-# CVS     : $Header: /home/cvs/software/cvsroot/email/lib/Email/MIME/CreateHTML.pm,v 1.26 2006/08/24 21:41:37 johna Exp $
+# CVS     : $Header: /home/cvs/software/cvsroot/email/lib/Email/MIME/CreateHTML.pm,v 1.29 2010/01/12 11:26:38 jamiel Exp $
 ###############################################################################
 
 package Email::MIME::CreateHTML;
@@ -18,7 +18,7 @@
 
 #Globals
 use vars qw($VERSION %EMBED @EXPORT_OK @ISA);
-$VERSION = sprintf "%d.%03d", q$Revision: 1.26 $ =~ /: (\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%03d", q$Revision: 1.29 $ =~ /: (\d+)\.(\d+)/;
 %EMBED = (
 	'bgsound' => {'src'=>1},
 	'body'    => {'background'=>1},
@@ -194,6 +194,7 @@
 package Email::MIME;
 
 use strict;
+use Carp;
 use Email::MIME::Creator;
 
 sub create_html {
@@ -391,15 +392,17 @@
 This should be a data structure of the form:
 
 	embed_elements => {
-		$elementname => {$attrname => $boolean}	
-	}
-
-i.e. resource will be embedded if C<$params->{embed_elements}{$element}{$attr}> is true.
+		$elementname_1 => {$attrname_1 => $boolean_1},
+		$elementname_2 => {$attrname_2 => $boolean_2},
+		...
+	}
+
+i.e. resource will be embedded if C<$embed_elements-E<gt>{$elementname}-E<gt>{$attrname}> is true.
 
 =item resolver =E<gt> I<object>
 
-If a resolver is supplied this will be used to fetch the resources that are embedded as MIME objects in the email.  If no resolver is given the default behaviour is to use the Email::MIME::CreateHTML::Resolver::BestAvailable resolver to read $uri with any $base value prefixed.
-Resources fetched using the resolver will be cached if an object_cache is supplied.
+If a resolver is supplied this will be used to fetch the resources that are embedded as MIME objects in the email.  If no resolver is given the default behaviour is to choose the best available resolver to read C<$uri> with any C<$base> value prefixed.
+Resources fetched using the resolver will be cached if an C<object_cache> is supplied.
 
 =item base =E<gt> I<scalar>
 
@@ -420,9 +423,9 @@
 
 =item objects =E<gt> I<hash reference>
 
-A reference to a hash of external objects. Keys are Content Ids (only letters, numbers and underscores allowed), 
+A reference to a hash of external objects. Keys are Content Ids
 and the values are filepaths or URIs used to fetch the resource with the resolver. We use C<MIME::Types> to derive the type from the 
-file extension. For example in an HTML mail you would use the file keyed on '123' like C<E<lt>img src="cid:123" alt="a test" width="20" height="20" /E<gt>>
+file extension. For example in an HTML mail you would use the file keyed on '12345678 at bbc.co.uk' like C<E<lt>img src="cid:12345678 at bbc.co.uk" alt="a test" width="20" height="20" /E<gt>>
 
 =item object_cache =E<gt> I<cache object>
 
@@ -515,14 +518,14 @@
 
 	my $html = qq{
 		<html><head><title>My Document</title></head><body>
-			<p>Here is a picture:</p><img src="cid:image1">
+			<p>Here is a picture:</p><img src="cid:some_image_jpg at bbc.co.uk">
 		</body></html>	
 	};
 
 You then need to create a mapping of the Content IDs to object filenames:
 	
 	my %objects = (
-		"image1" => "/var/html/some_image.jpg"
+		"some_image_jpg at bbc.co.uk" => "/var/html/some_image.jpg"
 	);
 
 Finally you need to disable both the C<embed> and C<inline_css> options to turn off HTML parsing, and pass in your mapping: 
@@ -658,7 +661,7 @@
 		
 =head1 SEE ALSO
 
-L<Perl Email Project|http://pep.pobox.com>
+Perl Email Project L<http://pep.pobox.com>
 
 L<Email::Simple>, L<Email::MIME>, L<Email::Send>, L<Email::MIME::Creator>
 
@@ -668,7 +671,7 @@
 
 =head1 VERSION
 
-$Revision: 1.26 $ on $Date: 2006/08/24 21:41:37 $ by $Author: johna $
+$Revision: 1.29 $ on $Date: 2010/01/12 11:26:38 $ by $Author: jamiel $
 
 =head1 AUTHOR
 

Modified: trunk/libemail-mime-createhtml-perl/t/Email-MIME-CreateHTML.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/t/Email-MIME-CreateHTML.t?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/t/Email-MIME-CreateHTML.t (original)
+++ trunk/libemail-mime-createhtml-perl/t/Email-MIME-CreateHTML.t Thu Feb 11 07:07:00 2010
@@ -8,7 +8,7 @@
 
 use strict;
 use vars qw/$opt_m/;
-use Test::Assertions::TestScript(tests => 48, options => {'m=s' => \$opt_m});
+use Test::Assertions::TestScript(tests => 49, options => {'m=s' => \$opt_m});
 use File::Slurp;
 use File::Copy;
 
@@ -90,7 +90,7 @@
 	],
 	body => $html_in,
 	objects => {
-		'123' => './data/end.png',
+		'123 at bbc.co.uk' => './data/end.png',
 		'landscapeview' => './data/landscape.jpg',
 	},
 	inline_css => 0,
@@ -103,11 +103,10 @@
 @parts = $mime->parts;
 ASSERT( scalar(@parts) == 3, "number of parts");
 test_mime( $parts[0], qr'text/html', $html_out );
-my $p = $parts[1]->content_type . $parts[2]->content_type;
+my $p = join '', map defined $_ ? $_->content_type : '', @parts[1..2];
 ASSERT($p =~ m|image/png|i && $p =~ m|image/jpeg|i, "Mime types image/png and image/jpeg");
 
 send_mail( $mime ) if($opt_m);
-
 
 # HTML with embedded objects, with text alternative
 # using embedded images
@@ -128,7 +127,7 @@
 	text_body => $text_body,
 	base => './data',
 	objects => {
-		'123' => 'end.png',
+		'123 at bbc.co.uk' => 'end.png',
 	},
 	inline_javascript => 1,
 );
@@ -142,11 +141,13 @@
 test_mime( $parts[0], qr'text/plain', $text_body );
 test_mime( $parts[1], qr'multipart/related', undef );
 
-my @sub_parts = $parts[1]->parts;
+my @sub_parts = defined $parts[1] ? $parts[1]->parts : ();
 ASSERT( scalar(@sub_parts) == 3, "number of parts");
 test_mime( $sub_parts[0], qr'text/html', $html_out );
-my $sp = $sub_parts[1]->content_type . $sub_parts[2]->content_type;
-ASSERT($sp =~ m|image/png|i && $sp =~ m|image/jpeg|i, "Mime types image/png and image/jpeg");
+my $sp = [map { defined($_) ? $_->content_type : () } @sub_parts[1..2]];
+DUMP("Sub parts",$sp);
+ASSERT((grep { m!image/png!i } @$sp), "MIME type image/png present");
+ASSERT((grep { m!image/jpeg!i } @$sp), "MIME type image/jpeg present");
 
 send_mail( $mime ) if($opt_m);
 
@@ -202,7 +203,7 @@
 		body => $html_in,
 		base => './data',
 		objects => {
-			'end_image' => 'cache_test_end.png',
+			'abcdefghi at bbc.co.uk' => 'cache_test_end.png',
 		},
 		object_cache => $cache,
 	);
@@ -219,7 +220,7 @@
 	body => $html_in,
 	base => './data',
 	objects => {
-		'end_image' => 'cache_test_end.png',
+		'abcdefghi at bbc.co.uk' => 'cache_test_end.png',
 	},
 	object_cache => $cache,
 );
@@ -239,7 +240,7 @@
 	body => $html_in,
 	base => './data',
 	objects => {
-		'end_image' => 'cache_test_end.png',
+		'abcdefghi at bbc.co.uk' => 'cache_test_end.png',
 	},
 	object_cache => $cache,
 );
@@ -262,36 +263,44 @@
 sub test_mime {
 	my ($mime, $exp_content_type, $exp_body) = @_;
 
-	my $got_content_type = $mime->content_type;
-	ASSERT( $got_content_type =~ /^$exp_content_type/i, "content-type: $got_content_type");
+	my $got_content_type = defined $mime ? $mime->content_type : undef;
+	ASSERT( defined $got_content_type && $got_content_type =~ /^$exp_content_type/i, "content-type: $got_content_type");
 
 	if ( defined $exp_body ) {
-		my $got_body = $mime->body;
-		# we don't care about trailing white space
-		$got_body =~ s/\s+$//g;
+		my $got_body;
+
 		$exp_body =~ s/\s+$//g;
-		# This is a quick fix to allow us to test against randomly generated cids
-		# note that the 10 is because the existing tests had some short all numeric cids
-		$got_body =~ s/cid:\d{10}\d+/cid:/g;
-		TRACE("EXPECTED:\n==========\n".$exp_body."\n==========\n");
-		TRACE("GOT:\n==========\n".$got_body."\n==========\n");
-		ASSERT($got_body eq $exp_body, "body");
+
+		if(defined $mime) {
+		    $got_body = $mime->body;
+			# we don't care about trailing white space
+	 	    $got_body =~ s/\s+$//g;
+			# This is a quick fix to allow us to test against randomly generated cids
+			# note that the 10 is because the existing tests had some short all numeric cids
+			$got_body =~ s/cid:\d{10}\d+/cid:/g;
+		}
+		DUMP("test_mime", { expected => $exp_body, got => $got_body });
+		ASSERT(defined $got_body && $got_body eq $exp_body, "body");
 	}
 }
 
 # Actually send the mail
 sub send_mail {
 	my $email = shift;
-	unless ($ENV{SMTP_HOST}) {
-		warn "You need to define the SMTP_HOST env var to send emails";
-		return;
-	}
-
+	my $smtp_host = $ENV{SMTP_HOST} || 'localhost';
+	warn "SMTP_HOST env var not set in environment using 'localhost'\n" unless ($ENV{SMTP_HOST});
 	require Email::Send;
 	warn "Sending email to '$mailto'...\n";
-	my $sender = Email::Send->new({mailer => 'SMTP'});
-	$sender->mailer_args([Host => $ENV{SMTP_HOST}]);
-	$sender->send($email);
+	if ( $Email::Send::VERSION < 2.0 ) {
+		my $rv = Email::Send::send('SMTP',$email, $smtp_host);
+		die $rv if ! $rv;
+	}
+	else {
+		my $sender = Email::Send->new({mailer => 'SMTP'});
+		$sender->mailer_args([Host => $smtp_host]);
+		my $rv = $sender->send($email);
+		die $rv if ! $rv;
+	}
 }
 
 #######################################################
@@ -316,4 +325,4 @@
 	return $self->{$key};
 }
 
-1;
+1;

Modified: trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_01.html
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_01.html?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_01.html (original)
+++ trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_01.html Thu Feb 11 07:07:00 2010
@@ -7,7 +7,7 @@
 <li>the stylesheet is not inlined</li>
 <li>we use capitals in our img tag</li>
 </ul>
-Hello HTML World with an image <IMG SRC="cid:123" ALT="the end"> and another one <img src="cid:landscapeview" alt="landscape">
+Hello HTML World with an image <IMG SRC="cid:123 at bbc.co.uk" ALT="the end"> and another one <img src="cid:landscapeview" alt="landscape">
 </body>
 </html>
 

Modified: trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02a.html
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02a.html?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02a.html (original)
+++ trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02a.html Thu Feb 11 07:07:00 2010
@@ -7,6 +7,6 @@
 <p>Look! a nice <img src="landscape.jpg" alt="landscape"></p>
 <p>Look! the same <img src="landscape.jpg" alt="landscape">, I hope it was included only once in the mime object!</p>
 <p>This <a href="http://www.w3c.org">link</a> (the w3c homepage) did not get rewritten as it is fully qualified.</p>
-<p>This is the <img src="cid:123" alt="end image"> again. Bye.</p>
+<p>This is the <img src="cid:123 at bbc.co.uk" alt="end image"> again. Bye.</p>
 </body>
 </html>

Modified: trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02b.html
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02b.html?rev=52514&op=diff
==============================================================================
--- trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02b.html (original)
+++ trunk/libemail-mime-createhtml-perl/t/data/CreateHTML_02b.html Thu Feb 11 07:07:00 2010
@@ -16,7 +16,7 @@
 <p>Look! a nice <img src="cid:" alt="landscape"></p>
 <p>Look! the same <img src="cid:" alt="landscape">, I hope it was included only once in the mime object!</p>
 <p>This <a href="http://www.w3c.org">link</a> (the w3c homepage) did not get rewritten as it is fully qualified.</p>
-<p>This is the <img src="cid:123" alt="end image"> again. Bye.</p>
+<p>This is the <img src="cid:123 at bbc.co.uk" alt="end image"> again. Bye.</p>
 </body>
 </html>
 




More information about the Pkg-perl-cvs-commits mailing list