Json inflator
package MySchema::Table; use base 'DBIx::Class'; _\|_PACKAGE_\|_->load_components('InflateColumn::Serializer', 'Core'); _\|_PACKAGE_\|_->add_columns( 'data_column' => { 'data_type' => 'VARCHAR', 'size' => 255, 'serializer_class' => 'JSON' } );
Then in your code...
my $struct = { 'I' => { 'am' => 'a struct' }; $obj->data_column($struct); $obj->update;
And you can recover your data structure with:
my $obj = ...->find(...); my $struct = $obj->data_column;
The data structures you assign to \*(L"data_column\*(R" will be saved in the database in \s-1JSON\s0 format.
Called by DBIx::Class::InflateColumn::Serializer to get the routine that serializes the data passed to it. Returns a coderef.
Called by DBIx::Class::InflateColumn::Serializer to get the routine that deserializes the data stored in the column. Returns a coderef.