Commit | Line | Data |
d442cc9f |
1 | =head1 NAME |
2 | |
3ab6187c |
3 | Catalyst::Manual::Tutorial::01_Intro - Catalyst Tutorial - Chapter 1: Introduction |
d442cc9f |
4 | |
5 | |
6 | =head1 OVERVIEW |
7 | |
4b4d3884 |
8 | This is B<Chapter 1 of 10> for the Catalyst tutorial. |
d442cc9f |
9 | |
10 | L<Tutorial Overview|Catalyst::Manual::Tutorial> |
11 | |
12 | =over 4 |
13 | |
14 | =item 1 |
15 | |
3ab6187c |
16 | B<01_Introduction> |
d442cc9f |
17 | |
18 | =item 2 |
19 | |
3ab6187c |
20 | L<Catalyst Basics|Catalyst::Manual::Tutorial::02_CatalystBasics> |
d442cc9f |
21 | |
22 | =item 3 |
23 | |
3ab6187c |
24 | L<More Catalyst Basics|Catalyst::Manual::Tutorial::03_MoreCatalystBasics> |
d442cc9f |
25 | |
26 | =item 4 |
27 | |
3ab6187c |
28 | L<Basic CRUD|Catalyst::Manual::Tutorial::04_BasicCRUD> |
d442cc9f |
29 | |
30 | =item 5 |
31 | |
3ab6187c |
32 | L<Authentication|Catalyst::Manual::Tutorial::05_Authentication> |
d442cc9f |
33 | |
34 | =item 6 |
35 | |
3ab6187c |
36 | L<Authorization|Catalyst::Manual::Tutorial::06_Authorization> |
d442cc9f |
37 | |
38 | =item 7 |
39 | |
3ab6187c |
40 | L<Debugging|Catalyst::Manual::Tutorial::07_Debugging> |
d442cc9f |
41 | |
42 | =item 8 |
43 | |
3ab6187c |
44 | L<Testing|Catalyst::Manual::Tutorial::08_Testing> |
d442cc9f |
45 | |
46 | =item 9 |
47 | |
3ab6187c |
48 | L<Advanced CRUD|Catalyst::Manual::Tutorial::09_AdvancedCRUD> |
1def4a20 |
49 | |
50 | =item 10 |
51 | |
3ab6187c |
52 | L<Appendices|Catalyst::Manual::Tutorial::10_Appendices> |
d442cc9f |
53 | |
54 | =back |
55 | |
1def4a20 |
56 | |
d442cc9f |
57 | =head1 DESCRIPTION |
58 | |
232da04a |
59 | This tutorial provides a multi-part introduction to the Catalyst Web |
60 | Framework. It seeks to provide a rapid overview of many of its most |
d442cc9f |
61 | commonly used features. The focus is on the real-world best practices |
62 | required in the construction of nearly all Catalyst applications. |
63 | |
64 | Although the primary target of the tutorial is users new to the Catalyst |
65 | framework, experienced users may wish to review specific sections (for |
1def4a20 |
66 | example, how to use DBIC for their model classes, how to add |
8168726b |
67 | authentication and authorization to an existing application, and/or |
68 | form management). |
d442cc9f |
69 | |
232da04a |
70 | The most recent code for the tutorial is included on the Tutorial Virtual |
71 | Machine you can download from: |
d442cc9f |
72 | |
014065cb |
73 | L<http://cattut.shadowcat.co.uk/> |
74 | |
75 | See L</STARTING WITH THE TUTORIAL VIRTUAL MACHINE> below for |
76 | instructions getting and using the VM. |
77 | |
78 | Should you wish to download the code directly, you get pull it via the |
79 | following command (note: will probably be switching to git soon): |
80 | |
028b4e1a |
81 | svn co http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/ CatalystTutorial |
d442cc9f |
82 | |
75b13da6 |
83 | This will download the most recent code for each chapter of the |
84 | tutorial into the CatalystTutorial directory on your machine. |
d442cc9f |
85 | |
81a33ef3 |
86 | These reference implementations are provided so that when you follow |
232da04a |
87 | the tutorial, you can use the code to ensure that your system is set up |
88 | correctly (which shouldn't be an issue if you use the Tutorial Virtual |
89 | Machine), :-) and that you have not inadvertently made any typographic |
81a33ef3 |
90 | errors, or accidentally skipped part of the tutorial. |
3d9ae335 |
91 | |
8168726b |
92 | B<NOTE: You can use any Perl-supported OS and environment to run |
93 | Catalyst.> It should make little or no difference to Catalyst's |
232da04a |
94 | operation, B<but this tutorial has been written using the Debian-based |
81a33ef3 |
95 | Tutorial Virtual Machine> that you can download and use to work through |
232da04a |
96 | the full tutorial step by step. B<WE STRONGLY RECOMMEND THAT YOU USE |
97 | THE VIRTUAL MACHINE IMAGE TO WORK THROUGH THE TUTORIAL> to avoid issues |
98 | that may crop up if you are working with a different configuration. We |
99 | have tested the Tutorial Virtual Machine to make sure all of the |
100 | examples work correctly, but it is hard to guarantee this on other |
101 | platforms and versions. |
102 | |
103 | If you would prefer to install directly from CPAN and not use the |
104 | Tutorial Virtual machine, you can download the example program and all |
105 | the necessary dependencies to your local machine by installing the |
106 | C<Task::Catalyst::Tutorial> distribution: |
d442cc9f |
107 | |
108 | cpan Task::Catalyst::Tutorial |
109 | |
110 | This will also test to make sure the dependencies are working. If you |
111 | have trouble installing these, please ask for help on the #catalyst |
112 | IRC channel, or the Catalyst mailing list. |
113 | |
3533daff |
114 | Subjects covered by the tutorial include: |
d442cc9f |
115 | |
116 | =over 4 |
117 | |
7ce05098 |
118 | =item * |
d442cc9f |
119 | |
120 | A simple application that lists and adds books. |
121 | |
122 | =item * |
123 | |
2217b252 |
124 | The use of L<DBIx::Class> (DBIC) for the model (including |
8168726b |
125 | some of the more advanced techniques you will probably want to use in |
acbd7bdd |
126 | your applications). |
d442cc9f |
127 | |
7ce05098 |
128 | =item * |
d442cc9f |
129 | |
130 | How to write CRUD (Create, Read, Update, and Delete) operations in |
131 | Catalyst. |
132 | |
133 | =item * |
134 | |
135 | Authentication ("auth"). |
136 | |
7ce05098 |
137 | =item * |
d442cc9f |
138 | |
139 | Role-based authorization ("authz"). |
140 | |
7ce05098 |
141 | =item * |
d442cc9f |
142 | |
8168726b |
143 | Attempts to provide an example showing current (5.9) Catalyst |
144 | practices. |
d442cc9f |
145 | |
7ce05098 |
146 | =item * |
d442cc9f |
147 | |
1390ef0e |
148 | The use of Template Toolkit (TT). |
d442cc9f |
149 | |
7ce05098 |
150 | =item * |
d442cc9f |
151 | |
152 | Useful techniques for troubleshooting and debugging Catalyst |
153 | applications. |
154 | |
7ce05098 |
155 | =item * |
d442cc9f |
156 | |
157 | The use of SQLite as a database (with code also provided for MySQL and |
8168726b |
158 | PostgreSQL). (Note: Because we make use of the DBIx::Class Object |
444d6b27 |
159 | Relational Mapping [ORM] layer, out our application will be database |
8168726b |
160 | agnostic and can easily be used by any of the databases supported by |
161 | DBIx::Class.) |
d442cc9f |
162 | |
7ce05098 |
163 | =item * |
d442cc9f |
164 | |
2217b252 |
165 | The use of L<HTML::FormFu> or L<HTML::FormHandler> |
0abc72ed |
166 | for automated form processing and validation. |
d442cc9f |
167 | |
168 | =back |
169 | |
170 | This tutorial makes the learning process its main priority. For |
171 | example, the level of comments in the code found here would likely be |
1def4a20 |
172 | considered excessive in a "normal project." Because of their contextual |
d442cc9f |
173 | value, this tutorial will generally favor inline comments over a |
174 | separate discussion in the text. It also deliberately tries to |
175 | demonstrate multiple approaches to various features (in general, you |
176 | should try to be as consistent as possible with your own production |
177 | code). |
178 | |
179 | Furthermore, this tutorial tries to minimize the number of controllers, |
180 | models, TT templates, and database tables. Although this does result in |
181 | things being a bit contrived at times, the concepts should be applicable |
182 | to more complex environments. More complete and complicated example |
232da04a |
183 | applications can be found at |
184 | L<http://wiki.catalystframework.org/wiki/resources/catalystexamples> and |
185 | in the C<examples> area of the Catalyst Subversion repository at |
d442cc9f |
186 | L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/>. |
1390ef0e |
187 | |
2e73e2be |
188 | |
232da04a |
189 | =head1 STARTING WITH THE TUTORIAL VIRTUAL MACHINE |
2e73e2be |
190 | |
ec5b24b2 |
191 | The steps below briefly outline how you can download the Tutorial |
192 | Virtual Machine. This document uses the term "host machine" to refer to |
193 | the physical machine where you will run the virtualization software and |
194 | boot up the VM. The terms "guest machine" or just "VM" refer to the |
195 | virtual machine itself -- the thing where you actually do the tutorial |
f0deaac8 |
196 | (and that you boot up on the "host machine"). |
689db796 |
197 | |
198 | B<Note:> Throughout the tutorial, we will shows the UNIX shell prompt as |
199 | "C<$>". If you are using the Tutorial VM, the prompt will really be |
200 | "C<catalyst@catalyst:~$>" (where "C<~"> will change to show your |
201 | current directory), but we will keep it short and just use "C<$>". |
ec5b24b2 |
202 | |
203 | |
2e73e2be |
204 | =over 4 |
205 | |
7ce05098 |
206 | =item 1 |
2e73e2be |
207 | |
014065cb |
208 | Download a Tutorial Virtual Machine image from |
209 | L<http://cattut.shadowcat.co.uk/> |
210 | |
81a33ef3 |
211 | B<A big thanks to Shadowcat Systems for hosting the virtual machines> |
212 | B<(and everything else they do for the Perl community)!> |
2e73e2be |
213 | |
214 | =item 2 |
215 | |
9be506a8 |
216 | Uncompress the image on the "host machine": |
232da04a |
217 | |
9be506a8 |
218 | MAINCOMPUTER:~$ tar zxvf CatalystTutorial.tgz |
2e73e2be |
219 | |
220 | =item 3 |
221 | |
232da04a |
222 | Boot the virtual machine using a tool like VMWare Player |
223 | L<http://www.vmware.com/products/player> or VirtualBox |
224 | L<http://www.virtualbox.org/>. |
2e73e2be |
225 | |
226 | =item 4 |
227 | |
477a6d5b |
228 | Once you get a login prompt, enter the username B<catalyst> and a |
229 | password for C<catalyst>. You should now be at a prompt that looks |
230 | like: |
2e73e2be |
231 | |
477a6d5b |
232 | catalyst login: catalyst |
3f97ca7b |
233 | Password: catalyst |
234 | ... |
689db796 |
235 | catalyst@catalyst:~$ |
2e73e2be |
236 | |
237 | =item 5 |
238 | |
232da04a |
239 | Type "C<ifconfig>" to get the IP address assigned to the virtual |
240 | machine. You should get output along the lines of: |
2e73e2be |
241 | |
232da04a |
242 | eth0 Link encap:Ethernet HWaddr 00:01:22:3b:45:69 |
ec5b24b2 |
243 | inet addr:192.168.0.12 Bcast:192.168.0.255 Mask:255.255.255.0 |
2e73e2be |
244 | ... |
245 | |
232da04a |
246 | You want the IP address on the second line below the C<eth0> interface. |
cd13ab36 |
247 | The image is designed to automatically use a DHCP-assigned address. |
232da04a |
248 | |
232da04a |
249 | |
ec5b24b2 |
250 | Try to ping this IP address from your "host machine" (main desktop): |
2e73e2be |
251 | |
2e73e2be |
252 | |
9be506a8 |
253 | MAINCOMPUTER:~$ ping 192.168.0.12 |
ec5b24b2 |
254 | PING 192.168.0.12 (192.168.0.12) 56(84) bytes of data. |
255 | 64 bytes from 192.168.0.12: icmp_req=1 ttl=255 time=4.97 ms |
256 | 64 bytes from 192.168.0.12: icmp_req=2 ttl=255 time=3.43 ms |
257 | ... |
2e73e2be |
258 | |
2e73e2be |
259 | |
ec5b24b2 |
260 | B<Note:> The ping above is being originated B<from> your B<host machine> |
261 | (main desktop) and going B<to> your guest B<virtual machine>, not the |
262 | other way around. |
263 | |
264 | If you are not seeing a valid IP address or it's not responding to pings |
265 | (for example, you get error messages along the lines of "Request timed |
266 | out", "100% packet loss", or "Destination Host Unreachable"), there |
267 | could be a few network-related issues you might need to sort out. See |
014065cb |
268 | the section below L</Sorting Out Virtual Machine Network-Related Issues> |
ec5b24b2 |
269 | for additional information and troubleshooting advice. |
270 | |
81a33ef3 |
271 | B<Note:> Remember this IP address... you will be using it throughout the |
ec5b24b2 |
272 | tutorial. |
273 | |
232da04a |
274 | |
275 | =item 6 |
276 | |
ec5b24b2 |
277 | B<From your main desktop machine>, open an SSH client and connect to the |
278 | IP address found in the previous step. You should get a login prompt |
279 | (accept the SSH key if you get a warning message about that). Login |
477a6d5b |
280 | with the same username and password as we used in Step 4: B<catalyst> / |
ec5b24b2 |
281 | B<catalyst> |
282 | |
d1598ab8 |
283 | catalyst login: catalyst |
ec5b24b2 |
284 | Password: catalyst |
285 | ... |
689db796 |
286 | catalyst@catalyst:~$ |
ec5b24b2 |
287 | |
2e73e2be |
288 | |
289 | =item 7 |
290 | |
232da04a |
291 | B<Using the SSH session>, change to the sample code directory for |
292 | Chapter 3 included with the Tutorial Virtual Machine and start the |
293 | Catalyst Development Server: |
2e73e2be |
294 | |
ec5b24b2 |
295 | $ cd Final/Chapter03/MyApp |
8835e16b |
296 | $ perl script/myapp_server.pl |
2e73e2be |
297 | |
298 | =item 8 |
299 | |
ec5b24b2 |
300 | B<From your main desktop machine> (the "host machine"), open a web |
301 | browser and go to B<http://A.B.C.D:3000/>, where C<A.B.C.D> is the IP |
302 | address to your virtual machine that you looked up in Step 5. For |
303 | example, if your virtual machine is using the IP address |
304 | C<192.168.0.12>, you would put the following URL into your web browser: |
232da04a |
305 | |
ec5b24b2 |
306 | http://192.168.0.12:3000/ |
232da04a |
307 | |
308 | Make sure you don't forget the B<:3000> to use port 3000 instead of the |
309 | usual port 80 that is used by HTTP by default. |
2e73e2be |
310 | |
232da04a |
311 | You should get a Catalyst Welcome Screen. If you do, feel free to jump |
312 | right in to L<Chapter 2|Catalyst::Manual::Tutorial::02_CatalystBasics> |
313 | of the tutorial. If you don't go get the Catalyst Welcome Screen, go |
314 | back and carefully check each of the steps above. |
315 | |
316 | =item 9 |
317 | |
46b6662a |
318 | B<Optional:> Also, to reduce download size, the Tutorial VM just |
319 | includes a minimal command-line environment. You are free to use |
320 | Debian's very capable C<apt> package manager to install other packages. |
321 | You will first want to pull the apt cache files with C<aptitude update> |
322 | (or C<apt-get update> if you prefer apt-get). |
323 | |
324 | The VI/VIM editor is already installed on the Tutorial Virtual Machine. |
325 | In order to reduce the size of the download, Emacs is not pre-installed. |
326 | Since people obviously have very strong opinions about which editor is |
327 | best, :-) fortunately it's very easy to install Emacs: |
328 | |
d1598ab8 |
329 | $ sudo aptitude update |
330 | $ sudo aptitude install emacs |
2e73e2be |
331 | |
46b6662a |
332 | In general, it is expected that people will |
333 | boot up the Tutorial VM on their main desktop (the "host machine" using |
334 | the terminology above) and then use that main desktop machine to SSH and |
335 | web browse into the "guest VM" as they work through the tutorial. If |
336 | you wish to install X Windows (or any other packages), just use the |
09627be4 |
337 | C<aptitude> (or C<apt-get>) Debian commands. |
338 | |
339 | For example, to install X Windows with Fluxbox (a lightweight |
340 | WindowManager -- it is great for things like this tutorial since it's |
341 | about 1/10th the size of other common X Windows environments), you can |
342 | do: |
46b6662a |
343 | |
d1598ab8 |
344 | $ sudo aptitude update |
09627be4 |
345 | $ sudo aptitude install xorg fluxbox iceweasel |
346 | |
347 | And then start X Windows from the B<VM Console> with this command: |
348 | |
349 | $ startx |
350 | |
351 | Note that if you want to start Fluxbox from an SSH session, you can use |
352 | the C<sudo dpkg-reconfigure x11-common> and select "anybody" from the |
353 | menu. Otherwise, you will need to be on the actual "VM console" to |
354 | start it. |
46b6662a |
355 | |
09627be4 |
356 | If you have a preference for the Gnome desktop environment, you can do: |
46b6662a |
357 | |
d1598ab8 |
358 | $ sudo aptitude update |
083e20bd |
359 | $ sudo aptitude install gnome iceweasel |
09627be4 |
360 | $ |
361 | $ # You can reboot or start with 'startx', we will just reboot here |
362 | $ reboot |
363 | |
8c454636 |
364 | For KDE, just substitute the package name "C<kde>" for "C<gnome>" above. |
46b6662a |
365 | |
11bd7647 |
366 | $ sudo aptitude install kde iceweasel |
367 | |
09627be4 |
368 | Note that C<iceweasel> is basically used to install Firefox on Debian |
369 | boxes. You can start it under X Windows with either the C<firefox> |
370 | command or the C<iceweasel> command (or use the menus). You can get |
371 | more information on Iceweasel at L<http://wiki.debian.org/Iceweasel>. |
372 | |
373 | Also, you might need to add more memory to your virtual machine if you |
374 | want to run X Windows (or other tools that might require additional |
3df63254 |
375 | memory). Consult the documentation of your virtualization software |
09627be4 |
376 | for instructions on how to do this (it's usually pretty simple). |
46b6662a |
377 | |
378 | |
2e73e2be |
379 | =back |
380 | |
381 | |
ec5b24b2 |
382 | You may note that the Tutorial Virtual Machine uses L<local::lib> so |
477a6d5b |
383 | that the Perl modules are run from ~/perl5 (in this case, |
384 | /home/catalyst/perl5) vs. the usual location of your "system Perl". We |
385 | recommend that you also consider using this very handy module. It can |
386 | greatly ease the process of maintaining and testing different |
387 | combinations or Perl modules across development, staging, and production |
3df63254 |
388 | servers. (The "relocatable Perl" feature can also be used to run |
477a6d5b |
389 | both the modules B<and> Perl itself from your home directory [or any |
390 | other directory you chose]). |
e684d796 |
391 | |
d35624c1 |
392 | B<Note>: Please provide feedback on how the Virtual Machine approach for |
393 | the tutorial works for you. If you have suggestions or comments, you |
394 | can reach the author through the email address at the bottom of this |
395 | page or via an RT ticket at |
396 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Manual>. |
397 | |
398 | |
e684d796 |
399 | |
ec5b24b2 |
400 | =head2 Sorting Out Virtual Machine Network-Related Issues |
401 | |
402 | In general, using a virtual machine to work through the tutorial is |
403 | *much* easier than trying to do it in other environments, especially if |
404 | you are new to Catalyst (or Perl or CPAN or ...). However, it's |
405 | possible that you could run into a few network-related issues. The good |
406 | news is that there is lots of information about the issue available via |
407 | search engines on the Internet. Here is some background information to |
408 | get you started. |
409 | |
410 | In Step 5 of the prior section above, we assumed that a "Bridged Mode" |
411 | configuration and DHCP will work (it should for most people). If DHCP |
412 | is not working or is not available in your location, most virtual |
413 | machine "host" environments let you select between one of several |
414 | different types of networking between the "guest" and the "host" |
415 | machine. |
416 | |
417 | 1) Bridged |
418 | 2) NAT |
419 | 3) Local host only |
420 | |
421 | The Tutorial Virtual Machine defaults to "Bridged" -- this should result |
422 | in the VM acting like another device on your network that will get a |
423 | different DHCP IP address than the host machine. The advantage of this |
424 | approach, is that you can easily SSH and web browse to the guest virtual |
425 | machine. In general, this is the best option if you want to be able to |
426 | boot up the VM and then use your SSH client and web browser from your |
427 | main machine to connect into the virtual machine. |
428 | |
429 | In some environments, you might have better luck with "NAT" (Network |
430 | Address Translation) mode. With this configuration, the guest VM shares |
431 | the same IP address as the host machine. The downside of this approach |
432 | is that special configuration is required if you want to be able to SSH |
433 | or web browse to the guest VM. The NAT option should automatically |
434 | allow the VM "outbound connection" (e.g., to the Internet if you want to |
435 | install additional Debian packages), but it requires special |
436 | configuration if you want to get "inbound connections" that go from some |
437 | other machine (including the "host machine") into the VM. Some virtual |
438 | machine host environments let you configure a "static NAT" or "port |
439 | forwarding" to reach the guest OS, but others omit this functionality. |
440 | |
09627be4 |
441 | Note: NAT mode can work fine if you install X Windows and do the whole |
442 | tutorial locally on the actual VM vs. using SSH and a web browser from |
443 | your host machine. |
444 | |
ec5b24b2 |
445 | "Local host only" mode let's the guest VM and the host machine talk on a |
446 | "private subnet" that other devices in your network cannot reach. This |
447 | can work as long as you don't need to go from the VM to the Internet |
448 | (for example, to install other Debian packages). |
449 | |
09627be4 |
450 | |
ec5b24b2 |
451 | Consult the documentation on your virtual machine host environment for |
452 | help configuring the options above. Here are some links that might |
453 | help: |
454 | |
455 | =over 4 |
456 | |
457 | =item * |
458 | |
90d7da3c |
459 | L<http://vmfaq.com/index.php?View=entry&EntryID=34> |
ec5b24b2 |
460 | |
461 | =item * |
462 | |
81a33ef3 |
463 | L<http://www.vmware.com/support/pubs/player_pubs.html> |
ec5b24b2 |
464 | |
465 | =item * |
466 | |
81a33ef3 |
467 | L<http://www.virtualbox.org/manual/ch06.html> |
ec5b24b2 |
468 | |
469 | =back |
470 | |
471 | |
472 | |
473 | |
d442cc9f |
474 | =head1 VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL |
475 | |
476 | This tutorial was built using the following resources. Please note that |
a6b4cff5 |
477 | you may need to make adjustments for different environments and versions |
478 | (note that trailing zeros in version numbers are not significant and may |
479 | get dropped with some techniques for viewing them; for example, Catalyst |
480 | v5.80020 might show up as 5.8002): |
d442cc9f |
481 | |
482 | =over 4 |
483 | |
7ce05098 |
484 | =item * |
d442cc9f |
485 | |
95968b61 |
486 | Debian 6 (Squeeze) |
d442cc9f |
487 | |
7ce05098 |
488 | =item * |
d442cc9f |
489 | |
232da04a |
490 | Catalyst v5.90002 |
dd88c3b6 |
491 | |
22a67212 |
492 | =item * |
dd88c3b6 |
493 | |
232da04a |
494 | Catalyst::Devel v1.34 |
d442cc9f |
495 | |
7ce05098 |
496 | =item * |
d442cc9f |
497 | |
232da04a |
498 | DBIx::Class v0.08195 |
d442cc9f |
499 | |
fce83e5f |
500 | =item * |
501 | |
232da04a |
502 | Catalyst::Model::DBIC::Schema v0.54 |
2e73e2be |
503 | |
504 | =item * |
505 | |
95968b61 |
506 | Template Toolkit v2.22 |
fce83e5f |
507 | |
2e73e2be |
508 | |
d442cc9f |
509 | =item * |
510 | |
232da04a |
511 | HTML::FormFu -- v0.09004 |
2e73e2be |
512 | |
7ce05098 |
513 | =item * |
d442cc9f |
514 | |
865d3efb |
515 | B<NOTE:> You can check the versions you have installed with the |
95968b61 |
516 | following command (note the slash before the space): |
517 | |
518 | perl -M<_mod_name_>\ 999 |
519 | |
520 | or: |
865d3efb |
521 | |
f63a9a2b |
522 | perl -M<_mod_name_> -e 'print "$<_mod_name_>::VERSION\n"' |
865d3efb |
523 | |
524 | For example: |
865d3efb |
525 | |
95968b61 |
526 | perl -MCatalyst::Devel\ 999 |
444d6b27 |
527 | |
528 | or: |
529 | |
530 | perl -MCatalyst::Devel -e 'print "$Catalyst::Devel::VERSION\n";' |
d442cc9f |
531 | |
7ce05098 |
532 | =item * |
d442cc9f |
533 | |
232da04a |
534 | This tutorial will show URLs in the format of C<http://localhost:3000>, |
535 | but if you are running your web browser from outside the Tutorial |
536 | Virtual Machine, you will want to substitute the IP address of your VM |
537 | for the C<localhost> in the URLs (again, you can get the IP address for |
538 | eth0 from the C<ifconfig> command). For example, if your VM has an |
ec5b24b2 |
539 | IP address of 192.168.0.12, you will want to use a base URL of |
540 | C<http://192.168.0.12:3000>. Note that the development server |
5336f546 |
541 | defaults to port 3000 (you can change with the "-p" option on the |
542 | command line). |
232da04a |
543 | |
d3b61552 |
544 | B<Please Note:> Depending on the web browser you are using, you might |
545 | need to hit C<Shift+Reload> or C<Ctrl+Reload> to pull a fresh page when |
8168726b |
546 | testing your application at various points (see |
d3b61552 |
547 | L<http://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache> for a |
548 | comprehensive list of options for each browser). |
549 | |
550 | Also, the C<-k> B<keepalive option> to the development server can be |
551 | necessary with some browsers (B<especially Internet Explorer>). |
0c51850e |
552 | |
d442cc9f |
553 | =back |
554 | |
1390ef0e |
555 | |
d442cc9f |
556 | =head1 DATABASES |
557 | |
558 | This tutorial will primarily focus on SQLite because of its simplicity |
559 | of installation and use; however, modifications in the script required |
a6b4cff5 |
560 | to support MySQL and PostgreSQL will be presented in the Appendix. |
d442cc9f |
561 | |
a6b4cff5 |
562 | B<Note:> One of the advantages of using tools like Catalyst and DBIC is |
563 | that applications become much more database independent. As such, you |
564 | will notice that only the C<.sql> files used to initialize the database |
565 | change between database systems: most of the code generally remains the |
d442cc9f |
566 | same. |
567 | |
1390ef0e |
568 | |
24acc5d7 |
569 | You can jump to the next chapter of the tutorial here: |
570 | L<Catalyst Basics|Catalyst::Manual::Tutorial::02_CatalystBasics> |
571 | |
572 | |
d442cc9f |
573 | =head1 AUTHOR |
574 | |
575 | Kennedy Clark, C<hkclark@gmail.com> |
576 | |
bb0999d3 |
577 | Feel free to contact the author for any errors or suggestions, but the |
578 | best way to report issues is via the CPAN RT Bug system at |
579 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Manual>. |
d442cc9f |
580 | |
bb0999d3 |
581 | Copyright 2006-2011, Kennedy Clark, under the |
ec3ef4ad |
582 | Creative Commons Attribution Share-Alike License Version 3.0 |
865d3efb |
583 | (L<http://creativecommons.org/licenses/by-sa/3.0/us/>). |