| 1 | =pod |
|---|
| 2 | |
|---|
| 3 | =head1 INTRODUCTION |
|---|
| 4 | |
|---|
| 5 | Welcome to the veekun codebase! This is the magical mystical melting pot of |
|---|
| 6 | Perl that somehow keeps http://veekun.com running. |
|---|
| 7 | |
|---|
| 8 | =head1 GETTING STARTED |
|---|
| 9 | |
|---|
| 10 | For the most part, this code should run as-is with very little setup. However, |
|---|
| 11 | there are two dependencies you will need to take care of first: Perl modules |
|---|
| 12 | and the database. |
|---|
| 13 | |
|---|
| 14 | =head2 Perl Modules |
|---|
| 15 | |
|---|
| 16 | You will need the following modules installed to run this code. This list is |
|---|
| 17 | not exhaustive, as I am typing it off the top of my head and making no effort |
|---|
| 18 | to confirm it whatsoever. |
|---|
| 19 | |
|---|
| 20 | Catalyst |
|---|
| 21 | Catalyst::Model::DBIC |
|---|
| 22 | Catalyst::Model::DBIC::Schema |
|---|
| 23 | Catalyst::View::TT |
|---|
| 24 | Catalyst::Plugin::Authentication |
|---|
| 25 | Catalyst::Plugin::Authentication::Store::DBIC |
|---|
| 26 | Catalyst::Plugin::ConfigLoader |
|---|
| 27 | Catalyst::Plugin::Session |
|---|
| 28 | Catalyst::Plugin::Session::State::Cookie |
|---|
| 29 | Catalyst::Plugin::Session::Store::DBIC |
|---|
| 30 | Catalyst::Plugin::Unicode |
|---|
| 31 | DBIx::Class |
|---|
| 32 | DBIx::Class::QueryLog |
|---|
| 33 | DateTime |
|---|
| 34 | Email::Valid |
|---|
| 35 | Image::Size |
|---|
| 36 | JSON |
|---|
| 37 | List::MoreUtils |
|---|
| 38 | List::Util (part of Scalar-List-Utils) |
|---|
| 39 | String::Approx |
|---|
| 40 | Template |
|---|
| 41 | Time::Out |
|---|
| 42 | XML::Feed |
|---|
| 43 | YAML |
|---|
| 44 | |
|---|
| 45 | Additionally, you may want the following modules if you plan to do any heavy |
|---|
| 46 | development. |
|---|
| 47 | |
|---|
| 48 | Catalyst::Devel |
|---|
| 49 | Catalyst::Plugin::StackTrace |
|---|
| 50 | Catalyst::Plugin::Static::Simple |
|---|
| 51 | |
|---|
| 52 | =head2 Database Setup |
|---|
| 53 | |
|---|
| 54 | All you need to do is create a database (or even reuse an old one, as long as |
|---|
| 55 | you aren't worried about naming clashes) and load each of the .sql files in the |
|---|
| 56 | script/ directory, as described below in L<script/>. The F<base_data.sql> file |
|---|
| 57 | contains very minimal test data; enough to ensure every page will display. A |
|---|
| 58 | dummy administrator login of C<admin:password> is included; I suggest you not |
|---|
| 59 | leave it there any longer than necessary. |
|---|
| 60 | |
|---|
| 61 | I have been using MySQL and have not tested the code on any other database, but |
|---|
| 62 | as long as you change the database driver in vee.yml and manage to import the |
|---|
| 63 | table definitions, any other database should be fine. |
|---|
| 64 | |
|---|
| 65 | =head2 File Setup |
|---|
| 66 | |
|---|
| 67 | If you want to generate the downloads at L</dex/resources>, run the script |
|---|
| 68 | F<script/create_downloads.pl>. You will need to have tar, gzip, ImageMagick, |
|---|
| 69 | and pngcrush available. |
|---|
| 70 | |
|---|
| 71 | =head2 Running |
|---|
| 72 | |
|---|
| 73 | The easiest way to get veekun on the Web is just to run F<script/vee_server.pl> |
|---|
| 74 | (although you may have to manually use perl; the shebang line was generated on |
|---|
| 75 | a Windows box). This will start the built-in Catalyst server on port 3000. |
|---|
| 76 | |
|---|
| 77 | =head1 CODE LAYOUT |
|---|
| 78 | |
|---|
| 79 | =head2 lib/ |
|---|
| 80 | |
|---|
| 81 | All of the actual site's Perl code is stashed in here, arranged as normal for a |
|---|
| 82 | Catalyst app. The main namespace is C<Vee::>. Controllers (i.e. the bulk of |
|---|
| 83 | the code) are under C<Vee::Controller::>, a small View module that serves as a |
|---|
| 84 | glue to Template Toolkit is in C<Vee::Controller::TT>, and class wrappers for |
|---|
| 85 | database tables reside in C<Vee::Model::>. C<Vee::Schema> is a tiny database |
|---|
| 86 | glue class. Other modules are extra bits of useful code that don't really fit |
|---|
| 87 | the regular Catalyst structure. |
|---|
| 88 | |
|---|
| 89 | =head2 root/ |
|---|
| 90 | |
|---|
| 91 | Root of the filesystem, where static files live. As a general rule, anything |
|---|
| 92 | static should go into one of the existing folders, to make it easier to run |
|---|
| 93 | veekun without C<Static::Simple>. |
|---|
| 94 | |
|---|
| 95 | =head2 script/ |
|---|
| 96 | |
|---|
| 97 | This folder contains scripts that are not actually part of the veekun code, are |
|---|
| 98 | are not ever called by any veekun code, and are not actually necessary for the |
|---|
| 99 | operation of veekun. Since looking through all of them to find out whether or |
|---|
| 100 | not they are necessary would be a colossal waste of time, their functions are |
|---|
| 101 | documented here. |
|---|
| 102 | |
|---|
| 103 | =head3 dump_sql.pl and *.sql |
|---|
| 104 | |
|---|
| 105 | The Perl script is a simple wrapper around mysqldump that will produce a .sql |
|---|
| 106 | file for some chunk of the database. It will read database, user, and password |
|---|
| 107 | information from the main Catalyst configuration file. It can take table |
|---|
| 108 | group names as arguments; the groups are rather clearly/obviously defined in |
|---|
| 109 | the script if you are really curious. These .sql files are in the repository |
|---|
| 110 | and are used to track the structure of the database. The Pokedex script dumps |
|---|
| 111 | all the table data, whereas the others only dump table structure; there is, |
|---|
| 112 | however, some very minimal starting data in F<base_data.sql>. |
|---|
| 113 | |
|---|
| 114 | If you change the structure of the database, please remember to also run the |
|---|
| 115 | corresponding dump script so that you can commit the change. |
|---|
| 116 | |
|---|
| 117 | =head3 vee_*.pl |
|---|
| 118 | |
|---|
| 119 | These are startup scripts generated by Catalyst for running the code under |
|---|
| 120 | various engines. C<vee_server.pl> is the Catalyst standalone server and best |
|---|
| 121 | suited for development or testing. The others are fairly self-explanatory, and |
|---|
| 122 | the Catalyst documentation will tell you which one you need depending on which |
|---|
| 123 | engine you are trying to use. |
|---|
| 124 | |
|---|
| 125 | =head2 static/ |
|---|
| 126 | |
|---|
| 127 | Static Template Toolkit templates that are used when a URL with no matching |
|---|
| 128 | controller is requested -- i.e., a request for F</a/b/c> with no controller |
|---|
| 129 | named C<A> will try to return F</static/a/b/c.tt>. If no static template is |
|---|
| 130 | found, of course, the client will get a 404. |
|---|
| 131 | |
|---|
| 132 | =head2 t/ |
|---|
| 133 | |
|---|
| 134 | Auto-generated Catalyst tests. I haven't written any real ones of my own yet |
|---|
| 135 | because I am a terrible person. I am sorry; maybe I will get around to it |
|---|
| 136 | sometime. |
|---|
| 137 | |
|---|
| 138 | =head2 templates/ |
|---|
| 139 | |
|---|
| 140 | Template Toolkit templates. More or less matches the URL structure, although |
|---|
| 141 | not necessarily exactly. There are a few 'include' templates, too, all named |
|---|
| 142 | F<common.tt> or similar. |
|---|
| 143 | |
|---|
| 144 | =cut |
|---|
| 145 | |
|---|