[Catalyst-commits] r9891 - in trunk/Catalyst-Model-DBIC-Schema: . lib/Catalyst/Helper/Model/DBIC lib/Catalyst/Model/DBIC lib/Catalyst/Model/DBIC/Schema/Role t

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Mon Apr 27 12:57:21 GMT 2009


Author: caelum
Date: 2009-04-27 13:57:19 +0100 (Mon, 27 Apr 2009)
New Revision: 9891

Removed:
   trunk/Catalyst-Model-DBIC-Schema/t/03podcoverage.t
   trunk/Catalyst-Model-DBIC-Schema/t/04kwalitee.t
Modified:
   trunk/Catalyst-Model-DBIC-Schema/Changes
   trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm
   trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema.pm
   trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema/Role/Caching.pm
Log:
C::M::DBIC::Schema - cleanups

Modified: trunk/Catalyst-Model-DBIC-Schema/Changes
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/Changes	2009-04-27 12:27:13 UTC (rev 9890)
+++ trunk/Catalyst-Model-DBIC-Schema/Changes	2009-04-27 12:57:19 UTC (rev 9891)
@@ -1,9 +1,10 @@
 Revision history for Perl extension Catalyst::Model::DBIC::Schema
 
+        - conversion to Moose (of Model, helper to follow)
+        - cursor caching support (via role)
         - switch to hashref connect_info for DBIC 8100
         - better helper option parsing
         - pass loader opts to dynamic schemas
-        - cursor caching support for model
 
 0.23  Sun Mar  8 20:30:02 GMT 2009
         - Kill a couple of warnings (one due to MRO::Compat)
@@ -93,5 +94,3 @@
 
 0.04  Mon Feb 13 04:22:49 UTC 2006
         - First public release
-
-0.23  2009-03-04 18:18:11

Modified: trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm	2009-04-27 12:27:13 UTC (rev 9890)
+++ trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Helper/Model/DBIC/Schema.pm	2009-04-27 12:57:19 UTC (rev 9891)
@@ -25,8 +25,9 @@
 =head1 SYNOPSIS
 
   script/create.pl model CatalystModelName DBIC::Schema MyApp::SchemaClass \
-    [ create=dynamic | create=static ] [ Schema::Loader opts ] \
-    [ dsn user pass ] [ other connect_info arguments ]
+    [ create=dynamic | create=static ] [ roles=role1,role2... ] \
+    [ Schema::Loader opts ] [ dsn user pass ] \
+    [ other connect_info args ]
 
 =head1 DESCRIPTION
 
@@ -56,6 +57,11 @@
 adapt itself to changes in your database structure.  You can edit
 the generated classes by hand to refine them.
 
+C<roles> is the list of roles to apply to the model, see
+L<Catalyst::Model::DBIC::Schema> for details.
+
+C<Schema::Loader opts> are described in L</TYPICAL EXAMPLES> below.
+
 C<connect_info> arguments are the same as what
 DBIx::Class::Schema::connect expects, and are storage_type-specific.
 For DBI-based storage, these arguments are the dsn, username,
@@ -120,10 +126,17 @@
     $self->helper($helper);
 
     my $create = '';
-    if ($args[0] && $args[0] =~ /^create=(dynamic|static)$/) {
+    if ($args[0] && $args[0] =~ /^create=(dynamic|static)\z/) {
         $create = $1;
         shift @args;
 
+        if ($args[0] && $args[0] =~ /^roles=(.*)\z/) {
+            $helper->{roles} = '['
+                .(join ',' => map { qq{'$_'} } (split /,/ => $1))
+                .']';
+            shift @args;
+        }
+
         if (@args) {
             $self->_parse_loader_args(\@args);
 
@@ -416,6 +429,10 @@
 
 Brandon L Black, C<blblack at gmail.com>
 
+Contributors:
+
+Rafael Kitover, C<<rkitover at cpan.org>>
+
 =head1 LICENSE
 
 This library is free software, you can redistribute it and/or modify
@@ -479,6 +496,7 @@
 
 __PACKAGE__->config(
     schema_class => '[% schema_class %]',
+    [% IF roles %]roles => [% roles %],[% END %]
     [% IF setup_connect_info %]connect_info => {
         [%- FOREACH key = connect_info.keys %]
         [% key %] => [% connect_info.${key} %],

Modified: trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema/Role/Caching.pm
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema/Role/Caching.pm	2009-04-27 12:27:13 UTC (rev 9890)
+++ trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema/Role/Caching.pm	2009-04-27 12:57:19 UTC (rev 9891)
@@ -41,7 +41,7 @@
 
   $c->model('DB::Table')->search({ foo => 'bar' }, { cache_for => 18000 });
 
-=bead1 CONFIG PARAMETERS
+=head1 CONFIG PARAMETERS
 
 =over 4
 

Modified: trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema.pm
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema.pm	2009-04-27 12:27:13 UTC (rev 9890)
+++ trunk/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema.pm	2009-04-27 12:57:19 UTC (rev 9891)
@@ -380,9 +380,9 @@
 
 =cut
 
-class_has 'composed_schema' => (is => 'rw');
+class_has 'composed_schema' => (is => 'rw', isa => 'DBIx::Class::Schema');
 
-has 'schema' => (is => 'rw');
+has 'schema' => (is => 'rw', isa => 'DBIx::Class::Schema');
 
 has 'schema_class' => (
     is => 'ro',
@@ -391,17 +391,17 @@
     required => 1
 );
 
-has 'storage_type' => (is => 'ro');
+has 'storage_type' => (is => 'ro', isa => 'Str');
 
 has 'connect_info' => (is => 'ro', isa => ConnectInfo, coerce => 1);
 
 # ref $self changes to anon after roles are applied, and _original_class_name is
-# broken in MX::O::P
+# broken in MX::O::P 0.0009
 has '_class_name' => (is => 'ro', isa => 'ClassName', default => sub {
     ref shift
 });
 
-has 'model_name' => (is => 'ro', default => sub {
+has 'model_name' => (is => 'ro', isa => 'Str', default => sub {
     my $self = shift;
 
     my $class = ref $self;
@@ -510,6 +510,10 @@
 
 Brandon L Black, C<blblack at gmail.com>
 
+Contributors:
+
+Rafael Kitover, C<<rkitover at cpan.org>>
+
 =head1 COPYRIGHT
 
 This program is free software, you can redistribute it and/or modify it

Deleted: trunk/Catalyst-Model-DBIC-Schema/t/03podcoverage.t
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/t/03podcoverage.t	2009-04-27 12:27:13 UTC (rev 9890)
+++ trunk/Catalyst-Model-DBIC-Schema/t/03podcoverage.t	2009-04-27 12:57:19 UTC (rev 9891)
@@ -1,7 +0,0 @@
-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();

Deleted: trunk/Catalyst-Model-DBIC-Schema/t/04kwalitee.t
===================================================================
--- trunk/Catalyst-Model-DBIC-Schema/t/04kwalitee.t	2009-04-27 12:27:13 UTC (rev 9890)
+++ trunk/Catalyst-Model-DBIC-Schema/t/04kwalitee.t	2009-04-27 12:57:19 UTC (rev 9891)
@@ -1,5 +0,0 @@
-use Test::More;
-
-eval { require Test::Kwalitee; Test::Kwalitee->import() };
-
-plan( skip_all => 'Test::Kwalitee not installed; skipping' ) if $@;




More information about the Catalyst-commits mailing list