mojolicious — переходим на версию 6

Запомнившиеся изменения в версии 6. Некоторые стали очень неожиданным сюрпризом.

6.55 2016-03-08

  • Fixed a bug where Morbo would restart more than once if multiple files changed at the same time. (leejo, nugged)

Теперь не будет миллиона рестартов morbo при запуске rsync

6.54 2016-03-06

  • Added support for named variables to Mojo::Template.
  • Added vars attribute to Mojo::Template.
  • Added process method to Mojo::Template.

Пример:

# Longer version
my $output = $mt->parse('<%= 1 + 1 %>')->process;

# Render with arguments
say Mojo::Template->new->render('<%= $_[0] %>', 'bar');

# Render with named variables
say Mojo::Template->new(vars => 1)->render('<%= $foo %>', {foo => 'bar'});

6.50 2016-02-27

  • Added throw method to Mojo::Exception.

6.49 2016-02-26

  • Removed throw method from Mojo::Exception.

Вот за что я люблю Mojolicious — всегда есть что-то, что может снести весь проект. Всегда надо указывать версию в cpanfile.

6.0 2015-02-26

  • Code name «Clinking Beer Mugs», this is a major release.
  • Removed name listing support from param method in Mojolicious::Controller.
  • Removed name listing support from param method in Mojo::Parameters.

Теперь $controller->param() не возвращает списка параметров, как было в CGI и есть в документации на Mojolicious. Жуткое нововведение… Ниже есть строчка «Added names method to Mojo::Parameters» — наверно, так правильней, но все программы придётся переписать. Вообще обработка параметров сильно изменилась, и не только для запросов. И вообще версия 6 стала не совсем (совсем НЕ) совместимой с 5-й, так что я оставляю весь список:

  • Removed name listing support from error and param methods in Mojolicious::Validator::Validation.
  • Removed multi-name support from cookie, param and signed_cookie methods in Mojolicious::Controller.
  • Removed multi-name support from param method in Mojolicious::Validator::Validation.
  • Removed multi-name support from param method in Mojo::Parameters.
  • Removed multi-name support from cookie and upload methods in Mojo::Message.
  • Removed custom socket support from Mojo::UserAgent.
  • Removed is_fatal, is_level and log methods from Mojo::Log.
  • Removed auto_render method from Mojolicious::Routes.
  • Removed deprecated object-oriented Mojo::Loader API.
  • Removed deprecated accept_interval, lock and unlock attributes from Mojo::IOLoop.
  • Removed deprecated accept_interval, lock_file and lock_timeout attributes from Mojo::Server::Prefork.
  • Removed deprecated bridge method from Mojolicious::Routes::Route.
  • Removed deprecated is_readable method from Mojo::Reactor.
  • Removed deprecated siblings method from Mojo::DOM.
  • Removed deprecated render_exception and render_not_found methods from Mojolicious::Controller.
  • Removed deprecated keep_alive_requests setting from Hypnotoad.
  • Changed return values of all and find methods in Mojo::UserAgent::CookieJar.
  • Renamed template attribute in Mojo::Template to unparsed.
  • Renamed extracting attribute in Mojo::UserAgent::CookieJar to collecting.
  • Renamed types attribute in Mojolicious::Types to mapping.
  • Renamed current attribute in Mojolicious::Routes::Match to position.
  • Renamed pattern attribute in Mojolicious::Routes::Pattern to unparsed.
  • Renamed all_contents, contents, following_siblings, match, next_sibling, node, preceding_siblings, previous_sibling and type methods in Mojo::DOM to descendant_nodes, child_nodes, following_nodes, matches, next_node, type, preceding_nodes, previous_node and tag.
  • Renamed match method in Mojo::DOM and Mojo::DOM::CSS to matches.
  • Renamed extract and inject methods in Mojo::UserAgent::CookieJar to collect and prepare.
  • Renamed inject method in Mojo::UserAgent::Proxy to prepare.
  • Renamed params method in Mojo::Parameters to pairs.
  • Renamed match method in Mojolicious::Routes::Match to find.
  • Renamed -A option of prefork command to -a.
  • Added names method to Mojo::Parameters.
  • Added failed and passed methods to Mojolicious::Validator::Validation.
  • Added -I and -M options to prefork command.
  • Fixed Mojo::Template support for parentheses in expressions. (jberger, sri)

Leave a Reply