File Coverage

blib/lib/Log/Dispatch/Binlog/File.pm
Criterion Covered Total %
statement 6 15 40.0
branch 0 8 0.0
condition n/a
subroutine 2 3 66.6
pod 0 1 0.0
total 8 27 29.6


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             package Log::Dispatch::Binlog::File;
4              
5 2     2   34627 use strict;
  2         5  
  2         77  
6              
7 2         1962 use base qw(
8             Log::Dispatch::File
9             Log::Dispatch::Binlog::Base
10 2     2   10 );
  2         3  
11              
12             sub log_message {
13 0     0 0   my ( $self, %p ) = @_;
14              
15 0           my $fh;
16              
17 0 0         if ( $self->{close} ) {
18 0           $self->_open_file;
19 0           $fh = $self->{fh};
20 0 0         $self->_storable_print( $fh, \%p )
21             or die "Cannot write to '$self->{filename}': $!";
22              
23 0 0         close $fh
24             or die "Cannot close '$self->{filename}': $!";
25             } else {
26 0           $fh = $self->{fh};
27 0 0         $self->_storable_print( $fh, \%p )
28             or die "Cannot write to '$self->{filename}': $!";
29             }
30             }
31              
32             __PACKAGE__
33              
34             __END__
35              
36             =pod
37              
38             =head1 NAME
39              
40             Log::Dispatch::Binlog::File - A subclass of L<Log::Dispatch::File> that logs
41             with L<Storable>.
42              
43             =head1 SYNOPSIS
44              
45             use Log::Dispatch::Binlog::File;
46              
47             my $output Log::Dispatch::Binlog::File->new(
48             # Log::Dispatch::File options go here
49             );
50              
51             =head1 DESCRIPTION
52              
53             Instead of printing messages this will store all of the params to
54             C<log_dispatch> using L<Storable/nstore_fd>.
55              
56             =head1 SEE ALSO
57              
58             L<Log::Dispatch::File>
59              
60             =cut