[Catalyst-commits] r8514 - in CatalystX-CRUD/CatalystX-CRUD/trunk:
. lib/CatalystX lib/CatalystX/CRUD
lib/CatalystX/CRUD/Iterator lib/CatalystX/CRUD/Model
lib/CatalystX/CRUD/ModelAdapter lib/CatalystX/CRUD/Object
lib/CatalystX/CRUD/Test
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Wed Oct 8 05:50:10 BST 2008
Author: karpet
Date: 2008-10-08 05:50:10 +0100 (Wed, 08 Oct 2008)
New Revision: 8514
Modified:
CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator/File.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/File.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter/File.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object/File.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Results.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Controller.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm
Log:
bump version; use CDI to store delegate_class
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/Changes 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/Changes 2008-10-08 04:50:10 UTC (rev 8514)
@@ -167,3 +167,6 @@
* add missing req to Makefile.PL
* force field_names to be an ARRAY ref in Utils make_sql_query()
+0.32 xxx
+ * use Class::Data::Inheritable to define delegate_class() class accessor in base Model
+
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/Makefile.PL 2008-10-08 04:50:10 UTC (rev 8514)
@@ -12,6 +12,7 @@
'Test::More' => 0,
'Data::Pageset' => 0,
'Class::Accessor::Fast' => 0,
+ 'Class::Data::Inheritable' => 0,
'Catalyst::Component::ACCEPT_CONTEXT' => 0,
'Catalyst::Runtime' => 0,
'Catalyst::Exception' => 0,
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -36,7 +36,7 @@
naked_results => 0,
);
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator/File.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator/File.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator/File.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -3,7 +3,7 @@
use warnings;
use Carp;
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -4,7 +4,7 @@
use Carp;
use base qw( CatalystX::CRUD );
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/File.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/File.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/File.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -5,12 +5,12 @@
use File::Find;
use Carp;
use Data::Dump qw( dump );
-use Path::Class::File;
+use Path::Class;
use Class::C3;
__PACKAGE__->mk_accessors(qw( inc_path ));
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
@@ -21,8 +21,9 @@
package MyApp::Model::Foo;
use base qw( CatalystX::CRUD::Model::File );
__PACKAGE__->config(
- object_class => 'MyApp::File',
- inc_path => [ '/some/path', '/other/path' ],
+ object_class => 'MyApp::File',
+ delegate_class => 'Path::Class::File', # optional
+ inc_path => [ '/some/path', '/other/path' ],
);
1;
@@ -49,6 +50,10 @@
sub Xsetup {
my ( $self, $c ) = @_;
$self->{inc_path} ||= [ $c->config->{root} ];
+ if ( $self->config->{delegate_class} ) {
+ $self->object_class->delegate_class(
+ $self->config->{delegate_class} );
+ }
$self->next::method($c);
}
@@ -77,7 +82,7 @@
# look through inc_path
for my $dir ( @{ $self->inc_path } ) {
- my $test = Path::Class::File->new( $dir, $file );
+ my $test = $self->object_class->delegate_class->new( $dir, $file );
if ( -s $test ) {
$file->{delegate} = $test;
@@ -92,7 +97,8 @@
# while file() is relative to inc_path.
if ( $file->dir eq '.' or !$file->dir->is_absolute ) {
$file->{delegate}
- = Path::Class::File->new( $self->inc_path->[0], $file );
+ = $self->object_class->delegate_class->new( $self->inc_path->[0],
+ $file );
}
#carp dump $file;
@@ -133,7 +139,8 @@
sub _find {
my ( $self, $filter_sub, $root ) = @_;
my %files;
- my $find_sub = sub {
+ my $del_class = $self->object_class->delegate_class;
+ my $find_sub = sub {
#warn "File::Find::Dir = $File::Find::dir";
#warn "file = $_";
@@ -149,7 +156,7 @@
# since that is the PK
my $rel = $dir->relative($root);
$rel =~ s!^\./!!;
- my $key = Path::Class::file( $rel, $_ );
+ my $key = $del_class->new( $rel, $_ );
#warn "$key => $f";
@@ -246,8 +253,8 @@
# if not, create symlink
# wrap in eval since win32 (others?) do not support symlink
- my $link
- = Path::Class::File->new( $file->dir, $other_file->basename );
+ my $link = $self->object_class->delegate_class->new( $file->dir,
+ $other_file->basename );
my $success = 1;
my $symlink_supported
= eval { $success = symlink( "$file", "$link" ); 1 };
@@ -297,8 +304,8 @@
}
if ( $rel_name eq 'dir' ) {
- my $link
- = Path::Class::File->new( $file->dir, $other_file->basename );
+ my $link = $self->object_class->delegate_class->new( $file->dir,
+ $other_file->basename );
unless ( -l $link ) {
$self->throw_error("$other_file is not a symlink");
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -9,7 +9,7 @@
__PACKAGE__->mk_accessors(qw( use_ilike ne_sign ));
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -8,7 +8,7 @@
);
use Class::C3;
-our $VERSION = '0.31';
+our $VERSION = '0.32';
__PACKAGE__->mk_accessors(qw( object_class page_size ));
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter/File.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter/File.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter/File.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -3,7 +3,7 @@
use warnings;
use base qw( CatalystX::CRUD::ModelAdapter );
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object/File.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object/File.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object/File.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -11,8 +11,9 @@
);
__PACKAGE__->mk_accessors(qw( content file ));
+__PACKAGE__->delegate_class('Path::Class::File');
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
@@ -46,7 +47,7 @@
my $self = $class->next::method(@_);
my $file = $self->{file} or $self->throw_error("file param required");
$self->{delegate}
- ||= Path::Class::File->new( ref $file eq 'ARRAY' ? @$file : $file );
+ ||= $self->delegate_class->new( ref $file eq 'ARRAY' ? @$file : $file );
return $self;
}
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -1,14 +1,15 @@
package CatalystX::CRUD::Object;
use strict;
use warnings;
-use base qw( Class::Accessor::Fast CatalystX::CRUD );
+use base qw( Class::Accessor::Fast Class::Data::Inheritable CatalystX::CRUD );
use Carp;
use Class::C3;
Class::C3::initialize();
__PACKAGE__->mk_ro_accessors(qw( delegate ));
+__PACKAGE__->mk_classdata('delegate_class');
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -9,7 +9,7 @@
__PACKAGE__->mk_accessors(qw( enable_rpc_compat ));
__PACKAGE__->config( enable_rpc_compat => 0 );
-our $VERSION = '0.31';
+our $VERSION = '0.32';
#warn "REST VERSION = $VERSION";
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Results.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Results.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Results.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -7,7 +7,7 @@
__PACKAGE__->mk_ro_accessors(qw( count pager query results ));
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Controller.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Controller.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Controller.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -8,7 +8,7 @@
__PACKAGE__->mk_accessors( qw( form_fields ) );
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -7,7 +7,7 @@
__PACKAGE__->mk_accessors(qw( params fields ));
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD.pm 2008-10-07 22:41:34 UTC (rev 8513)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD.pm 2008-10-08 04:50:10 UTC (rev 8514)
@@ -4,7 +4,7 @@
use strict;
use Carp;
-our $VERSION = '0.31';
+our $VERSION = '0.32';
=head1 NAME
More information about the Catalyst-commits
mailing list