my($prematch, $match) = $t->waitfor('/(Press any key to continue \(Q to quit\)|#)/');
$out .= $prematch;
last if $match eq '#';
- $t->put(" ");
+# $t->put(" ");
+ $t->print('');
}
warn "## out = [$out]";
my $hash;
+ my $section = '';
+ my $last_line;
foreach my $line ( split(/[\n\r]+/, $out) ) {
warn "# $line\n";
if ( $line =~ m/^(\S+.*?)\s+:\s+(\S+.*)$/ ) {
my ($n,$v) = ($1,$2);
$n =~ s/\(.+\)//;
- $hash->{$n} = $v;
+ $hash->{ $section . $n } = $v;
warn "## $n = $v\n";
+ } elsif ( $line =~ m/^-+$/ ) {
+ $section = $last_line . '.'
}
-
+ $last_line = $line;
}
- warn dump $hash;
+ warn "## hash = ",dump $hash;
+
+ if ( $ENV{DEBUG} ) {
+ my $path = $command;
+ $path =~ s{\W+}{_}g;
+ $path = "/tmp/dump.$path";
+ open( my $fh, '>', $path ) || die "$path: $!";
+ print $fh $out;
+ close $fh;
+ warn "DEBUG ",$path, " ", -s $path, " bytes\n";
+ }
return $hash;
}