(I'm wondering why there's carp instead of croak, but that's a different issue.)use strict; use warnings; require 5.008_008; use Carp; use English qw( -no_match_vars ); [...] open my $fh, '-|', "$command" or carp "Error while executing command:$ERRNO\n"; my @command_output = <$fh>; close $fh or carp "ERROR: Couldn't close filehandle: $ERRNO\n";
The open/close is part of a subroutine, $command is provided as a parameter. In this case it's "LC_ALL=C sudo mpt-status --newstyle --probe_id" and the command output is:
The server is running Ubuntu 12.04 LTS, like at least 40 other ones. (The other ones don't exhibit this behaviour.) The installed perl version is 5.14.2-6ubuntu2.4.Checking for SCSI ID:0 ioc:0 vol_id:0 type:IM raidlevel:RAID-1 num_disks:2 size(GB):148 state +: OPTIMAL flags: ENABLED ioc:0 phys_id:1 scsi_id:8 vendor:ATA product_id:SAMSUNG HE160HJ +revision:0-24 size(GB):149 state: ONLINE flags: NONE sync_state: 100 +ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff ioc:0 phys_id:0 scsi_id:1 vendor:ATA product_id:ST3160812AS +revision:J size(GB):149 state: ONLINE flags: NONE sync_state: 100 +ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff ioc:0 spare_id:2 scsi_id:255 vendor: product_id: revision: size(GB):14 +9 state: MISSING flags: OUT_OF_SYNC sync_state: n/a ASC/ASCQ:0x00/0x0 +0 SMART ASC/ASCQ:0x00/0x00 scsi_id:1 100% scsi_id:0 100%
ERRATA: I provided the wrong command, it wasn't 'LC_ALL=C sudo mpt-status --controller $id' but 'LC_ALL=C sudo mpt-status --newstyle --probe_id'. The output is/was correct.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |