Commit | Line | Data |
4d583dd8 |
1 | =head1 NAME |
2 | |
64ccd8a8 |
3 | Catalyst::Manual::Tutorial::Appendices - Catalyst Tutorial - Part 9: Appendices |
4d583dd8 |
4 | |
5 | |
6 | =head1 OVERVIEW |
7 | |
64ccd8a8 |
8 | This is B<Part 9 of 9> of the Catalyst tutorial. |
4d583dd8 |
9 | |
64ccd8a8 |
10 | L<Tutorial Overview|Catalyst::Manual::Tutorial> |
4d583dd8 |
11 | |
12 | =over 4 |
13 | |
14 | =item 1 |
15 | |
16 | L<Introduction|Catalyst::Manual::Tutorial::Intro> |
17 | |
18 | =item 2 |
19 | |
20 | L<Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics> |
21 | |
22 | =item 3 |
23 | |
64ccd8a8 |
24 | L<Basic CRUD|Catalyst::Manual::Tutorial_BasicCRUD> |
4d583dd8 |
25 | |
26 | =item 4 |
27 | |
28 | L<Authentication|Catalyst::Manual::Tutorial::Authentication> |
29 | |
30 | =item 5 |
31 | |
32 | L<Authorization|Catalyst::Manual::Tutorial::Authorization> |
33 | |
34 | =item 6 |
35 | |
36 | L<Debugging|Catalyst::Manual::Tutorial::Debugging> |
37 | |
38 | =item 7 |
39 | |
40 | L<Testing|Catalyst::Manual::Tutorial::Testing> |
41 | |
42 | =item 8 |
43 | |
44 | L<AdvancedCRUD|Catalyst::Manual::Tutorial::AdvancedCRUD> |
45 | |
46 | =item 9 |
47 | |
3c098c71 |
48 | B<Appendices> |
4d583dd8 |
49 | |
50 | =back |
51 | |
4d583dd8 |
52 | =head1 DESCRIPTION |
53 | |
64ccd8a8 |
54 | This part of the tutorial provides supporting information relevant to |
55 | the Catalyst tutorial. |
4d583dd8 |
56 | |
4d583dd8 |
57 | =head1 APPENDIX 1: CUT AND PASTE FOR POD-BASED EXAMPLES |
58 | |
64ccd8a8 |
59 | You may notice that Pod indents example code with four spaces. This |
60 | section provides some quick advice to "un-indent" this text in common |
61 | editors. |
4d583dd8 |
62 | |
4d583dd8 |
63 | =head2 "Un-indenting" with Vi/Vim |
64 | |
64ccd8a8 |
65 | When cutting and pasting multi-line text from Pod-based documents, the |
66 | following vi/vim regexs can be helpful to "un-indent" the inserted text |
67 | (do NOT type the quotes, they are only included to show spaces in the |
68 | regex patterns). I<Note that all 3 of the regexs end in 4 spaces>: |
4d583dd8 |
69 | |
70 | =over 4 |
71 | |
72 | =item * |
73 | |
74 | ":0,$s/^ " |
75 | |
64ccd8a8 |
76 | Removes four leading spaces from the entire file (from the first line, |
77 | C<0>, to the last line, C<$>). |
4d583dd8 |
78 | |
79 | =item * |
80 | |
cc548726 |
81 | "%$s/^ " |
82 | |
83 | A shortcut for the previous item (C<%> specifies the entire file; so |
84 | this removes four leading spaces from every line). |
85 | |
86 | =item * |
87 | |
4d583dd8 |
88 | ":.,$s/^ " |
89 | |
64ccd8a8 |
90 | Removes the first four spaces from the line the cursor is on at the time |
91 | the regex command is executed (".") to the last line of the file. |
4d583dd8 |
92 | |
93 | =item * |
94 | |
95 | ":.,44s/^ " |
96 | |
64ccd8a8 |
97 | Removes four leading space from the current line through line 44 |
98 | (obviously adjust the C<44> to the appropriate value in your example). |
4d583dd8 |
99 | |
100 | =back |
101 | |
4d583dd8 |
102 | =head2 "Un-indenting" with Emacs |
103 | |
64ccd8a8 |
104 | B<TODO> |
4d583dd8 |
105 | |
4d583dd8 |
106 | =head1 APPENDIX 2: USING MYSQL AND POSTGRESQL |
107 | |
64ccd8a8 |
108 | The main database used in this tutorial is the very simple yet powerful |
109 | SQLite. This section provides information that can be used to "convert" |
110 | the tutorial to use MySQL and PostgreSQL. However, note that part of |
111 | the beauty of the MVC architecture is that very little database-specific |
112 | code is spread throughout the system (at least when MVC is "done |
113 | right"). Consequently, converting from one database to another is |
114 | relatively painless with most Catalyst applications. In general, you |
115 | just need to adapt the schema definition C<.sql> file you use to |
116 | initialize your database and adjust a few configuration parameters. |
4d583dd8 |
117 | |
64ccd8a8 |
118 | Also note that the purpose of the data definition statements for this |
119 | section are not designed to take maximum advantage of the various |
120 | features in each database for issues such as referential integrity and |
121 | field types/constraints. |
4d583dd8 |
122 | |
4d583dd8 |
123 | =head2 MySQL |
124 | |
64ccd8a8 |
125 | B<TODO> |
4d583dd8 |
126 | |
127 | =head2 PostgreSQL |
128 | |
64ccd8a8 |
129 | B<TODO> |
4d583dd8 |
130 | |
cc548726 |
131 | |
132 | =head1 APPENDIX 3: IMPROVED HASHING SCRIPT |
133 | |
134 | Here is an improved SHA-1 hashing script from Gavin Henry that does |
135 | not expose the passwords to "capture" on the command line. |
136 | |
137 | #!/usr/bin/perl -w |
138 | #=============================================================================== |
139 | # |
140 | # FILE: enc_pass.pl |
141 | # |
142 | # USAGE: ./enc_pass.pl |
143 | # |
144 | # DESCRIPTION: Encrypt a Password using SHA-1 |
145 | # |
146 | # OPTIONS: --- |
147 | # REQUIREMENTS: --- |
148 | # BUGS: --- |
149 | # NOTES: --- |
150 | # AUTHOR: Gavin Henry (GH), <ghenry@suretecsystems.com> |
151 | # COMPANY: Suretec Systems Ltd. |
152 | # VERSION: 1.0 |
153 | # CREATED: 26/06/2006 |
154 | # REVISION: --- |
155 | # COPYRIGHT: http://search.cpan.org/dist/perl/pod/perlgpl.pod |
156 | #=============================================================================== |
157 | |
158 | use strict; |
159 | use warnings; |
160 | use Digest::SHA1; |
161 | use Term::ReadKey; |
162 | |
163 | sub get_pass { |
164 | ReadMode 'noecho'; |
165 | chomp( my $pw = ReadLine 0 ); |
166 | ReadMode 'normal'; |
167 | return $pw; |
168 | } |
169 | |
170 | print "Enter the password to be encrypted: "; |
171 | my $pass = get_pass(); |
172 | |
173 | print "\nConfirm the password: "; |
174 | my $verify = get_pass(); |
175 | |
176 | if ( $pass eq $verify ) { |
177 | my $sha1_enc = Digest::SHA1->new; |
178 | $sha1_enc->add($pass); |
179 | |
180 | print "\nYour encrypted password is: " |
181 | . $sha1_enc->hexdigest . "\n" |
182 | . "Paste this into your SQL INSERT/COPY Data.\n"; |
183 | } |
184 | else { |
185 | print "\nPasswords do not match!\n"; |
186 | } |
187 | |
188 | |
189 | |
190 | =head1 AUTHOR |
191 | |
192 | Kennedy Clark, C<hkclark@gmail.com> |
193 | |
194 | Please report any errors, issues or suggestions to the author. |
195 | |
196 | Copyright 2006, Kennedy Clark, under Creative Commons License |
197 | (L<http://creativecommons.org/licenses/by-nc-sa/2.5/>). |