1 |
|
---|
2 | =encoding utf8
|
---|
3 |
|
---|
4 | =head1 NAME
|
---|
5 |
|
---|
6 | Mojolicious::Guides - The Mojolicious Guide to the Galaxy
|
---|
7 |
|
---|
8 | =head1 DON'T PANIC!
|
---|
9 |
|
---|
10 | We are constantly working on new documentation. Follow us on
|
---|
11 | L<GitHub|http://github.com/kraih/mojo> or join the official IRC channel C<#mojo>
|
---|
12 | on C<irc.perl.org> to get all the latest updates.
|
---|
13 |
|
---|
14 | =head1 BASICS
|
---|
15 |
|
---|
16 | =over 2
|
---|
17 |
|
---|
18 | =item Learning Perl
|
---|
19 |
|
---|
20 | If you are new to Perl, we recommend
|
---|
21 | L<Learn Perl in 2 hours 30 minutes|http://qntm.org/files/perl/perl.html> for a
|
---|
22 | quick introduction, or the
|
---|
23 | L<Modern Perl book|https://pragprog.com/book/swperl/modern-perl-fourth-edition>,
|
---|
24 | freely available in many formats. Both are excellent introductions to the
|
---|
25 | language. For more books and documentation, check out
|
---|
26 | L<learn.perl.org|http://learn.perl.org/>.
|
---|
27 |
|
---|
28 | =item Learning Web Technologies
|
---|
29 |
|
---|
30 | All web development starts with HTML, CSS and JavaScript, to learn the basics
|
---|
31 | we recommend the
|
---|
32 | L<Mozilla Developer Network|https://developer.mozilla.org/en-US/docs/Web>. And
|
---|
33 | if you want to know more about how browsers and web servers actually
|
---|
34 | communicate, there's also a very nice introduction to
|
---|
35 | L<HTTP|https://developer.mozilla.org/en-US/docs/Web/HTTP>.
|
---|
36 |
|
---|
37 | =back
|
---|
38 |
|
---|
39 | =head1 CONVENTIONS
|
---|
40 |
|
---|
41 | =over 2
|
---|
42 |
|
---|
43 | =item Modern Perl
|
---|
44 |
|
---|
45 | L<Mojolicious> uses a modern subset of Perl exclusively, and therefore all
|
---|
46 | documentation assumes that L<strict>, L<warnings>, L<utf8> and Perl 5.10
|
---|
47 | L<features|feature> are enabled, even if examples don't specifically mention it.
|
---|
48 |
|
---|
49 | use strict;
|
---|
50 | use warnings;
|
---|
51 | use utf8;
|
---|
52 | use feature ':5.10';
|
---|
53 |
|
---|
54 | Some modules, like L<Mojo::Base> and L<Mojolicious::Lite>, will enable them for
|
---|
55 | you automatically, whenever they are used.
|
---|
56 |
|
---|
57 | =back
|
---|
58 |
|
---|
59 | =head1 TUTORIAL
|
---|
60 |
|
---|
61 | =over 2
|
---|
62 |
|
---|
63 | =item L<Mojolicious::Guides::Tutorial>
|
---|
64 |
|
---|
65 | A fast and fun way to get started developing web applications with
|
---|
66 | L<Mojolicious>. The tutorial introduces the L<Mojolicious::Lite> micro web
|
---|
67 | framework, which is only a thin wrapper around the full web framework. The
|
---|
68 | simplified notation introduced in the tutorial is commonly used throughout the
|
---|
69 | guides and is therefore considered a prerequisite, you should definitely take a
|
---|
70 | look!
|
---|
71 |
|
---|
72 | =back
|
---|
73 |
|
---|
74 | =head1 GUIDES
|
---|
75 |
|
---|
76 | =over 2
|
---|
77 |
|
---|
78 | =item L<Mojolicious::Guides::Growing>
|
---|
79 |
|
---|
80 | Starting a L<Mojolicious::Lite> prototype from scratch and growing it into a
|
---|
81 | well-structured L<Mojolicious> application.
|
---|
82 |
|
---|
83 | =item L<Mojolicious::Guides::Routing>
|
---|
84 |
|
---|
85 | Simple and fun introduction to the L<Mojolicious> router.
|
---|
86 |
|
---|
87 | =item L<Mojolicious::Guides::Rendering>
|
---|
88 |
|
---|
89 | Generating content with the L<Mojolicious> renderer.
|
---|
90 |
|
---|
91 | =item L<Mojolicious::Guides::Testing>
|
---|
92 |
|
---|
93 | Powerful yet elegant testing techniques and tools for L<Mojolicious> and other
|
---|
94 | web applications.
|
---|
95 |
|
---|
96 | =item L<Mojolicious::Guides::Cookbook>
|
---|
97 |
|
---|
98 | Cooking with L<Mojolicious>, recipes for every taste.
|
---|
99 |
|
---|
100 | =item L<Mojolicious::Guides::Contributing>
|
---|
101 |
|
---|
102 | Become a part of the ongoing L<Mojolicious> development.
|
---|
103 |
|
---|
104 | =item L<Mojolicious::Guides::FAQ>
|
---|
105 |
|
---|
106 | Answers to the most frequently asked questions.
|
---|
107 |
|
---|
108 | =back
|
---|
109 |
|
---|
110 | =head1 HIGHLIGHTS
|
---|
111 |
|
---|
112 | L<Mojolicious> and L<Mojolicious::Lite> are the sum of many parts, built on top
|
---|
113 | of the L<Mojo> web development toolkit. Small building blocks that can be used
|
---|
114 | independently for all kinds of applications, these are the most prominent ones.
|
---|
115 |
|
---|
116 | =over 2
|
---|
117 |
|
---|
118 | =item L<Mojo::UserAgent>
|
---|
119 |
|
---|
120 | Full featured non-blocking I/O HTTP and WebSocket user agent.
|
---|
121 |
|
---|
122 | =item L<Mojo::DOM>
|
---|
123 |
|
---|
124 | Very fun and minimalistic HTML/XML DOM parser with CSS selector support.
|
---|
125 |
|
---|
126 | =item L<Mojo::JSON>
|
---|
127 |
|
---|
128 | Minimalistic JSON implementation that just works.
|
---|
129 |
|
---|
130 | =item L<Mojo::Server::Daemon>
|
---|
131 |
|
---|
132 | Full featured, highly portable non-blocking I/O HTTP and WebSocket server, with
|
---|
133 | self-restart support through L<Mojo::Server::Morbo>, perfect for development
|
---|
134 | and testing.
|
---|
135 |
|
---|
136 | =item L<Mojo::Server::Prefork>
|
---|
137 |
|
---|
138 | Full featured, UNIX optimized, preforking non-blocking I/O HTTP and WebSocket
|
---|
139 | server with support for zero downtime software upgrades (hot deployment)
|
---|
140 | through L<Mojo::Server::Hypnotoad>.
|
---|
141 |
|
---|
142 | =item L<Mojo::Server::CGI>, L<Mojo::Server::PSGI>
|
---|
143 |
|
---|
144 | Transparent CGI and L<PSGI> support out of the box.
|
---|
145 |
|
---|
146 | =item L<Mojo::IOLoop>
|
---|
147 |
|
---|
148 | A minimalistic event loop with support for multiple reactor backends.
|
---|
149 |
|
---|
150 | =item L<Mojo::Template>
|
---|
151 |
|
---|
152 | Very Perl-ish and minimalistic template system.
|
---|
153 |
|
---|
154 | =item L<Test::Mojo>
|
---|
155 |
|
---|
156 | Testing toolkit for web applications.
|
---|
157 |
|
---|
158 | =item L<ojo>
|
---|
159 |
|
---|
160 | Fun one-liners using everything above.
|
---|
161 |
|
---|
162 | =back
|
---|
163 |
|
---|
164 | =head1 SPIN-OFFS
|
---|
165 |
|
---|
166 | These modules are not part of the L<Mojolicious> distribution, but have been
|
---|
167 | designed to be used with it and are being developed under the same umbrella.
|
---|
168 |
|
---|
169 | =over 2
|
---|
170 |
|
---|
171 | =item L<Mojo::Pg>
|
---|
172 |
|
---|
173 | A tiny wrapper around L<DBD::Pg> that makes
|
---|
174 | L<PostgreSQL|http://www.postgresql.org> a lot of fun to use with
|
---|
175 | L<Mojolicious>. Perform queries blocking and non-blocking, use all
|
---|
176 | L<SQL features|https://www.postgresql.org/docs/current/static/sql.html>
|
---|
177 | PostgreSQL has to offer, generate CRUD queries from data structures, manage your
|
---|
178 | database schema with migrations and build scalable real-time web applications
|
---|
179 | with the publish/subscribe pattern.
|
---|
180 |
|
---|
181 | And it comes with two great
|
---|
182 | L<example applications|https://github.com/kraih/mojo-pg/tree/master/examples/>
|
---|
183 | you can use for inspiration. The minimal
|
---|
184 | L<chat|https://github.com/kraih/mojo-pg/tree/master/examples/chat.pl>
|
---|
185 | application will show you how to scale WebSockets to multiple servers, and the
|
---|
186 | well-structured
|
---|
187 | L<blog|https://github.com/kraih/mojo-pg/tree/master/examples/blog> application
|
---|
188 | how to apply the MVC design pattern in practice.
|
---|
189 |
|
---|
190 | =item L<Minion>
|
---|
191 |
|
---|
192 | A full featured job queue for L<Mojolicious> with support for multiple backends
|
---|
193 | (such as L<PostgreSQL|http://www.postgresql.org>). Job queues allow you to
|
---|
194 | process time and/or computationally intensive tasks in background processes,
|
---|
195 | outside of the request/response lifecycle. Among those tasks you'll commonly
|
---|
196 | find image resizing, spam filtering, HTTP downloads, building tarballs, warming
|
---|
197 | caches and basically everything else you can imagine that's not super fast.
|
---|
198 |
|
---|
199 | And it comes with a great example application you can use for inspiration. The
|
---|
200 | L<link checker|https://github.com/kraih/minion/tree/master/examples/linkcheck>
|
---|
201 | will show you how to integrate background jobs into well-structured
|
---|
202 | L<Mojolicious> applications.
|
---|
203 |
|
---|
204 | =back
|
---|
205 |
|
---|
206 | =head1 REFERENCE
|
---|
207 |
|
---|
208 | This is the class hierarchy of the L<Mojolicious> distribution.
|
---|
209 |
|
---|
210 | =over 2
|
---|
211 |
|
---|
212 | =item * L<Mojo>
|
---|
213 |
|
---|
214 | =item * L<Mojo::Base>
|
---|
215 |
|
---|
216 | =over 2
|
---|
217 |
|
---|
218 | =item * L<Mojolicious>
|
---|
219 |
|
---|
220 | =over 2
|
---|
221 |
|
---|
222 | =item * L<Mojo::HelloWorld>
|
---|
223 |
|
---|
224 | =item * L<Mojolicious::Lite>
|
---|
225 |
|
---|
226 | =back
|
---|
227 |
|
---|
228 | =item * L<Mojo::Cache>
|
---|
229 |
|
---|
230 | =item * L<Mojo::Cookie>
|
---|
231 |
|
---|
232 | =over 2
|
---|
233 |
|
---|
234 | =item * L<Mojo::Cookie::Request>
|
---|
235 |
|
---|
236 | =item * L<Mojo::Cookie::Response>
|
---|
237 |
|
---|
238 | =back
|
---|
239 |
|
---|
240 | =item * L<Mojo::DOM::CSS>
|
---|
241 |
|
---|
242 | =item * L<Mojo::DOM::HTML>
|
---|
243 |
|
---|
244 | =item * L<Mojo::Date>
|
---|
245 |
|
---|
246 | =item * L<Mojo::EventEmitter>
|
---|
247 |
|
---|
248 | =over 2
|
---|
249 |
|
---|
250 | =item * L<Mojo::Asset>
|
---|
251 |
|
---|
252 | =over 2
|
---|
253 |
|
---|
254 | =item * L<Mojo::Asset::File>
|
---|
255 |
|
---|
256 | =item * L<Mojo::Asset::Memory>
|
---|
257 |
|
---|
258 | =back
|
---|
259 |
|
---|
260 | =item * L<Mojo::Content>
|
---|
261 |
|
---|
262 | =over 2
|
---|
263 |
|
---|
264 | =item * L<Mojo::Content::MultiPart>
|
---|
265 |
|
---|
266 | =item * L<Mojo::Content::Single>
|
---|
267 |
|
---|
268 | =back
|
---|
269 |
|
---|
270 | =item * L<Mojo::IOLoop>
|
---|
271 |
|
---|
272 | =item * L<Mojo::IOLoop::Client>
|
---|
273 |
|
---|
274 | =item * L<Mojo::IOLoop::Server>
|
---|
275 |
|
---|
276 | =item * L<Mojo::IOLoop::Stream>
|
---|
277 |
|
---|
278 | =over 2
|
---|
279 |
|
---|
280 | =item * L<Mojo::IOLoop::Stream::HTTPClient>
|
---|
281 |
|
---|
282 | =item * L<Mojo::IOLoop::Stream::HTTPServer>
|
---|
283 |
|
---|
284 | =item * L<Mojo::IOLoop::Stream::WebSocketClient>
|
---|
285 |
|
---|
286 | =item * L<Mojo::IOLoop::Stream::WebSocketServer>
|
---|
287 |
|
---|
288 | =back
|
---|
289 |
|
---|
290 | =item * L<Mojo::IOLoop::TLS>
|
---|
291 |
|
---|
292 | =item * L<Mojo::Log>
|
---|
293 |
|
---|
294 | =item * L<Mojo::Message>
|
---|
295 |
|
---|
296 | =over 2
|
---|
297 |
|
---|
298 | =item * L<Mojo::Message::Request>
|
---|
299 |
|
---|
300 | =item * L<Mojo::Message::Response>
|
---|
301 |
|
---|
302 | =back
|
---|
303 |
|
---|
304 | =item * L<Mojo::Reactor>
|
---|
305 |
|
---|
306 | =over 2
|
---|
307 |
|
---|
308 | =item * L<Mojo::Reactor::Poll>
|
---|
309 |
|
---|
310 | =over 2
|
---|
311 |
|
---|
312 | =item * L<Mojo::Reactor::EV>
|
---|
313 |
|
---|
314 | =back
|
---|
315 |
|
---|
316 | =back
|
---|
317 |
|
---|
318 | =item * L<Mojo::Server>
|
---|
319 |
|
---|
320 | =over 2
|
---|
321 |
|
---|
322 | =item * L<Mojo::Server::CGI>
|
---|
323 |
|
---|
324 | =item * L<Mojo::Server::Daemon>
|
---|
325 |
|
---|
326 | =over 2
|
---|
327 |
|
---|
328 | =item * L<Mojo::Server::Prefork>
|
---|
329 |
|
---|
330 | =back
|
---|
331 |
|
---|
332 | =item * L<Mojo::Server::PSGI>
|
---|
333 |
|
---|
334 | =back
|
---|
335 |
|
---|
336 | =item * L<Mojo::Transaction>
|
---|
337 |
|
---|
338 | =over 2
|
---|
339 |
|
---|
340 | =item * L<Mojo::Transaction::HTTP>
|
---|
341 |
|
---|
342 | =item * L<Mojo::Transaction::WebSocket>
|
---|
343 |
|
---|
344 | =back
|
---|
345 |
|
---|
346 | =item * L<Mojo::UserAgent>
|
---|
347 |
|
---|
348 | =item * L<Mojolicious::Plugins>
|
---|
349 |
|
---|
350 | =back
|
---|
351 |
|
---|
352 | =item * L<Mojo::Exception>
|
---|
353 |
|
---|
354 | =item * L<Mojo::Headers>
|
---|
355 |
|
---|
356 | =item * L<Mojo::IOLoop::Subprocess>
|
---|
357 |
|
---|
358 | =item * L<Mojo::JSON::Pointer>
|
---|
359 |
|
---|
360 | =item * L<Mojo::Parameters>
|
---|
361 |
|
---|
362 | =item * L<Mojo::Path>
|
---|
363 |
|
---|
364 | =item * L<Mojo::Promise>
|
---|
365 |
|
---|
366 | =over 2
|
---|
367 |
|
---|
368 | =item * L<Mojo::IOLoop::Delay>
|
---|
369 |
|
---|
370 | =back
|
---|
371 |
|
---|
372 | =item * L<Mojo::Server::Hypnotoad>
|
---|
373 |
|
---|
374 | =item * L<Mojo::Server::Morbo>
|
---|
375 |
|
---|
376 | =item * L<Mojo::Server::Morbo::Backend>
|
---|
377 |
|
---|
378 | =over 2
|
---|
379 |
|
---|
380 | =item * L<Mojo::Server::Morbo::Backend::Poll>
|
---|
381 |
|
---|
382 | =back
|
---|
383 |
|
---|
384 | =item * L<Mojo::Template>
|
---|
385 |
|
---|
386 | =item * L<Mojo::URL>
|
---|
387 |
|
---|
388 | =item * L<Mojo::Upload>
|
---|
389 |
|
---|
390 | =item * L<Mojo::UserAgent::CookieJar>
|
---|
391 |
|
---|
392 | =item * L<Mojo::UserAgent::Proxy>
|
---|
393 |
|
---|
394 | =item * L<Mojo::UserAgent::Server>
|
---|
395 |
|
---|
396 | =item * L<Mojo::UserAgent::Transactor>
|
---|
397 |
|
---|
398 | =item * L<Mojolicious::Command>
|
---|
399 |
|
---|
400 | =over 2
|
---|
401 |
|
---|
402 | =item * L<Mojolicious::Command::cgi>
|
---|
403 |
|
---|
404 | =item * L<Mojolicious::Command::cpanify>
|
---|
405 |
|
---|
406 | =item * L<Mojolicious::Command::daemon>
|
---|
407 |
|
---|
408 | =item * L<Mojolicious::Command::eval>
|
---|
409 |
|
---|
410 | =item * L<Mojolicious::Command::generate::app>
|
---|
411 |
|
---|
412 | =item * L<Mojolicious::Command::generate::lite_app>
|
---|
413 |
|
---|
414 | =item * L<Mojolicious::Command::generate::makefile>
|
---|
415 |
|
---|
416 | =item * L<Mojolicious::Command::generate::plugin>
|
---|
417 |
|
---|
418 | =item * L<Mojolicious::Command::get>
|
---|
419 |
|
---|
420 | =item * L<Mojolicious::Command::inflate>
|
---|
421 |
|
---|
422 | =item * L<Mojolicious::Command::prefork>
|
---|
423 |
|
---|
424 | =item * L<Mojolicious::Command::psgi>
|
---|
425 |
|
---|
426 | =item * L<Mojolicious::Command::routes>
|
---|
427 |
|
---|
428 | =item * L<Mojolicious::Command::test>
|
---|
429 |
|
---|
430 | =item * L<Mojolicious::Command::version>
|
---|
431 |
|
---|
432 | =item * L<Mojolicious::Commands>
|
---|
433 |
|
---|
434 | =over 2
|
---|
435 |
|
---|
436 | =item * L<Mojolicious::Command::generate>
|
---|
437 |
|
---|
438 | =back
|
---|
439 |
|
---|
440 | =back
|
---|
441 |
|
---|
442 | =item * L<Mojolicious::Controller>
|
---|
443 |
|
---|
444 | =item * L<Mojolicious::Plugin>
|
---|
445 |
|
---|
446 | =over 2
|
---|
447 |
|
---|
448 | =item * L<Mojolicious::Plugin::Config>
|
---|
449 |
|
---|
450 | =over 2
|
---|
451 |
|
---|
452 | =item * L<Mojolicious::Plugin::JSONConfig>
|
---|
453 |
|
---|
454 | =back
|
---|
455 |
|
---|
456 | =item * L<Mojolicious::Plugin::DefaultHelpers>
|
---|
457 |
|
---|
458 | =item * L<Mojolicious::Plugin::EPLRenderer>
|
---|
459 |
|
---|
460 | =over 2
|
---|
461 |
|
---|
462 | =item * L<Mojolicious::Plugin::EPRenderer>
|
---|
463 |
|
---|
464 | =back
|
---|
465 |
|
---|
466 | =item * L<Mojolicious::Plugin::HeaderCondition>
|
---|
467 |
|
---|
468 | =item * L<Mojolicious::Plugin::Mount>
|
---|
469 |
|
---|
470 | =item * L<Mojolicious::Plugin::PODRenderer>
|
---|
471 |
|
---|
472 | =item * L<Mojolicious::Plugin::TagHelpers>
|
---|
473 |
|
---|
474 | =back
|
---|
475 |
|
---|
476 | =item * L<Mojolicious::Renderer>
|
---|
477 |
|
---|
478 | =item * L<Mojolicious::Routes::Match>
|
---|
479 |
|
---|
480 | =item * L<Mojolicious::Routes::Pattern>
|
---|
481 |
|
---|
482 | =item * L<Mojolicious::Routes::Route>
|
---|
483 |
|
---|
484 | =over 2
|
---|
485 |
|
---|
486 | =item * L<Mojolicious::Routes>
|
---|
487 |
|
---|
488 | =back
|
---|
489 |
|
---|
490 | =item * L<Mojolicious::Sessions>
|
---|
491 |
|
---|
492 | =item * L<Mojolicious::Static>
|
---|
493 |
|
---|
494 | =item * L<Mojolicious::Types>
|
---|
495 |
|
---|
496 | =item * L<Mojolicious::Validator>
|
---|
497 |
|
---|
498 | =item * L<Mojolicious::Validator::Validation>
|
---|
499 |
|
---|
500 | =item * L<Test::Mojo>
|
---|
501 |
|
---|
502 | =back
|
---|
503 |
|
---|
504 | =item * L<Mojo::ByteStream>
|
---|
505 |
|
---|
506 | =item * L<Mojo::Collection>
|
---|
507 |
|
---|
508 | =item * L<Mojo::DOM>
|
---|
509 |
|
---|
510 | =item * L<Mojo::File>
|
---|
511 |
|
---|
512 | =over 2
|
---|
513 |
|
---|
514 | =item * L<Mojo::Home>
|
---|
515 |
|
---|
516 | =back
|
---|
517 |
|
---|
518 | =item * L<Mojo::JSON>
|
---|
519 |
|
---|
520 | =item * L<Mojo::Loader>
|
---|
521 |
|
---|
522 | =item * L<Mojo::Util>
|
---|
523 |
|
---|
524 | =item * L<Mojo::WebSocket>
|
---|
525 |
|
---|
526 | =item * L<ojo>
|
---|
527 |
|
---|
528 | =back
|
---|
529 |
|
---|
530 | =head1 MORE
|
---|
531 |
|
---|
532 | A lot more documentation and examples by many different authors can be found in
|
---|
533 | the L<Mojolicious wiki|http://github.com/kraih/mojo/wiki>.
|
---|
534 |
|
---|
535 | =head1 SUPPORT
|
---|
536 |
|
---|
537 | If you have any questions the documentation might not yet answer, don't
|
---|
538 | hesitate to ask on the
|
---|
539 | L<mailing list|http://groups.google.com/group/mojolicious> or the official IRC
|
---|
540 | channel C<#mojo> on C<irc.perl.org>
|
---|
541 | (L<chat now!|https://chat.mibbit.com/?channel=%23mojo&server=irc.perl.org>).
|
---|
542 |
|
---|
543 | =cut
|
---|