From c188736f395b4deca42f41d195b3ec543d82b843 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 30 Jul 2012 15:44:36 +0200 Subject: [PATCH] Bugfixing in lib/FrBr/Common/MooseX/Role/WithPidFile.pm --- lib/FrBr/Common/MooseX/Role/WithPidFile.pm | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) 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; -- 2.39.5