File: TestAppOptions.pm

package info (click to toggle)
libcgi-application-plugin-logdispatch-perl 1.02-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 180 kB
  • sloc: perl: 454; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,114 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package TestAppOptions;

use strict;

use CGI::Application;
use CGI::Application::Plugin::LogDispatch;
use DummyIOHandle;
@TestAppOptions::ISA = qw(CGI::Application);

sub cgiapp_init {
    my $self = shift;

    $self->{__LOG_MESSAGES}->{HANDLE} = new DummyIOHandle;
    $self->log_config(
              LOG_DISPATCH_OPTIONS => {
                        callbacks => sub { my %h = @_; chomp $h{message}; return $h{message}.'EXTRA'; },
              },
              LOG_DISPATCH_MODULES => [
                          {
                            module         => 'Log::Dispatch::Handle',
                            name           => 'handle',
                            min_level      => 'debug',
                            handle         => $self->{__LOG_MESSAGES}->{HANDLE},
                          },
              ],
    );
}

sub setup {
    my $self = shift;
    $self->start_mode('test_mode');
    $self->run_modes(test_mode => 'test_mode' );
}

sub test_mode {
    my $self = shift;

    $self->log->debug("log debug");
    $self->log->info('log info');
    return "test_mode return value";
}

1;