From 2dd592c0b04478695d3b5b32744ac09466387a78 Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 19 Oct 2005 18:28:34 +0000 Subject: template iniziale --- Build.PL | 13 +++++++++ Changes | 3 +++ Makefile.PL | 29 ++++++++++++++++++++ README | 1 + lib/Bookmarks.pm | 50 ++++++++++++++++++++++++++++++++++ script/bookmarks_cgi.pl | 37 ++++++++++++++++++++++++++ script/bookmarks_create.pl | 65 +++++++++++++++++++++++++++++++++++++++++++++ script/bookmarks_fastcgi.pl | 37 ++++++++++++++++++++++++++ script/bookmarks_server.pl | 57 +++++++++++++++++++++++++++++++++++++++ script/bookmarks_test.pl | 56 ++++++++++++++++++++++++++++++++++++++ t/01app.t | 4 +++ t/02pod.t | 7 +++++ t/03podcoverage.t | 7 +++++ 13 files changed, 366 insertions(+) create mode 100644 Build.PL create mode 100644 Changes create mode 100644 Makefile.PL create mode 100644 README create mode 100644 lib/Bookmarks.pm create mode 100755 script/bookmarks_cgi.pl create mode 100755 script/bookmarks_create.pl create mode 100755 script/bookmarks_fastcgi.pl create mode 100755 script/bookmarks_server.pl create mode 100755 script/bookmarks_test.pl create mode 100644 t/01app.t create mode 100644 t/02pod.t create mode 100644 t/03podcoverage.t diff --git a/Build.PL b/Build.PL new file mode 100644 index 0000000..20ab39b --- /dev/null +++ b/Build.PL @@ -0,0 +1,13 @@ +use strict; +use Catalyst::Build; + +my $build = Catalyst::Build->new( + create_makefile_pl => 'passthrough', + license => 'perl', + module_name => 'Bookmarks', + requires => { Catalyst => '5.10' }, + create_makefile_pl => 'passthrough', + script_files => [ glob('script/*') ], + test_files => [ glob('t/*.t'), glob('t/*/*.t') ] +); +$build->create_build_script; diff --git a/Changes b/Changes new file mode 100644 index 0000000..246f6ab --- /dev/null +++ b/Changes @@ -0,0 +1,3 @@ +This file documents the revision history for Perl extension Bookmarks. +0.01 Wed Oct 19 20:26:30 2005 + - initial revision, generated by Catalyst diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..6f6494d --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,29 @@ + unless ( eval "use Module::Build::Compat 0.02; 1" ) { + print "This module requires Module::Build to install itself.\n"; + + require ExtUtils::MakeMaker; + my $yn = + ExtUtils::MakeMaker::prompt( ' Install Module::Build now from CPAN?', 'y' ); + + unless ( $yn =~ /^y/i ) { + die " *** Cannot install without Module::Build. Exiting ...\n"; + } + + require Cwd; + require File::Spec; + require CPAN; + + # Save this 'cause CPAN will chdir all over the place. + my $cwd = Cwd::cwd(); + my $makefile = File::Spec->rel2abs($0); + + CPAN::Shell->install('Module::Build::Compat') + or die " *** Cannot install without Module::Build. Exiting ...\n"; + + chdir $cwd or die "Cannot chdir() back to $cwd: $!"; + } + eval "use Module::Build::Compat 0.02; 1" or die $@; + use lib '_build/lib'; + Module::Build::Compat->run_build_pl( args => \@ARGV ); + require Module::Build; + Module::Build::Compat->write_makefile( build_class => 'Module::Build' ); diff --git a/README b/README new file mode 100644 index 0000000..d6b9974 --- /dev/null +++ b/README @@ -0,0 +1 @@ +Run script/bookmarks_server.pl to test the application. diff --git a/lib/Bookmarks.pm b/lib/Bookmarks.pm new file mode 100644 index 0000000..4603e5e --- /dev/null +++ b/lib/Bookmarks.pm @@ -0,0 +1,50 @@ +package Bookmarks; + +use strict; +use Catalyst qw/-Debug/; + +our $VERSION = '0.01'; + +Bookmarks->config( name => 'Bookmarks' ); + +Bookmarks->setup; + +=head1 NAME + +Bookmarks - Catalyst based application + +=head1 SYNOPSIS + + script/bookmarks_server.pl + +=head1 DESCRIPTION + +Catalyst based application. + +=head1 METHODS + +=over 4 + +=item default + +=cut + +sub default : Private { + my ( $self, $c ) = @_; + $c->res->output('Congratulations, Bookmarks is on Catalyst!'); +} + +=back + +=head1 AUTHOR + +Catalyst developer + +=head1 LICENSE + +This library is free software . You can redistribute it and/or modify +it under the same terms as perl itself. + +=cut + +1; diff --git a/script/bookmarks_cgi.pl b/script/bookmarks_cgi.pl new file mode 100755 index 0000000..473bb30 --- /dev/null +++ b/script/bookmarks_cgi.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl -w + +BEGIN { $ENV{CATALYST_ENGINE} ||= 'CGI' } + +use strict; +use FindBin; +use lib "$FindBin::Bin/../lib"; +use Bookmarks; + +Bookmarks->run; + +1; + +=head1 NAME + +bookmarks_cgi.pl - Catalyst CGI + +=head1 SYNOPSIS + +See L + +=head1 DESCRIPTION + +Run a Catalyst application as cgi. + +=head1 AUTHOR + +Sebastian Riedel, C + +=head1 COPYRIGHT + +Copyright 2004 Sebastian Riedel. All rights reserved. + +This library is free software. You can redistribute it and/or modify +it under the same terms as perl itself. + +=cut diff --git a/script/bookmarks_create.pl b/script/bookmarks_create.pl new file mode 100755 index 0000000..4dceeba --- /dev/null +++ b/script/bookmarks_create.pl @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w + +use strict; +use Getopt::Long; +use Pod::Usage; +use Catalyst::Helper; + +my $help = 0; +my $nonew = 0; + +GetOptions( 'help|?' => \$help, + 'nonew' => \$nonew ); + +pod2usage(1) if ( $help || !$ARGV[0] ); + +my $helper = Catalyst::Helper->new({'.newfiles' => !$nonew}); +pod2usage(1) unless $helper->mk_component( 'Bookmarks', @ARGV ); + +1; + +=head1 NAME + +bookmarks_create.pl - Create a new Catalyst Component + +=head1 SYNOPSIS + +bookmarks_create.pl [options] model|view|controller name [helper] [options] + + Options: + -help display this help and exits + -nonew don't create a .new file where a file to be created exists + + Examples: + bookmarks_create.pl controller My::Controller + bookmarks_create.pl view My::View + bookmarks_create.pl view MyView TT + bookmarks_create.pl view TT TT + bookmarks_create.pl model My::Model + bookmarks_create.pl model SomeDB CDBI dbi:SQLite:/tmp/my.db + bookmarks_create.pl model AnotherDB CDBI dbi:Pg:dbname=foo root 4321 + + See also: + perldoc Catalyst::Manual + perldoc Catalyst::Manual::Intro + +=head1 DESCRIPTION + +Create a new Catalyst Component. + +Existing component files are not overwritten. If any of the component files +to be created already exist the file will be written with a '.new' suffix. +This behaviour can be supressed with the C<-nonew> option. + +=head1 AUTHOR + +Sebastian Riedel, C + +=head1 COPYRIGHT + +Copyright 2004 Sebastian Riedel. All rights reserved. + +This library is free software. You can redistribute it and/or modify +it under the same terms as perl itself. + +=cut diff --git a/script/bookmarks_fastcgi.pl b/script/bookmarks_fastcgi.pl new file mode 100755 index 0000000..7061403 --- /dev/null +++ b/script/bookmarks_fastcgi.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl -w + +BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' } + +use strict; +use FindBin; +use lib "$FindBin::Bin/../lib"; +use Bookmarks; + +Bookmarks->run; + +1; + +=head1 NAME + +bookmarks_fastcgi.pl - Catalyst FastCGI + +=head1 SYNOPSIS + +See L + +=head1 DESCRIPTION + +Run a Catalyst application as fastcgi. + +=head1 AUTHOR + +Sebastian Riedel, C + +=head1 COPYRIGHT + +Copyright 2004 Sebastian Riedel. All rights reserved. + +This library is free software. You can redistribute it and/or modify +it under the same terms as perl itself. + +=cut diff --git a/script/bookmarks_server.pl b/script/bookmarks_server.pl new file mode 100755 index 0000000..ac117e0 --- /dev/null +++ b/script/bookmarks_server.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w + +BEGIN { + $ENV{CATALYST_ENGINE} ||= 'HTTP'; + $ENV{CATALYST_SCRIPT_GEN} = 4; +} + +use strict; +use Getopt::Long; +use Pod::Usage; +use FindBin; +use lib "$FindBin::Bin/../lib"; +use Bookmarks; + +my $help = 0; +my $port = 3000; + +GetOptions( 'help|?' => \$help, 'port=s' => \$port ); + +pod2usage(1) if $help; + +Bookmarks->run($port); + +1; + +=head1 NAME + +bookmarks_server.pl - Catalyst Testserver + +=head1 SYNOPSIS + +bookmarks_server.pl [options] + + Options: + -? -help display this help and exits + -p -port port (defaults to 3000) + + See also: + perldoc Catalyst::Manual + perldoc Catalyst::Manual::Intro + +=head1 DESCRIPTION + +Run a Catalyst Testserver for this application. + +=head1 AUTHOR + +Sebastian Riedel, C + +=head1 COPYRIGHT + +Copyright 2004 Sebastian Riedel. All rights reserved. + +This library is free software. You can redistribute it and/or modify +it under the same terms as perl itself. + +=cut diff --git a/script/bookmarks_test.pl b/script/bookmarks_test.pl new file mode 100755 index 0000000..9476a7d --- /dev/null +++ b/script/bookmarks_test.pl @@ -0,0 +1,56 @@ +#!/usr/bin/perl -w + +BEGIN { $ENV{CATALYST_ENGINE} ||= 'Test' } + +use strict; +use Getopt::Long; +use Pod::Usage; +use FindBin; +use lib "$FindBin::Bin/../lib"; +use Bookmarks; + +my $help = 0; + +GetOptions( 'help|?' => \$help ); + +pod2usage(1) if ( $help || !$ARGV[0] ); + +print Bookmarks->run($ARGV[0])->content . "\n"; + +1; + +=head1 NAME + +bookmarks_test.pl - Catalyst Test + +=head1 SYNOPSIS + +bookmarks_test.pl [options] uri + + Options: + -help display this help and exits + + Examples: + bookmarks_test.pl http://localhost/some_action + bookmarks_test.pl /some_action + + See also: + perldoc Catalyst::Manual + perldoc Catalyst::Manual::Intro + +=head1 DESCRIPTION + +Run a Catalyst action from the comand line. + +=head1 AUTHOR + +Sebastian Riedel, C + +=head1 COPYRIGHT + +Copyright 2004 Sebastian Riedel. All rights reserved. + +This library is free software. You can redistribute it and/or modify +it under the same terms as perl itself. + +=cut diff --git a/t/01app.t b/t/01app.t new file mode 100644 index 0000000..67ca6c3 --- /dev/null +++ b/t/01app.t @@ -0,0 +1,4 @@ +use Test::More tests => 2; +use_ok( Catalyst::Test, 'Bookmarks' ); + +ok( request('/')->is_success ); diff --git a/t/02pod.t b/t/02pod.t new file mode 100644 index 0000000..1647794 --- /dev/null +++ b/t/02pod.t @@ -0,0 +1,7 @@ +use Test::More; + +eval "use Test::Pod 1.14"; +plan skip_all => 'Test::Pod 1.14 required' if $@; +plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; + +all_pod_files_ok(); diff --git a/t/03podcoverage.t b/t/03podcoverage.t new file mode 100644 index 0000000..d91be5e --- /dev/null +++ b/t/03podcoverage.t @@ -0,0 +1,7 @@ +use Test::More; + +eval "use Test::Pod::Coverage 1.04"; +plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@; +plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD}; + +all_pod_coverage_ok(); -- cgit v1.2.3