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   146 use strict;
  29         57  
  29         1143  
4 29     29   140 use warnings;
  29         54  
  29         531  
5 29     29   10216 use namespace::autoclean;
  29         393987  
  29         95  
6              
7             our $VERSION = '2.69';
8              
9 29     29   2606 use parent 'Specio::Exporter';
  29         510  
  29         176  
10              
11 29     29   99669 use Log::Dispatch::Vars qw( %CanonicalLevelNames );
  29         61  
  29         3103  
12 29     29   10078 use Specio 0.32;
  29         3558  
  29         639  
13 29     29   11102 use Specio::Declare;
  29         1564740  
  29         176  
14 29     29   16371 use Specio::Library::Builtins -reexport;
  29         563999  
  29         318  
15 29     29   238444 use Specio::Library::Numeric -reexport;
  29         301429  
  29         298  
16 29     29   204953 use Specio::Library::String -reexport;
  29         258789  
  29         198  
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.69
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) 2019 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