Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Hello Monks,
i'm having problems with bufferoutputs after i upload something with a multipartform.

basicly i launch background scripts with a system(1,cmd,arg), so i don't need to mess with threads or fork, and i don't need to monitor the launched script.
here is a SUB where i'm launching a background script and everything works well
The Sub (code reduced)

my $sth_cs = $dbh->prepare(q~update script_run_rules s +et running=1,run_user=? where NAME='InvDispute'~) or die "Couldn't pr +epare statement: " . $dbh->errstr; $sth_cs->execute($u_email); my @args = ("c:\\Apache2.2\\script_run\\exec_invdisput +e.pl", $u_email); system( 1,$cmd, @args ); print header; print Header_HTML(); print<<HTML; <table width="745" border="0" align="center" cellpaddi +ng="0" cellspacing="0"> $balken $scr_menue <tr><td>&nbsp;</td></tr> <tr><td align="center"><p>script started you will get +an email when it's finished</p></td></tr> $logo </table></body></HTML> HTML
and this is the background script (code reduced)
my $sth = $dbh_o->prepare(q~GIANT MIGHTY SQL STATEMENT~) or die "Couldn't prepare statement: " . $dbh_o->errstr; open(OUT,'>',"c:\\Apache2.2\\script_run\\Calldetails_".$inv_nr +.".txt") or die("open failed: $!"); $sth->execute($inv_nr); while (my @data = $sth->fetchrow_array()) { print OUT join(';',@data),"\n"; } $dbh_o->disconnect; close(OUT);

so system( 1,$cmd, @args ); calls the external script and the user can messaround with the site, the launched script finishes the work and send an email to the user when his output is ready.


Now some other sub with the difference of uploading a file with informations (code reduced)

binmode $filehandle; open OUT, "> c:\\Apache2.2\\script_run\\BV_on_acc.txt" + or die $!; binmode OUT; { my $buffer; while ( read $filehandle, $buffer, 1024 ) { print OUT $buffer; } } close OUT; close $filehandle; my $sth_cs = $dbh->prepare(q~update script_run_rules s +et running=1,run_user=? where NAME='BVonAcc'~) or die "Couldn't prepa +re statement: " . $dbh->errstr; $sth_cs->execute($u_email); my @args = ("c:\\Apache2.2\\script_run\\exec_bvonacc.p +l", $u_email); system( 1,$cmd, @args ); print header; print Header_HTML(); print<<HTML; <table width="745" border="0" align="center" cellpaddi +ng="0" cellspacing="0"> $balken $scr_menue <tr><td>&nbsp;</td></tr> <tr><td align="center"><p>script started you will get +an email when it's finished</p></td></tr> $logo </table></body></HTML> HTML }

and the background script (code reduced)
system('sqlldr.exe CREDS CONTROL=C:\Apache2.2\script_run\bv_on_acc_loa +der.ctl'); my $sth = $dbh_o->prepare(q~MIGHTY SQL STATEMENT~) or die "Couldn't pr +epare statement: " . $dbh_o->errstr; open(OUT,'>',"c:\\Apache2.2\\script_run\\$file") or die("open failed: +$!"); $sth->execute(); while (my @data = $sth->fetchrow_array()) { print OUT join(';',@data),"\n"; } $dbh_o->disconnect; close(OUT);

so system( 1,$cmd, @args ); launches the backgroud script.
but now the launched script pushes back the buffer output to the main CGI site,data flows during the whole time the background process runs and the site is unusable.

i checked the search about buffer CGI and apache and i found some tips, and tryed them but nothing works.
this only happens when the launching sub uses a multipartform.
i really apreciate any idear or tipp how to solve this

kind regards
ultibuzz

PS: i hope the readmore's are working


In reply to CGI Buffer problem after upload with multipart form by ultibuzz

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (6)
    As of 2014-04-21 13:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (495 votes), past polls