I whipped up a snippet somewhat is (supposedly) equivalent of what I do: the son acts on a file selected by FileSelect and feed it to the father. So the relation dad/son cannot be permutted.

I have yet to identify the difference between this snippet which works as intended and my code.

Probably the position of the mainloop is instrumental Here, the mainloop is after the my $fnm = $top->FileSelect()->Show(); and it works nevertheless

#! /usr/bin/perl use strict; use Socket; use Tk; use Tk::FileSelect; use FileHandle; my $top= MainWindow->new(); my $txtw = $top->Text->pack(); my $fnm = $top->FileSelect()->Show(); my $rd = new FileHandle; my $wr = new FileHandle; pipe $rd, $wr; if ( fork() ) { $top->fileevent($rd,'readable',\&insert); MainLoop; } else { open I,$fnm; print $wr $_ while($_=<I>); }

-- stefp -- check out TeXmacs wiki


In reply to Re: forking in Tk and letting the dad alone deal with X stuff by stefp
in thread forking in Tk and letting the dad alone deal with X stuff by stefp

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.