Skip to content

Commit

Permalink
better examples for routes attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 18, 2013
1 parent 4d1f878 commit 2531343
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,4 +1,7 @@

3.83 2013-01-19
- Improved documentation.

3.82 2013-01-18
- Improved documentation.
- Fixed Windows bugs in tests. (kmx, sri)
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -55,11 +55,11 @@ sub cookies {
}

sub extract_start_line {
my ($self, $bufferref) = @_;
my ($self, $bufref) = @_;

# Ignore any leading empty lines
$$bufferref =~ s/^\s+//;
return undef unless defined(my $line = get_line $bufferref);
$$bufref =~ s/^\s+//;
return undef unless defined(my $line = get_line $bufref);

# We have a (hopefully) full request line
$self->error('Bad request start line', 400) and return undef
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Message/Response.pm
Expand Up @@ -92,10 +92,10 @@ sub cookies {
sub default_message { $MESSAGES{$_[1] || $_[0]->code || 404} || '' }

sub extract_start_line {
my ($self, $bufferref) = @_;
my ($self, $bufref) = @_;

# We have a full response line
return undef unless defined(my $line = get_line $bufferref);
return undef unless defined(my $line = get_line $bufref);
$self->error('Bad response start line') and return undef
unless $line =~ m!^\s*HTTP/(\d\.\d)\s+(\d\d\d)\s*(.+)?$!;
$self->content->skip_body(1) if $self->code($2)->is_empty;
Expand Down
11 changes: 5 additions & 6 deletions lib/Mojolicious.pm
Expand Up @@ -40,7 +40,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Rainbow';
our $VERSION = '3.82';
our $VERSION = '3.83';

sub AUTOLOAD {
my $self = shift;
Expand Down Expand Up @@ -314,12 +314,11 @@ contain more information.
The router, defaults to a L<Mojolicious::Routes> object. You use this in your
startup method to define the url endpoints for your application.
sub startup {
my $self = shift;
# Add route
$app->routes->get('/:controller/:action')->to('test#welcome');
my $r = $self->routes;
$r->get('/:controller/:action')->to('test#welcome');
}
# Add another namespace to load controllers from
push @{$app->routes->namespaces}, 'MyApp::Controller';
=head2 secret
Expand Down

0 comments on commit 2531343

Please sign in to comment.