Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 13, 2016
0 parents commit d7ec5aa
Show file tree
Hide file tree
Showing 142 changed files with 4,769 additions and 0 deletions.
Binary file added 4439.zip
Binary file not shown.
Binary file added 9781430223658.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,27 @@
Freeware License, some rights reserved

Copyright (c) 2009 Kieren Diment and Matt Trout

Permission is hereby granted, free of charge, to anyone obtaining a copy
of this software and associated documentation files (the "Software"),
to work with the Software within the limits of freeware distribution and fair use.
This includes the rights to use, copy, and modify the Software for personal use.
Users are also allowed and encouraged to submit corrections and modifications
to the Software for the benefit of other users.

It is not allowed to reuse, modify, or redistribute the Software for
commercial use in any way, or for a user�s educational materials such as books
or blog articles without prior permission from the copyright holder.

The above copyright notice and this permission notice need to be included
in all copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


15 changes: 15 additions & 0 deletions README.md
@@ -0,0 +1,15 @@
#Apress Source Code

This repository accompanies [*The Definitive Guide to Catalyst*](http://www.apress.com/9781430223658) by Kieren Diment and Matt Trout (Apress, 2009).

![Cover image](9781430223658.jpg)

Download the files as a zip using the green button, or clone the repository to your machine using Git.

##Releases

Release v1.0 corresponds to the code in the published book, without corrections or updates.

##Contributions

See the file Contributing.md for more information on how you can contribute to this repository.
Binary file added catalyst-book-code/.DS_Store
Binary file not shown.
@@ -0,0 +1,10 @@
blib*
Makefile
Makefile.old
Build
_build*
pm_to_blib*
*.tar.gz
.lwpcookies
Catalyst-View-SerialiseStashKey-*
cover_db
@@ -0,0 +1,5 @@
Revision history for Catalyst-View-SerialiseStashKey

0.01 Date/time
First version, released on an unsuspecting world.

@@ -0,0 +1,8 @@
Changes
MANIFEST
Makefile.PL
README
lib/Catalyst/View/SerialiseStashKey.pm
t/00-load.t
t/pod-coverage.t
t/pod.t
@@ -0,0 +1,13 @@
use inc::Module::Install;

name 'Catalyst-View-SerialiseStashKey';
all_from 'lib/Catalyst/View/SerialiseStashKey.pm';
author 'Kieren Diment <zarquon@cpan.org>';
license 'perl';

build_requires 'Test::More';

auto_install;

WriteAll;

@@ -0,0 +1,52 @@
Catalyst-View-SerialiseStashKey

The README is used to introduce the module and provide instructions on
how to install the module, any machine dependencies it may have (for
example C compilers and installed libraries) and any other information
that should be provided before the module is installed.

A README file is required for CPAN modules since CPAN extracts the README
file from a module distribution so that people browsing the archive
can use it to get an idea of the module's uses. It is usually a good idea
to provide version information here so that people can decide whether
fixes for the module are worth downloading.


INSTALLATION

To install this module, run the following commands:

perl Makefile.PL
make
make test
make install

SUPPORT AND DOCUMENTATION

After installing, you can find documentation for this module with the
perldoc command.

perldoc Catalyst::View::SerialiseStashKey

You can also look for information at:

RT, CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-View-SerialiseStashKey

AnnoCPAN, Annotated CPAN documentation
http://annocpan.org/dist/Catalyst-View-SerialiseStashKey

CPAN Ratings
http://cpanratings.perl.org/d/Catalyst-View-SerialiseStashKey

Search CPAN
http://search.cpan.org/dist/Catalyst-View-SerialiseStashKey/


COPYRIGHT AND LICENCE

Copyright (C) 2009 Kieren Diment

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

@@ -0,0 +1,23 @@
package Catalyst::View::SerialiseStashKey;

use strict;
use warnings;
use parent qw( Catalyst::View );
use YAML;

__PACKAGE__->config( 'stash_key' => 'response');

sub process {
my ($self, $c)= @_;
my $content = $self->render($c->stash);
$c->response->body($content);
}

sub render {
my ($self, $c) = @_;
my $data = Load( $c->stash->{ $self->stash_key } );
my $content = "<pre>\n$data</pre>";
return $content;
}

1;
@@ -0,0 +1,9 @@
#!perl -T

use Test::More tests => 1;

BEGIN {
use_ok( 'Catalyst::View::SerialiseStashKey' );
}

diag( "Testing Catalyst::View::SerialiseStashKey $Catalyst::View::SerialiseStashKey::VERSION, Perl $], $^X" );
@@ -0,0 +1,55 @@
#!perl -T

use strict;
use warnings;
use Test::More tests => 3;

sub not_in_file_ok {
my ($filename, %regex) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";

my %violated;

while (my $line = <$fh>) {
while (my ($desc, $regex) = each %regex) {
if ($line =~ $regex) {
push @{$violated{$desc}||=[]}, $.;
}
}
}

if (%violated) {
fail("$filename contains boilerplate text");
diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
} else {
pass("$filename contains no boilerplate text");
}
}

sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}

