Ok, I'm a programmer that has been given the task to fix a bug with a Perl-generated web page. I have a background in mainframe programming, and I don't know a thing about Perl so please be gentle.

The page that I'm having trouble with is a query page that greps a particular log file for the a series of strings {tty2, tty3, tty4, ...., tty17} for a given date range.

The code is a loop from 2 - 17 that runs this grep:

$start_ts = sprintf("\"%s %s:%s:00\"",$fromdate,$hr,$min); $end_ts = sprintf("\"%s %s:%s:00\"",$todate,$tohour,$tomin); for ($i = $TTYFIRST; $i <= $TTYLAST; $i++) { Tty_check($i,$start_ts,$end_ts,$selectedserver); } sub Tty_check { $tty_string = sprintf( "tty%d", $_[0] ); $tty = qx{aml_read /l trace /h $_[3] /a commproc /s $_[1] /b $_[2] + /d all | egrep -c -e $tty_string}; printf("<TR ALIGN=LEFT VALIGN=TOP>\n"); printf("<TD>%s</TD>\n",$tty_string); chomp($tty); printf("<TD>%d</TD>\n",$tty); printf("</TR>\n"); }

The query should return a number count for each string search. I've run the line from a UNIX prompt with hardcoded information in the variable names and received correct results. But through the Perl script the program falsely returns 0 as the count or ends abnormally before it can dynamically create the web page (I get a page not found error). Hardcoding the variable information in the Perl script and running it also works. The variables are also displayed and they appear to be correct.

I guess I have 2 questions:

1. Any suggestions on how to debug this?

2. I was hoping to display what that actual query looks like within the qx .... is there a way to write that out to a file or the html page?

Thank you for any help.

Bryan


In reply to a dumb question by Motley

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.