| 1 | package CMS::Drupal::Types; | ||
| 2 | 3 | $CMS::Drupal::Types::VERSION = '0.94'; | |
| 3 | # ABSTRACT: A Perl type library for working with Drupal | ||
| 4 | |||
| 5 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 3 | use Type::Library -base, -declare => qw/ DBName | |
| 9 | DBDriver | ||
| 10 | DBUsername | ||
| 11 | DBPassword | ||
| 12 | DBHost | ||
| 13 | DBPort | ||
| 14 | 3 | ▶ | DBPrefix /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 3 | ▶ | use Type::Utils qw/ :all /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 3 | ▶ | use Types::Standard qw/ Optional Maybe Str StrMatch Int slurpy Dict /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | 4 | ▶ | declare DBName, as Str, where { length > 0 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 19 | 0 | ▶ | message { 'You must supply the database name. ' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 20 | |||
| 21 | declare DBDriver, as StrMatch[ qr{ ^(mysql|Pg|SQLite)$ }x ], | ||
| 22 | 0 | ▶ | message { 'You must supply the name of a valid installed dbi:dbd driver (mysql, Pg, or SQLite). ' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 23 | |||
| 24 | declare DBUsername, as Optional[Str], | ||
| 25 | 0 | ▶ | message { 'The username must be a string. ' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 26 | |||
| 27 | declare DBPassword, as Optional[Str], | ||
| 28 | 0 | ▶ | message { 'The password must be a string. ' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 29 | |||
| 30 | declare DBHost, as Optional[Str], | ||
| 31 | 0 | ▶ | message { 'The hostname must be a string. ' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 32 | |||
| 33 | declare DBPort, as Optional[Int], | ||
| 34 | 0 | ▶ | message { 'The port number must be an integer. ' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 35 | |||
| 36 | declare DBPrefix, as Optional[Str], | ||
| 37 | 0 | ▶ | message { return 'The table prefix must be a string. ' }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 38 | |||
| 39 | 3 | 1; ## return true to end package CMS::Drupal::Types | |
| 40 | |||
| 41 | __END__ | ||