| 1 | package Fey::ORM::Schema; | ||
| 2 | { | ||
| 3 | 9 | $Fey::ORM::Schema::VERSION = '0.46'; | |
| 4 | } | ||
| 5 | |||
| 6 | 9 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 9 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 9 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 9 | ▶ | use Fey::Meta::Class::Schema; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 9 | ▶ | use Fey::Object::Schema; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 9 | ▶ | use Moose 1.15 (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 9 | ▶ | use MooseX::StrictConstructor 0.13 (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 9 | ▶ | use Moose::Exporter; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 9 | ▶ | use MooseX::Params::Validate qw( pos_validated_list ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | 9 | Moose::Exporter->setup_import_methods( | |
| 19 | with_meta => [qw( has_schema )], | ||
| 20 | also => [ 'Moose', 'MooseX::StrictConstructor' ], | ||
| 21 | ); | ||
| 22 | |||
| 23 | sub init_meta { | ||
| 24 | 11 | ▶ | shift; |
|
Subroutine
init_meta: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 25 | 11 | my %p = @_; | |
| 26 | |||
| 27 | 11 | return Moose->init_meta( | |
| 28 | %p, | ||
| 29 | base_class => 'Fey::Object::Schema', | ||
| 30 | metaclass => 'Fey::Meta::Class::Schema', | ||
| 31 | ); | ||
| 32 | } | ||
| 33 | |||
| 34 | sub has_schema { | ||
| 35 | 11 | ▶ | my $meta = shift; |
|
Subroutine
has_schema: called CC=1 SCAR=0.0
Pod
documented
| |||
| 36 | |||
| 37 | 11 | my ($schema) = pos_validated_list( \@_, { isa => 'Fey::Schema' } ); | |
| 38 | |||
| 39 | 11 | $meta->_associate_schema($schema); | |
| 40 | } | ||
| 41 | |||
| 42 | 9 | 1; | |
| 43 | |||
| 44 | # ABSTRACT: Provides sugar for schema-based classes | ||
| 45 | |||
| 46 | __END__ | ||
| 47 | |||
| 48 | =pod | ||
| 49 | |||
| 50 | =head1 NAME | ||
| 51 | |||
| 52 | Fey::ORM::Schema - Provides sugar for schema-based classes | ||
| 53 | |||
| 54 | =head1 VERSION | ||
| 55 | |||
| 56 | version 0.46 | ||
| 57 | |||
| 58 | =head1 SYNOPSIS | ||
| 59 | |||
| 60 | package MyApp::Schema; | ||
| 61 | |||
| 62 | use Fey::ORM::Schema; | ||
| 63 | |||
| 64 | has_schema ...; | ||
| 65 | |||
| 66 | no Fey::ORM::Schema; | ||
| 67 | |||
| 68 | =head1 DESCRIPTION | ||
| 69 | |||
| 70 | Use this class to associate your class with a schema. It exports a | ||
| 71 | number of sugar functions to allow you to define things in a | ||
| 72 | declarative manner. | ||
| 73 | |||
| 74 | =head1 EXPORTED FUNCTIONS | ||
| 75 | |||
| 76 | This package exports the following functions: | ||
| 77 | |||
| 78 | =head2 has_schema($schema) | ||
| 79 | |||
| 80 | Given a L<Fey::Schema> object, this method associates that schema with | ||
| 81 | the calling class. | ||
| 82 | |||
| 83 | =head1 AUTHOR | ||
| 84 | |||
| 85 | Dave Rolsky <autarch@urth.org> | ||
| 86 | |||
| 87 | =head1 COPYRIGHT AND LICENSE | ||
| 88 | |||
| 89 | This software is copyright (c) 2011 by Dave Rolsky. | ||
| 90 | |||
| 91 | This is free software; you can redistribute it and/or modify it under | ||
| 92 | the same terms as the Perl 5 programming language system itself. | ||
| 93 | |||
| 94 | =cut | ||