8 inflater => sub { YAML::Load (shift) },
9 deflater => sub { die "Expecting a reference" unless (ref $_[0]); YAML::Dump (shift) },
11 { module => 'Storable.pm',
12 inflater => sub { Storable::thaw (shift) },
13 deflater => sub { die "Expecting a reference" unless (ref $_[0]); Storable::nfreeze (shift) },
19 foreach my $serializer (@serializers) {
20 eval { require $serializer->{module} };
22 $selected = $serializer;
27 plan (skip_all => "No suitable serializer found") unless $selected;
30 DBICTest::Schema::Serialized->inflate_column( 'serialized',
31 { inflate => $selected->{inflater},
32 deflate => $selected->{deflater},
35 Class::C3->reinitialize;
57 my $rs = $schema->resultset('Serialized');
58 my $entry = $rs->create({ id => 1, serialized => ''});
62 ok($entry->update ({ %{$complex1} }), 'hashref deflation ok');
63 ok($inflated = $entry->serialized, 'hashref inflation ok');
64 is_deeply($inflated, $complex1->{serialized}, 'inflated hash matches original');
66 ok($entry->update ({ %{$complex2} }), 'arrayref deflation ok');
67 ok($inflated = $entry->serialized, 'arrayref inflation ok');
68 is_deeply($inflated, $complex2->{serialized}, 'inflated array matches original');