Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/remove deprecated functions for compatibility with Mojolicious 5 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions bootylite.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
my $config = plugin 'config';

# set cookie secret
app->secret($config->{secret} // 'Bootylite');
app->secrets([$config->{secret} // 'Bootylite']);

# use the right character encoding
plugin charset => {charset => $config->{encoding}};
Expand Down Expand Up @@ -53,21 +53,7 @@
*Mojolicious::Controller::url_for = sub {
my $c = shift;

# create urls
my $url = $url_for->($c, @_)->to_abs;
my $req_url = $c->req->url->to_abs;

# return relative version if request url exists
if ($req_url->to_string) {

# "repair" if empty
my $rel_url = $url->to_rel($req_url);
return Mojo::URL->new('./') unless $rel_url->to_string;
return $rel_url;
}

# or change nothing
return $url;
return $url_for->($c, @_)->to_abs;
};
}

Expand Down