Showing 5 changed files with 36 additions and 31 deletions
+5
Changes
... ...
@@ -1,3 +1,8 @@
1
+0.1638
2
+  renamed helper to method. helper is available, but deprecated.
3
+  added experimental DBIx::Custom::Result::stash()
4
+  added experimental base_table attribute and  removed experimental table_class attribute
5
+  renamed experimental DBIx::Custom::Table helper to method
1 6
 0.1637
2 7
   renamed dbi_options to dbi_option. dbi_options is available, but deprecated.
3 8
   renamed DBIx::Custom::TagProcessor to DBIx::Custom::Tag, and function names is cleanuped.
+2 -5
lib/DBIx/Custom.pm
... ...
@@ -1,6 +1,6 @@
1 1
 package DBIx::Custom;
2 2
 
3
-our $VERSION = '0.1637';
3
+our $VERSION = '0.1638';
4 4
 
5 5
 use 5.008001;
6 6
 use strict;
... ...
@@ -584,9 +584,6 @@ sub table {
584 584
         = $table_class->new(name => $name, dbi => $self)
585 585
       unless defined $self->{_tables}->{$name};
586 586
     
587
-    # Helper
588
-    $self->{_tables}->{$name}->helper(@_) if @_;
589
-    
590 587
     return $self->{_tables}{$name};
591 588
 }
592 589
 
... ...
@@ -1246,7 +1243,7 @@ Return value of C<update()> is the count of affected rows.
1246 1243
 
1247 1244
 =head2 C<(experimental) table>
1248 1245
 
1249
-    $dbi->table('book',
1246
+    $dbi->table('book')->method(
1250 1247
         insert => sub { ... },
1251 1248
         update => sub { ... }
1252 1249
     );
+15 -15
lib/DBIx/Custom/Table.pm
... ...
@@ -17,24 +17,24 @@ our $AUTOLOAD;
17 17
 sub AUTOLOAD {
18 18
     my $self = shift;
19 19
 
20
-    # Method
21
-    my ($package, $method) = $AUTOLOAD =~ /^([\w\:]+)\:\:(\w+)$/;
20
+    # Method name
21
+    my ($package, $mname) = $AUTOLOAD =~ /^([\w\:]+)\:\:(\w+)$/;
22 22
 
23
-    # Helper
24
-    $self->{_helpers} ||= {};
25
-    croak qq/Can't locate object method "$method" via "$package"/
26
-      unless my $helper = $self->{_helpers}->{$method};
23
+    # Method
24
+    $self->{_methods} ||= {};
25
+    croak qq/Can't locate object method "$mname" via "$package"/
26
+      unless my $method = $self->{_methods}->{$mname};
27 27
 
28
-    # Run
29
-    return $self->$helper(@_);
28
+    # Execute
29
+    return $self->$method(@_);
30 30
 }
31 31
 
32
-sub helper {
32
+sub method {
33 33
     my $self = shift;
34 34
     
35 35
     # Merge
36
-    my $helpers = ref $_[0] eq 'HASH' ? $_[0] : {@_};
37
-    $self->{_helpers} = {%{$self->{_helpers} || {}}, %$helpers};
36
+    my $methods = ref $_[0] eq 'HASH' ? $_[0] : {@_};
37
+    $self->{_methods} = {%{$self->{_methods} || {}}, %$methods};
38 38
     
39 39
     return $self;
40 40
 }
... ...
@@ -45,7 +45,7 @@ sub new {
45 45
     # Methods
46 46
     my @methods = qw/insert update update_all delete delete_all select/;
47 47
     foreach my $method (@methods) {
48
-        $self->helper(
48
+        $self->method(
49 49
             $method => sub {
50 50
                 my $self = shift;
51 51
                 return $self->dbi->$method(table => $self->name, @_);
... ...
@@ -89,15 +89,15 @@ you don't have to specify table name.
89 89
 Same as C<delete_all()> of L<DBIx::Custom> except that
90 90
 you don't have to specify table name.
91 91
 
92
-=head2 C<helper>
92
+=head2 C<method>
93 93
 
94
-    $table->helper(insert => sub {
94
+    $table->method(insert => sub {
95 95
         my $self = shift;
96 96
         
97 97
         return $self->dbi->insert(table => $self->name, @_);
98 98
     });
99 99
     
100
-Add helper method to a L<DBIx::Custom::Table> object.
100
+Add method to a L<DBIx::Custom::Table> object.
101 101
 
102 102
 =head2 C<insert>
103 103
 
+14 -10
t/dbix-custom-core-sqlite.t
... ...
@@ -697,19 +697,23 @@ $rows = $table->select->fetch_hash_all;
697 697
 is_deeply($rows, [], "delete_all");
698 698
 
699 699
 $dbi->dbh->do($CREATE_TABLE->{2});
700
-$dbi->table('table2', ppp => sub {
701
-    my $self = shift;
700
+$dbi->table('table2')->method(
701
+    ppp => sub {
702
+        my $self = shift;
702 703
     
703
-    return $self->name;
704
-});
705
-is($dbi->table('table2')->ppp, 'table2', "helper");
704
+        return $self->name;
705
+    }
706
+);
707
+is($dbi->table('table2')->ppp, 'table2', "method");
706 708
 
707
-$dbi->table('table2', {qqq => sub {
708
-    my $self = shift;
709
+$dbi->table('table2')->method({
710
+    qqq => sub {
711
+        my $self = shift;
709 712
     
710
-    return $self->name;
711
-}});
712
-is($dbi->table('table2')->qqq, 'table2', "helper");
713
+        return $self->name;
714
+    }
715
+});
716
+is($dbi->table('table2')->qqq, 'table2', "method");
713 717
 
714 718
 
715 719
 test 'limit';
-1
t/pod.t → xt/pod.t
... ...
@@ -1,4 +1,3 @@
1
-#!perl -T
2 1
 
3 2
 use strict;
4 3
 use warnings;