Debian Codegraph @

README

raw
1 NAME
2
3 DBIx::Class::InflateColumn::Serializer - Inflators to serialize data
4 structures for DBIx::Class
5
6 SYNOPSIS
7
8 package MySchema::Table;
9 use base 'DBIx::Class';
10
11 __PACKAGE__->load_components('InflateColumn::Serializer', 'Core');
12 __PACKAGE__->add_columns(
13 'data_column' => {
14 'data_type' => 'VARCHAR',
15 'size' => 255,
16 'serializer_class' => 'JSON'
17 }
18 );
19
20 Then in your code...
21
22 my $struct = { 'I' => { 'am' => 'a struct' };
23 $obj->data_column($struct);
24 $obj->update;
25
26 And you can recover your data structure with:
27
28 my $obj = ...->find(...);
29 my $struct = $obj->data_column;
30
31 The data structures you assign to "data_column" will be saved in the
32 database in JSON format.
33
34 DESCRIPTION
35
36 These modules help you store and access serialized data structures in
37 the columns of your DB from your DBIx::Classes. They are inspired from
38 the DBIx::Class::Manual::FAQ and the DBIC test suite, and provide a bit
39 more protection than the inflators proposed in the FAQ. The intention
40 is to provide a suite of well proven and reusable inflators and
41 deflators to complement DBIx::Class.
42
43 Added features for these inflators are: - throw an exception if the
44 serialization doesn't fit in the field - throw an exception if the
45 deserialization results in an error
46
47 Right now there are three serializers: - Storable - JSON - YAML
48
49 USAGE
50
51 1. Choose your serializer: JSON, YAML or Storable
52
53 2. Add 'InflateColumn::Serializer' into the load_components of your
54 table class
55
56 3. add 'serializer_class' => SERIALIZER to the properties of the column
57 that you want to (de/i)nflate with the SERIALIZER class.
58
59 NOTES
60
61 As stated in the DBIC FAQ: "Be careful not to overuse this capability,
62 however. If you find yourself depending more and more on some data
63 within the inflated column, then it may be time to factor that data
64 out."
65
66 AUTHOR
67
68 Jose Luis Martinez
69 CPAN ID: JLMARTIN
70 CAPSiDE
71 [email protected]
72 http://www.pplusdomain.net
73
74 COPYRIGHT
75
76 This program is free software; you can redistribute it and/or modify it
77 under the same terms as Perl itself.
78
79 The full text of the license can be found in the LICENSE file included
80 with this module.
81
82 THANKS
83
84 Matt S Trout for his valuable feedback
85
86 Ask Bjorn Hansen
87
88 Karen Etheridge
89
90 SEE ALSO
91
92 DBIx::Class, DBIx::Class::Manual::FAQ
93