Skip to content

Commit

Permalink
updated Changes and changed formatting a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 8, 2011
1 parent 5b14ad0 commit 12c2c15
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Changes
Expand Up @@ -6,7 +6,7 @@ This file documents the revision history for Perl extension Mojolicious.
- Added EXPERIMENTAL status code support to rendred method in
Mojolicious::Controller.
- Improved layout tests.
- Improved documentation.
- Improved documentation. (chromatic, sri)
- Fixed a bug that prevented Mojo::Base subclasses from using the
"-base" flag.
- Fixed a few small default status code bugs.
Expand Down
31 changes: 17 additions & 14 deletions README.pod
@@ -1,11 +1,13 @@

=pod

Back in the early days of the web, many people learned Perl because of a
wonderful Perl library called L<CGI>. It was simple enough to get started
without knowing much about the language and powerful enough to keep you going,
learning by doing was much fun. While most of the techniques used are outdated
now, the idea behind it is not. L<Mojolicious> is a new attempt at
implementing this idea using state of the art technology.
wonderful Perl library called L<CGI>.
It was simple enough to get started without knowing much about the language
and powerful enough to keep you going, learning by doing was much fun.
While most of the techniques used are outdated now, the idea behind it is not.
L<Mojolicious> is a new attempt at implementing this idea using state of the
art technology.

=head2 Features

Expand Down Expand Up @@ -87,7 +89,7 @@ Web development for humans, making hard things possible and everything fun.
# Simple plain text response
get '/' => sub { shift->render_text('Hello World!') };

# Route associating the /time URL to template in DATA section
# Route associating the "/time" URL to template in DATA section
get '/time' => 'clock';

# RESTful web service sending JSON responses
Expand Down Expand Up @@ -125,8 +127,8 @@ Web development for humans, making hard things possible and everything fun.

=head2 Growing

Single file prototypes can easily grow into well-structured applications. A
controller collects several actions together:
Single file prototypes can easily grow into well-structured applications.
A controller collects several actions together.

package MyApp::Example;
use Mojo::Base 'Mojolicious::Controller';
Expand Down Expand Up @@ -155,7 +157,7 @@ controller collects several actions together:
1;

While the application class is unique, you can have as many controllers as
you like:
you like.

package MyApp::Realtime;
use Mojo::Base 'Mojolicious::Controller';
Expand All @@ -172,7 +174,7 @@ you like:
1;

Larger applications benefit from the separation of actions and routes,
especially when working in a team:
especially when working in a team.

package MyApp;
use Mojo::Base 'Mojolicious';
Expand All @@ -182,16 +184,16 @@ especially when working in a team:
my $self = shift;
my $r = $self->routes;

# Create a route at /example for the "MyApp::Example" controller
# Create a route at "/example" for the "MyApp::Example" controller
my $example = $r->route('/example')->to('example#');

# Connect these HTTP GET requests to routes in the controller
# paths are relative to the controller
# (paths are relative to the controller)
$example->get('/')->to('#hello');
$example->get('/time')->to('#clock');
$example->get('/:offset')->to('#restful');

# Mojo supports all common HTTP verbs
# All common HTTP verbs are supported
$example->post('/title')->to('#title');

# ... and much, much more
Expand All @@ -209,7 +211,8 @@ exactly the same.
The time is <%= $hour %>:<%= $minute %>:<%= $second %>.
<% end %>

Mojolicious has been designed from the ground up for a fun and unique workflow.
Mojolicious has been designed from the ground up for a fun and unique
workflow.

