| 1 | package Fey::Meta::Attribute::FromColumn; | ||
| 2 | { | ||
| 3 | 10 | $Fey::Meta::Attribute::FromColumn::VERSION = '0.46'; | |
| 4 | } | ||
| 5 | |||
| 6 | 10 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 10 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 10 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 10 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 10 | extends 'Moose::Meta::Attribute'; | |
| 13 | |||
| 14 | 10 | has 'column' => ( | |
| 15 | is => 'ro', | ||
| 16 | isa => 'Fey::Column', | ||
| 17 | required => 1, | ||
| 18 | ); | ||
| 19 | |||
| 20 | # The parent class's constructor is not a Moose::Object-based | ||
| 21 | # constructor, so we don't want to inline one that is. | ||
| 22 | 10 | __PACKAGE__->meta()->make_immutable( inline_constructor => 0 ); | |
| 23 | |||
| 24 | 10 | 1; | |
| 25 | |||
| 26 | # ABSTRACT: An attribute metaclass for column-based attributes | ||
| 27 | |||
| 28 | __END__ | ||
| 29 | |||
| 30 | =pod | ||
| 31 | |||
| 32 | =head1 NAME | ||
| 33 | |||
| 34 | Fey::Meta::Attribute::FromColumn - An attribute metaclass for column-based attributes | ||
| 35 | |||
| 36 | =head1 VERSION | ||
| 37 | |||
| 38 | version 0.46 | ||
| 39 | |||
| 40 | =head1 SYNOPSIS | ||
| 41 | |||
| 42 | package MyApp::Song; | ||
| 43 | |||
| 44 | has_table( $schema->table('Song') ); | ||
| 45 | |||
| 46 | for my $attr ( grep { $_->can('column') } $self->meta()->get_all_attributes ) | ||
| 47 | { | ||
| 48 | ... | ||
| 49 | } | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | This attribute metaclass is used when L<Fey::ORM::Table> creates | ||
| 54 | attributes for the class's associated table. | ||
| 55 | |||
| 56 | =head1 METHODS | ||
| 57 | |||
| 58 | This class adds a single method to those provided by | ||
| 59 | C<Moose::Meta::Attribute>: | ||
| 60 | |||
| 61 | =head2 $attr->column() | ||
| 62 | |||
| 63 | Returns the L<Fey::Column> object associated with this attribute. | ||
| 64 | |||
| 65 | =head1 AUTHOR | ||
| 66 | |||
| 67 | Dave Rolsky <autarch@urth.org> | ||
| 68 | |||
| 69 | =head1 COPYRIGHT AND LICENSE | ||
| 70 | |||
| 71 | This software is copyright (c) 2011 by Dave Rolsky. | ||
| 72 | |||
| 73 | This is free software; you can redistribute it and/or modify it under | ||
| 74 | the same terms as the Perl 5 programming language system itself. | ||
| 75 | |||
| 76 | =cut | ||