c84a10b4b06da21f2fd0f5227b59d10667aa0910
[dbsrgits/DBIx-Class-InflateColumn-Object-Enum.git] / README
1 NAME
2     DBIx::Class::InflateColumn::Object::Enum - Allows a DBIx::Class user to
3     define a Object::Enum column
4
5 VERSION
6     Version 0.03
7
8 SYNOPSIS
9     Load this module via load_components and utilize is_enum and values
10     property to define Enumuration columns via Object::Enum
11
12         package TableClass;
13     
14         use strict;
15         use warnings;
16         use base 'DBIx::Class';
17     
18         __PACKAGE__->load_components(qw/InflateColumn::Object::Enum Core/);
19         __PACKAGE__->table('testtable');
20         __PACKAGE__->add_columns(
21             color => {
22                 data_type => 'varchar',
23                 is_enum => 1,
24                 extra => {
25                     list => [qw/red green blue/]
26                 }
27             }
28             color_native => { # works inline with native enum type
29                 data_type => 'enum',
30                 is_enum => 1,
31                 extra => {
32                     list => [qw/red green blue/]
33                 }
34             }
35         );
36     
37         1;
38     
39     Now you may treat the column as an Object::Enum object.
40
41         my $table_rs = $db->resultset('TableClass')->create({
42             color => undef
43         });
44     
45         $table_rs->color->set_red; # sets color to red
46         $table_rs->color->is_red; # would return true
47         $table_rs->color->is_green; # would return false
48         print $table_rs->color->value; # would print 'red'
49         $table_rs->color->unset; # set the value to 'undef' or 'null'
50         $table_rs->color->is_red; # returns false now
51     
52 METHODS
53   register_column
54     Internal chained method with "register_column" in DBIx::Class::Row.
55     Users do not call this directly!
56
57 AUTHOR
58     Jason M. Mills, "<jmmills at cpan.org>"
59
60 BUGS
61     Please report any bugs or feature requests to
62     "bug-dbix-class-inflatecolumn-object-enum at rt.cpan.org", or through
63     the web interface at
64     <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-InflateColumn
65     -Object-Enum>. I will be notified, and then you'll automatically be
66     notified of progress on your bug as I make changes.
67
68 SUPPORT
69     You can find documentation for this module with the perldoc command.
70
71         perldoc DBIx::Class::InflateColumn::Object::Enum
72
73     You can also look for information at:
74
75     * RT: CPAN's request tracker
76         <http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-InflateColumn-O
77         bject-Enum>
78
79     * AnnoCPAN: Annotated CPAN documentation
80         <http://annocpan.org/dist/DBIx-Class-InflateColumn-Object-Enum>
81
82     * CPAN Ratings
83         <http://cpanratings.perl.org/d/DBIx-Class-InflateColumn-Object-Enum>
84
85     * Search CPAN
86         <http://search.cpan.org/dist/DBIx-Class-InflateColumn-Object-Enum>
87
88 SEE ALSO
89     Object::Enum, DBIx::Class, DBIx::Class::InflateColumn::URI
90
91 INSTALLATION
92
93 To install this module, run the following commands:
94
95         perl Makefile.PL
96         make
97         make test
98         make install
99
100 SUPPORT AND DOCUMENTATION
101
102 After installing, you can find documentation for this module with the
103 perldoc command.
104
105     perldoc Foo
106
107 You can also look for information at:
108
109     RT, CPAN's request tracker
110         http://rt.cpan.org/NoAuth/Bugs.html?Dist=Foo
111
112     AnnoCPAN, Annotated CPAN documentation
113         http://annocpan.org/dist/Foo
114
115     CPAN Ratings
116         http://cpanratings.perl.org/d/Foo
117
118     Search CPAN
119         http://search.cpan.org/dist/Foo
120
121
122 COPYRIGHT AND LICENCE
123
124 Copyright (C) 2009 Jason M. Mills
125
126 This program is free software; you can redistribute it and/or modify it
127 under the same terms as Perl itself.
128