Hello monks!

As some of you may be aware I have bee struggling with a perl script for a few days in my attempts to parse the extremely verbose output of 3par commands.

I feel I am inching closer to my goal, but I have hit a new stumbling block. For some reason this script does not output anything at all, even tho it is loaded with test print statements.

#!/usr/bin/perl use strict; use warnings; use IO::Pipe; use IO::Handle; my @systems = ('3par-S400','3par-E200'); my $system; my $output; my $command; STDOUT->autoflush(1); print "this is test statement one!\n"; foreach $system (@systems) { $output = run_command($system); STDOUT->autoflush(1); print "this test is just before the while loop!\n"; while (<$output>) { next if (m/^$/); last if (m/^Press.*/); my (@headers) = /\d\d:\d\d:\d\d/; STDOUT->autoflush(1); print "This is a test before the loop from insde while!\n"; foreach my $header(@headers) { STDOUT->autoflush(1); print "this is a test\n"; STDOUT->autoflush(1); print "$header \n"; } } close($output); } sub run_command { my $user = 'gmon'; my $system = shift; my $protocol = 'ssh'; my $command = "statvv -ni"; my $space = " "; #The following is bad but it works for now.. my $do_command = $protocol . $space . "-l $user" . $space . $system . +$space . $command; my $cmd = new IO::Pipe; $cmd->reader($do_command); return $cmd; }


It doesn't even print any errors. Any thoughts? Thanks Monks!


In reply to script doesn't print anything by bluethundr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.