[Catalyst-commits] r7699 - in
Catalyst-Controller-DBIC-Transaction/1.0/trunk: .
lib/Catalyst/Action/DBIC lib/Catalyst/Controller/DBIC t t/lib
t/lib/TestApp t/lib/TestApp/Controller
ruoso at dev.catalyst.perl.org
ruoso at dev.catalyst.perl.org
Tue May 6 22:50:57 BST 2008
Author: ruoso
Date: 2008-05-06 22:50:56 +0100 (Tue, 06 May 2008)
New Revision: 7699
Added:
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/01_basic.t
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp.pm
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Controller/
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Controller/Foo.pm
Modified:
Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Action/DBIC/Transaction.pm
Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Controller/DBIC/Transaction.pm
Log:
[C-C-DBIC-Transaction] Uses Class::C3 and Sub::Name to avoid NEXT:: weirdness
Modified: Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Action/DBIC/Transaction.pm
===================================================================
--- Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Action/DBIC/Transaction.pm 2008-05-06 21:04:53 UTC (rev 7698)
+++ Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Action/DBIC/Transaction.pm 2008-05-06 21:50:56 UTC (rev 7699)
@@ -1,7 +1,9 @@
{ package Catalyst::Action::DBIC::Transaction;
use strict;
use warnings;
- use base qw(Catalyst::Action);
+ use base 'Catalyst::Action';
+ use Class::C3;
+ use Sub::Name 'subname';
sub execute {
my $self = shift;
@@ -13,11 +15,11 @@
my $wantarray = wantarray;
my ($return, @return, $success);
- my $sub = sub {
+ my $sub = subname 'Catalyst::Action::DBIC::Transaction::execute' => sub {
if ($wantarray) {
- @return = $self->NEXT::execute(@_);
+ @return = $self->next::method($self, at _);
} else {
- $return = $self->NEXT::execute(@_);
+ $return = $self->next::method($self, at _);
}
};
Modified: Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Controller/DBIC/Transaction.pm
===================================================================
--- Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Controller/DBIC/Transaction.pm 2008-05-06 21:04:53 UTC (rev 7698)
+++ Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Controller/DBIC/Transaction.pm 2008-05-06 21:50:56 UTC (rev 7699)
@@ -14,7 +14,7 @@
$self->_dbic_transaction_schemas->{$name} = $value;
- ( ActionClass => 'DBIC::Transaction' );
+ ( ActionClass => 'Catalyst::Action::DBIC::Transaction' );
}
};
Added: Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/01_basic.t
===================================================================
--- Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/01_basic.t (rev 0)
+++ Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/01_basic.t 2008-05-06 21:50:56 UTC (rev 7699)
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+use lib 't/lib';
+
+{ package MyTestSchemaReplacer;
+ sub txn_do {
+ my ($self, $code) = @_;
+ ::ok('txn_do called...');
+ $code->();
+ ::ok('txn_do exitting...');
+ }
+};
+
+use Catalyst::Test 'TestApp';
+
+get('/foo/bar');
Added: Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Controller/Foo.pm
===================================================================
--- Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Controller/Foo.pm (rev 0)
+++ Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Controller/Foo.pm 2008-05-06 21:50:56 UTC (rev 7699)
@@ -0,0 +1,14 @@
+package TestApp::Controller::Foo;
+
+use base 'Catalyst::Controller::DBIC::Transaction';
+use strict;
+use warnings;
+
+sub bar :Local :DBICTransaction('MyTestSchemaReplacer') {
+ my ($self, $c) = @_;
+
+ ::ok('Inside the method');
+}
+
+
+1;
Added: Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp.pm
===================================================================
--- Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp.pm (rev 0)
+++ Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp.pm 2008-05-06 21:50:56 UTC (rev 7699)
@@ -0,0 +1,8 @@
+package TestApp;
+
+use Catalyst::Runtime;
+use Catalyst;
+
+our $VERSION = '0.01';
+__PACKAGE__->config( name => 'TestApp' );
+__PACKAGE__->setup;
More information about the Catalyst-commits
mailing list