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