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   202 use strict;
  29         56  
  29         853  
4 29     29   154 use warnings;
  29         57  
  29         667  
5 29     29   14723 use namespace::autoclean;
  29         507257  
  29         150  
6              
7             our $VERSION = '2.71';
8              
9 29     29   3060 use parent 'Specio::Exporter';
  29         625  
  29         174  
10              
11 29     29   125270 use Log::Dispatch::Vars qw( %CanonicalLevelNames );
  29         70  
  29         3519  
12 29     29   13225 use Specio 0.32;
  29         4328  
  29         766  
13 29     29   13522 use Specio::Declare;
  29         1935365  
  29         246  
14 29     29   19511 use Specio::Library::Builtins -reexport;
  29         688831  
  29         326  
15 29     29   287568 use Specio::Library::Numeric -reexport;
  29         365434  
  29         345  
16 29     29   250400 use Specio::Library::String -reexport;
  29         309850  
  29         261  
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.71
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             =head1 SOURCE
100              
101             The source code repository for Log-Dispatch can be found at L<https://github.com/houseabsolute/Log-Dispatch>.
102              
103             =head1 AUTHOR
104              
105             Dave Rolsky <autarch@urth.org>
106              
107             =head1 COPYRIGHT AND LICENSE
108              
109             This software is Copyright (c) 2023 by Dave Rolsky.
110              
111             This is free software, licensed under:
112              
113             The Artistic License 2.0 (GPL Compatible)
114              
115             The full text of the license can be found in the
116             F<LICENSE> file included with this distribution.
117              
118             =cut