Hi there,
In this perl/Tk program i'm working on, i am opening a pipe to a simplistic, minimalistic "print-preview" Tk program:
open(VIRTUALPRN, "| perl print.pl");
... and some thime later i simply do some
print VIRTUALPRN "foobar\n"
but the "preview" program only pops up after i close VIRTUALPRN (something which i don't want to do), and my main program waits for the preview program to terminate before ending (something i don't want, either).
this is under WinXP, BTW.

Anybody know how i can make the previewer pop up immediatly after the open(), let my main program not wait for the previewer to exit, and make all of this DWIMANWIS (Do What I Mean, And Not What I Say)?

here's the previewer:
use Tk; $mw = MainWindow->new(-width => 300, -height => 600); $pp = $mw->Scrolled("Text")->pack; $pp->configure( -background => 'white', -scrollbars => 'osoe', -font => '*-courier-medium-r-*-*-17-*' ); tie(*PP, 'Tk::Text', $pp); sub foo { while($l = <STDIN>) { print INVOICEVIEW $l; $pp->update(); } } MainLoop();

In reply to Pipeing to a Tk-App by schweini

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.