File Coverage

blib/lib/CMS/Drupal/Types.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


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