File Coverage

blib/lib/MooseX/Types/LogAny.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package MooseX::Types::LogAny;
2 1     1   557237 use 5.008;
  1         3  
  1         32  
3 1     1   6 use strict;
  1         1  
  1         26  
4 1     1   5 use warnings;
  1         1  
  1         49  
5              
6             our $VERSION = '0.001001'; # VERSION
7              
8 1         10 use MooseX::Types -declare => [qw(
9             LogAny
10             LogAnyBase
11             LogAnyNull
12 1     1   841 )];
  1         44535  
13              
14             class_type LogAnyBase, { class => 'Log::Any::Adapter::Base' };
15             class_type LogAnyNull, { class => 'Log::Any::Adapter::Null' };
16             subtype LogAny, as LogAnyBase|LogAnyNull;
17              
18             1;
19              
20             # ABSTRACT: Moose Types for Log::Any
21              
22             __END__
23              
24             =pod
25              
26             =head1 NAME
27              
28             MooseX::Types::LogAny - Moose Types for Log::Any
29              
30             =head1 VERSION
31              
32             version 0.001001
33              
34             =head1 SYNOPSIS
35              
36             use Moose;
37             use Class::Load 0.20 'load_class';
38             use MooseX::Types::LogAny qw( LogAny );
39              
40             has log => (
41             isa => LogAny,
42             is => 'ro',
43             lazy => 1,
44             default => sub { load_class('Log::Any')->get_logger },
45             );
46              
47             =head1 DESCRIPTION
48              
49             The motivation behind this modules is that L<Log::Any::Adapter::Null> does not
50             inherit from L<Log::Any::Adapter::Base> which all of the other adapters do.
51             Moose will not allow a type union of undefined types unless they are Moose
52             classes. This module allows you to simply use the L<LogAny> type which has
53             done the union for you.
54              
55             =head1 SUBROUTINES
56              
57             =head2 LogAny
58              
59             Type union of L<LogAnyNull> and L<LogAnyBase>
60              
61             =head2 LogAnyNull
62              
63             Class L<Log::Any::Adapter::Null>
64              
65             =head2 LogAnyBase
66              
67             Class L<Log::Any::Adapter::Base>
68              
69             =head1 SEE ALSO
70              
71             =over
72              
73             =item L<MooseX::Types>
74              
75             =item L<Log::Any>
76              
77             =item L<Log::Any::Adapter>
78              
79             =back
80              
81             =head1 ACKNOWLEDGMENTS
82              
83             Development sponsored by L<HostGator.com|http://hostgator.com>
84              
85             =head1 BUGS
86              
87             Please report any bugs or feature requests on the bugtracker website
88             https://github.com/xenoterracide/moosex-types-logany/issues
89              
90             When submitting a bug or request, please include a test-file or a
91             patch to an existing test-file that illustrates the bug or desired
92             feature.
93              
94             =head1 AUTHOR
95              
96             Caleb Cushing <xenoterracide@gmail.com>
97              
98             =head1 COPYRIGHT AND LICENSE
99              
100             This software is Copyright (c) 2013 by Caleb Cushing.
101              
102             This is free software, licensed under:
103              
104             The Artistic License 2.0 (GPL Compatible)
105              
106             =cut