Overwrite if the md5sum in a file is wrong but the content has not changed
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / Column.pm
CommitLineData
3a7a1d77 1package DBIx::Class::Schema::Loader::Column;
2
3use strict;
4use warnings;
5use base 'Class::Accessor::Grouped';
6use mro 'c3';
7use Carp::Clan qw/^DBIx::Class/;
8use Scalar::Util 'weaken';
9use namespace::clean;
10
11=head1 NAME
12
13DBIx::Class::Schema::Loader::Column - Class for Columns in
14L<DBIx::Class::Schema::Loader>
15
16=head1 DESCRIPTION
17
18Used for representing columns in
19L<DBIx::Class::Schema::Loader::Base/col_accessor_map>.
20
21Stringifies to L</name>, and arrayrefifies to the
22L<name_parts|DBIx::Class::Schema::Loader::Table/name_parts> of
23L</table> plus L</name>.
24
25=cut
26
27__PACKAGE__->mk_group_accessors(simple => qw/
28 table
29 name
30/);
31
32use overload
33 '""' => sub { $_[0]->name },
34 '@{}' => sub { [ @{$_[0]->table->name_parts}, $_[0]->name ] },
35 fallback => 1;
36
37=head1 METHODS
38
39=head2 new
40
41The constructor. Takes L</table> and L</name> key-value parameters.
42
43=cut
44
45sub new {
46 my $class = shift;
47
48 my $self = { @_ };
49 croak "table is required" unless ref $self->{table};
50
51 weaken $self->{table};
52
53 return bless $self, $class;
54}
55
56=head2 table
57
58The L</DBIx::Class::Schema::Loader::Table> object this column belongs to.
59Required parameter for L</new>
60
61=head2 name
62
63The name of the column. Required parameter for L</new>.
64
65=cut
66
671;