[Catalyst-commits] r11949 - in CatalystX-CRUD/CatalystX-CRUD/trunk:
. t/lib t/lib/MyApp/Controller
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Fri Nov 20 19:51:54 GMT 2009
Author: karpet
Date: 2009-11-20 19:51:54 +0000 (Fri, 20 Nov 2009)
New Revision: 11949
Added:
CatalystX-CRUD/CatalystX-CRUD/trunk/t/lib/MyApp/Controller/Root.pm
Modified:
CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD/trunk/MANIFEST
CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL
CatalystX-CRUD/CatalystX-CRUD/trunk/t/lib/MyApp.pm
Log:
bump Sort::SQL dep; refactor test app so Root in its own controller; release 0.46
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/Changes 2009-11-20 18:26:37 UTC (rev 11948)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/Changes 2009-11-20 19:51:54 UTC (rev 11949)
@@ -221,9 +221,10 @@
0.45 13 June 2009
* fix multi-column sort via cxc-order param (requires Sort::SQL 0.04)
-0.46 xxx
+0.46 20 Nov 2009
* tweek Model::File _find to avoid multiple loops over the same list of root dirs.
* tweek Model::File->search to read() each object like fetch() does.
+ * add dep on Sort::SQL 0.07 to avoid sql injection (RT#51777)
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/MANIFEST
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/MANIFEST 2009-11-20 18:26:37 UTC (rev 11948)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/MANIFEST 2009-11-20 19:51:54 UTC (rev 11949)
@@ -25,6 +25,7 @@
t/04-query.t
t/boilerplate.t
t/lib/MyApp.pm
+t/lib/MyApp/Controller/Root.pm
t/lib/MyApp/Controller/File.pm
t/lib/MyApp/Controller/FileAdapter.pm
t/lib/MyApp/Controller/FetchRewrite.pm
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL 2009-11-20 18:26:37 UTC (rev 11948)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL 2009-11-20 19:51:54 UTC (rev 11949)
@@ -20,7 +20,7 @@
'Moose' => 0,
'MooseX::Emulate::Class::Accessor::Fast' => 0,
'Data::Dump' => 0, # for testing
- 'Sort::SQL' => 0.04,
+ 'Sort::SQL' => 0.07,
'Search::QueryParser::SQL' => 0.005,
},
Added: CatalystX-CRUD/CatalystX-CRUD/trunk/t/lib/MyApp/Controller/Root.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/t/lib/MyApp/Controller/Root.pm (rev 0)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/t/lib/MyApp/Controller/Root.pm 2009-11-20 19:51:54 UTC (rev 11949)
@@ -0,0 +1,114 @@
+package MyApp::Controller::Root;
+use strict;
+use base qw( Catalyst::Controller );
+use Carp;
+use Data::Dump qw( dump );
+
+__PACKAGE__->config->{namespace} = '';
+
+my @temp_files;
+
+sub push_temp_files {
+ shift;
+ push( @temp_files, @_ );
+}
+
+END {
+ for my $f (@temp_files) {
+ warn "unlinking $f\n" if $ENV{CATALYST_DEBUG};
+ $f->remove;
+ }
+}
+
+sub foo : Local {
+
+ my ( $self, $c, @arg ) = @_;
+
+ #carp "inc_path: " . dump $c->model('File')->inc_path;
+
+ my $file
+ = $c->model('File')
+ ->new_object(
+ file => [ $c->model('File')->inc_path->[0], 'crud_temp_file' ] );
+
+ $self->push_temp_files($file);
+
+ #carp dump $file;
+
+ $file->content('hello world');
+
+ $file->create or croak "failed to create $file : $!";
+
+ my $filename = $file->basename;
+
+ #carp "filename = $filename";
+
+ $file = $c->model('File')->fetch( file => $filename );
+
+ #carp dump $file;
+
+ $file->read;
+
+ if ( $file->content ne 'hello world' ) {
+ croak "bad read";
+ }
+
+ $file->content('change the text');
+
+ #carp $file;
+
+ $file->update;
+
+ $file = $c->model('File')->fetch( file => $filename );
+
+ #carp $file;
+
+ $c->res->body("foo is a-ok");
+
+}
+
+sub autoload : Local {
+ my ( $self, $c ) = @_;
+
+ my $file = $c->model('File')->new_object(
+ file => [ $c->model('File')->inc_path->[0], 'autoload_test' ],
+ content => 'test AUTOLOAD black magic'
+ );
+
+ $self->push_temp_files($file);
+
+ $file->create;
+
+ #warn "testing basename on $file";
+
+ # test that calling $file->foo actually calls foo()
+ # on $file->delegate and not $file itself
+ eval { $file->basename };
+ if ($@) {
+ warn "failed to call ->basename on $file: $@";
+ return;
+ }
+
+ unless ( $file->can('basename') ) {
+ warn "can't can(basename) but can ->basename";
+ return;
+ }
+
+ # test that we can still call read() and can(read) on the parent object
+ eval { $file->read };
+ if ($@) {
+ warn "$file cannot read() - $@ $!";
+ return;
+ }
+
+ eval { $file->can('read') };
+ if ($@) {
+ warn "$file cannot can(read) - $@ $!";
+ return;
+ }
+
+ $c->res->body("autoload is a-ok");
+
+}
+
+1;
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/t/lib/MyApp.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/t/lib/MyApp.pm 2009-11-20 18:26:37 UTC (rev 11948)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/t/lib/MyApp.pm 2009-11-20 19:51:54 UTC (rev 11949)
@@ -17,109 +17,4 @@
#warn dump MyApp->config;
-my @temp_files;
-
-sub push_temp_files {
- shift;
- push( @temp_files, @_ );
-}
-
-END {
- for my $f (@temp_files) {
- warn "unlinking $f\n" if $ENV{CATALYST_DEBUG};
- $f->remove;
- }
-}
-
-sub foo : Local {
-
- my ( $self, $c, @arg ) = @_;
-
- #carp "inc_path: " . dump $c->model('File')->inc_path;
-
- my $file
- = $c->model('File')
- ->new_object(
- file => [ $c->model('File')->inc_path->[0], 'crud_temp_file' ] );
-
- $self->push_temp_files($file);
-
- #carp dump $file;
-
- $file->content('hello world');
-
- $file->create or croak "failed to create $file : $!";
-
- my $filename = $file->basename;
-
- #carp "filename = $filename";
-
- $file = $c->model('File')->fetch( file => $filename );
-
- #carp dump $file;
-
- $file->read;
-
- if ( $file->content ne 'hello world' ) {
- croak "bad read";
- }
-
- $file->content('change the text');
-
- #carp $file;
-
- $file->update;
-
- $file = $c->model('File')->fetch( file => $filename );
-
- #carp $file;
-
- $c->res->body("foo is a-ok");
-
-}
-
-sub autoload : Local {
- my ( $self, $c ) = @_;
-
- my $file = $c->model('File')->new_object(
- file => [ $c->model('File')->inc_path->[0], 'autoload_test' ],
- content => 'test AUTOLOAD black magic'
- );
-
- $self->push_temp_files($file);
-
- $file->create;
-
- #warn "testing basename on $file";
-
- # test that calling $file->foo actually calls foo()
- # on $file->delegate and not $file itself
- eval { $file->basename };
- if ($@) {
- warn "failed to call ->basename on $file: $@";
- return;
- }
-
- unless ( $file->can('basename') ) {
- warn "can't can(basename) but can ->basename";
- return;
- }
-
- # test that we can still call read() and can(read) on the parent object
- eval { $file->read };
- if ($@) {
- warn "$file cannot read() - $@ $!";
- return;
- }
-
- eval { $file->can('read') };
- if ($@) {
- warn "$file cannot can(read) - $@ $!";
- return;
- }
-
- $c->res->body("autoload is a-ok");
-
-}
-
1;
More information about the Catalyst-commits
mailing list