Permalink
Browse files

changed indentation style

  • Loading branch information...
1 parent 1906c42 commit e8805d1c235bdc6c9ce3260eafd7fee234c57962 @kraih committed Feb 4, 2011
Showing with 19,762 additions and 19,800 deletions.
  1. +1 −0 .perltidyrc
  2. +62 −62 Makefile.PL
  3. +96 −96 README.pod
  4. +43 −43 examples/connect-proxy.pl
  5. +6 −6 examples/flash-policy-server.pl
  6. +25 −25 examples/microhttpd.pl
  7. +41 −41 lib/Mojo.pm
  8. +11 −11 lib/Mojo/Asset.pm
  9. +133 −133 lib/Mojo/Asset/File.pm
  10. +38 −38 lib/Mojo/Asset/Memory.pm
  11. +129 −129 lib/Mojo/Base.pm
  12. +169 −169 lib/Mojo/ByteStream.pm
  13. +1,026 −1,030 lib/Mojo/Client.pm
  14. +297 −297 lib/Mojo/Command.pm
  15. +299 −299 lib/Mojo/Content.pm
  16. +189 −189 lib/Mojo/Content/MultiPart.pm
  17. +66 −66 lib/Mojo/Content/Single.pm
  18. +51 −51 lib/Mojo/Cookie.pm
  19. +51 −51 lib/Mojo/Cookie/Request.pm
  20. +101 −101 lib/Mojo/Cookie/Response.pm
  21. +105 −106 lib/Mojo/CookieJar.pm
  22. +849 −851 lib/Mojo/DOM.pm
  23. +100 −100 lib/Mojo/Date.pm
  24. +177 −177 lib/Mojo/Exception.pm
  25. +208 −208 lib/Mojo/Headers.pm
  26. +258 −260 lib/Mojo/HelloWorld.pm
  27. +95 −95 lib/Mojo/Home.pm
  28. +1,206 −1,207 lib/Mojo/IOLoop.pm
  29. +244 −247 lib/Mojo/JSON.pm
  30. +108 −109 lib/Mojo/Loader.pm
  31. +69 −69 lib/Mojo/Log.pm
  32. +454 −454 lib/Mojo/Message.pm
  33. +297 −297 lib/Mojo/Message/Request.pm
  34. +154 −154 lib/Mojo/Message/Response.pm
  35. +176 −176 lib/Mojo/Parameters.pm
  36. +87 −87 lib/Mojo/Path.pm
  37. +61 −61 lib/Mojo/Server.pm
  38. +103 −103 lib/Mojo/Server/CGI.pm
  39. +303 −303 lib/Mojo/Server/Daemon.pm
  40. +287 −288 lib/Mojo/Server/FastCGI.pm
  41. +383 −383 lib/Mojo/Server/Hypnotoad.pm
  42. +70 −70 lib/Mojo/Server/PSGI.pm
  43. +529 −529 lib/Mojo/Template.pm
  44. +103 −103 lib/Mojo/Transaction.pm
  45. +306 −306 lib/Mojo/Transaction/HTTP.pm
  46. +168 −169 lib/Mojo/Transaction/WebSocket.pm
  47. +313 −313 lib/Mojo/URL.pm
  48. +15 −15 lib/Mojo/Upload.pm
  49. +526 −528 lib/Mojo/Util.pm
  50. +390 −390 lib/Mojolicious.pm
  51. +16 −16 lib/Mojolicious/Command/Cgi.pm
  52. +32 −32 lib/Mojolicious/Command/Daemon.pm
  53. +13 −13 lib/Mojolicious/Command/Fastcgi.pm
  54. +11 −11 lib/Mojolicious/Command/Generate.pm
  55. +55 −55 lib/Mojolicious/Command/Generate/App.pm
  56. +11 −11 lib/Mojolicious/Command/Generate/Gitignore.pm
  57. +13 −13 lib/Mojolicious/Command/Generate/Hypnotoad.pm
  58. +21 −21 lib/Mojolicious/Command/Generate/LiteApp.pm
  59. +20 −21 lib/Mojolicious/Command/Generate/Makefile.pm
  60. +91 −91 lib/Mojolicious/Command/Get.pm
  61. +38 −38 lib/Mojolicious/Command/Inflate.pm
  62. +14 −14 lib/Mojolicious/Command/Psgi.pm
  63. +68 −68 lib/Mojolicious/Command/Routes.pm
  64. +46 −48 lib/Mojolicious/Command/Test.pm
  65. +44 −45 lib/Mojolicious/Command/Version.pm
  66. +38 −38 lib/Mojolicious/Commands.pm
  67. +1,011 −1,012 lib/Mojolicious/Controller.pm
  68. +2 −2 lib/Mojolicious/Guides.pod
  69. +44 −44 lib/Mojolicious/Guides/Cheatsheet.pod
  70. +2 −2 lib/Mojolicious/Guides/CodingGuidelines.pod
  71. +226 −226 lib/Mojolicious/Guides/Cookbook.pod
  72. +1 −1 lib/Mojolicious/Guides/FAQ.pod
  73. +365 −365 lib/Mojolicious/Guides/Growing.pod
  74. +289 −289 lib/Mojolicious/Guides/Rendering.pod
  75. +338 −340 lib/Mojolicious/Guides/Routing.pod
  76. +461 −464 lib/Mojolicious/Lite.pm
  77. +2 −2 lib/Mojolicious/Plugin.pm
  78. +21 −21 lib/Mojolicious/Plugin/AgentCondition.pm
  79. +25 −25 lib/Mojolicious/Plugin/Charset.pm
  80. +163 −162 lib/Mojolicious/Plugin/DefaultHelpers.pm
  81. +80 −80 lib/Mojolicious/Plugin/EpRenderer.pm
  82. +79 −79 lib/Mojolicious/Plugin/EplRenderer.pm
  83. +43 −43 lib/Mojolicious/Plugin/HeaderCondition.pm
  84. +79 −80 lib/Mojolicious/Plugin/I18n.pm
  85. +110 −111 lib/Mojolicious/Plugin/JsonConfig.pm
  86. +319 −319 lib/Mojolicious/Plugin/PodRenderer.pm
  87. +17 −17 lib/Mojolicious/Plugin/PoweredBy.pm
  88. +48 −49 lib/Mojolicious/Plugin/RequestTimer.pm
  89. +424 −424 lib/Mojolicious/Plugin/TagHelpers.pm
  90. +73 −73 lib/Mojolicious/Plugins.pm
  91. +256 −256 lib/Mojolicious/Renderer.pm
  92. +516 −516 lib/Mojolicious/Routes.pm
  93. +197 −197 lib/Mojolicious/Routes/Match.pm
  94. +259 −259 lib/Mojolicious/Routes/Pattern.pm
  95. +57 −57 lib/Mojolicious/Sessions.pm
  96. +161 −161 lib/Mojolicious/Static.pm
  97. +34 −34 lib/Mojolicious/Types.pm
  98. +233 −234 lib/Test/Mojo.pm
  99. +106 −106 lib/ojo.pm
  100. +4 −4 script/hypnotoad
  101. +23 −23 t/mojo/apache_cgi.t
  102. +22 −22 t/mojo/apache_fastcgi.t
  103. +42 −42 t/mojo/app.t
  104. +18 −18 t/mojo/base.t
  105. +101 −101 t/mojo/bytestream.t
  106. +86 −86 t/mojo/client.t
  107. +84 −84 t/mojo/client_online.t
  108. +16 −16 t/mojo/client_tls.t
  109. +9 −9 t/mojo/cookie.t
  110. +41 −41 t/mojo/cookiejar.t
  111. +5 −5 t/mojo/dom.t
  112. +1 −1 t/mojo/headers.t
  113. +7 −7 t/mojo/hypnotoad.t
  114. +14 −14 t/mojo/ioloop.t
  115. +68 −68 t/mojo/ioloop_online.t
  116. +96 −96 t/mojo/ioloop_tls.t
  117. +1 −1 t/mojo/json.t
  118. +3 −3 t/mojo/lib/LoaderException2.pm
  119. +338 −338 t/mojo/message.t
  120. +4 −3 t/mojo/parameters.t
  121. +52 −50 t/mojo/psgi.t
  122. +4 −4 t/mojo/template.t
  123. +6 −6 t/mojo/url.t
  124. +17 −17 t/mojolicious/charset_lite_app.t
  125. +4 −4 t/mojolicious/dispatch.t
  126. +10 −10 t/mojolicious/dispatcher_lite_app.t
  127. +26 −26 t/mojolicious/embedded_lite_app.t
  128. +2 −2 t/mojolicious/exception_lite_app.t
  129. +1 −1 t/mojolicious/external.json
  130. +1 −1 t/mojolicious/external.testing.json
  131. +2 −2 t/mojolicious/external_lite_app.t
  132. +2 −2 t/mojolicious/json_config_lite_app.json
  133. +2 −2 t/mojolicious/json_config_mode_lite_app.json
  134. +2 −2 t/mojolicious/json_config_mode_lite_app.t
  135. +1 −1 t/mojolicious/json_config_mode_lite_app.testing.json
  136. +115 −116 t/mojolicious/lib/MojoliciousTest.pm
  137. +26 −26 t/mojolicious/lib/MojoliciousTest/Foo.pm
  138. +3 −3 t/mojolicious/lib/MojoliciousTest/Plugin/TestPlugin.pm
  139. +3 −3 t/mojolicious/lib/MojoliciousTest2/Foo.pm
  140. +3 −3 t/mojolicious/lib/MojoliciousTestController.pm
  141. +2 −2 t/mojolicious/lib/PluginWithEmbeddedApp.pm
  142. +6 −6 t/mojolicious/lib/PluginWithTemplate.pm
  143. +23 −23 t/mojolicious/lib/SingleFileTestApp.pm
  144. +346 −355 t/mojolicious/lite_app.t
  145. +132 −133 t/mojolicious/longpolling_lite_app.t
  146. +1 −1 t/mojolicious/pattern.t
  147. +2 −2 t/mojolicious/pod_renderer_lite_app.t
  148. +3 −3 t/mojolicious/rebased_lite_app.t
  149. +4 −4 t/mojolicious/renderer.t
  150. +14 −14 t/mojolicious/routes.t
  151. +1 −1 t/mojolicious/twinkle_lite_app.conf
  152. +8 −8 t/mojolicious/twinkle_lite_app.t
  153. +66 −66 t/mojolicious/upload_lite_app.t
  154. +150 −150 t/mojolicious/websocket_lite_app.t
  155. +84 −84 t/mojolicious/websocket_proxy_lite_app.t
  156. +105 −105 t/mojolicious/websocket_tls_proxy_lite_app.t
