Permalink
Browse files

removed a few deprecated functions and methods

  • Loading branch information...
kraih committed Apr 11, 2013
1 parent 0772343 commit 93179b269bdefd20d2a170959180b7dedf215a1a
Showing with 9 additions and 49 deletions.
  1. +2 −0 Changes
  2. +0 −1 lib/Mojo/ByteStream.pm
  3. +1 −8 lib/Mojo/Home.pm
  4. +0 −25 lib/Mojo/Util.pm
  5. +4 −13 lib/Test/Mojo.pm
  6. +2 −2 t/pod_coverage.t
View
@@ -1,6 +1,8 @@
3.95 2013-04-11
- Added finished_ok method to Test::Mojo.
- Removed deprecated slurp_rel_file method from Mojo::Home.
- Removed deprecated html_escape function from Mojo::Util.
- Improved Mojo::Transaction::WebSocket with support for status codes.
- Improved documentation. (jberger, sri)
- Improved tests.
View
@@ -15,7 +15,6 @@ my @UTILS = (
qw(sha1_bytes sha1_sum slurp spurt squish trim unquote url_escape),
qw(url_unescape xml_escape xor_encode)
);
push @UTILS, 'html_escape'; # DEPRECATED in Rainbow!
for my $name (@UTILS) {
my $sub = Mojo::Util->can($name);
Mojo::Util::monkey_patch __PACKAGE__, $name, sub {
View
@@ -10,7 +10,7 @@ use File::Basename 'dirname';
use File::Find 'find';
use File::Spec::Functions qw(abs2rel catdir catfile splitdir);
use FindBin;
use Mojo::Util qw(class_to_path deprecated slurp);
use Mojo::Util qw(class_to_path slurp);
sub new { shift->SUPER::new->parse(@_) }
@@ -80,13 +80,6 @@ sub parse {
sub rel_dir { catdir(@{shift->{parts} || []}, split '/', shift) }
sub rel_file { catfile(@{shift->{parts} || []}, split '/', shift) }
# DEPRECATED in Rainbow!
sub slurp_rel_file {
deprecated
'Mojo::Home::slurp_rel_file is DEPRECATED in favor of Mojo::Util::slurp';
slurp shift->rel_file(@_);
}
sub to_string { catdir(@{shift->{parts} || []}) }
1;
View
@@ -33,12 +33,6 @@ for my $line (split "\x0a", slurp(catfile dirname(__FILE__), 'entities.txt')) {
$ENTITIES{$1} = defined $3 ? (chr(hex $2) . chr(hex $3)) : chr(hex $2);
}
# DEPRECATED in Rainbow!
my %REVERSE = ("\x{0027}" => '#39;');
$REVERSE{$ENTITIES{$_}} //= $_
for sort { @{[$a =~ /[A-Z]/g]} <=> @{[$b =~ /[A-Z]/g]} }
sort grep {/;/} keys %ENTITIES;
# Encoding cache
my %CACHE;
@@ -51,9 +45,6 @@ our @EXPORT_OK = (
qw(xor_encode)
);
# DEPRECATED in Rainbow!
push @EXPORT_OK, 'html_escape';
sub b64_decode { decode_base64($_[0]) }
sub b64_encode { encode_base64($_[0], $_[1]) }
@@ -123,17 +114,6 @@ sub get_line {
sub hmac_md5_sum { _hmac(\&md5, @_) }
sub hmac_sha1_sum { _hmac(\&sha1, @_) }
# DEPRECATED in Rainbow!
sub html_escape {
deprecated 'Mojo::Util::html_escape is DEPRECATED in favor of '
. 'Mojo::Util::xml_escape';
my ($string, $pattern) = @_;
$pattern ||= '^\n\r\t !#$%(-;=?-~';
return $string unless $string =~ /[^$pattern]/;
$string =~ s/([$pattern])/_encode($1)/ge;
return $string;
}
sub html_unescape {
my $string = shift;
$string
@@ -385,11 +365,6 @@ sub _decode {
return "&$_[1]";
}
# DEPRECATED in Rainbow!
sub _encode {
return exists $REVERSE{$_[0]} ? "&$REVERSE{$_[0]}" : "&#@{[ord($_[0])]};";
}
sub _encoding {
$CACHE{$_[0]} //= find_encoding($_[0]) // croak "Unknown encoding '$_[0]'";
}
View
@@ -205,7 +205,7 @@ sub message_like {
sub message_ok {
my ($self, $desc) = @_;
return $self->_test('ok', !!$self->_wait(1), $desc, 'message received');
return $self->_test('ok', !!$self->_wait, $desc, 'message received');
}
sub message_unlike {
@@ -332,13 +332,13 @@ sub _get_content {
sub _json {
my ($self, $method, $p) = @_;
return Mojo::JSON::Pointer->new->$method(
Mojo::JSON->new->decode(@{$self->_wait || []}[1]), $p);
Mojo::JSON->new->decode(@{$self->message}[1]), $p);
}
sub _message {
my ($self, $name, $value, $desc) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my ($type, $msg) = @{$self->_wait || ['']};
my ($type, $msg) = @{$self->message};
# Type check
if (ref $value eq 'HASH') {
@@ -377,16 +377,7 @@ sub _text {
}
sub _wait {
my ($self, $wait) = @_;
# DEPRECATED in Rainbow!
my $new = $self->{new} //= $wait;
deprecated
'Testing WebSocket messages without Test::Mojo::message_ok is DEPRECATED'
unless $new;
return $self->message if $new && !$wait;
# Wait for message
my $self = shift;
Mojo::IOLoop->one_tick while !$self->{finished} && !@{$self->{messages}};
return $self->message(shift @{$self->{messages}})->message;
}
View
@@ -9,8 +9,8 @@ plan skip_all => 'Test::Pod::Coverage 1.04 required for this test!'
# DEPRECATED in Rainbow!
my @rainbow = (
qw(build_form_tx build_json_tx end form html_escape json post_form),
qw(post_form_ok post_json post_json_ok slurp_rel_file)
qw(build_form_tx build_json_tx end form json post_form post_form_ok),
qw(post_json post_json_ok)
);
# False positive constants

0 comments on commit 93179b2

Please sign in to comment.