1Mojolicious::Guides(3)User Contributed Perl DocumentationMojolicious::Guides(3)
2
3
4
6 Mojolicious::Guides - The Mojolicious Guide to the Galaxy
7
9 The Mojolicious <https://mojolicious.org> documentation is structured
10 into three parts. The "TUTORIAL" everyone starts with, the "GUIDES"
11 that explain all major features in detail, and the class "REFERENCE"
12 listing all available APIs.
13
14 Some parts of the documentation only use the Mojolicious::Lite micro
15 web framework for examples, but that's merely a convenience for the
16 reader. Almost all features are exactly the same for full Mojolicious
17 applications.
18
20 Learning Perl
21 If you are new to Perl, we recommend Learn Perl in 2 hours 30 minutes
22 <http://qntm.org/files/perl/perl.html> for a quick introduction, or
23 the Modern Perl book <https://pragprog.com/book/swperl/modern-perl-
24 fourth-edition>, freely available in many formats. Both are excellent
25 introductions to the language. For more books and documentation,
26 check out learn.perl.org <http://learn.perl.org/>.
27
28 Learning Web Technologies
29 All web development starts with HTML, CSS and JavaScript, to learn
30 the basics we recommend the Mozilla Developer Network
31 <https://developer.mozilla.org/en-US/docs/Web>. And if you want to
32 know more about how browsers and web servers actually communicate,
33 there's also a very nice introduction to HTTP
34 <https://developer.mozilla.org/en-US/docs/Web/HTTP>.
35
37 Modern Perl
38 Mojolicious uses a modern subset of Perl exclusively, and therefore
39 all documentation assumes that strict, warnings, utf8 and Perl 5.10
40 features are enabled, even if examples don't specifically mention it.
41
42 use strict;
43 use warnings;
44 use utf8;
45 use feature ':5.10';
46
47 Some modules, like Mojo::Base and Mojolicious::Lite, will enable them
48 for you automatically, whenever they are used.
49
50 Variable names
51 For brevity and clarity, example variables will reflect the type of
52 data the API uses. For instance, $bytes or $chars to distinguish
53 whether it is encoded bytes or decoded characters in a Perl string,
54 $bool if the value just indicates true or false, $c to denote a
55 Mojolicious::Controller object, or $app to denote the application
56 object.
57
59 Mojolicious::Guides::Tutorial
60 A fast and fun way to get started developing web applications with
61 Mojolicious. The tutorial introduces the Mojolicious::Lite micro web
62 framework, which is only a thin wrapper around the full web
63 framework. The simplified notation introduced in the tutorial is
64 commonly used throughout the guides and is therefore considered a
65 prerequisite, you should definitely take a look!
66
68 Mojolicious::Guides::Growing
69 Starting a Mojolicious::Lite prototype from scratch and growing it
70 into a well-structured Mojolicious application.
71
72 Mojolicious::Guides::Routing
73 Simple and fun introduction to the Mojolicious router.
74
75 Mojolicious::Guides::Rendering
76 Generating content with the Mojolicious renderer.
77
78 Mojolicious::Guides::Testing
79 Powerful yet elegant testing techniques and tools for Mojolicious and
80 other web applications.
81
82 Mojolicious::Guides::Cookbook
83 Cooking with Mojolicious, recipes for every taste.
84
85 Mojolicious::Guides::Contributing
86 Become a part of the ongoing Mojolicious development.
87
88 Mojolicious::Guides::FAQ
89 Answers to the most frequently asked questions.
90
92 Mojolicious and Mojolicious::Lite are the sum of many parts, built on
93 top of the Mojo web development toolkit. Small building blocks that can
94 be used independently for all kinds of applications, these are the most
95 prominent ones.
96
97 Mojo::UserAgent
98 Full featured non-blocking I/O HTTP and WebSocket user agent.
99
100 Mojo::DOM
101 Very fun and minimalistic HTML/XML DOM parser with CSS selector
102 support.
103
104 Mojo::JSON
105 Minimalistic JSON implementation that just works.
106
107 Mojo::Server::Daemon
108 Full featured, highly portable non-blocking I/O HTTP and WebSocket
109 server, with self-restart support through Mojo::Server::Morbo,
110 perfect for development and testing.
111
112 Mojo::Server::Prefork
113 Full featured, UNIX optimized, preforking non-blocking I/O HTTP and
114 WebSocket server with support for zero downtime software upgrades
115 (hot deployment) through Mojo::Server::Hypnotoad.
116
117 Mojo::Server::CGI, Mojo::Server::PSGI
118 Transparent CGI and PSGI support out of the box.
119
120 Mojo::IOLoop
121 A minimalistic event loop with support for multiple reactor backends.
122
123 Mojo::Template
124 Very Perl-ish and minimalistic template system.
125
126 Test::Mojo
127 Testing toolkit for web applications.
128
129 ojo
130 Fun one-liners using everything above.
131
133 These modules are not part of the Mojolicious distribution, but have
134 been designed to be used with it and are being developed under the same
135 umbrella.
136
137 Mojo::Pg
138 A tiny wrapper around DBD::Pg that makes PostgreSQL
139 <http://www.postgresql.org> a lot of fun to use with Mojolicious.
140 Perform queries blocking and non-blocking, use all SQL features
141 <https://www.postgresql.org/docs/current/static/sql.html> PostgreSQL
142 has to offer, generate CRUD queries from data structures, manage your
143 database schema with migrations and build scalable real-time web
144 applications with the publish/subscribe pattern.
145
146 Examples: The minimal chat <https://github.com/mojolicious/mojo-
147 pg/tree/master/examples/chat.pl> application will show you how to
148 scale WebSockets to multiple servers, and the well-structured blog
149 <https://github.com/mojolicious/mojo-pg/tree/master/examples/blog>
150 application how to apply the MVC design pattern in practice.
151
152 Minion
153 A full featured job queue for Mojolicious with support for multiple
154 backends (such as PostgreSQL <http://www.postgresql.org>). Job queues
155 allow you to process time and/or computationally intensive tasks in
156 background processes, outside of the request/response lifecycle.
157 Among those tasks you'll commonly find image resizing, spam
158 filtering, HTTP downloads, building tarballs, warming caches and
159 basically everything else you can imagine that's not super fast.
160
161 Examples: The link checker
162 <https://github.com/mojolicious/minion/tree/master/examples/linkcheck>
163 will show you how to integrate background jobs into well-structured
164 Mojolicious applications.
165
167 This is the class hierarchy of the Mojolicious distribution.
168
169 · Mojo
170
171 · Mojo::Base
172
173 · Mojolicious
174
175 · Mojo::HelloWorld
176
177 · Mojolicious::Lite
178
179 · Mojo::Cache
180
181 · Mojo::Cookie
182
183 · Mojo::Cookie::Request
184
185 · Mojo::Cookie::Response
186
187 · Mojo::DOM::CSS
188
189 · Mojo::DOM::HTML
190
191 · Mojo::Date
192
193 · Mojo::EventEmitter
194
195 · Mojo::Asset
196
197 · Mojo::Asset::File
198
199 · Mojo::Asset::Memory
200
201 · Mojo::Content
202
203 · Mojo::Content::MultiPart
204
205 · Mojo::Content::Single
206
207 · Mojo::IOLoop
208
209 · Mojo::IOLoop::Client
210
211 · Mojo::IOLoop::Server
212
213 · Mojo::IOLoop::Stream
214
215 · Mojo::IOLoop::Subprocess
216
217 · Mojo::IOLoop::TLS
218
219 · Mojo::Log
220
221 · Mojo::Message
222
223 · Mojo::Message::Request
224
225 · Mojo::Message::Response
226
227 · Mojo::Reactor
228
229 · Mojo::Reactor::Poll
230
231 · Mojo::Reactor::EV
232
233 · Mojo::Server
234
235 · Mojo::Server::CGI
236
237 · Mojo::Server::Daemon
238
239 · Mojo::Server::Prefork
240
241 · Mojo::Server::PSGI
242
243 · Mojo::Transaction
244
245 · Mojo::Transaction::HTTP
246
247 · Mojo::Transaction::WebSocket
248
249 · Mojo::UserAgent
250
251 · Mojolicious::Plugins
252
253 · Mojo::Exception
254
255 · Mojo::Headers
256
257 · Mojo::JSON::Pointer
258
259 · Mojo::Parameters
260
261 · Mojo::Path
262
263 · Mojo::Promise
264
265 · Mojo::IOLoop::Delay
266
267 · Mojo::Server::Hypnotoad
268
269 · Mojo::Server::Morbo
270
271 · Mojo::Server::Morbo::Backend
272
273 · Mojo::Server::Morbo::Backend::Poll
274
275 · Mojo::Template
276
277 · Mojo::URL
278
279 · Mojo::Upload
280
281 · Mojo::UserAgent::CookieJar
282
283 · Mojo::UserAgent::Proxy
284
285 · Mojo::UserAgent::Server
286
287 · Mojo::UserAgent::Transactor
288
289 · Mojolicious::Command
290
291 · Mojolicious::Command::cgi
292
293 · Mojolicious::Command::daemon
294
295 · Mojolicious::Command::eval
296
297 · Mojolicious::Command::get
298
299 · Mojolicious::Command::prefork
300
301 · Mojolicious::Command::psgi
302
303 · Mojolicious::Command::routes
304
305 · Mojolicious::Command::version
306
307 · Mojolicious::Command::Author::cpanify
308
309 · Mojolicious::Command::Author::generate::app
310
311 · Mojolicious::Command::Author::generate::lite_app
312
313 · Mojolicious::Command::Author::generate::makefile
314
315 · Mojolicious::Command::Author::generate::plugin
316
317 · Mojolicious::Command::Author::inflate
318
319 · Mojolicious::Commands
320
321 · Mojolicious::Command::Author::generate
322
323 · Mojolicious::Controller
324
325 · Mojolicious::Plugin
326
327 · Mojolicious::Plugin::Config
328
329 · Mojolicious::Plugin::JSONConfig
330
331 · Mojolicious::Plugin::DefaultHelpers
332
333 · Mojolicious::Plugin::EPLRenderer
334
335 · Mojolicious::Plugin::EPRenderer
336
337 · Mojolicious::Plugin::HeaderCondition
338
339 · Mojolicious::Plugin::Mount
340
341 · Mojolicious::Plugin::TagHelpers
342
343 · Mojolicious::Renderer
344
345 · Mojolicious::Routes::Match
346
347 · Mojolicious::Routes::Pattern
348
349 · Mojolicious::Routes::Route
350
351 · Mojolicious::Routes
352
353 · Mojolicious::Sessions
354
355 · Mojolicious::Static
356
357 · Mojolicious::Types
358
359 · Mojolicious::Validator
360
361 · Mojolicious::Validator::Validation
362
363 · Test::Mojo
364
365 · Mojo::ByteStream
366
367 · Mojo::Collection
368
369 · Mojo::DynamicMethods
370
371 · Mojo::DOM
372
373 · Mojo::File
374
375 · Mojo::Home
376
377 · Mojo::JSON
378
379 · Mojo::Loader
380
381 · Mojo::Util
382
383 · Mojo::WebSocket
384
385 · ojo
386
388 A lot more documentation and examples by many different authors can be
389 found in the Mojolicious wiki
390 <http://github.com/mojolicious/mojo/wiki>.
391
393 If you have any questions the documentation might not yet answer, don't
394 hesitate to ask on the mailing list
395 <http://groups.google.com/group/mojolicious> or the official IRC
396 channel "#mojo" on "irc.freenode.net" (chat now!
397 <https://kiwiirc.com/nextclient/#irc://irc.freenode.net/mojo?nick=guest-?>).
398
399
400
401perl v5.30.1 2020-01-30 Mojolicious::Guides(3)