Skip to content

Commit

Permalink
remove a lot of deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 12, 2017
1 parent 06f68c2 commit 953ddc8
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 106 deletions.
9 changes: 8 additions & 1 deletion Changes
@@ -1,5 +1,12 @@

7.31 2017-04-06
7.31 2017-04-12
- Removed deprecated filed, slurp and spurt functions from Mojo::Util.
- Removed deprecated parts attribute from Mojo::Home.
- Removed deprecated slurp and spurt methods from Mojo::ByteStream.
- Removed deprecated lib_dir, list_files, parse and rel_dir methods
from Mojo::Home.
- Removed deprecated rel_dir method from Mojolicious::Command.
- Removed deprecated is_status_class method from Mojo::Message::Response.

7.30 2017-04-04
- Deprecated Mojo::Server::Morbo::watch in favor of
Expand Down
20 changes: 0 additions & 20 deletions lib/Mojo/ByteStream.pm
Expand Up @@ -47,31 +47,11 @@ sub secure_compare { Mojo::Util::secure_compare ${shift()}, shift }

sub size { length ${$_[0]} }

# DEPRECATED!
sub slurp {
Mojo::Util::deprecated 'Mojo::ByteStream::slurp is DEPRECATED'
. ' in favor of Mojo::File::slurp';
require Mojo::File;
my $self = shift;
$$self = Mojo::File->new($$self)->slurp;
return $self;
}

sub split {
my ($self, $pattern) = @_;
return Mojo::Collection->new(map { $self->new($_) } split $pattern, $$self);
}

# DEPRECATED!
sub spurt {
Mojo::Util::deprecated 'Mojo::ByteStream::spurt is DEPRECATED'
. ' in favor of Mojo::File::spurt';
require Mojo::File;
my $self = shift;
Mojo::File->new(shift)->spurt($$self);
return $self;
}

sub tap { shift->Mojo::Base::tap(@_) }

sub to_string { ${$_[0]} }
Expand Down
42 changes: 1 addition & 41 deletions lib/Mojo/Home.pm
@@ -1,7 +1,7 @@
package Mojo::Home;
use Mojo::Base 'Mojo::File';

use Mojo::Util qw(class_to_path deprecated);
use Mojo::Util 'class_to_path';

