Skip to content
Browse files

s/as_header_string/as_string/g

  • Loading branch information...
1 parent 15a64fc commit be28b60b62c29a5a22bc1f123c1f006fd36e3689 @autarch autarch committed Sep 24, 2011
View
6 Changes
@@ -1,5 +1,11 @@
{{$NEXT}}
+[API CHANGES]
+
+- Renamed the Header->as_header_string and HeaderAttribute->as_header_string
+ methods to as_string, so that all objects have the same stringification API.
+
+
0.26 2011-09-19
[BUG FIXES]
View
4 lib/Courriel/Header.pm
@@ -30,7 +30,7 @@ has value => (
charset => { isa => NonEmptyStr, default => 'utf8' },
);
- sub as_header_string {
+ sub as_string {
my $self = shift;
my ($charset) = validated_list(
\@_,
@@ -165,7 +165,7 @@ The header name as passed to the constructor.
The header value as passed to the constructor.
-=head2 $header->as_header_string()
+=head2 $header->as_string()
Returns the header name and value with any necessary MIME encoding and folding.
View
4 lib/Courriel/HeaderAttribute.pm
@@ -59,7 +59,7 @@ override BUILDARGS => sub {
[\x00-\x1f\x7f] # ctrl chars
}x;
- sub as_header_string {
+ sub as_string {
my $self = shift;
my $value = $self->value();
@@ -219,7 +219,7 @@ The attribute's charset.
The attribute's language.
-=head2 $attribute->as_header_string()
+=head2 $attribute->as_string()
This returns the attribute in a form suitable for putting in an email. This
may involve escaping, quoting, splitting up, and otherwise messing with the
View
2 lib/Courriel/Headers.pm
@@ -373,7 +373,7 @@ sub _maybe_fix_broken_headers {
for my $header ( grep { blessed($_) } @{$self->_headers()} ) {
next if $skip{ lc $header->name() };
- $string .= $header->as_header_string( charset => $charset );
+ $string .= $header->as_string( charset => $charset );
}
return $string;
View
2 lib/Courriel/Role/HeaderWithAttributes.pm
@@ -73,7 +73,7 @@ sub _attributes_as_string {
my $attr = $self->_attributes();
- return join '; ', map { $attr->{$_}->as_header_string() } sort keys %{$attr};
+ return join '; ', map { $attr->{$_}->as_string() } sort keys %{$attr};
}
{
View
18 t/HeaderAttribute.t
@@ -12,7 +12,7 @@ use Courriel::HeaderAttribute;
);
is(
- $attr->as_header_string(),
+ $attr->as_string(),
'foo=simple',
'simple attribute as string'
);
@@ -28,7 +28,7 @@ use Courriel::HeaderAttribute;
$expect .= q{ } . 'foo*1=' . ( 'a' x ( 150 - 78 ) );
is(
- $attr->as_header_string(),
+ $attr->as_string(),
$expect,
'simple attribute with continuation as string'
);
@@ -42,7 +42,7 @@ use Courriel::HeaderAttribute;
is(
- $attr->as_header_string(),
+ $attr->as_string(),
q{foo="has space"},
'quoted attribute as string'
);
@@ -56,7 +56,7 @@ use Courriel::HeaderAttribute;
is(
- $attr->as_header_string(),
+ $attr->as_string(),
q{foo="has space and double quote (\\")"},
'quoted attribute as string with escaped quote'
);
@@ -72,7 +72,7 @@ use Courriel::HeaderAttribute;
$expect .= q{ } . q{foo*1="} . ( 'a ' x 31 ) . q{"};
is(
- $attr->as_header_string(),
+ $attr->as_string(),
$expect,
'simple attribute with continuation as string'
);
@@ -86,7 +86,7 @@ use Courriel::HeaderAttribute;
);
is(
- $attr->as_header_string(),
+ $attr->as_string(),
q{foo*=UTF-8'zh'not%20really%20chinese},
'attribute with a language is always encoded'
);
@@ -100,7 +100,7 @@ use Courriel::HeaderAttribute;
);
is(
- $attr->as_header_string(),
+ $attr->as_string(),
q{foo*=UTF-8'zh'%E4%B8%80%E4%B8%80%E4%B8%80},
'attribute with utf-8 data'
);
@@ -118,7 +118,7 @@ use Courriel::HeaderAttribute;
);
is(
- $attr->as_header_string(),
+ $attr->as_string(),
q{foo*=UTF-8''%E4%B8%80%E4%B8%80%E4%B8%80},
'attribute with utf-8 data and no language'
);
@@ -137,7 +137,7 @@ use Courriel::HeaderAttribute;
'foo*3*=%E4%B8%80%E4%B8%80%E4%B8%80%E4%B8%80';
is(
- $attr->as_header_string(),
+ $attr->as_string(),
$expect,
'attribute with utf-8 data and continuations'
);
View
2 t/Headers.t
@@ -605,7 +605,7 @@ EOF
);
like(
- $header->as_header_string(),
+ $header->as_string(),
qr/
\Q?UTF-8?B?\E
\S+

0 comments on commit be28b60

Please sign in to comment.
Something went wrong with that request. Please try again.