The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Quiq::Exit - Prüfe Exitstatus von Child-Prozess

BASE CLASS

Quiq::Object

DESCRIPTION

Die Klasse implementiert eine einzelne Methode. Diese prüft den Status eines terminierten Child-Prozesses. Im Fehlerfall löst sie eine Exception aus.

METHODS

Klassenmethoden

check() - Prüfe den Status eines terminierten Child-Prozesses

Synopsis

  $this->check;
  $this->check($exitCode);
  $this->check($exitCode,$cmd);

Arguments

$exitCode (Default: $?)

(Integer) Der Returnwert von system() oder $? im Falle von qx// (bzw. ``).

$cmd (Default: undef)

(String) Ausgeführtes Kommando. Dieses wird im Fehlerfall in den Exception-Text eingesetzt.

Description

Prüfe den Status eines terminierten Child-Prozesses und löse eine Execption aus, wenn dieser ungleich 0 ist.

Examples

Prüfe den Status nach Aufruf von system():

  my $r = system($cmd);
  Quiq::Exit->check($r,$cmd);

Minimale Variante (Prüfung über $?):

  system($cmd);
  Quiq::Exit->check;

Prüfe den Status nach Anwendung des Backtick-Operators:

  $str = `$cmd`;
  Quiq::Exit->check($?,$cmd);

VERSION

1.208

AUTHOR

Frank Seitz, http://fseitz.de/

COPYRIGHT

Copyright (C) 2023 Frank Seitz

LICENSE

This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.