Brethren, I have the following Catalyst-Controller
sub test1 : Local { my ( $self, $c ) = @_; my $konf = ECS::Inkasso::Konfig->new(); my $bin = $konf->{location}->{bin}; my $pro = $konf->{location}->{progress}; print STDERR ">>P start\n"; my($chld_out, $chld_in); open2($chld_out, $chld_in, "perl", "$bin/x2.pl", "$pro/foo.txt"); print STDERR ">>P end\n"; $c->res->redirect( $c->req->base."/forderung/importieren/progress_ +bar" ); }
As you see the code uses IPC::Open2 to spawn off (should survive the creating process) x2.pl:
#x2.pl for ( 0.. 10 ) { open $out, ">$ARGV[0]"; print $out "$_\n"; close $out; sleep(1); }
The problem: From the Catalyst output I see the action gets called:
>>P start >>P end [info] *** Request 1 (0.025/s) [4040] [Thu Aug 2 08:13:30 2007] *** [debug] "GET" request for "forderung/importieren/test1" from "127.0.0. +1" [debug] Path is "forderung/importieren/test1" [debug] Redirecting to "http://localhost:3000//forderung/importieren/p +rogress_bar" [info] Request took 0.208057s (4.806/s) .----------------------------------------------------------------+---- +-------. | Action | Tim +e | +----------------------------------------------------------------+---- +-------+ | /begin | 0.0 +72754s | | /auto | 0.0 +00065s | | /forderung/importieren/test1 | 0.0 +00891s | '----------------------------------------------------------------+---- +-------'
However, no response gets ever sent to the browser. If I comment out the open2() line, everything works as expected. What's happening here? Does open2() something fancy with STDOUT?


holli, /regexed monk/

In reply to Catalyst and IPC::Open2 by holli

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.