TODO: {
local $TODO = "Need to replace the boilerplate text";

not_in_file_ok(README =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);

not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);

module_boilerplate_ok('lib/Catalyst/View/SerialiseStashKey.pm');


}

@@ -0,0 +1,18 @@
use strict;
use warnings;
use Test::More;

# Ensure a recent version of Test::Pod::Coverage
my $min_tpc = 1.08;
eval "use Test::Pod::Coverage $min_tpc";
plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
if $@;

# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
# but older versions don't recognize some common documentation styles
my $min_pc = 0.18;
eval "use Pod::Coverage $min_pc";
plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
if $@;

all_pod_coverage_ok();
@@ -0,0 +1,12 @@
#!perl -T

use strict;
use warnings;
use Test::More;

# Ensure a recent version of Test::Pod
my $min_tp = 1.22;
eval "use Test::Pod $min_tp";
plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;

all_pod_files_ok();
@@ -0,0 +1,4 @@
This file documents the revision history for Perl extension MyApp.

0.01 2009-04-26 12:26:28
- initial revision, generated by Catalyst
@@ -0,0 +1,19 @@
# IMPORTANT: if you delete this file your app will not work as
# expected. you have been warned
use inc::Module::Install;

name 'MyApp';
all_from 'lib/MyApp.pm';

requires 'Catalyst::Runtime' => '5.80001';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
requires 'Catalyst::Action::RenderView';
requires 'parent';
requires 'Config::General'; # This should reflect the config file format you've chosen
# See Catalyst::Plugin::ConfigLoader for supported formats
catalyst;

install_script glob('script/*.pl');
auto_install;
WriteAll;
@@ -0,0 +1 @@
Run script/myapp_server.pl to test the application.
@@ -0,0 +1,64 @@
package MyApp;

use strict;
use warnings;

use Catalyst::Runtime '5.70';

# Set flags and add plugins for the application
#
# -Debug: activates the debug mode for very useful log messages
# ConfigLoader: will load the configuration from a Config::General file in the
# application's home directory
# Static::Simple: will serve static files from the application's root
# directory

use parent qw/Catalyst/;
use Catalyst qw/-Debug
ConfigLoader
Static::Simple/;
our $VERSION = '0.01';

# Configure the application.
#
# Note that settings in myapp.conf (or other external
# configuration file that you set up manually) take precedence
# over this when using ConfigLoader. Thus configuration
# details given here can function as a default configuration,
# with a external configuration file acting as an override for
# local deployment.

__PACKAGE__->config( name => 'MyApp' );

# Start the application
__PACKAGE__->setup();


=head1 NAME
MyApp - Catalyst based application
=head1 SYNOPSIS
script/myapp_server.pl
=head1 DESCRIPTION
[enter your description here]
=head1 SEE ALSO
L<MyApp::Controller::Root>, L<Catalyst>
=head1 AUTHOR
Kieren Diment
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut

1;
@@ -0,0 +1,30 @@
package MyApp::Controller::Root;

use Moose;
use namespace::autoclean;

BEGIN { extends 'Catalyst::Controller'; }

__PACKAGE__->config->{namespace} = '';

sub index : Path Args(0) {
my ($self, $c) = @_;
$c->stash(things => [qw/
affe
tiger
loewe
birne
/]);

# template name automatically infered to be root/templates/index
}

sub default : Path {
my ($self, $ctx) = @_;
$ctx->response->body( 'Page not found' );
$ctx->response->status(404);
}

sub end : ActionClass('RenderView') {}

1;

0 comments on commit d7ec5aa

Please sign in to comment.