Skip to content

Commit

Permalink
better deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 23, 2013
1 parent 6beb2c9 commit e15f134
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 109 deletions.
164 changes: 82 additions & 82 deletions Changes

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/Mojo/Home.pm
Expand Up @@ -82,8 +82,8 @@ 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';
deprecated
'Mojo::Home::slurp_rel_file is DEPRECATED in favor of Mojo::Util::slurp';
slurp shift->rel_file(@_);
}

Expand Down
16 changes: 8 additions & 8 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -61,15 +61,15 @@ sub app_url {

# DEPRECATED in Rainbow!
sub build_form_tx {
deprecated 'Mojo::UserAgent->build_form_tx is DEPRECATED in favor of '
. 'Mojo::UserAgent->build_tx';
deprecated 'Mojo::UserAgent::build_form_tx is DEPRECATED in favor of '
. 'Mojo::UserAgent::build_tx';
shift->transactor->form(@_);
}

# DEPRECATED in Rainbow!
sub build_json_tx {
deprecated 'Mojo::UserAgent->build_json_tx is DEPRECATED in favor of '
. 'Mojo::UserAgent->build_tx';
deprecated 'Mojo::UserAgent::build_json_tx is DEPRECATED in favor of '
. 'Mojo::UserAgent::build_tx';
shift->transactor->json(@_);
}

Expand All @@ -90,17 +90,17 @@ sub need_proxy {

# DEPRECATED in Rainbow!
sub post_form {
deprecated 'Mojo::UserAgent->post_form is DEPRECATED in favor of '
. 'Mojo::UserAgent->post';
deprecated 'Mojo::UserAgent::post_form is DEPRECATED in favor of '
. 'Mojo::UserAgent::post';
my $self = shift;
my $cb = ref $_[-1] eq 'CODE' ? pop : undef;
return $self->start($self->build_form_tx(@_), $cb);
}

# DEPRECATED in Rainbow!
sub post_json {
deprecated 'Mojo::UserAgent->post_json is DEPRECATED in favor of '
. 'Mojo::UserAgent->post';
deprecated 'Mojo::UserAgent::post_json is DEPRECATED in favor of '
. 'Mojo::UserAgent::post';
my $self = shift;
my $cb = ref $_[-1] eq 'CODE' ? pop : undef;
return $self->start($self->build_json_tx(@_), $cb);
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -47,8 +47,8 @@ sub endpoint {

# DEPRECATED in Rainbow!
sub form {
deprecated 'Mojo::UserAgent::Transactor->form is DEPRECATED in favor of '
. 'Mojo::UserAgent::Transactor->tx';
deprecated 'Mojo::UserAgent::Transactor::form is DEPRECATED in favor of '
. 'Mojo::UserAgent::Transactor::tx';
my ($self, $url, $charset) = (shift, shift, shift);
my $form = ref $charset ? $charset : shift;
$charset = undef if ref $charset;
Expand All @@ -57,8 +57,8 @@ sub form {

# DEPRECATED in Rainbow!
sub json {
deprecated 'Mojo::UserAgent::Transactor->json is DEPRECATED in favor of '
. 'Mojo::UserAgent::Transactor->tx';
deprecated 'Mojo::UserAgent::Transactor::json is DEPRECATED in favor of '
. 'Mojo::UserAgent::Transactor::tx';
my ($self, $url, $data) = (shift, shift, shift);
return $self->tx(POST => $url, @_, json => $data);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Util.pm
Expand Up @@ -122,8 +122,8 @@ 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';
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]/;
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Commands.pm
Expand Up @@ -106,8 +106,8 @@ sub run {

# DEPRECATED in Rainbow!
sub start {
deprecated 'Mojolicious::Commands->start is DEPRECATED in favor of '
. 'Mojolicious::Commands->start_app';
deprecated 'Mojolicious::Commands::start is DEPRECATED in favor of '
. 'Mojolicious::Commands::start_app';
my $self = shift;
return $self->start_app($ENV{MOJO_APP} => @_) if $ENV{MOJO_APP};
return $self->new->app->start(@_);
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Routes.pm
Expand Up @@ -81,8 +81,8 @@ sub lookup {

# DEPRECATED in Rainbow!
sub namespace {
deprecated 'Mojolicious::Routes->namespace is DEPRECATED in favor of '
. 'Mojolicious::Routes->namespaces';
deprecated 'Mojolicious::Routes::namespace is DEPRECATED in favor of '
. 'Mojolicious::Routes::namespaces';
my $self = shift;
return $self->namespaces->[0] unless @_;
$self->namespaces->[0] = shift;
Expand Down
10 changes: 5 additions & 5 deletions lib/Test/Mojo.pm
Expand Up @@ -220,17 +220,17 @@ sub post_ok { shift->_request_ok(post => @_) }

# DEPRECATED in Rainbow!
sub post_form_ok {
deprecated 'Test::Mojo->post_form_ok is DEPRECATED in favor of '
. 'Test::Mojo->post_ok';
deprecated
'Test::Mojo::post_form_ok is DEPRECATED in favor of Test::Mojo::post_ok';
my ($self, $url) = (shift, shift);
my $tx = $self->tx($self->ua->post_form($url, @_))->tx;
return $self->_test('ok', $tx->is_finished, encode('UTF-8', "post $url"));
}

# DEPRECATED in Rainbow!
sub post_json_ok {
deprecated 'Test::Mojo->post_json_ok is DEPRECATED in favor of '
. 'Test::Mojo->post_ok';
deprecated
'Test::Mojo::post_json_ok is DEPRECATED in favor of Test::Mojo::post_ok';
my ($self, $url) = (shift, shift);
my $tx = $self->tx($self->ua->post_json($url, @_))->tx;
return $self->_test('ok', $tx->is_finished, encode('UTF-8', "post $url"));
Expand Down Expand Up @@ -376,7 +376,7 @@ sub _wait {
# DEPRECATED in Rainbow!
my $new = $self->{new} //= $wait;
deprecated
'Testing WebSocket messages without Test::Mojo->message_ok is DEPRECATED'
'Testing WebSocket messages without Test::Mojo::message_ok is DEPRECATED'
unless $new;
return $self->message if $new && !$wait;

Expand Down
4 changes: 2 additions & 2 deletions lib/ojo.pm
Expand Up @@ -42,11 +42,11 @@ sub import {

# DEPRECATED in Rainbow!
my $f = sub {
deprecated 'ojo->f is DEPRECATED in favor of ojo->p';
deprecated 'ojo::f is DEPRECATED in favor of ojo::p';
_request($UA->build_form_tx(@_));
};
my $n = sub {
deprecated 'ojo->n is DEPRECATED in favor of ojo->p';
deprecated 'ojo::n is DEPRECATED in favor of ojo::p';
_request($UA->build_json_tx(@_));
};
monkey_patch $caller, f => $f, n => $n;
Expand Down

0 comments on commit e15f134

Please sign in to comment.