Leser: 1
|< 1 2 3 4 >| | 40 Einträge, 4 Seiten |
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
#!/usr/bin/perl use warnings; use strict; use CGI; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); _ _PACKAGE__->new()->main; sub new { my $class = shift; my $self = bless {}, $class; return $self; } sub main { my $self = shift; $self->init; $self->process; $self->print_out; } sub init { my $self = shift; $self->init_resource; $self->init_arguments; $self->init_config; my $q = $self->{resource}{cgi}; print $q->header; } sub init_resource { my $self = shift; $self->{resource}{cgi} = new CGI; } sub init_arguments { my $self = shift; my $q = $self->{resource}{cgi}; $self->{args} = $q->Vars; } sub init_config { my $self = shift; $self->{conf} = { file_input => '/var/log/someting/somelog.log', }; } #### sub process { my $self = shift; $self->process_prepare; $self->process_do; $self->process_finish; } sub process_prepare { my $self = shift; my $filename = $self->{conf}{file_input}; open FILE_IN, $filename or die $!; } sub process_do { my $self = shift; my %errors = ( 1 => 0, 2 => 0, 3 => 0, ); while (<FILE_IN>) { my $errortype = /^(\d+)/; next unless $errortype; $errors{$errortype}++; } $self->{data}{errors} = \%errors; } sub process_finish { close FILE_IN or die $!; } ### sub print_out { my $self = shift; my %erros = $self->{data}{errors}; # ... # So und hier kannst du deiner Phantasie freien lauf lassen # }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my %seen_err;
while(<DATA>) {$seen_err{$2} += $1 if (/(\d+)\s(\w+\s\w+)/)}
print Dumper \%seen_err;
_ _DATA_ _
Bla bla
4 Leichte Fehler
2 Mittlere Fehler
3 Schwere Fehler
wbuiuigb
wogo 5 Mittlere Fehler
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
#!/usr/bin/perl use warnings; use strict; use CGI; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); _ _PACKAGE__->new()->main; sub new { my $class = shift; my $self = bless {}, $class; return $self; } sub main { my $self = shift; $self->init; $self->process; $self->print_out; } sub init { my $self = shift; $self->init_resource; $self->init_arguments; $self->init_config; my $q = $self->{resource}{cgi}; print $q->header; } sub init_resource { my $self = shift; $self->{resource}{cgi} = new CGI; } sub init_arguments { my $self = shift; my $q = $self->{resource}{cgi}; $self->{args} = $q->Vars; } sub init_config { my $self = shift; $self->{conf} = { file_input => '/var/log/someting/somelog.log', }; } #### sub process { my $self = shift; $self->process_prepare; $self->process_do; $self->process_finish; } sub process_prepare { my $self = shift; my $filename = $self->{conf}{file_input}; open FILE_IN, $filename or die $!; } sub process_do { my $self = shift; my %errors = ( 1 => 0, 2 => 0, 3 => 0, ); while (<FILE_IN>) { my $errortype = /^(\d+)/; next unless $errortype; $errors{$errortype}++; } $self->{data}{errors} = \%errors; } sub process_finish { close FILE_IN or die $!; } ### sub print_out { my $self = shift; my %erros = $self->{data}{errors}; # ... # So und hier kannst du deiner Phantasie freien lauf lassen # }
####
'/var/log/someting/somelog.log',
my %erros = $self->{data}{errors};
|< 1 2 3 4 >| | 40 Einträge, 4 Seiten |