Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

comment on

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

WARNING: I'm afraid this message is actually irrelevant. See EDIT note at the end.

Well, you can have your two processes communicate with yet another named pipe. I really think you should (re-)read perlipc. There are lots of examples for this kind of stuff. Check out the open() command for instance. You can use it to fork and create a named pipe in the same time. See the "Safe Pipe Opens" section.

Maybe something like this:

if (my $pid = open(JSON, '|-') { # database stuff print JSON $json; } else { # this is the child fork. # STDIN here is actually JSON in the other fork. # network stuff my $json = <>; # some more network stuff I guess }

EDIT I've just realized this wont solve your issue since the child process would block waiting for data from the parent process. It can't do that *AND* act as a network server at the same time. It only moves the blocking problem from one place to an other. So I'm sorry, I don't know.

In reply to Re^3: Simultaneously reading from a file and serving data by grondilu
in thread Simultaneously reading from a file and serving data by wazoox

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2022-05-26 15:43 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (93 votes). Check out past polls.