| 1 | package Log::Dispatch::Types; | ||
| 2 | |||
| 3 | 33 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 33 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 33 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 33 | our $VERSION = '2.71'; | |
| 8 | |||
| 9 | 33 | ▶ | use parent 'Specio::Exporter'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 33 | ▶ | use Log::Dispatch::Vars qw( %CanonicalLevelNames ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 33 | ▶ | use Specio 0.32; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 33 | ▶ | use Specio::Declare; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 33 | ▶ | use Specio::Library::Builtins -reexport; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 33 | ▶ | use Specio::Library::Numeric -reexport; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 33 | ▶ | use Specio::Library::String -reexport; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | 33 | any_can_type( | |
| 19 | 'ApacheLog', | ||
| 20 | methods => ['log'], | ||
| 21 | ); | ||
| 22 | |||
| 23 | 33 | declare( | |
| 24 | 'ArrayOfAddresses', | ||
| 25 | parent => t( 'ArrayRef', of => t('NonEmptySimpleStr') ), | ||
| 26 | ); | ||
| 27 | |||
| 28 | coerce( | ||
| 29 | t('ArrayOfAddresses'), | ||
| 30 | from => t('NonEmptySimpleStr'), | ||
| 31 | 0 | ▶ | inline => sub {"[ $_[1] ]"}, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 32 | 33 | ); | |
| 33 | |||
| 34 | 33 | declare( | |
| 35 | 'Callbacks', | ||
| 36 | parent => t( 'ArrayRef', of => t('CodeRef') ), | ||
| 37 | ); | ||
| 38 | |||
| 39 | coerce( | ||
| 40 | t('Callbacks'), | ||
| 41 | from => t('CodeRef'), | ||
| 42 | 66 | ▶ | inline => sub {"[ $_[1] ]"}, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 43 | 33 | ); | |
| 44 | |||
| 45 | 33 | any_can_type( | |
| 46 | 'CanPrint', | ||
| 47 | methods => ['print'], | ||
| 48 | ); | ||
| 49 | |||
| 50 | { | ||
| 51 | 33 | my $level_names_re = join '|', keys %CanonicalLevelNames; | |
| 52 | declare( | ||
| 53 | 'LogLevel', | ||
| 54 | parent => t('Value'), | ||
| 55 | 99 | ▶ | inline => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 56 | 99 | sprintf( <<'EOF', $_[1], $level_names_re ); | |
| 57 | %s =~ /\A(?:[0-7]|%s)\z/ | ||
| 58 | EOF | ||
| 59 | }, | ||
| 60 | 33 | ); | |
| 61 | } | ||
| 62 | |||
| 63 | declare( | ||
| 64 | 33 | 'SyslogSocket', | |
| 65 | parent => t( | ||
| 66 | 'Maybe', | ||
| 67 | of => union( of => [ t('NonEmptyStr'), t('ArrayRef'), t('HashRef') ] ) | ||
| 68 | ), | ||
| 69 | ); | ||
| 70 | |||
| 71 | 33 | 1; | |
| 72 | |||
| 73 | # ABSTRACT: Types used for parameter checking in Log::Dispatch | ||
| 74 | |||
| 75 | __END__ | ||