File Coverage

blib/lib/Log/Dispatch/Types.pm
Criterion Covered Total %
statement 30 30 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 40 40 100.0


line stmt bran cond sub pod time code
1             package Log::Dispatch::Types;
2              
3 29     29   199 use strict;
  29         54  
  29         880  
4 29     29   151 use warnings;
  29         34  
  29         665  
5 29     29   13634 use namespace::autoclean;
  29         500678  
  29         116  
6              
7             our $VERSION = '2.70';
8              
9 29     29   3257 use parent 'Specio::Exporter';
  29         631  
  29         177  
10              
11 29     29   124979 use Log::Dispatch::Vars qw( %CanonicalLevelNames );
  29         63  
  29         3772  
12 29     29   13437 use Specio 0.32;
  29         4576  
  29         820  
13 29     29   13503 use Specio::Declare;
  29         1939634  
  29         233  
14 29     29   21252 use Specio::Library::Builtins -reexport;
  29         702081  
  29         402  
15 29     29   285803 use Specio::Library::Numeric -reexport;
  29         371407  
  29         288  
16 29     29   254707 use Specio::Library::String -reexport;
  29         312407  
  29         204  
17              
18             any_can_type(
19             'ApacheLog',
20             methods => ['log'],
21             );
22              
23             declare(
24             'ArrayOfAddresses',
25             parent => t( 'ArrayRef', of => t('NonEmptySimpleStr') ),
26             );
27              
28             coerce(
29             t('ArrayOfAddresses'),
30             from => t('NonEmptySimpleStr'),
31             inline => sub {"[ $_[1] ]"},
32             );
33              
34             declare(
35             'Callbacks',
36             parent => t( 'ArrayRef', of => t('CodeRef') ),
37             );
38              
39             coerce(
40             t('Callbacks'),
41             from => t('CodeRef'),
42             inline => sub {"[ $_[1] ]"},
43             );
44              
45             any_can_type(
46             'CanPrint',
47             methods => ['print'],
48             );
49              
50             {
51             my $level_names_re = join '|', keys %CanonicalLevelNames;
52             declare(
53             'LogLevel',
54             parent => t('Value'),
55             inline => sub {
56             sprintf( <<'EOF', $_[1], $level_names_re );
57             %s =~ /\A(?:[0-7]|%s)\z/
58             EOF
59             },
60             );
61             }
62              
63             declare(
64             'SyslogSocket',
65             parent => t(
66             'Maybe',
67             of => union( of => [ t('NonEmptyStr'), t('ArrayRef'), t('HashRef') ] )
68             ),
69             );
70              
71             1;
72              
73             # ABSTRACT: Types used for parameter checking in Log::Dispatch
74              
75             __END__
76              
77             =pod
78              
79             =encoding UTF-8
80              
81             =head1 NAME
82              
83             Log::Dispatch::Types - Types used for parameter checking in Log::Dispatch
84              
85             =head1 VERSION
86              
87             version 2.70
88              
89             =head1 DESCRIPTION
90              
91             This module has no user-facing parts.
92              
93             =for Pod::Coverage .*
94              
95             =head1 SUPPORT
96              
97             Bugs may be submitted at L<https://github.com/houseabsolute/Log-Dispatch/issues>.
98              
99             I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
100              
101             =head1 SOURCE
102              
103             The source code repository for Log-Dispatch can be found at L<https://github.com/houseabsolute/Log-Dispatch>.
104              
105             =head1 AUTHOR
106              
107             Dave Rolsky <autarch@urth.org>
108              
109             =head1 COPYRIGHT AND LICENSE
110              
111             This software is Copyright (c) 2020 by Dave Rolsky.
112              
113             This is free software, licensed under:
114              
115             The Artistic License 2.0 (GPL Compatible)
116              
117             The full text of the license can be found in the
118             F<LICENSE> file included with this distribution.
119              
120             =cut