Kieren Diment > Catalyst-Manual > Catalyst::Manual::Tutorial::10_Appendices

Download:
Catalyst-Manual-5.9005.tar.gz

Annotate this POD

CPAN RT

New  8
Open  2
View/Report Bugs
Source   Latest Release: Catalyst-Manual-5.9009

NAME ^

Catalyst::Manual::Tutorial::10_Appendices - Catalyst Tutorial - Chapter 10: Appendices

OVERVIEW ^

This is Chapter 10 of 10 for the Catalyst tutorial.

Tutorial Overview

  1. Introduction
  2. Catalyst Basics
  3. More Catalyst Basics
  4. Basic CRUD
  5. Authentication
  6. Authorization
  7. Debugging
  8. Testing
  9. Advanced CRUD
  10. 10_Appendices

DESCRIPTION ^

This chapter of the tutorial provides supporting information relevant to the Catalyst tutorial.

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.

"Un-indenting" with Vi/Vim

When cutting and pasting multi-line text from Pod-based documents, the following vi/vim regexs can be helpful to "un-indent" the inserted text (do NOT type the quotes, they are only included to show spaces in the regex patterns). Note that all 3 of the regexs end in 4 spaces:

"Un-indenting" with Emacs

Although the author has not used Emacs for many years (apologies to the Emacs fans out there), here is a quick hint to get you started. To replace the leading spaces of every line in a file, use:

    M-x replace-regexp<RET>
    Replace regexp: ^    <RET>
    with: <RET>

All of that will occur on the single line at the bottom of your screen. Note that "<RET>" represents the return key/enter. Also, there are four spaces after the "^" on the "Replace regexp:" line and no spaces entered on the last line.

You can limit the replacement operation by selecting text first (depending on your version of Emacs, you can either use the mouse or experiment with commands such as C-SPC to set the mark at the cursor location and C-< and C-> to set the mark at the beginning and end of the file respectively.

Also, Stefan Kangas sent in the following tip about an alternate approach using the command indent-region to redo the indentation for the currently selected region (adhering to indent rules in the current major mode). You can run the command by typing M-x indent-region or pressing the default keybinding C-M-\ in cperl-mode. Additional details can be found here:

http://www.gnu.org/software/emacs/manual/html_node/emacs/Indentation-Commands.html

APPENDIX 2: USING POSTGRESQL AND MYSQL ^

The main database used in this tutorial is the very simple yet powerful SQLite. This section provides information that can be used to "convert" the tutorial to use PostgreSQL and MySQL. However, note that part of the beauty of the MVC architecture is that very little database-specific code is spread throughout the system (at least when MVC is "done right"). Consequently, converting from one database to another is relatively painless with most Catalyst applications. In general, you just need to adapt the schema definition .sql file you use to initialize your database and adjust a few configuration parameters.

Also note that the purpose of the data definition statements for this 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.

PostgreSQL

Use the following steps to adapt the tutorial to PostgreSQL. Thanks to Caelum (Rafael Kitover) for assistance with the most recent updates, and Louis Moore, Marcello Romani and Tom Lanyon for help with earlier versions.

MySQL

Use the following steps to adapt the tutorial to MySQL. Thanks to Jim Howard for the help and Zsolt Zemancsik for the up to date fixes.

AUTHOR ^

Kennedy Clark, hkclark@gmail.com

Feel free to contact the author for any errors or suggestions, but the best way to report issues is via the CPAN RT Bug system at https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Manual.

Copyright 2006-2011, Kennedy Clark, under the Creative Commons Attribution Share-Alike License Version 3.0 (http://creativecommons.org/licenses/by-sa/3.0/us/).

syntax highlighting: