object key modifier works okay
[dbsrgits/DBIx-Class-ResultSet-WithMetaData.git] / t / lib / DBICTest / Schema / ResultSet / Artist.pm
index 94f4fe1..4cc4a09 100644 (file)
@@ -4,18 +4,39 @@ use Moose;
 use Method::Signatures::Simple;
 extends 'DBICTest::Schema::ResultSet';
 
-method with_substr () {
-  $self->build_metadata( 
-    modifier => sub () {
+method with_substr_multi () {
+  $self->_with_meta_hash( 
+    sub {
       my $row = shift;
       my $substr = substr($row->{name}, 0, 3);
+      my $substr2 = substr($row->{name}, 0, 4);
       $row->{substr} = $substr;
+      $row->{substr2} = $substr2;
       return $row;
     }
   );
   return $self;
 }
 
+method with_substr_key () {
+  $self->_with_meta_key( 
+    substr => sub {
+      return substr(shift->{name}, 0, 3);
+    }
+  );
+  return $self;
+}
+
+method with_substr_key_obj () {
+  $self->_with_object_meta_key( 
+    substr => sub {
+      my ($hash, $obj) = @_;
+      return substr($obj->name, 0, 3);
+    }
+  );
+  return $self;
+}
+
 method with_substr_old () {
   foreach my $row ($self->all) {
     my $substr = substr($row->name, 0, 3);