X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FAppendices.pod;h=69710a18e2891513710e8873575dff6256a8baaa;hb=eed933017cf2b84d65e016fe75ac16b32280f35c;hp=c408e8226b93cc442b21e4408dbe9444a429fecd;hpb=64ccd8a8bfbc16276c044c94702b1440c2897695;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Manual/Tutorial/Appendices.pod b/lib/Catalyst/Manual/Tutorial/Appendices.pod index c408e82..69710a1 100644 --- a/lib/Catalyst/Manual/Tutorial/Appendices.pod +++ b/lib/Catalyst/Manual/Tutorial/Appendices.pod @@ -45,26 +45,21 @@ L =item 9 -B +B =back - - =head1 DESCRIPTION This part of the tutorial provides supporting information relevant to the Catalyst tutorial. - - =head1 APPENDIX 1: CUT AND PASTE FOR POD-BASED EXAMPLES You may notice that Pod indents example code with four spaces. This section provides some quick advice to "un-indent" this text in common editors. - =head2 "Un-indenting" with Vi/Vim When cutting and pasting multi-line text from Pod-based documents, the @@ -83,6 +78,13 @@ C<0>, to the last line, C<$>). =item * +"%$s/^ " + +A shortcut for the previous item (C<%> specifies the entire file; so +this removes four leading spaces from every line). + +=item * + ":.,$s/^ " Removes the first four spaces from the line the cursor is on at the time @@ -97,13 +99,10 @@ Removes four leading space from the current line through line 44 =back - =head2 "Un-indenting" with Emacs B - - =head1 APPENDIX 2: USING MYSQL AND POSTGRESQL The main database used in this tutorial is the very simple yet powerful @@ -121,7 +120,6 @@ section are not designed to take maximum advantage of the various features in each database for issues such as referential integrity and field types/constraints. - =head2 MySQL B @@ -130,3 +128,72 @@ B B + +=head1 APPENDIX 3: IMPROVED HASHING SCRIPT + +Here is an improved SHA-1 hashing script from Gavin Henry that does +not expose the passwords to "capture" on the command line. + + #!/usr/bin/perl -w + #=============================================================================== + # + # FILE: enc_pass.pl + # + # USAGE: ./enc_pass.pl + # + # DESCRIPTION: Encrypt a Password using SHA-1 + # + # OPTIONS: --- + # REQUIREMENTS: --- + # BUGS: --- + # NOTES: --- + # AUTHOR: Gavin Henry (GH), + # COMPANY: Suretec Systems Ltd. + # VERSION: 1.0 + # CREATED: 26/06/2006 + # REVISION: --- + # COPYRIGHT: http://search.cpan.org/dist/perl/pod/perlgpl.pod + #=============================================================================== + + use strict; + use warnings; + use Digest::SHA1; + use Term::ReadKey; + + sub get_pass { + ReadMode 'noecho'; + chomp( my $pw = ReadLine 0 ); + ReadMode 'normal'; + return $pw; + } + + print "Enter the password to be encrypted: "; + my $pass = get_pass(); + + print "\nConfirm the password: "; + my $verify = get_pass(); + + if ( $pass eq $verify ) { + my $sha1_enc = Digest::SHA1->new; + $sha1_enc->add($pass); + + print "\nYour encrypted password is: " + . $sha1_enc->hexdigest . "\n" + . "Paste this into your SQL INSERT/COPY Data.\n"; + } + else { + print "\nPasswords do not match!\n"; + } + + + +=head1 AUTHOR + +Kennedy Clark, C + +Please report any errors, issues or suggestions to the author. The +most recent version of the Catlayst Tutorial can be found at +L. + +Copyright 2006, Kennedy Clark, under Creative Commons License +(L).