View
@@ -22,6 +22,7 @@
--nohanging-side-comments # Troublesome for commented out code
-isbc # Block comments may only be indented if they have some space characters before the #
+-i=2 # Indent level is 2 cols
-ci=2 # Continuation indent is 2 cols
# We use version control, so just rewrite the file
View
@@ -14,69 +14,69 @@ my ($mm) = $ExtUtils::MakeMaker::VERSION =~ /^([^_]+)/;
# We only use core modules, so you shouldn't have to install anything besides
# Perl 5.8.7!
WriteMakefile(
- NAME => 'Mojolicious',
- VERSION_FROM => 'lib/Mojolicious.pm',
- ABSTRACT => 'The Web In A Box!',
- AUTHOR => 'Sebastian Riedel <sri@cpan.org>',
+ NAME => 'Mojolicious',
+ VERSION_FROM => 'lib/Mojolicious.pm',
+ ABSTRACT => 'The Web In A Box!',
+ AUTHOR => 'Sebastian Riedel <sri@cpan.org>',
- ($mm < 6.3002 ? () : ('LICENSE' => 'artistic_2')),
+ ($mm < 6.3002 ? () : ('LICENSE' => 'artistic_2')),
- ( $mm < 6.46
- ? ()
- : ( META_MERGE => {
- requires => {perl => '5.008007'},
- resources => {
- homepage => 'http://mojolicio.us',
- license => 'http://dev.perl.org/licenses/',
- MailingList =>
- 'http://groups.google.com/group/mojolicious',
- repository => 'http://github.com/kraih/mojo',
- bugtracker => 'http://github.com/kraih/mojo/issues'
- },
- no_index => {directory => [qw/t/]}
- },
- META_ADD => {
- build_requires => {},
- configure_requires => {}
- },
- )
- ),
+ ( $mm < 6.46
+ ? ()
+ : (
+ META_MERGE => {
+ requires => {perl => '5.008007'},
+ resources => {
+ homepage => 'http://mojolicio.us',
+ license => 'http://dev.perl.org/licenses/',
+ MailingList => 'http://groups.google.com/group/mojolicious',
+ repository => 'http://github.com/kraih/mojo',
+ bugtracker => 'http://github.com/kraih/mojo/issues'
+ },
+ no_index => {directory => [qw/t/]}
+ },
+ META_ADD => {
+ build_requires => {},
+ configure_requires => {}
+ },
+ )
+ ),
- EXE_FILES => ['script/mojo', 'script/hypnotoad'],
- PREREQ_PM => {
- 'B' => 0,
- 'Carp' => 0,
- 'Cwd' => 0,
- 'Data::Dumper' => 0,
- 'Digest::MD5' => 0,
- 'Encode' => 0,
- 'Errno' => 0,
- 'Exporter' => 0,
- 'ExtUtils::MakeMaker' => 0,
- 'File::Basename' => 0,
- 'File::Copy' => 0,
- 'File::Path' => 0,
- 'File::Spec' => 0,
- 'File::Spec::Functions' => 0,
- 'File::Temp' => 0,
- 'FindBin' => 0,
- 'Getopt::Long' => 0,
- 'I18N::LangTags' => 0,
- 'IO::File' => 0,
- 'IO::Poll' => 0,
- 'IO::Socket' => 0,
- 'List::Util' => 0,
- 'Locale::Maketext' => 0,
- 'MIME::Base64' => 0,
- 'MIME::QuotedPrint' => 0,
- 'POSIX' => 0,
- 'Scalar::Util' => 0,
- 'Storable' => 0,
- 'Sys::Hostname' => 0,
- 'Test::Builder' => 0,
- 'Test::Harness' => 0,
- 'Test::More' => 0,
- 'Time::HiRes' => 0
- },
- test => {TESTS => 't/*.t t/*/*.t'}
+ EXE_FILES => ['script/mojo', 'script/hypnotoad'],
+ PREREQ_PM => {
+ 'B' => 0,
+ 'Carp' => 0,
+ 'Cwd' => 0,
+ 'Data::Dumper' => 0,
+ 'Digest::MD5' => 0,
+ 'Encode' => 0,
+ 'Errno' => 0,
+ 'Exporter' => 0,
+ 'ExtUtils::MakeMaker' => 0,
+ 'File::Basename' => 0,
+ 'File::Copy' => 0,
+ 'File::Path' => 0,
+ 'File::Spec' => 0,
+ 'File::Spec::Functions' => 0,
+ 'File::Temp' => 0,
+ 'FindBin' => 0,
+ 'Getopt::Long' => 0,
+ 'I18N::LangTags' => 0,
+ 'IO::File' => 0,
+ 'IO::Poll' => 0,
+ 'IO::Socket' => 0,
+ 'List::Util' => 0,
+ 'Locale::Maketext' => 0,
+ 'MIME::Base64' => 0,
+ 'MIME::QuotedPrint' => 0,
+ 'POSIX' => 0,
+ 'Scalar::Util' => 0,
+ 'Storable' => 0,
+ 'Sys::Hostname' => 0,
+ 'Test::Builder' => 0,
+ 'Test::Harness' => 0,
+ 'Test::More' => 0,
+ 'Time::HiRes' => 0
+ },
+ test => {TESTS => 't/*.t t/*/*.t'}
);
View
@@ -12,14 +12,14 @@ art technology.
=head2 Features
-=over 4
+=over 2
=item *
An amazing MVC web framework supporting a simplified single file mode through
L<Mojolicious::Lite>.
-=over 4
+=over 2
Powerful out of the box with RESTful routes, plugins, Perl-ish templates,
session management, signed cookies, testing framework, static file server,
@@ -60,136 +60,136 @@ Fresh code based upon years of experience developing L<Catalyst>.
All you need is a oneliner.
- sudo -s 'curl -L cpanmin.us | perl - Mojolicious'
+ sudo -s 'curl -L cpanmin.us | perl - Mojolicious'
=head2 Duct Tape For The HTML5 Web
Web development for humans, making hard things possible and everything fun.
- use Mojolicious::Lite;
-
- # Simple route with plain text response
- get '/hello' => sub { shift->render(text => 'Hello World!') };
-
- # Route to template in DATA section
- get '/time' => 'clock';
-
- # RESTful web service sending JSON responses
- get '/:offset' => sub {
- my $self = shift;
- my $offset = $self->param('offset') || 23;
- $self->render(json => {list => [0 .. $offset]});
- };
-
- # Scrape information from remote sites
- post '/title' => sub {
- my $self = shift;
- my $url = $self->param('url') || 'http://mojolicio.us';
- $self->render(text =>
- $self->client->get($url)->res->dom->at('head > title')->text);
- };
-
- # WebSocket echo service
- websocket '/echo' => sub {
- my $self = shift;
- $self->on_message(sub {
- my ($self, $message) = @_;
- $self->send_message("echo: $message");
- });
- };
-
- app->start;
- __DATA__
-
- @@ clock.html.ep
- % my ($second, $minute, $hour) = (localtime(time))[0, 1, 2];
- <%= link_to clock => begin %>
- The time is <%= $hour %>:<%= $minute %>:<%= $second %>.
- <% end %>
+ use Mojolicious::Lite;
+
+ # Simple route with plain text response
+ get '/hello' => sub { shift->render(text => 'Hello World!') };
+
+ # Route to template in DATA section
+ get '/time' => 'clock';
+
+ # RESTful web service sending JSON responses
+ get '/:offset' => sub {
+ my $self = shift;
+ my $offset = $self->param('offset') || 23;
+ $self->render(json => {list => [0 .. $offset]});
+ };
+
+ # Scrape information from remote sites
+ post '/title' => sub {
+ my $self = shift;
+ my $url = $self->param('url') || 'http://mojolicio.us';
+ $self->render(text =>
+ $self->client->get($url)->res->dom->at('head > title')->text);
+ };
+
+ # WebSocket echo service
+ websocket '/echo' => sub {
+ my $self = shift;
+ $self->on_message(sub {
+ my ($self, $message) = @_;
+ $self->send_message("echo: $message");
+ });
+ };
+
+ app->start;
+ __DATA__
+
+ @@ clock.html.ep
+ % my ($second, $minute, $hour) = (localtime(time))[0, 1, 2];
+ <%= link_to clock => begin %>
+ The time is <%= $hour %>:<%= $minute %>:<%= $second %>.
+ <% end %>
=head2 Growing
Single file prototypes like the one above can easily grow into well
structured applications.
- package MyApp;
- use Mojo::Base 'Mojolicious';
+ package MyApp;
+ use Mojo::Base 'Mojolicious';
- # Runs once on application startup
- sub startup {
- my $self = shift;
- my $r = $self->routes;
+ # Runs once on application startup
+ sub startup {
+ my $self = shift;
+ my $r = $self->routes;
- # Route prefix for "MyApp::Example" controller
- my $example = $r->under('/example')->to('example#');
+ # Route prefix for "MyApp::Example" controller
+ my $example = $r->under('/example')->to('example#');
- # GET routes connecting the controller prefix with actions
- $example->get('/hello')->to('#hello');
- $example->get('/time')->to('#clock');
- $example->get('/:offset')->to('#restful');
+ # GET routes connecting the controller prefix with actions
+ $example->get('/hello')->to('#hello');
+ $example->get('/time')->to('#clock');
+ $example->get('/:offset')->to('#restful');
- # All common verbs are supported
- $example->post('/title')->to('#title');
+ # All common verbs are supported
+ $example->post('/title')->to('#title');
- # And much more
- $r->websocket('/echo')->to('realtime#echo');
- }
+ # And much more
+ $r->websocket('/echo')->to('realtime#echo');
+ }
- 1;
+ 1;
Bigger applications are a lot easier to maintain once routing information has
been separated from action code, especially when working in teams.
- package MyApp::Example;
- use Mojo::Base 'Mojolicious::Controller';
+ package MyApp::Example;
+ use Mojo::Base 'Mojolicious::Controller';
- # Plain text response
- sub hello { shift->render(text => 'Hello World!') }
+ # Plain text response
+ sub hello { shift->render(text => 'Hello World!') }
- # Render external template "templates/example/clock.html.ep"
- sub clock { shift->render }
+ # Render external template "templates/example/clock.html.ep"
+ sub clock { shift->render }
- # RESTful web service sending JSON responses
- sub restful {
- my $self = shift;
- my $offset = $self->param('offset') || 23;
- $self->render(json => {list => [0 .. $offset]});
- }
+ # RESTful web service sending JSON responses
+ sub restful {
+ my $self = shift;
+ my $offset = $self->param('offset') || 23;
+ $self->render(json => {list => [0 .. $offset]});
+ }
- # Scrape information from remote sites
- sub title {
- my $self = shift;
- my $url = $self->param('url') || 'http://mojolicio.us';
- $self->render(text =>
- $self->client->get($url)->res->dom->at('head > title')->text);
- }
+ # Scrape information from remote sites
+ sub title {
+ my $self = shift;
+ my $url = $self->param('url') || 'http://mojolicio.us';
+ $self->render(text =>
+ $self->client->get($url)->res->dom->at('head > title')->text);
+ }
- 1;
+ 1;
While the application class is unique, you can have as many controllers as
you like.
- package MyApp::Realtime;
- use Mojo::Base 'Mojolicious::Controller';
+ package MyApp::Realtime;
+ use Mojo::Base 'Mojolicious::Controller';
- # WebSocket echo service
- sub echo {
- my $self = shift;
- $self->on_message(sub {
- my ($self, $message) = @_;
- $self->send_message("echo: $message");
- });
- }
+ # WebSocket echo service
+ sub echo {
+ my $self = shift;
+ $self->on_message(sub {
+ my ($self, $message) = @_;
+ $self->send_message("echo: $message");
+ });
+ }
- 1;
+ 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.
- % my ($second, $minute, $hour) = (localtime(time))[0, 1, 2];
- <%= link_to clock => begin %>
- The time is <%= $hour %>:<%= $minute %>:<%= $second %>.
- <% end %>
+ % my ($second, $minute, $hour) = (localtime(time))[0, 1, 2];
+ <%= link_to clock => begin %>
+ The time is <%= $hour %>:<%= $minute %>:<%= $second %>.
+ <% end %>
=head2 Want to know more?
Oops, something went wrong.

0 comments on commit e8805d1

Please sign in to comment.