From: Frank Brehm Date: Mon, 30 Jul 2012 13:44:36 +0000 (+0200) Subject: Bugfixing in lib/FrBr/Common/MooseX/Role/WithPidFile.pm X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=c188736f395b4deca42f41d195b3ec543d82b843;p=my-stuff%2Fperl.git Bugfixing in lib/FrBr/Common/MooseX/Role/WithPidFile.pm --- diff --git a/lib/FrBr/Common/MooseX/Role/WithPidFile.pm b/lib/FrBr/Common/MooseX/Role/WithPidFile.pm index 744125a..46e7436 100644 --- a/lib/FrBr/Common/MooseX/Role/WithPidFile.pm +++ b/lib/FrBr/Common/MooseX/Role/WithPidFile.pm @@ -184,17 +184,36 @@ after 'init_app' => sub { return if $self->no_pidfile_action; my $piddir = $self->pidfile->file->dir; + $self->debug( sprintf("Checke PID-Verzeichnis '%s' ...", $piddir ) ) if $self->verbose >= 2; if ( -d $piddir ) { - $self->piddir( $piddir->resolve ); + my $resolved = undef; + eval { + $resolved = $piddir->resolve; + $self->debug( sprintf("Resolvdes PID-Verzeichnis '%s' ...", $resolved ) ) if $self->verbose >= 3; + }; + if ( $@ ) { + $self->error( $@ ); + } + $self->piddir( $resolved ); $piddir = $self->piddir; - $self->pidfile( $self->pidfile->file->resolve ); + $self->debug( sprintf("Verwende PID-Verzeichnis '%s' ...", $piddir ) ) if $self->verbose >= 3; + $self->debug( sprintf("Checke PID-File '%s' ...", $self->pidfile->file ) ) if $self->verbose >= 2; + if ( -f $self->pidfile->file ) { + eval { + $resolved = $self->pidfile->file->resolve; + }; + if ( $@ ) { + $self->error( $@ ); + } + $self->pidfile( $resolved ); + } } else { $self->error( sprintf( "Verzeichnis für PID-Datei '%s' existiert nicht oder ist kein Verzeichnis.", $piddir ) ); exit 14; } - my $pidfile = $self->pidfile->file; + my $pidfile = $self->pidfile->file; $self->debug( "Initialisiere PID-Datei ..." ); $self->debug( sprintf( "PID-Datei: '%s'", $pidfile ) ) if $self->verbose >= 2;