Skip to content

Commit

Permalink
removed qp_decode and qp_encode
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 24, 2012
1 parent 4fbeed8 commit 50dddbe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 43 deletions.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -4,6 +4,8 @@
- Removed Mojolicious::Plugin::I18N so it can be maintained as a separate
distribution.
- Removed app_class attribute from Mojo::Server.
- Removed qp_decode and qp_encode methods from Mojo::ByteStream.
- Removed qp_decode and qp_encode functions from Mojo::Util.
- Renamed Mojo::CookieJar to Mojo::UserAgent::CookieJar.
- Renamed Mojo::Command to Mojolicious::Command.
- Merged get_all_data and get_data methods from Mojo::Command into data
Expand Down
16 changes: 2 additions & 14 deletions lib/Mojo/ByteStream.pm
Expand Up @@ -11,8 +11,8 @@ our @EXPORT_OK = ('b');
my @UTILS = (
qw(b64_decode b64_encode camelize decamelize hmac_md5_sum hmac_sha1_sum),
qw(html_escape html_unescape md5_bytes md5_sum punycode_decode),
qw(punycode_encode qp_decode qp_encode quote sha1_bytes sha1_sum trim),
qw(unquote url_escape url_unescape xml_escape)
qw(punycode_encode quote sha1_bytes sha1_sum trim unquote url_escape),
qw(url_unescape xml_escape)
);
{
no strict 'refs';
Expand Down Expand Up @@ -234,18 +234,6 @@ Alias for L<Mojo::Util/"punycode_decode">.
Alias for L<Mojo::Util/"punycode_encode">.
=head2 C<qp_decode>
$stream = $stream->qp_decode;
Alias for L<Mojo::Util/"qp_decode">.
=head2 C<qp_encode>
$stream = $stream->qp_encode;
Alias for L<Mojo::Util/"qp_encode">.
=head2 C<quote>
$stream = $stream->quote;
Expand Down
21 changes: 2 additions & 19 deletions lib/Mojo/Util.pm
Expand Up @@ -7,7 +7,6 @@ use Encode ();
use File::Basename 'dirname';
use File::Spec::Functions 'catfile';
use MIME::Base64 qw(decode_base64 encode_base64);
use MIME::QuotedPrint qw(decode_qp encode_qp);

# Punycode bootstring parameters
use constant {
Expand Down Expand Up @@ -40,8 +39,8 @@ our @EXPORT_OK = (
qw(b64_decode b64_encode camelize class_to_file class_to_path decamelize),
qw(decode encode get_line hmac_md5_sum hmac_sha1_sum html_escape),
qw(html_unescape md5_bytes md5_sum punycode_decode punycode_encode),
qw(qp_decode qp_encode quote secure_compare sha1_bytes sha1_sum trim),
qw(unquote url_escape url_unescape xml_escape)
qw(quote secure_compare sha1_bytes sha1_sum trim unquote url_escape),
qw(url_unescape xml_escape)
);

sub b64_decode { decode_base64(shift) }
Expand Down Expand Up @@ -246,10 +245,6 @@ sub punycode_encode {
return $output;
}

sub qp_decode { decode_qp(shift) }

sub qp_encode { encode_qp(shift) }

sub quote {
my $string = shift;
$string =~ s/(["\\])/\\$1/g;
Expand Down Expand Up @@ -532,18 +527,6 @@ Punycode encode string.
Quote string.
=head2 C<qp_decode>
my $string = qp_decode $qp;
Quoted Printable decode string.
=head2 C<qp_encode>
my $qp = qp_encode $string;
Quoted Printable encode string.
=head2 C<secure_compare>
my $success = secure_compare $string1, $string2;
Expand Down
11 changes: 1 addition & 10 deletions t/mojo/bytestream.t
Expand Up @@ -5,11 +5,10 @@ use utf8;
# "Homer, we're going to ask you a few simple yes or no questions.
# Do you understand?
# Yes. *lie dectector blows up*"
use Test::More tests => 146;
use Test::More tests => 144;

# Need to be loaded first to trigger edge case
use MIME::Base64;
use MIME::QuotedPrint;
use Mojo::Util 'md5_bytes';
use Mojo::ByteStream 'b';

Expand Down Expand Up @@ -98,14 +97,6 @@ is "$stream", 'foo%C3%9F%C4%80bar%E2%98%BA', 'right url escaped result';
$stream = b('foo%C3%9F%C4%80bar%E2%98%BA')->url_unescape->decode('UTF-8');
is "$stream", "foo\x{df}\x{0100}bar\x{263a}", 'right url unescaped result';

# qp_encode
$stream = b("foo\x{99}bar$%^&3217");
like $stream->qp_encode, qr/^foo\=99bar0\^\&3217/, 'right qp encoded result';

# qp_decode
$stream = b("foo=99bar0^&3217=\n");
is $stream->qp_decode, "foo\x{99}bar$%^&3217", 'right qp decoded result';

# quote
$stream = b('foo; 23 "bar');
is $stream->quote, '"foo; 23 \"bar"', 'right quoted result';
Expand Down

0 comments on commit 50dddbe

Please sign in to comment.