Page Not Found
Sorry, this is the void.
13 |├── .gitignore ├── chapters ├── frameworks │ ├── dancer.md │ ├── plack.md │ ├── catalyst.md │ ├── mojolicious.md │ ├── websimple.md │ └── other.md ├── intro.md ├── deployment.md ├── frameworks.md ├── archeology.md ├── how_the_web_works.md └── tools.md ├── title.txt ├── converters.png ├── README.md ├── code ├── todo │ ├── ToDo │ │ ├── t │ │ │ ├── 001_base.t │ │ │ └── 002_index_route.t │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── images │ │ │ │ ├── perldancer.jpg │ │ │ │ └── perldancer-bg.jpg │ │ │ ├── dispatch.cgi │ │ │ ├── 404.html │ │ │ ├── 500.html │ │ │ ├── dispatch.fcgi │ │ │ ├── css │ │ │ │ ├── error.css │ │ │ │ └── style.css │ │ │ └── javascripts │ │ │ │ └── jquery.js │ │ ├── bin │ │ │ └── app.psgi │ │ ├── lib │ │ │ ├── ToDo.pm │ │ │ └── Todo │ │ │ │ ├── Schema.pm │ │ │ │ └── Schema │ │ │ │ └── Result │ │ │ │ └── TodoItem.pm │ │ ├── MANIFEST.SKIP │ │ ├── cpanfile │ │ ├── environments │ │ │ ├── production.yml │ │ │ └── development.yml │ │ ├── MANIFEST │ │ ├── Makefile.PL │ │ ├── views │ │ │ ├── layouts │ │ │ │ └── main.tt │ │ │ └── index.tt │ │ └── config.yml │ ├── db │ │ ├── todo.sql │ │ └── dbic.conf │ └── util │ │ ├── make_item │ │ └── show_items ├── dancer2 │ ├── BookWeb │ │ ├── t │ │ │ ├── 001_base.t │ │ │ └── 002_index_route.t │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── images │ │ │ │ ├── perldancer.jpg │ │ │ │ └── perldancer-bg.jpg │ │ │ ├── dispatch.cgi │ │ │ ├── 404.html │ │ │ ├── 500.html │ │ │ ├── dispatch.fcgi │ │ │ └── css │ │ │ │ ├── error.css │ │ │ │ └── style.css │ │ ├── bin │ │ │ └── app.psgi │ │ ├── MANIFEST.SKIP │ │ ├── views │ │ │ ├── login.tt │ │ │ ├── results.tt │ │ │ ├── index.tt │ │ │ └── layouts │ │ │ │ └── main.tt │ │ ├── cpanfile │ │ ├── environments │ │ │ ├── production.yml │ │ │ └── development.yml │ │ ├── MANIFEST │ │ ├── lib │ │ │ ├── BookWeb │ │ │ │ ├── Schema.pm │ │ │ │ └── Schema │ │ │ │ │ └── Result │ │ │ │ │ ├── Author.pm │ │ │ │ │ └── Book.pm │ │ │ └── BookWeb.pm │ │ ├── Makefile.PL │ │ └── config.yml │ └── books.sql └── moose │ ├── person5 │ ├── person3 │ ├── person4 │ ├── person1 │ ├── person2 │ ├── person │ └── Person.pm ├── chapters.txt ├── about.md ├── metadata.xml ├── Makefile ├── epub.css ├── plan.md └── BUILD.md /.gitignore: -------------------------------------------------------------------------------- 1 | perlwebbook.* 2 | -------------------------------------------------------------------------------- /chapters/frameworks/dancer.md: -------------------------------------------------------------------------------- 1 | ## Dancer 2 | -------------------------------------------------------------------------------- /chapters/frameworks/plack.md: -------------------------------------------------------------------------------- 1 | ## Plack 2 | -------------------------------------------------------------------------------- /chapters/frameworks/catalyst.md: -------------------------------------------------------------------------------- 1 | ## Catalyst 2 | -------------------------------------------------------------------------------- /title.txt: -------------------------------------------------------------------------------- 1 | % Perl Web Book 2 | % Dave Cross 3 | -------------------------------------------------------------------------------- /chapters/frameworks/mojolicious.md: -------------------------------------------------------------------------------- 1 | ## Mojolicious 2 | -------------------------------------------------------------------------------- /chapters/frameworks/websimple.md: -------------------------------------------------------------------------------- 1 | ## Web::Simple 2 | -------------------------------------------------------------------------------- /chapters/frameworks/other.md: -------------------------------------------------------------------------------- 1 | ## Squatting 2 | 3 | ## Ox 4 | 5 | ## Etc... 6 | -------------------------------------------------------------------------------- /converters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davorg/perlwebbook/HEAD/converters.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | perlwebbook 2 | =========== 3 | 4 | A book. About Perl. And the Web. 5 | 6 | http://perlwebbook.com/ 7 | -------------------------------------------------------------------------------- /code/todo/ToDo/t/001_base.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More tests => 1; 5 | use_ok 'ToDo'; 6 | -------------------------------------------------------------------------------- /code/todo/ToDo/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davorg/perlwebbook/HEAD/code/todo/ToDo/public/favicon.ico -------------------------------------------------------------------------------- /code/dancer2/BookWeb/t/001_base.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More tests => 1; 5 | use_ok 'BookWeb'; 6 | -------------------------------------------------------------------------------- /code/dancer2/BookWeb/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davorg/perlwebbook/HEAD/code/dancer2/BookWeb/public/favicon.ico -------------------------------------------------------------------------------- /chapters/intro.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Why this book? 4 | 5 | Intended audience. 6 | 7 | ## A Brief History of Web Development 8 | 9 | -------------------------------------------------------------------------------- /code/todo/ToDo/public/images/perldancer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davorg/perlwebbook/HEAD/code/todo/ToDo/public/images/perldancer.jpg -------------------------------------------------------------------------------- /code/todo/ToDo/public/images/perldancer-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davorg/perlwebbook/HEAD/code/todo/ToDo/public/images/perldancer-bg.jpg -------------------------------------------------------------------------------- /code/dancer2/BookWeb/public/images/perldancer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davorg/perlwebbook/HEAD/code/dancer2/BookWeb/public/images/perldancer.jpg -------------------------------------------------------------------------------- /code/dancer2/BookWeb/public/images/perldancer-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davorg/perlwebbook/HEAD/code/dancer2/BookWeb/public/images/perldancer-bg.jpg -------------------------------------------------------------------------------- /code/todo/ToDo/bin/app.psgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use FindBin; 6 | use lib "$FindBin::Bin/../lib"; 7 | 8 | use ToDo; 9 | ToDo->to_app; 10 | -------------------------------------------------------------------------------- /code/dancer2/BookWeb/bin/app.psgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; 4 | use warnings; 5 | use FindBin; 6 | use lib "$FindBin::Bin/../lib"; 7 | 8 | use BookWeb; 9 | BookWeb->to_app; 10 | -------------------------------------------------------------------------------- /code/moose/person5: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | use 5.010; 5 | use Person; 6 | 7 | my $dave = Person->new( 8 | name => 'Dave', 9 | dob => '1962-09-07', 10 | gender => 'M' 11 | ); 12 | 13 | say $dave->age; 14 | -------------------------------------------------------------------------------- /code/todo/ToDo/lib/ToDo.pm: -------------------------------------------------------------------------------- 1 | package ToDo; 2 | use Dancer2; 3 | 4 | use Dancer2::Plugin::DBIC; 5 | 6 | our $VERSION = '0.1'; 7 | 8 | get '/' => sub { 9 | template 'index', { items => [ resultset('TodoItem')->all ] }; 10 | }; 11 | 12 | true; 13 | -------------------------------------------------------------------------------- /code/moose/person3: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | use 5.010; 5 | use Person; 6 | 7 | my $dave = Person->new( 8 | name => 'Dave', 9 | dob => '1962-09-07', 10 | gender => 'M' 11 | ); 12 | 13 | say $dave->dob->day_name; 14 | -------------------------------------------------------------------------------- /code/moose/person4: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | use 5.010; 5 | use Person; 6 | 7 | my $dave = Person->new( 8 | name => 'Dave', 9 | dob => '1962-09-07', 10 | gender => 'X' 11 | ); 12 | 13 | say $dave->dob->day_name; 14 | -------------------------------------------------------------------------------- /code/todo/ToDo/MANIFEST.SKIP: -------------------------------------------------------------------------------- 1 | ^\.git\/ 2 | maint 3 | ^tags$ 4 | .last_cover_stats 5 | Makefile$ 6 | ^blib 7 | ^pm_to_blib 8 | ^.*.bak 9 | ^.*.old 10 | ^t.*sessions 11 | ^cover_db 12 | ^.*\.log 13 | ^.*\.swp$ 14 | MYMETA.* 15 | ^.gitignore 16 | ^.svn\/ 17 | ^ToDo- 18 | -------------------------------------------------------------------------------- /code/dancer2/BookWeb/MANIFEST.SKIP: -------------------------------------------------------------------------------- 1 | ^\.git\/ 2 | maint 3 | ^tags$ 4 | .last_cover_stats 5 | Makefile$ 6 | ^blib 7 | ^pm_to_blib 8 | ^.*.bak 9 | ^.*.old 10 | ^t.*sessions 11 | ^cover_db 12 | ^.*\.log 13 | ^.*\.swp$ 14 | MYMETA.* 15 | ^.gitignore 16 | ^.svn\/ 17 | ^BookWeb- 18 | -------------------------------------------------------------------------------- /code/moose/person1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | use 5.010; 5 | use DateTime; 6 | use Person; 7 | 8 | my $dob = DateTime->new(year => 1962, month => 9, day => 7); 9 | 10 | my $dave = Person->new( 11 | name => 'Dave', 12 | dob => $dob, 13 | gender => 'M' 14 | ); 15 | 16 | say $dave->dob->day_name; 17 | -------------------------------------------------------------------------------- /chapters/deployment.md: -------------------------------------------------------------------------------- 1 | # Deployment 2 | 3 | When working with a framework based on PSGI, one of the major advantages is 4 | that we can put off thinking about deployment issues until far later in the 5 | project. But, eventually, you will need to deploy your application. In this 6 | chapter we will review some of the deployment options open to you. 7 | 8 | -------------------------------------------------------------------------------- /code/dancer2/BookWeb/views/login.tt: -------------------------------------------------------------------------------- 1 |
You need to be logged in to do that
4 | -------------------------------------------------------------------------------- /code/todo/ToDo/cpanfile: -------------------------------------------------------------------------------- 1 | requires "Dancer2" => "0.161000"; 2 | 3 | recommends "YAML" => "0"; 4 | recommends "URL::Encode::XS" => "0"; 5 | recommends "CGI::Deurl::XS" => "0"; 6 | recommends "HTTP::Parser::XS" => "0"; 7 | 8 | on "test" => sub { 9 | requires "Test::More" => "0"; 10 | requires "HTTP::Request::Common" => "0"; 11 | }; 12 | -------------------------------------------------------------------------------- /code/dancer2/BookWeb/cpanfile: -------------------------------------------------------------------------------- 1 | requires "Dancer2" => "0.159003"; 2 | 3 | recommends "YAML" => "0"; 4 | recommends "URL::Encode::XS" => "0"; 5 | recommends "CGI::Deurl::XS" => "0"; 6 | recommends "HTTP::Parser::XS" => "0"; 7 | 8 | on "test" => sub { 9 | requires "Test::More" => "0"; 10 | requires "HTTP::Request::Common" => "0"; 11 | }; 12 | -------------------------------------------------------------------------------- /chapters.txt: -------------------------------------------------------------------------------- 1 | chapters/intro.md 2 | chapters/how_the_web_works.md 3 | chapters/tools.md 4 | chapters/frameworks.md 5 | chapters/frameworks/plack.md 6 | chapters/frameworks/websimple.md 7 | chapters/frameworks/dancer.md 8 | chapters/frameworks/mojolicious.md 9 | chapters/frameworks/catalyst.md 10 | chapters/frameworks/other.md 11 | chapters/deployment.md 12 | chapters/archeology.md 13 | -------------------------------------------------------------------------------- /code/todo/ToDo/t/002_index_route.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use ToDo; 5 | use Test::More tests => 2; 6 | use Plack::Test; 7 | use HTTP::Request::Common; 8 | 9 | my $app = ToDo->to_app; 10 | is( ref $app, 'CODE', 'Got app' ); 11 | 12 | my $test = Plack::Test->create($app); 13 | my $res = $test->request( GET '/' ); 14 | 15 | ok( $res->is_success, '[GET /] successful' ); 16 | -------------------------------------------------------------------------------- /code/todo/db/todo.sql: -------------------------------------------------------------------------------- 1 | DROP DATABASE IF EXISTS todo; 2 | CREATE DATABASE todo; 3 | 4 | GRANT ALL ON todo.* to 'todo'@'localhost' IDENTIFIED BY 'sekrit'; 5 | 6 | USE todo; 7 | 8 | CREATE TABLE todo_item ( 9 | id INTEGER PRIMARY KEY AUTO_INCREMENT, 10 | title VARCHAR(250) NOT NULL, 11 | description TEXT NOT NULL, 12 | priority INTEGER NOT NULL DEFAULT 5, 13 | due_date DATETIME 14 | ); 15 | -------------------------------------------------------------------------------- /code/dancer2/BookWeb/t/002_index_route.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use BookWeb; 5 | use Test::More tests => 2; 6 | use Plack::Test; 7 | use HTTP::Request::Common; 8 | 9 | my $app = BookWeb->to_app; 10 | is( ref $app, 'CODE', 'Got app' ); 11 | 12 | my $test = Plack::Test->create($app); 13 | my $res = $test->request( GET '/' ); 14 | 15 | ok( $res->is_success, '[GET /] successful' ); 16 | -------------------------------------------------------------------------------- /chapters/frameworks.md: -------------------------------------------------------------------------------- 1 | # Perl Web Frameworks 2 | 3 | In this chapter we will look at some of the most popular frameworks that are 4 | currently used to write web applications in Perl. We will write a standard 5 | application in each of these frameworks. 6 | 7 | The frameworks we will cover are: 8 | 9 | * Raw Plack 10 | 11 | * Web::Simple 12 | 13 | * Mojolicious 14 | 15 | * Dancer 16 | 17 | * Catalyst 18 | -------------------------------------------------------------------------------- /code/todo/ToDo/environments/production.yml: -------------------------------------------------------------------------------- 1 | # configuration file for production environment 2 | 3 | # only log warning and error messsages 4 | log: "warning" 5 | 6 | # log message to a file in logs/ 7 | logger: "file" 8 | 9 | # don't consider warnings critical 10 | warnings: 0 11 | 12 | # hide errors 13 | show_errors: 0 14 | 15 | # disable server tokens in production environments 16 | no_server_tokens: 1 17 | -------------------------------------------------------------------------------- /code/dancer2/BookWeb/environments/production.yml: -------------------------------------------------------------------------------- 1 | # configuration file for production environment 2 | 3 | # only log warning and error messsages 4 | log: "warning" 5 | 6 | # log message to a file in logs/ 7 | logger: "file" 8 | 9 | # don't consider warnings critical 10 | warnings: 0 11 | 12 | # hide errors 13 | show_errors: 0 14 | 15 | # disable server tokens in production environments 16 | no_server_tokens: 1 17 | -------------------------------------------------------------------------------- /code/todo/db/dbic.conf: -------------------------------------------------------------------------------- 1 | schema_class Todo::Schema 2 | 3 | lib lib 4 | 5 | # connection string 6 |<% error %> 4 | <% ELSE %> 5 |
You searched for: <% search %>
6 | <% IF books.size %> 7 |Your search returned no results.
14 | <% END %> 15 | <% END %> -------------------------------------------------------------------------------- /code/todo/util/make_item: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | use 5.010; 6 | 7 | use FindBin qw($Bin); 8 | use lib "$Bin/../lib"; 9 | 10 | use Todo::Schema; 11 | 12 | my $schema = Todo::Schema->connect( 13 | 'dbi:mysql:database=todo', 'todo', 'sekrit', 14 | ) or die; 15 | 16 | my $item_rs = $schema->resultset('TodoItem'); 17 | 18 | $item_rs->create({ 19 | title => 'Test Item', 20 | description => 'Do this first', 21 | priority => 1, 22 | }); 23 | -------------------------------------------------------------------------------- /code/todo/util/show_items: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | use 5.010; 6 | 7 | use FindBin qw($Bin); 8 | use lib "$Bin/../lib"; 9 | 10 | use Todo::Schema; 11 | 12 | my $schema = Todo::Schema->connect( 13 | 'dbi:mysql:database=todo', 'todo', 'sekrit', 14 | ) or die; 15 | 16 | my $item_rs = $schema->resultset('TodoItem'); 17 | 18 | foreach my $item ($item_rs->all) { 19 | say $item->title, ': ', $item->description, ' [', $item->priority, ']'; 20 | } 21 | -------------------------------------------------------------------------------- /metadata.xml: -------------------------------------------------------------------------------- 1 |Sorry, this is the void.
13 |Sorry, this is the void.
13 |Wooops, something went wrong
13 |Wooops, something went wrong
13 |
3 | <% book.title %>
4 |
By <% book.author.name %>
<% IF book.started %>Began reading: <% book.started.strftime('%d %b %Y') %>.<% END %> 6 | <% IF book.ended %>Finished reading: <% book.ended.strftime('%d %b %Y') %>.<% END %>
7 | <% IF book.started AND NOT book.ended -%> 8 | 9 | <% ELSIF NOT book.started -%> 10 | 11 | <% END %> 12 |No books found.
24 | <% END %> 25 | 26 |No books found.
33 | <% END %> 34 | 35 |No books found.
42 | <% END %> -------------------------------------------------------------------------------- /code/todo/ToDo/public/css/error.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Lucida,sans-serif; 3 | } 4 | 5 | h1 { 6 | color: #AA0000; 7 | border-bottom: 1px solid #444; 8 | } 9 | 10 | h2 { color: #444; } 11 | 12 | pre { 13 | font-family: "lucida console","monaco","andale mono","bitstream vera sans mono","consolas",monospace; 14 | font-size: 12px; 15 | border-left: 2px solid #777; 16 | padding-left: 1em; 17 | } 18 | 19 | footer { 20 | font-size: 10px; 21 | } 22 | 23 | span.key { 24 | color: #449; 25 | font-weight: bold; 26 | width: 120px; 27 | display: inline; 28 | } 29 | 30 | span.value { 31 | color: #494; 32 | } 33 | 34 | /* these are for the message boxes */ 35 | 36 | pre.content { 37 | background-color: #eee; 38 | color: #000; 39 | padding: 1em; 40 | margin: 0; 41 | border: 1px solid #aaa; 42 | border-top: 0; 43 | margin-bottom: 1em; 44 | } 45 | 46 | div.title { 47 | font-family: "lucida console","monaco","andale mono","bitstream vera sans mono","consolas",monospace; 48 | font-size: 12px; 49 | background-color: #aaa; 50 | color: #444; 51 | font-weight: bold; 52 | padding: 3px; 53 | padding-left: 10px; 54 | } 55 | 56 | pre.content span.nu { 57 | color: #889; 58 | margin-right: 10px; 59 | } 60 | 61 | pre.error { 62 | background: #334; 63 | color: #ccd; 64 | padding: 1em; 65 | border-top: 1px solid #000; 66 | border-left: 1px solid #000; 67 | border-right: 1px solid #eee; 68 | border-bottom: 1px solid #eee; 69 | } 70 | 71 | -------------------------------------------------------------------------------- /code/dancer2/BookWeb/public/css/error.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Lucida,sans-serif; 3 | } 4 | 5 | h1 { 6 | color: #AA0000; 7 | border-bottom: 1px solid #444; 8 | } 9 | 10 | h2 { color: #444; } 11 | 12 | pre { 13 | font-family: "lucida console","monaco","andale mono","bitstream vera sans mono","consolas",monospace; 14 | font-size: 12px; 15 | border-left: 2px solid #777; 16 | padding-left: 1em; 17 | } 18 | 19 | footer { 20 | font-size: 10px; 21 | } 22 | 23 | span.key { 24 | color: #449; 25 | font-weight: bold; 26 | width: 120px; 27 | display: inline; 28 | } 29 | 30 | span.value { 31 | color: #494; 32 | } 33 | 34 | /* these are for the message boxes */ 35 | 36 | pre.content { 37 | background-color: #eee; 38 | color: #000; 39 | padding: 1em; 40 | margin: 0; 41 | border: 1px solid #aaa; 42 | border-top: 0; 43 | margin-bottom: 1em; 44 | } 45 | 46 | div.title { 47 | font-family: "lucida console","monaco","andale mono","bitstream vera sans mono","consolas",monospace; 48 | font-size: 12px; 49 | background-color: #aaa; 50 | color: #444; 51 | font-weight: bold; 52 | padding: 3px; 53 | padding-left: 10px; 54 | } 55 | 56 | pre.content span.nu { 57 | color: #889; 58 | margin-right: 10px; 59 | } 60 | 61 | pre.error { 62 | background: #334; 63 | color: #ccd; 64 | padding: 1em; 65 | border-top: 1px solid #000; 66 | border-left: 1px solid #000; 67 | border-right: 1px solid #eee; 68 | border-bottom: 1px solid #eee; 69 | } 70 | 71 | -------------------------------------------------------------------------------- /code/dancer2/BookWeb/lib/BookWeb/Schema/Result/Author.pm: -------------------------------------------------------------------------------- 1 | use utf8; 2 | package BookWeb::Schema::Result::Author; 3 | 4 | # Created by DBIx::Class::Schema::Loader 5 | # DO NOT MODIFY THE FIRST PART OF THIS FILE 6 | 7 | =head1 NAME 8 | 9 | BookWeb::Schema::Result::Author 10 | 11 | =cut 12 | 13 | use strict; 14 | use warnings; 15 | 16 | use base 'DBIx::Class::Core'; 17 | 18 | =head1 COMPONENTS LOADED 19 | 20 | =over 4 21 | 22 | =item * L| t |