Assign program result or die

From: Martin Nilsson (martin_rufus_at_hotmail.com)
Date: 07/15/04

  • Next message: Jürgen Exner: "Re: Assign program result or die"
    Date: 14 Jul 2004 23:01:23 -0700
    
    

    Hi,

    I'm new to Perl and have a question about return statuses and
    errorhandling. I want to do the following.

    Execute a program and assign the result to an array and if the program
    return an error I want to show the error. Something like this:

    my @files = system("$ncftpls -1 -u $USER -p $PASSW
    ftp:\/\/$HOST$remote_dir") && die "Could not execute NcFTPLS. Error:
    $????";

    Of course this does not work but maybe it shows what I want to do? How
    do I get the error code ($????) from the program $ncftpls and how
    should I write the code?

    For info: $ncfptls is NcFTPLS found at http://www.ncftp.com/

    Any hints?

    Br,

    Martin


  • Next message: Jürgen Exner: "Re: Assign program result or die"

    Relevant Pages

    • Re: Component Registration Failure
      ... Error code 15100> ... Execute the command regsvr32.exe atl.dll ... The message was checked by ESET Smart Security. ...
      (microsoft.public.windows.mediacenter)
    • Re: Component Registration Failure
      ... Error code 15100> ... Execute the command regsvr32.exe atl.dll ... The message was checked by ESET Smart Security. ...
      (microsoft.public.windows.mediacenter)
    • mssql2k5 db2 to mssql errors
      ... All was working correctly until i tried download data with some ... After execute i got errors: ... Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. ... a shutdown signal and is terminating. ...
      (microsoft.public.sqlserver.programming)
    • Re: make buildworld
      ... > I face w/ problem when i execute make buildworld after ... An erorr message would be helpful. ... Please take note that "Error code 1", ...
      (freebsd-stable)