#!/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 () {         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     # }