File Coverage

blib/lib/CGI/Application/Plugin/DBIProfile/Data.pm
Criterion Covered Total %
statement 12 27 44.4
branch 0 6 0.0
condition 0 3 0.0
subroutine 4 5 80.0
pod n/a
total 16 41 39.0


line stmt bran cond sub pod time code
1             package CGI::Application::Plugin::DBIProfile::Data;
2 1     1   6 use strict;
  1         3  
  1         46  
3 1     1   8 use base 'DBI::ProfileData';
  1         3  
  1         1117  
4              
5 1     1   3626 use vars qw($VERSION);
  1         2  
  1         60  
6             $VERSION = "1.0";
7              
8 1     1   6 use Symbol;
  1         13  
  1         274  
9              
10              
11             # override _read_files
12             # this is only so that we can add support for filehandles, rather than just files.
13             sub _read_files {
14 0     0     my $self = shift;
15 0           my $files = $self->{Files};
16 0           my $read_header = 0;
17              
18 0           foreach my $filename (@$files) {
19              
20 0           my $fh;
21 0 0 0       if (!ref($filename) && ref(\$filename) ne 'GLOB') {
22             # Assume $filename is a filename
23 0           $fh = gensym;
24 0 0         open($fh, $filename)
25             or croak("Unable to read profile file '$filename': $!");
26             } else {
27 0           $fh = $filename;
28 0           $filename = ref($fh).' object';
29             }
30              
31 0 0         $self->_read_header($fh, $filename, $read_header ? 0 : 1);
32 0           $read_header = 1;
33 0           $self->_read_body($fh, $filename);
34 0           close($fh);
35             }
36              
37             # discard node_lookup now that all files are read
38 0           delete $self->{_node_lookup};
39             }