File Coverage

blib/lib/Log/Agent/Channel.pm
Criterion Covered Total %
statement 3 15 20.0
branch n/a
condition n/a
subroutine 1 6 16.6
pod 3 5 60.0
total 7 26 26.9


line stmt bran cond sub pod time code
1             ###########################################################################
2             #
3             # Channel.pm
4             #
5             # Copyright (C) 1999 Raphael Manfredi.
6             # Copyright (C) 2002-2017 Mark Rogaski, mrogaski@cpan.org;
7             # all rights reserved.
8             #
9             # See the README file included with the
10             # distribution for license information.
11             #
12             ##########################################################################
13              
14 8     8   59 use strict;
  8         18  
  8         1712  
15              
16             ########################################################################
17             package Log::Agent::Channel;
18              
19             #
20             # Ancestor for all Log::Agent logging channels.
21             #
22              
23             #
24             # is_deferred
25             #
26             # Report routine as being deferred
27             #
28             sub is_deferred {
29 0     0 0   require Carp;
30 0           Carp::confess("deferred");
31             }
32              
33             #
34             # ->make -- deferred
35             #
36             # Creation routine.
37             #
38             sub make {
39 0     0 1   &is_deferred;
40             }
41              
42             #
43             # ->write_fn -- frozen
44             #
45             # Message is a CODE ref, call routine to generate it, then perform write.
46             # Extra arguments after CODE ref are passed back to the routine.
47             #
48             sub write_fn {
49 0     0 0   my $self = shift;
50 0           my ($priority, $fn) = splice(@_, 0, 2);
51 0           my $msg = &$fn(@_);
52 0           $self->write($priority, $msg);
53             }
54              
55             #
56             # ->write -- deferred
57             #
58             # Physical writing of the message with the said priority.
59             #
60             sub write {
61 0     0 1   my $self = shift;
62 0           my ($priority, $msg) = @_;
63 0           &is_deferred;
64             }
65              
66             #
67             # ->close -- deferred
68             #
69             sub close {
70 0     0 1   my $self = shift;
71 0           &is_deferred;
72             }
73              
74             1; # for require
75             __END__