| 1 | package DBIx::Class::Migration::Types; | ||
| 2 | |||
| 3 | use Type::Library | ||
| 4 | 10 | ▶ | -base, |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | -declare => ( | ||
| 6 | 'LoadableDBICSchemaClass', | ||
| 7 | 'SQLTProducer', 'ArraySQLTProducers', | ||
| 8 | 'AbsolutePath', | ||
| 9 | 10 | ); | |
| 10 | 10 | ▶ | use Type::Utils -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 10 | ▶ | BEGIN { extends "Types::Standard" }; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 10 | ▶ | use Class::Load 'load_class'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 10 | ▶ | use Module::Find (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 10 | ▶ | use File::Spec::Functions 'file_name_is_absolute', 'rel2abs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | declare LoadableClass, | ||
| 18 | as Str, | ||
| 19 | 127 | ▶ | where { load_class $_ }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | declare LoadableDBICSchemaClass, | ||
| 22 | as LoadableClass, | ||
| 23 | 0 | ▶ | message { "$_ is not the name of a loadable schema class. You probably have a typo, or some problem with \@INC"}; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 24 | |||
| 25 | coerce LoadableDBICSchemaClass, | ||
| 26 | from Str, | ||
| 27 | 0 | ▶ | via { to_LoadableClass($_); $_ }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
| |||
| 28 | |||
| 29 | 10 | my $sqltp = 'SQL::Translator::Producer'; | |
| 30 | declare SQLTProducer, | ||
| 31 | as Str, | ||
| 32 | 0 | ▶ | where { eval { load_class "$sqltp\::$_"; 1 } }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.4
| |||
| 33 | 10 | ; | |
| 34 | |||
| 35 | declare ArraySQLTProducers, | ||
| 36 | as ArrayRef[SQLTProducer], | ||
| 37 | 1 | ▶ | message { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 38 | join '', | ||
| 39 | "\nUnknown database type among (@$_) try:\n", | ||
| 40 | 1 | map {s#$sqltp\::##; "$_\n"} Module::Find::findallmod($sqltp); | |
| 41 | }, | ||
| 42 | 10 | ; | |
| 43 | |||
| 44 | declare AbsolutePath, | ||
| 45 | as Str, | ||
| 46 | 32 | ▶ | where { file_name_is_absolute $_ }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 47 | 10 | ; | |
| 48 | coerce AbsolutePath, | ||
| 49 | from Str, | ||
| 50 | 15 | ▶ | via { rel2abs $_ }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 51 | 10 | ; | |
| 52 | |||
| 53 | 10 | 1; | |
| 54 | |||
| 55 | =head1 NAME | ||
| 56 | |||
| 57 | DBIx::Class::Migration::Types - Custom Type::Tiny Types | ||
| 58 | |||
| 59 | =head1 SYNOPSIS | ||
| 60 | |||
| 61 | use DBIx::Class::Migration::Types -all; | ||
| 62 | use Moo; | ||
| 63 | |||
| 64 | has 'schema' => isa=>LoadableClass; | ||
| 65 | |||
| 66 | =head1 DESCRIPTION | ||
| 67 | |||
| 68 | Custom L<Type::Tiny> types. Probably nothing here you need to worry about. | ||
| 69 | |||
| 70 | =head1 SEE ALSO | ||
| 71 | |||
| 72 | L<DBIx::Class::Migration>, L<Type::Tiny> | ||
| 73 | |||
| 74 | =head1 AUTHOR | ||
| 75 | |||
| 76 | See L<DBIx::Class::Migration> for author information | ||
| 77 | |||
| 78 | =head1 COPYRIGHT & LICENSE | ||
| 79 | |||
| 80 | See L<DBIx::Class::Migration> for copyright and license information | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||