Catalyst-Manual

 view release on metacpan or  search on metacpan

lib/Catalyst/Manual/Tutorial/10_Appendices.pod  view on Meta::CPAN

L<Authorization|Catalyst::Manual::Tutorial::06_Authorization>

=item 7

L<Debugging|Catalyst::Manual::Tutorial::07_Debugging>

=item 8

L<Testing|Catalyst::Manual::Tutorial::08_Testing>

=item 9

L<Advanced CRUD|Catalyst::Manual::Tutorial::09_AdvancedCRUD>

=item 10

B<10_Appendices>

=back


=head1 DESCRIPTION

This chapter 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
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).  I<Note that all 3 of the regexs end in 4 spaces>:

=over 4

=item *

C<":0,$s/^    ">

Removes four leading spaces from the entire file (from the first line,
C<0>, to the last line, C<$>).

=item *

C<"%s/^    ">

A shortcut for the previous item (C<%> specifies the entire file; so
this removes four leading spaces from every line).

=item *

C<":.,$s/^    ">

Removes the first four spaces from the line the cursor is on at the time
the regex command is executed (".") to the last line of the file.

=item *

C<":.,44s/^    ">

Removes four leading space from the current line through line 44
(obviously adjust the C<44> to the appropriate value in your example).

=back

=head2 "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<C-SPC> to set the mark at the cursor location and
C<< C-< >> and C<< 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 C<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:

L<https://www.gnu.org/software/emacs/manual/html_node/emacs/Indentation-Commands.html>


=head1 APPENDIX 2: USING POSTGRESQL AND MYSQL

The main database used in this tutorial is the very simple yet powerful
L<SQLite|https://www.sqlite.org>.  This section provides information
that can be used to "convert" the tutorial to use
L<PostgreSQL|https://www.postgresql.org> and
L<MySQL|https://dev.mysql.com>.  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 C<.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.


=head2 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.

=over 4

=item *

Chapter 3: More Catalyst Basics

=over 4

=item *

Install the PostgreSQL server and client and DBD::Pg:

If you are following along in Debian 6, you can quickly install these
items via this command:

    sudo aptitude install postgresql libdbd-pg-perl libdatetime-format-pg-perl

To configure the permissions, you can open
F</etc/postgresql/8.3/main/pg_hba.conf> and change this line (near the
bottom):



( run in 0.769 second using v1.01-cache-2.11-cpan-39bf76dae61 )