| 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.003.0'); | ||
| 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.003.0 | ||
| 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<databases> a site declares. | ||
| 47 | |||
| 48 | =head1 AUTHOR | ||
| 49 | |||
| 50 | Nigel Horne, C<< <njh at nigelhorne.com> >> | ||
| 51 | |||
| 52 | =head1 LICENCE AND COPYRIGHT | ||
| 53 | |||
| 54 | Copyright 2010-2026 Nigel Horne. | ||
| 55 | |||
| 56 | Usage is subject to the GPL2 licence terms. | ||
| 57 | If you use it, | ||
| 58 | please let me know. | ||
| 59 | |||
| 60 | =cut |