=head2 Want to know more?

Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -1652,7 +1652,7 @@ Open a TCP connection to a remote host.
Note that TLS support depends on L<IO::Socket::SSL> and IPv6 support on
L<IO::Socket::IP>.
These options are currently available.
These options are currently available:
=over 2
Expand Down Expand Up @@ -1778,7 +1778,7 @@ Create a new listen socket.
Note that TLS support depends on L<IO::Socket::SSL> and IPv6 support on
L<IO::Socket::IP>.
These options are currently available.
These options are currently available:
=over 2
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/Hypnotoad.pm
Expand Up @@ -532,7 +532,7 @@ C<Hypnotoad> configuration files are normal Perl scripts returning a hash.
# hypnotoad.conf
{listen => ['http://*:3000', 'http://*:4000'], workers => 10};
The following parameters are currently available.
The following parameters are currently available:
=head2 C<accepts>
Expand Down
92 changes: 52 additions & 40 deletions lib/Mojolicious.pm
Expand Up @@ -283,12 +283,11 @@ Mojolicious - The Web In A Box!
=head1 DESCRIPTION
Back in the early days of the web there was this wonderful Perl library
called L<CGI>, many people only learned Perl because of it.
Back in the early days of the web, many people learned Perl because of a
wonderful Perl library called L<CGI>.
It was simple enough to get started without knowing much about the language
and powerful enough to keep you going, learning by doing was much fun.
While most of the techniques used are outdated now, the idea behind it is
not.
While most of the techniques used are outdated now, the idea behind it is not.
L<Mojolicious> is a new attempt at implementing this idea using state of the
art technology.
Expand Down Expand Up @@ -326,7 +325,7 @@ hot deployment, perfect for embedding.
=item *
Automatic CGI, FastCGI and L<PSGI> detection.
Automatic CGI, FastCGI, and L<PSGI> detection.
=item *
Expand All @@ -338,6 +337,12 @@ Fresh code based upon years of experience developing L<Catalyst>.
=back
=head2 Installation
All you need is a oneliner.
sudo sh -c "curl -L cpanmin.us | perl - Mojolicious"
=head2 Getting Started
These three lines are a whole web application.
Expand All @@ -363,10 +368,10 @@ Web development for humans, making hard things possible and everything fun.
use Mojolicious::Lite;
# Simple route with plain text response
# Simple plain text response
get '/' => sub { shift->render_text('Hello World!') };
# Route to template in DATA section
# Route associating the "/time" URL to template in DATA section
get '/time' => 'clock';
# RESTful web service sending JSON responses
Expand All @@ -376,7 +381,7 @@ Web development for humans, making hard things possible and everything fun.
$self->render_json({list => [0 .. $offset]});
};
# Scrape information from remote sites
# Scrape and return information from remote sites
post '/title' => sub {
my $self = shift;
my $url = $self->param('url') || 'http://mojolicio.us';
Expand Down Expand Up @@ -404,36 +409,8 @@ Web development for humans, making hard things possible and everything fun.
=head2 Growing
Single file prototypes like the one above can easily grow into well
structured applications.
package MyApp;
use Mojo::Base 'Mojolicious';
# Runs once on application startup
sub startup {
my $self = shift;
my $r = $self->routes;
# Route prefix for "MyApp::Example" controller
my $example = $r->route('/example')->to('example#');
# GET routes connecting the controller prefix with actions
$example->get('/')->to('#hello');
$example->get('/time')->to('#clock');
$example->get('/:offset')->to('#restful');
# All common verbs are supported
$example->post('/title')->to('#title');
# And much more
$r->websocket('/echo')->to('realtime#echo');
}
1;
Bigger applications are a lot easier to maintain once routing information has
been separated from action code, especially when working in teams.
Single file prototypes can easily grow into well-structured applications.
A controller collects several actions together.
package MyApp::Example;
use Mojo::Base 'Mojolicious::Controller';
Expand Down Expand Up @@ -478,14 +455,47 @@ you like.
1;
Action code and templates can stay almost exactly the same, everything was
designed from the ground up for this very unique and fun workflow.
Larger applications benefit from the separation of actions and routes,
especially when working in a team.
package MyApp;
use Mojo::Base 'Mojolicious';
# Runs once on application startup
sub startup {
my $self = shift;
my $r = $self->routes;
# Create a route at "/example" for the "MyApp::Example" controller
my $example = $r->route('/example')->to('example#');
# Connect these HTTP GET requests to routes in the controller
# (paths are relative to the controller)
$example->get('/')->to('#hello');
$example->get('/time')->to('#clock');
$example->get('/:offset')->to('#restful');
# All common HTTP verbs are supported
$example->post('/title')->to('#title');
# ... and much, much more
# including multiple, auto-discovered controllers
$r->websocket('/echo')->to('realtime#echo');
}
1;
Through all of these changes, your action code and templates can stay almost
exactly the same.
% my ($second, $minute, $hour) = (localtime(time))[0, 1, 2];
<%= link_to clock => begin %>
The time is <%= $hour %>:<%= $minute %>:<%= $second %>.
<% end %>
Mojolicious has been designed from the ground up for a fun and unique
workflow.
=head2 Have Some Cake
Loosely coupled building blocks, use what you like and just ignore the rest.
Expand Down Expand Up @@ -985,6 +995,8 @@ Chas. J. Owens IV
Christian Hansen
Chromatic

This comment has been minimized.

Copy link
@chromatic

chromatic Jun 8, 2011

Contributor

I never capitalize my nom de plume.

This comment has been minimized.

Copy link
@kraih

kraih Jun 9, 2011

Author Member

Fixed. :)

Curt Tilmes
Daniel Kimsey
Expand Down

0 comments on commit 12c2c15

Please sign in to comment.