Showing 2 changed files with 8 additions and 14 deletions
+2
Changes
... ...
@@ -1,4 +1,6 @@
1 1
 0.1722
2
+    - added {KEY => {OPTION_KEY => OPTION_VALUE} syntax
3
+      to EXPERIMENTAL DBIx::Custom::Mapper map method
2 4
     - added {KEY => sub { VALUE }} syntax
3 5
       to EXPERIMETNAL DBIx::Custom::Mapper map method
4 6
     - removed EXPERIMENTAL wrap option from select method
+6 -14
lib/DBIx/Custom/Mapper.pm
... ...
@@ -29,21 +29,13 @@ sub map {
29 29
         my $new_key;
30 30
         
31 31
         # Get mapping information
32
-        $rule{$key} = [$key, $rule{$key}] if ref $rule{$key} eq 'CODE';
33
-        if (ref $rule{$key} eq 'ARRAY') {
34
-            foreach my $some (@{$rule{$key}}) {
35
-                $new_key = $some unless ref $some;
36
-                $condition = $some->{condition} if ref $some eq 'HASH';
37
-                $value_cb = $some if ref $some eq 'CODE';
38
-            }
39
-        }
40
-        elsif (defined $rule{$key}) {
41
-            $new_key = $rule{$key};
32
+        $rule{$key} = [$rule{$key}] if ref $rule{$key} ne 'ARRAY';
33
+        foreach my $some (@{$rule{$key}}) {
34
+            $new_key = $some unless ref $some;
35
+            $condition = $some->{condition} if ref $some eq 'HASH';
36
+            $value_cb = $some if ref $some eq 'CODE';
42 37
         }
43
-        else {
44
-            $new_key = $key;
45
-        }
46
-        
38
+        $new_key = $key unless defined $new_key;
47 39
         $value_cb ||= sub { $_[0] };
48 40
         $condition ||= $self->condition;
49 41
         $condition = $self->_condition_to_sub($condition);