blib/lib/Web/VWF/Data/vwf_log.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 31 CC 2 SCAR 11.5
CC
2
Cov
0%
_open
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.1
1 package Web::VWF::Data::vwf_log;
2  
3 # Open /tmp/vwf.log as a database
4 # Standard CSV file, with no header line
5  
6 use strict;
7 use warnings;
8  
9 use version; our $VERSION = version->declare('0.004.2');
10  
11 use Database::Abstraction;
12 use DBD::CSV;
13  
14 our @ISA = ('Database::Abstraction');
15  
16 # Doesn't ignore lines starting with '#' as it's not treated like a CSV file
17 sub _open {
18 my $self = shift;
19 my %args = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_;
20  
21 return $self->SUPER::_open(sep_char => ',', column_names => ['domain_name', 'time', 'IP', 'country', 'type', 'language', 'http_code', 'template', 'args', 'warnings', 'error', 'duration_ms'], %args);
22 }
23  
24 1;
25  
26 =encoding utf8
27  
28 =head1 NAME
29  
30 Web::VWF::Data::vwf_log - The access log, as a database
31  
32 =head1 VERSION
33  
34 Version 0.004.2
35  
36 =head1 DESCRIPTION
37  
38 A L<Database::Abstraction> over the CSV file that the framework appends a line
39 to for every request (the C<vwflog> setting). The file has no header line, so
40 the columns are fixed: C<domain_name>, C<time>, C<IP>, C<country>, C<type>,
41 C<language>, C<http_code>, C<template>, C<args>, C<warnings>, C<error> and
42 C<duration_ms>. Lines starting with C<#> are not skipped.
43  
44 The framework builds this handle itself and gives it to every page as
45 C<vwf_log>, which is what L<Web::VWF::Display::meta_data> reads. It is not one
46 of the C<data> drivers a site declares.
47  
48 =head1 METHODS
49  
50 It has none of its own. C<new> and the queries are those of
51 L<Database::Abstraction>.
52  
53 =head2 new
54  
55 =head3 API SPECIFICATION
56  
57 =head4 INPUT
58  
59 {
60 directory => { type => 'string' }, # of the log
61 filename => { type => 'string' }, # of the log, without the directory
62 no_entry => { type => 'boolean', optional => 1 }, # the framework sets it
63 logger => { type => 'object', optional => 1 },
64 }
65  
66 =head4 OUTPUT
67  
68 { type => 'object', isa => 'Web::VWF::Data::vwf_log' }
69  
70 =head1 AUTHOR
71  
72 Nigel Horne, C<< <njh at nigelhorne.com> >>
73  
74 =head1 LICENCE AND COPYRIGHT
75  
76 Copyright 2010-2026 Nigel Horne.
77  
78 Usage is subject to the GPL2 licence terms.
79 If you use it,
80 please let me know.
81  
82 =cut