Skip to content

Commit

Permalink
better request information examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 16, 2012
1 parent ddf2267 commit 84df65a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

3.0 2012-06-15
3.0 2012-06-16
- Code name "Rainbow", this is a major release.
- Removed Mojolicious::Plugin::I18N so it can be maintained as a separate
distribution.
Expand Down
14 changes: 1 addition & 13 deletions lib/Mojo/Message.pm
Expand Up @@ -22,19 +22,7 @@ has version => '1.1';
# "I'll keep it short and sweet. Family. Religion. Friendship.
# These are the three demons you must slay if you wish to succeed in
# business."
sub at_least_version {
my ($self, $version) = @_;

# Major and minor
my ($search_major, $search_minor) = split /\./, $version;
my ($current_major, $current_minor) = split /\./, $self->version;

# Major version is newer
return 1 if $search_major < $current_major;

# Minor version is newer or equal
return $search_major == $current_major && $search_minor <= $current_minor;
}
sub at_least_version { shift->version >= shift }

sub body {
my $self = shift;
Expand Down
4 changes: 4 additions & 0 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -824,6 +824,10 @@ L<Mojo::Message::Request> object.
# Extract request information
my $userinfo = $c->req->url->userinfo;
my $agent = $c->req->headers->user_agent;
my $body = $c->req->body;
my $foo = $c->req->json('/23/foo');
my $bar = $c->req->dom('div.bar')->first->text;
=head2 C<res>
Expand Down

0 comments on commit 84df65a

Please sign in to comment.