Quiq/Mojolicious/Plugin/Log/Parameters.pm

filter: Statementstmt 56.5% 13 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 100% 1 / 1 totaltotal 60.0% 18 / 30 CC 2 SCAR 9.4
CC
2
Cov
57%
__ANON__
6.0
register
2.0
BEGIN
1.0
CRAP 2.6
« Quiq/ContentProcessor/File.pm ↑ Summary Quiq/Gnuplot/Graph.pm »
1 # -----------------------------------------------------------------------------
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 Quiq::Mojolicious::Plugin::Log::Parameters - Logge Request-Parameter
8  
9 =head1 BASE CLASS
10  
11 Mojolicious::Plugin
12  
13 =head1 SYNOPSIS
14  
15 # Mojolicious
16 $app->plugin('Quiq::Mojolicious::Plugin::Log::Parameters');
17
18 # Mojolicious::Lite
19 plugin 'Quiq::Mojolicious::Plugin::Log::Parameters';
20  
21 =head1 DESCRIPTION
22  
23 Das Plugin installiert einen C<before_routes> Handler, der bei
24 jedem Request auf Loglevel C<debug> die Liste der empfangenen GET-
25 und POST-Parameter ins Log ausgibt.
26  
27 Das Plugin ist bei der Entwicklung von Action-Seiten zu Formularen
28 nützlich, denn es macht sichtbar, welche Daten die Action-Seite
29 empfängt.
30  
31 =cut
32  
33 # -----------------------------------------------------------------------------
34  
35 package Quiq::Mojolicious::Plugin::Log::Parameters;
36 1 ▶use base qw/Mojolicious::Plugin/;
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 1 our $VERSION = '1.240';
43  
44 # -----------------------------------------------------------------------------
45  
46 =head1 METHODS
47  
48 =head2 Objektmethoden
49  
50 =head3 register() - Registriere Plugin
51  
52 =head4 Synopsis
53  
54 $plugin->register($app,$conf);
55  
56 =head4 Description
57  
58 Diese Methode implementiert die Funktionalität des Plugin. Sie
59 wird nicht direkt, sondern von Mojolicious aufgerufen.
60  
61 =cut
62  
63 # -----------------------------------------------------------------------------
64  
65 0 ▶sub register {
Subroutine register: not called CC=1 SCAR=6.9
Pod documented
66 0 my ($self,$app,$conf) = @_;
67  
68 0 ▶ $app->hook(before_routes=>sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
69 0 my $c = shift;
70  
71 0 my $p = $c->req->params;
72 0 for my $key (sort @{$p->names}) {
73 0 my $valA = $p->every_param($key);
74 $c->app->log->debug(
75 0 "Param: $key => ".join ',',map {qq|"$_"|} @$valA);
76 }
77 0 });
78  
79 0 return;
80 }
81  
82 # -----------------------------------------------------------------------------
83  
84 =head1 VERSION
85  
86 1.240
87  
88 =head1 AUTHOR
89  
90 Frank Seitz, L<http://fseitz.de/>
91  
92 =head1 COPYRIGHT
93  
94 Copyright (C) 2026 Frank Seitz
95  
96 =head1 LICENSE
97  
98 This code is free software; you can redistribute it and/or modify
99 it under the same terms as Perl itself.
100  
101 =cut
102  
103 # -----------------------------------------------------------------------------
104  
105 1 1;
106  
107 # eof
« Quiq/ContentProcessor/File.pm ↑ Summary Quiq/Gnuplot/Graph.pm »