| 1 | package BackPAN::Index::Types; | ||
| 2 | |||
| 3 | 11 | ▶ | use Mouse; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 11 | ▶ | use Mouse::Util::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | # Predeclare class types. Otherwise if the class isn't loaded Mouse might | ||
| 7 | # quietly and confusingly think its a non-class type. | ||
| 8 | 11 | class_type('App::Cache'); | |
| 9 | 11 | class_type('BackPAN::Index'); | |
| 10 | 11 | class_type('BackPAN::Index::Database'); | |
| 11 | 11 | class_type('BackPAN::Index::IndexFile'); | |
| 12 | 11 | class_type('DBI::db'); | |
| 13 | 11 | class_type('DBIx::Class::Schema'); | |
| 14 | |||
| 15 | coerce class_type("URI") => | ||
| 16 | from 'Str', | ||
| 17 | 0 | ▶ | via { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 18 | 0 | require URI; | |
| 19 | 0 | URI->new($_) | |
| 20 | 11 | }; | |
| 21 | |||
| 22 | coerce class_type("Path::Class::File") => | ||
| 23 | from 'Str', | ||
| 24 | 11 | ▶ | via { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 25 | 11 | require Path::Class::File; | |
| 26 | 11 | Path::Class::File->new($_) | |
| 27 | 11 | }; | |
| 28 | |||
| 29 | coerce class_type("Path::Class::Dir") => | ||
| 30 | from 'Str', | ||
| 31 | 1 | ▶ | via { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 32 | 1 | require Path::Class::Dir; | |
| 33 | 1 | Path::Class::Dir->new($_) | |
| 34 | 11 | }; | |
| 35 | |||
| 36 | 11 | 1; | |