[Catalyst-commits] r6959 - in trunk/Catalyst-Plugin-Session-Store-DBI: . lib/Catalyst/Plugin/Session/Store

andyg at dev.catalyst.perl.org andyg at dev.catalyst.perl.org
Fri Oct 5 16:37:20 GMT 2007


Author: andyg
Date: 2007-10-05 16:37:19 +0100 (Fri, 05 Oct 2007)
New Revision: 6959

Removed:
   trunk/Catalyst-Plugin-Session-Store-DBI/Build.PL
Modified:
   trunk/Catalyst-Plugin-Session-Store-DBI/Changes
   trunk/Catalyst-Plugin-Session-Store-DBI/Makefile.PL
   trunk/Catalyst-Plugin-Session-Store-DBI/lib/Catalyst/Plugin/Session/Store/DBI.pm
Log:
Session::Store::DBI 0.12, patch to add Model::DBI support, switched to M::I

Deleted: trunk/Catalyst-Plugin-Session-Store-DBI/Build.PL
===================================================================
--- trunk/Catalyst-Plugin-Session-Store-DBI/Build.PL	2007-10-05 14:50:53 UTC (rev 6958)
+++ trunk/Catalyst-Plugin-Session-Store-DBI/Build.PL	2007-10-05 15:37:19 UTC (rev 6959)
@@ -1,20 +0,0 @@
-use strict;
-use Module::Build;
-
-my $build = Module::Build->new(
-    license            => 'perl',
-    module_name        => 'Catalyst::Plugin::Session::Store::DBI',
-    requires           => { 
-        'Catalyst'                  => '5.49',
-        'Catalyst::Plugin::Session' => '0.05',
-        'DBI'                       => 0,
-        'MIME::Base64'              => 0,
-        'Storable'                  => 0,
-    },
-    create_makefile_pl => 'passthrough',
-    create_readme      => 1,
-    test_files   => [
-        glob('t/*.t') 
-    ]
-);
-$build->create_build_script;

Modified: trunk/Catalyst-Plugin-Session-Store-DBI/Changes
===================================================================
--- trunk/Catalyst-Plugin-Session-Store-DBI/Changes	2007-10-05 14:50:53 UTC (rev 6958)
+++ trunk/Catalyst-Plugin-Session-Store-DBI/Changes	2007-10-05 15:37:19 UTC (rev 6959)
@@ -1,5 +1,9 @@
 Revision history for Perl extension Catalyst::Plugin::Session::Store::DBI
 
+0.12    2007-10-05 11:00:00
+        - Added support for Catalyst::Model::DBI models. (Geoffrey Giesemann)
+        - Switched to Module::Install.
+
 0.11    2007-03-22 17:00:00
         - Reset cached statement handles if the dbh goes away or changes.
           (Peter Karman)

Modified: trunk/Catalyst-Plugin-Session-Store-DBI/Makefile.PL
===================================================================
--- trunk/Catalyst-Plugin-Session-Store-DBI/Makefile.PL	2007-10-05 14:50:53 UTC (rev 6958)
+++ trunk/Catalyst-Plugin-Session-Store-DBI/Makefile.PL	2007-10-05 15:37:19 UTC (rev 6959)
@@ -1,31 +1,14 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.03
-    
-    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();
-      
-      CPAN::Shell->install('Module::Build::Compat');
-      CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
-	or die "Couldn't install Module::Build, giving up.\n";
-      
-      chdir $cwd or die "Cannot chdir() back to $cwd: $!";
-    }
-    eval "use Module::Build::Compat 0.02; 1" or die $@;
-    
-    Module::Build::Compat->run_build_pl(args => \@ARGV);
-    require Module::Build;
-    Module::Build::Compat->write_makefile(build_class => 'Module::Build');
+use inc::Module::Install 0.65;
+
+name 'Catalyst-Plugin-Session-Store-DBI';
+all_from 'lib/Catalyst/Plugin/Session/Store/DBI.pm';
+
+requires 'Catalyst::Runtime'         => '5.49';
+requires 'Catalyst::Plugin::Session' => '0.05';
+requires 'DBI';
+requires 'MIME::Base64';
+requires 'Storable';
+requires 'Test::More';
+
+auto_install;
+WriteAll;

Modified: trunk/Catalyst-Plugin-Session-Store-DBI/lib/Catalyst/Plugin/Session/Store/DBI.pm
===================================================================
--- trunk/Catalyst-Plugin-Session-Store-DBI/lib/Catalyst/Plugin/Session/Store/DBI.pm	2007-10-05 14:50:53 UTC (rev 6958)
+++ trunk/Catalyst-Plugin-Session-Store-DBI/lib/Catalyst/Plugin/Session/Store/DBI.pm	2007-10-05 15:37:19 UTC (rev 6959)
@@ -8,7 +8,7 @@
 use NEXT;
 use Storable qw/nfreeze thaw/;
 
-our $VERSION = '0.11';
+our $VERSION = '0.12';
 
 __PACKAGE__->mk_classdata('_session_sql');
 __PACKAGE__->mk_classdata('_session_dbh');
@@ -243,6 +243,19 @@
                     );
                 }
             }
+
+            # Model::DBI support
+            elsif ( $c->model($class)
+                 && $c->model($class)->isa('Catalyst::Model::DBI')
+            ) {
+                eval { $dbh = $c->model($class)->dbh };
+                if ($@) {
+                    Catalyst::Exception->throw(
+                        message => "Unable to get a handle from "
+                                 . "DBI model '$class': $@"
+                    );
+                }
+            }
             
             else {
                 Catalyst::Exception->throw( 
@@ -357,8 +370,9 @@
 =head2 dbi_dbh
 
 Set this to an existing $dbh or the class name of a L<DBIx::Class>,
-L<Class::DBI>, or L<Rose::DB::Object> model.  DBIx::Class schema is also
-supported by setting dbi_dbh to the name of your schema model.
+L<Class::DBI>, L<Rose::DB::Object>, or L<Catalyst::Model::DBI> model. 
+DBIx::Class schema is also supported by setting dbi_dbh to the name of
+your schema model.
 
 This method is recommended if you have other database code in your
 application as it will avoid opening additional connections.




More information about the Catalyst-commits mailing list