summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-09-24 10:47:01 -0500
committerJesse Luehrs <doy@tozt.net>2012-09-24 10:47:01 -0500
commit3a057152c20efba7fd1b5a1d7c3710935d175d74 (patch)
tree1ac6869fcf480641cf5a45b5419985bab3abeb99
parent8f2f8e15b34067343931ffa9f47a4295baca8a6c (diff)
downloadweb-request-3a057152c20efba7fd1b5a1d7c3710935d175d74.tar.gz
web-request-3a057152c20efba7fd1b5a1d7c3710935d175d74.zip
make encode and decode private
-rw-r--r--lib/Web/Request.pm22
-rw-r--r--lib/Web/Response.pm4
2 files changed, 13 insertions, 13 deletions
diff --git a/lib/Web/Request.pm b/lib/Web/Request.pm
index acc5fff..84bccaf 100644
--- a/lib/Web/Request.pm
+++ b/lib/Web/Request.pm
@@ -248,7 +248,7 @@ has content => (
# XXX get Plack::TempBuffer onto CPAN separately, so that this doesn't
# always have to be sitting in memory
- return $self->decode($self->_parsed_body->{content});
+ return $self->_decode($self->_parsed_body->{content});
},
);
@@ -265,7 +265,7 @@ has query_parameters => (
(map { $_ => '' } $self->uri->query_keywords),
);
return {
- map { $self->decode($_) } map { $_ => $params{$_} } keys %params
+ map { $self->_decode($_) } map { $_ => $params{$_} } keys %params
};
},
);
@@ -282,8 +282,8 @@ has all_query_parameters => (
my $ret = {};
while (my ($k, $v) = splice @params, 0, 2) {
- $k = $self->decode($k);
- push @{ $ret->{$k} ||= [] }, $self->decode($v);
+ $k = $self->_decode($k);
+ push @{ $ret->{$k} ||= [] }, $self->_decode($v);
}
return $ret;
@@ -303,8 +303,8 @@ has body_parameters => (
my $ret = {};
for my $key (keys %$body) {
my $val = $body->{$key};
- $key = $self->decode($key);
- $ret->{$key} = $self->decode(ref($val) ? $val->[-1] : $val);
+ $key = $self->_decode($key);
+ $ret->{$key} = $self->_decode(ref($val) ? $val->[-1] : $val);
}
return $ret;
@@ -324,10 +324,10 @@ has all_body_parameters => (
my $ret = {};
for my $key (keys %$body) {
my $val = $body->{$key};
- $key = $self->decode($key);
+ $key = $self->_decode($key);
$ret->{$key} = ref($val)
- ? [ map { $self->decode($_) } @$val ]
- : [ $self->decode($val) ];
+ ? [ map { $self->_decode($_) } @$val ]
+ : [ $self->_decode($val) ];
}
return $ret;
@@ -462,7 +462,7 @@ sub param {
$self->parameters->{$key};
}
-sub decode {
+sub _decode {
my $self = shift;
my ($content) = @_;
return $content unless $self->has_encoding;
@@ -724,7 +724,7 @@ overridden in a subclass.
=method default_encoding
-Returns the name of the default encoding to use for C<decode>. Defaults to
+Returns the name of the default encoding to use for decoding. Defaults to
iso8859-1. This can be overridden in a subclass.
=head1 BUGS
diff --git a/lib/Web/Response.pm b/lib/Web/Response.pm
index 914cbbd..c276724 100644
--- a/lib/Web/Response.pm
+++ b/lib/Web/Response.pm
@@ -135,12 +135,12 @@ sub finalize {
return sub {
my $chunk = shift;
return unless defined $chunk;
- return $self->encode($chunk);
+ return $self->_encode($chunk);
};
});
}
-sub encode {
+sub _encode {
my $self = shift;
my ($content) = @_;
return $content unless $self->has_encoding;