I've written a perl script that generates some bioinformatic reports drawn from data in a MySQL database. The reports are written into their own directory and the script itself generates a little stdout telling what it is doing. This script actually has several small modules and a main driver. The problem is that I want to use a system or exec inside a cgi script to run the process. Here's the cgi code:
#!/usr/bin/perl -wT #use strict; use CGI qw(:standard); # important shortcuts use Fcntl qw(:flock); # imports LOCK_EX, LOCK_SH, LOCK_NB my $timestamp = localtime; my $userID = 'No'; my $passwrd; sub bail { my $error = "@_"; print h1("Unexpected Error"), p($error), end_html; } sub runReports { print "Generating Reports\n"; system("./Kreports.plx"); } $TITLE = "Kim's Report Generator"; $LOGFILE = "/usr/tmp/KreportLog"; print header,start_html($TITLE),h1($TITLE); $q = CGI->new(); #my ( $name, $value); print hr, start_form; # hr() emits a horizontal rule: <HR> #print $q->p( $timestamp ); print p( "User ID:", $q->textfield( -NAME => "name" ) ); print p( "Passwrd:", $q->password_field( -NAME => "passwrd")); print p( submit( "send" ), reset( "clear" ) ); print hr; print end_form; # for each name in hash produce the value foreach $ID ( $q->param ) { foreach $value ( $q->param( $ID ) ) { if ( $value eq 'Kim' ) { $userID = 'OK'; } if ($value eq 'Knecht' ) { $passwrd = 'OK'; } } } my $ret; if ( ($userID eq 'OK') and ($passwrd eq 'OK') ) { &runReports(); } else { print "Unauthorized!\n"; }
This may be a dumb question but I'm new to cgi programming and aint proud. Just need to learn how to do it. I've tried locating the report generator inside the cgi-bin and running it in it's own directory. The behavior is that the system call is ignored both ways! Thanks

In reply to How to do system calls in cgi programs by Anonymous Monk

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.