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