r76869 - in /branches/upstream/libcourriel-perl/current: ./ lib/ lib/Courriel/ lib/Courriel/Part/ lib/Courriel/Role/ lib/Courriel/Types/ lib/Email/Abstract/ t/
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Fri Jul 1 18:27:01 UTC 2011
Author: carnil
Date: Fri Jul 1 18:26:59 2011
New Revision: 76869
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=76869
Log:
[svn-upgrade] new version libcourriel-perl (0.15)
Modified:
branches/upstream/libcourriel-perl/current/Changes
branches/upstream/libcourriel-perl/current/META.json
branches/upstream/libcourriel-perl/current/META.yml
branches/upstream/libcourriel-perl/current/Makefile.PL
branches/upstream/libcourriel-perl/current/README
branches/upstream/libcourriel-perl/current/dist.ini
branches/upstream/libcourriel-perl/current/lib/Courriel.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Builder.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/ContentType.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Disposition.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Headers.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Helpers.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Multipart.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Single.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Role/HasParts.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Headers.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Part.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Types.pm
branches/upstream/libcourriel-perl/current/lib/Courriel/Types/Internal.pm
branches/upstream/libcourriel-perl/current/lib/Email/Abstract/Courriel.pm
branches/upstream/libcourriel-perl/current/t/Builder.t
branches/upstream/libcourriel-perl/current/t/Courriel.t
branches/upstream/libcourriel-perl/current/t/Part-Single.t
Modified: branches/upstream/libcourriel-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/Changes?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/Changes (original)
+++ branches/upstream/libcourriel-perl/current/Changes Fri Jul 1 18:26:59 2011
@@ -1,3 +1,23 @@
+0.15 2011-06-28
+
+- Skip a test which may fail on other people's machines, as File::LibMagic
+ does not return consistent results on all machines.
+
+
+0.14 2011-06-25
+
+- An email part with non-text content would still be treated as character data
+ rather than binary data, and its Content-Type header would end up with a
+ charset of us-ascii. This has been fixed, and now you must explicitly ask
+ for a charset in the Content-Type header when creating a
+ Courriel::ContentType object. Note that plain and html body parts created
+ via Courriel::Builder are unaffected, since these always default to UTF-8 as
+ the charset. Reported by ico. RT #69085.
+
+- Added Courriel::ContentType->has_charset() and
+ Courriel::ContentType->is_binary() methods.
+
+
0.13 2011-06-20
- A multipart email build with Courriel::Builder would have a broken
Modified: branches/upstream/libcourriel-perl/current/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/META.json?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/META.json (original)
+++ branches/upstream/libcourriel-perl/current/META.json Fri Jul 1 18:26:59 2011
@@ -4,7 +4,7 @@
"Dave Rolsky <autarch at urth.org>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 4.200006, CPAN::Meta::Converter version 2.110930",
+ "generated_by" : "Dist::Zilla version 4.200008, CPAN::Meta::Converter version 2.110440",
"license" : [
"artistic_2"
],
@@ -62,6 +62,6 @@
"web" : "http://git.urth.org/Courriel.git"
}
},
- "version" : "0.13"
+ "version" : "0.15"
}
Modified: branches/upstream/libcourriel-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/META.yml?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/META.yml (original)
+++ branches/upstream/libcourriel-perl/current/META.yml Fri Jul 1 18:26:59 2011
@@ -10,7 +10,7 @@
configure_requires:
ExtUtils::MakeMaker: 6.30
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.200006, CPAN::Meta::Converter version 2.110930'
+generated_by: 'Dist::Zilla version 4.200008, CPAN::Meta::Converter version 2.110440'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -38,4 +38,4 @@
resources:
bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Courriel
repository: git://git.urth.org/Courriel.git
-version: 0.13
+version: 0.15
Modified: branches/upstream/libcourriel-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/Makefile.PL?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/Makefile.PL (original)
+++ branches/upstream/libcourriel-perl/current/Makefile.PL Fri Jul 1 18:26:59 2011
@@ -2,7 +2,7 @@
use strict;
use warnings;
-BEGIN { require 5.10.0; }
+use 5.010000;
use ExtUtils::MakeMaker 6.30;
@@ -43,7 +43,7 @@
'Sub::Exporter' => '0',
'namespace::autoclean' => '0'
},
- 'VERSION' => '0.13',
+ 'VERSION' => '0.15',
'test' => {
'TESTS' => 't/*.t'
}
Modified: branches/upstream/libcourriel-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/README?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/README (original)
+++ branches/upstream/libcourriel-perl/current/README Fri Jul 1 18:26:59 2011
@@ -1,7 +1,7 @@
This archive contains the distribution Courriel,
-version 0.13:
+version 0.15:
High level email parsing and manipulation
Modified: branches/upstream/libcourriel-perl/current/dist.ini
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/dist.ini?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/dist.ini (original)
+++ branches/upstream/libcourriel-perl/current/dist.ini Fri Jul 1 18:26:59 2011
@@ -3,7 +3,7 @@
license = Artistic_2_0
copyright_holder = Dave Rolsky
-version = 0.13
+version = 0.15
[NextRelease]
format = %-8v %{yyyy-MM-dd}d
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel;
BEGIN {
- $Courriel::VERSION = '0.13';
+ $Courriel::VERSION = '0.15';
}
use 5.10.0;
@@ -433,7 +433,7 @@
=head1 VERSION
-version 0.13
+version 0.15
=head1 SYNOPSIS
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Builder.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Builder.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Builder.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Builder.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Builder;
BEGIN {
- $Courriel::Builder::VERSION = '0.13';
+ $Courriel::Builder::VERSION = '0.15';
}
use strict;
@@ -473,7 +473,7 @@
=head1 VERSION
-version 0.13
+version 0.15
=head1 SYNOPSIS
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/ContentType.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/ContentType.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/ContentType.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/ContentType.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::ContentType;
BEGIN {
- $Courriel::ContentType::VERSION = '0.13';
+ $Courriel::ContentType::VERSION = '0.15';
}
use strict;
@@ -8,7 +8,7 @@
use namespace::autoclean;
use Courriel::Helpers qw( quote_and_escape_attribute_value );
-use Courriel::Types qw( HashRef NonEmptyStr );
+use Courriel::Types qw( HashRef Maybe NonEmptyStr );
use Moose;
use MooseX::StrictConstructor;
@@ -20,11 +20,11 @@
);
has charset => (
- is => 'ro',
- isa => NonEmptyStr,
- init_arg => undef,
- lazy => 1,
- builder => '_build_charset',
+ is => 'rw',
+ writer => '_set_charset',
+ isa => Maybe [NonEmptyStr],
+ init_arg => undef,
+ predicate => 'has_charset',
);
has _attributes => (
@@ -39,10 +39,13 @@
},
);
-sub _build_charset {
+sub BUILD {
my $self = shift;
- return $self->_attributes()->{charset} // 'us-ascii';
+ $self->_set_charset( $self->_attributes()->{charset} )
+ if exists $self->_attributes()->{charset};
+
+ return;
}
sub as_header_value {
@@ -58,6 +61,12 @@
}
return $string;
+}
+
+sub is_binary {
+ my $self = shift;
+
+ return $self->has_charset() && $self->charset() ne 'binary' ? 0 : 1;
}
__PACKAGE__->meta()->make_immutable();
@@ -76,7 +85,7 @@
=head1 VERSION
-version 0.13
+version 0.15
=head1 SYNOPSIS
@@ -130,14 +139,17 @@
=head2 $ct->charset()
-Returns the charset for the content type.
-
-This defaults to the value found in the C<attributes> or "us-ascii" as a
-fallback.
+Returns the charset for the content type, which will be the value found in the
+C<attributes>, if one exists.
=head2 $ct->attributes()
Returns a hash (not a reference) of the attributes passed to the constructor.
+
+=head2 $ct->is_binary()
+
+Returns true unless the attachment looks like text data. Currently, this means
+that is has a charset defined and the charset is not "binary".
=head2 $ct->get_attribute($key)
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Disposition.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Disposition.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Disposition.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Disposition.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Disposition;
BEGIN {
- $Courriel::Disposition::VERSION = '0.13';
+ $Courriel::Disposition::VERSION = '0.15';
}
use strict;
@@ -111,7 +111,7 @@
=head1 VERSION
-version 0.13
+version 0.15
=head1 SYNOPSIS
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Headers.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Headers.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Headers.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Headers.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Headers;
BEGIN {
- $Courriel::Headers::VERSION = '0.13';
+ $Courriel::Headers::VERSION = '0.15';
}
use strict;
@@ -413,7 +413,7 @@
=head1 VERSION
-version 0.13
+version 0.15
=head1 SYNOPSIS
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Helpers.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Helpers.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Helpers.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Helpers.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Helpers;
BEGIN {
- $Courriel::Helpers::VERSION = '0.13';
+ $Courriel::Helpers::VERSION = '0.15';
}
use strict;
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Multipart.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Multipart.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Multipart.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Multipart.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Part::Multipart;
BEGIN {
- $Courriel::Part::Multipart::VERSION = '0.13';
+ $Courriel::Part::Multipart::VERSION = '0.15';
}
use strict;
@@ -122,7 +122,7 @@
=head1 VERSION
-version 0.13
+version 0.15
=head1 SYNOPSIS
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Single.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Single.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Single.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Part/Single.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Part::Single;
BEGIN {
- $Courriel::Part::Single::VERSION = '0.13';
+ $Courriel::Part::Single::VERSION = '0.15';
}
use strict;
@@ -148,6 +148,8 @@
$self->encoded_content(),
);
+ return \$bytes if $self->content_type()->is_binary();
+
return \(
decode(
$self->content_type()->charset(),
@@ -161,10 +163,11 @@
my $encoding = $self->encoding();
- my $bytes = encode(
+ my $bytes
+ = $self->content_type()->is_binary() ? $self->content() : encode(
$self->content_type()->charset(),
$self->content(),
- );
+ );
return \$bytes if $unencoded{ lc $encoding };
@@ -207,7 +210,7 @@
=head1 VERSION
-version 0.13
+version 0.15
=head1 SYNOPSIS
@@ -287,6 +290,11 @@
Returns the mime type for this part.
+=head2 $part->has_charset()
+
+Return true if the part has a charset defined. Binary attachments will usually
+not have this defined.
+
=head2 $part->charset()
Returns the charset for this part.
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Role/HasParts.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Role/HasParts.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Role/HasParts.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Role/HasParts.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Role::HasParts;
BEGIN {
- $Courriel::Role::HasParts::VERSION = '0.13';
+ $Courriel::Role::HasParts::VERSION = '0.15';
}
use strict;
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Headers.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Headers.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Headers.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Headers.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Role::Headers;
BEGIN {
- $Courriel::Role::Headers::VERSION = '0.13';
+ $Courriel::Role::Headers::VERSION = '0.15';
}
use strict;
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Part.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Part.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Part.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Role/Part.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Role::Part;
BEGIN {
- $Courriel::Role::Part::VERSION = '0.13';
+ $Courriel::Role::Part::VERSION = '0.15';
}
use strict;
@@ -37,7 +37,7 @@
lazy => 1,
builder => '_build_content_type',
predicate => '_has_content_type',
- handles => [qw( mime_type charset )],
+ handles => [qw( mime_type charset has_charset )],
);
sub as_string {
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Types.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Types.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Types.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Types.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Types;
BEGIN {
- $Courriel::Types::VERSION = '0.13';
+ $Courriel::Types::VERSION = '0.15';
}
use strict;
Modified: branches/upstream/libcourriel-perl/current/lib/Courriel/Types/Internal.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Courriel/Types/Internal.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Courriel/Types/Internal.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Courriel/Types/Internal.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Courriel::Types::Internal;
BEGIN {
- $Courriel::Types::Internal::VERSION = '0.13';
+ $Courriel::Types::Internal::VERSION = '0.15';
}
use strict;
Modified: branches/upstream/libcourriel-perl/current/lib/Email/Abstract/Courriel.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/lib/Email/Abstract/Courriel.pm?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/lib/Email/Abstract/Courriel.pm (original)
+++ branches/upstream/libcourriel-perl/current/lib/Email/Abstract/Courriel.pm Fri Jul 1 18:26:59 2011
@@ -1,6 +1,6 @@
package Email::Abstract::Courriel;
BEGIN {
- $Email::Abstract::Courriel::VERSION = '0.13';
+ $Email::Abstract::Courriel::VERSION = '0.15';
}
use strict;
@@ -58,7 +58,7 @@
=head1 VERSION
-version 0.13
+version 0.15
=head1 DESCRIPTION
Modified: branches/upstream/libcourriel-perl/current/t/Builder.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/t/Builder.t?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/t/Builder.t (original)
+++ branches/upstream/libcourriel-perl/current/t/Builder.t Fri Jul 1 18:26:59 2011
@@ -180,11 +180,16 @@
'correct mime type detected for attachment'
);
- is(
- $attachment->charset(),
- 'us-ascii',
- 'correct charset detected for attachment'
- );
+ SKIP:
+ {
+ skip 'This test relies on my local magic definitions', 1
+ unless $ENV{RELEASE_TESTING};
+ is(
+ $attachment->charset(),
+ 'us-ascii',
+ 'correct charset detected for attachment'
+ );
+ }
is(
$attachment->content(),
Modified: branches/upstream/libcourriel-perl/current/t/Courriel.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/t/Courriel.t?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/t/Courriel.t (original)
+++ branches/upstream/libcourriel-perl/current/t/Courriel.t Fri Jul 1 18:26:59 2011
@@ -40,10 +40,9 @@
'email with no content type defaults to text/plain'
);
- is(
- $part->content_type()->charset(),
- 'us-ascii',
- 'email with no charset defaults to us-ascii'
+ ok(
+ !$part->content_type()->has_charset(),
+ 'email with no charset does not get a default charset'
);
is(
Modified: branches/upstream/libcourriel-perl/current/t/Part-Single.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcourriel-perl/current/t/Part-Single.t?rev=76869&op=diff
==============================================================================
--- branches/upstream/libcourriel-perl/current/t/Part-Single.t (original)
+++ branches/upstream/libcourriel-perl/current/t/Part-Single.t Fri Jul 1 18:26:59 2011
@@ -245,5 +245,33 @@
);
}
+{
+ my $part = Courriel::Part::Single->new(
+ headers => Courriel::Headers->new(),
+ content_type =>
+ Courriel::ContentType->new( mime_type => 'image/jpeg' ),
+ encoded_content => 'foo',
+ );
+
+ ok(
+ !Encode::is_utf8( $part->content() ),
+ 'part is not decoded as utf8 when content-type has no charset'
+ );
+}
+
+{
+ my $part = Courriel::Part::Single->new(
+ headers => Courriel::Headers->new(),
+ content_type =>
+ Courriel::ContentType->new( mime_type => 'image/jpeg' ),
+ content => 'foo',
+ );
+
+ ok(
+ defined $part->encoded_content(),
+ 'can build encoded content for binary content'
+ );
+}
+
done_testing();
More information about the Pkg-perl-cvs-commits
mailing list