sub detect {
my ($self, $class) = @_;
Expand All @@ -22,48 +22,8 @@ sub detect {
return $self;
}

# DEPRECATED!
sub lib_dir {
deprecated 'Mojo::Home::lib_dir is DEPRECATED';
shift->child('lib')->to_string;
}

# DEPRECATED!
sub list_files {
deprecated
'Mojo::Home::list_files is DEPRECATED in favor of Mojo::Files::list_tree';
my ($self, $dir, $options) = (shift, shift // '', shift);
my $base = $self->child(split('/', $dir));
$base->list_tree($options)->map(sub { join '/', @{$_->to_rel($base)} })
->to_array;
}

sub mojo_lib_dir { shift->new(__FILE__)->sibling('..') }

# DEPRECATED!
sub parse {
deprecated 'Mojo::Home::parse is DEPRECATED';
my $self = shift;
$$self = shift;
return $self;
}

# DEPRECATED!
sub parts {
deprecated 'Mojo::Home::parts is DEPRECATED';
my $self = shift;
return $self->to_array unless @_;
$$self = Mojo::File->new(@{shift()})->to_string;
return $self;
}

# DEPRECATED!
sub rel_dir {
deprecated
'Mojo::Home::rel_dir is DEPRECATED in favor of Mojo::Home::rel_file';
Mojo::File->new(@{shift->parts}, split('/', shift))->to_string;
}

sub rel_file { shift->child(split('/', shift)) }

1;
Expand Down
8 changes: 0 additions & 8 deletions lib/Mojo/Message/Response.pm
Expand Up @@ -3,7 +3,6 @@ use Mojo::Base 'Mojo::Message';

use Mojo::Cookie::Response;
use Mojo::Date;
use Mojo::Util 'deprecated';

has [qw(code message)];
has max_message_size => sub { $ENV{MOJO_MAX_MESSAGE_SIZE} // 2147483648 };
Expand Down Expand Up @@ -134,13 +133,6 @@ sub is_info { shift->_status_class(100) }
sub is_redirect { shift->_status_class(300) }
sub is_server_error { shift->_status_class(500) }

# DEPRECATED!
sub is_status_class {
deprecated 'Mojo::Message::Response::is_status_class is DEPRECATED'
. ' in favor of new is_* methods';
shift->_status_class(@_);
}

sub is_success { shift->_status_class(200) }

sub start_line_size { length shift->_start_line->{start_buffer} }
Expand Down
25 changes: 0 additions & 25 deletions lib/Mojo/Util.pm
Expand Up @@ -66,9 +66,6 @@ our @EXPORT_OK = (
qw(unindent unquote url_escape url_unescape xml_escape xor_encode)
);

# DEPRECATED!
push @EXPORT_OK, qw(files slurp spurt);

# Aliases
monkey_patch(__PACKAGE__, 'b64_decode', \&decode_base64);
monkey_patch(__PACKAGE__, 'b64_encode', \&encode_base64);
Expand Down Expand Up @@ -142,14 +139,6 @@ sub extract_usage {
return unindent($output);
}

# DEPRECATED!
sub files {
deprecated
'Mojo::Util::files is DEPRECATED in favor of Mojo::File::list_tree';
require Mojo::File;
Mojo::File->new(shift)->list_tree(@_)->map('to_string')->each;
}

sub getopt {
my ($array, $opts) = map { ref $_[0] eq 'ARRAY' ? shift : $_ } \@ARGV, [];
my $save = Getopt::Long::Configure(qw(default no_auto_abbrev no_ignore_case),
Expand Down Expand Up @@ -259,23 +248,9 @@ sub secure_compare {
return $r == 0;
}

# DEPRECATED!
sub slurp {

This comment has been minimized.

Copy link
@pavelsr

pavelsr Apr 28, 2017

Maybe it's better to leave that ? Removing this method broke backward compatibility, at least one good module as Mojolicious::Plugin::Webtail will fail to install

This comment has been minimized.

Copy link
@jberger

jberger Apr 28, 2017

Member

The code has warned for 3 months as per the official deprecation policy.

deprecated 'Mojo::Util::slurp is DEPRECATED in favor of Mojo::File::slurp';
require Mojo::File;
Mojo::File->new(shift)->slurp;
}

sub split_cookie_header { _header(shift, 1) }
sub split_header { _header(shift, 0) }

# DEPRECATED!
sub spurt {
deprecated 'Mojo::Util::spurt is DEPRECATED in favor of Mojo::File::spurt';
require Mojo::File;
Mojo::File->new($_[1])->spurt($_[0]) and return $_[0];
}

sub tablify {
my $rows = shift;

Expand Down
8 changes: 0 additions & 8 deletions lib/Mojolicious/Command.pm
Expand Up @@ -6,7 +6,6 @@ use Mojo::File 'path';
use Mojo::Loader 'data_section';
use Mojo::Server;
use Mojo::Template;
use Mojo::Util 'deprecated';

has app => sub { Mojo::Server->new->build_app('Mojo::HelloWorld') };
has description => 'No description';
Expand Down Expand Up @@ -34,13 +33,6 @@ sub extract_usage { Mojo::Util::extract_usage((caller)[1]) }

sub help { print shift->usage }

# DEPRECATED!
sub rel_dir {
deprecated 'Mojolicious::Command::rel_dir is DEPRECATED'
. ' in favor of Mojolicious::Command::rel_file';
path->child(split('/', pop))->to_string;
}

sub rel_file { path->child(split('/', pop)) }

sub render_data {
Expand Down
4 changes: 1 addition & 3 deletions t/pod_coverage.t
Expand Up @@ -8,6 +8,4 @@ plan skip_all => 'Test::Pod::Coverage 1.04+ required for this test!'
unless eval 'use Test::Pod::Coverage 1.04; 1';

# DEPRECATED!
my @deprecated
= qw(files is_status_class lib_dir parse parts rel_dir slurp spurt watch);
all_pod_coverage_ok({also_private => \@deprecated});
all_pod_coverage_ok({also_private => ['watch']});

0 comments on commit 953ddc8

Please sign in to comment.