LogConnector.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 49 CC 4 SCAR 20.2
CC
4
Cov
0%
new
20.0
prepare_grouping
2.0
dispatch_request
2.0
CRAP 7.5
1 package FirePHP::LogConnector;
2  
3 =pod
4  
5 =head1 NAME
6  
7 FirePHP::LogConnector
8  
9 =head1 DESCRIPTION
10  
11 B<FirePHP::LogConnector> is an abstract base class for
12 FirePHP log connectors.
13  
14 =cut
15  
16 use strict;
17 use warnings;
18  
19 use base qw/Class::Accessor::Fast/;
20 __PACKAGE__->mk_accessors( qw/enabled fire_php/ );
21  
22 use Carp;
23 use Scalar::Util qw/blessed/;
24  
25 =head1 METHODS
26  
27 =head2 $class->new
28  
29 Returns a new abstract log connector
30  
31 =cut
32  
33 sub new {
34 my $class = shift;
35 my %opts;
36 %opts = %{ $_[0] } if ref $_[0] eq 'HASH';
37 $opts{enabled} = 0 unless exists $opts{enabled};
38 $opts{fire_php} = 0 unless exists $opts{fire_php};
39  
40 return $class->SUPER::new( \%opts );
41 }
42  
43 =head2 $self->prepare_grouping
44  
45 Subclasses that need to prepare the opening or closing
46 of a group (e.g. flushing the logs) should implement it here.
47  
48 =cut
49  
50 sub prepare_grouping {}
51  
52 =head2 $self->dispatch_request( $coderef, @args )
53  
54 Handler for controlling the dispatch cycle and binding L<FirePHP::Dispatcher>
55 to the current response headers.
56  
57 =cut
58  
59 sub dispatch_request { croak 'Method needs to be defined in a subclass' }
60  
61 =head2 $self->flush_log
62  
63 Method to write all pending FirePHP messages (not necessarily all
64 log messages) to the response headers.
65  
66 =cut
67  
68 sub flush_log { croak 'Method needs to be defined in a subclass' }
69  
70 =head2 $self->fetch_dispatcher
71  
72 Returns the current L<FirePHP::Dispatcher> object.
73  
74 =cut
75  
76 sub fetch_dispatcher {
77 my $self = shift;
78 return $self->{fire_php};
79 }
80  
81 1;
82  
83 __END__