Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: Perl/Tk code structure

by BrowserUk (Pope)
on Jan 17, 2012 at 23:23 UTC ( #948439=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        my $doStdout = sub {
             ## $Qout is a [Thread::Queue] object onto which anything that
    + is printed to stdout is enqued by the "black magic".
    ...
                 }
             }
         };
    
  2. or download this
        $mw->repeat( 500, $doStdout ); # execute $doStdout once every 500 
    +millisec...? but why mw->
    
         Tk::MainLoop(); #OK
    }
    
  3. or download this
    use Thread::Queue;
    
    ...
     tie *STDOUT, 'MyGuiStdout', $Qout;
    
     # everything up to this point is pure black magic
    
  4. or download this
    sub PRINT  { $_[0]->enqueue( join ' ', @_[ 1 .. $#_ ] ); }
    
  5. or download this
    package MyGuiStdin;
    our @ISA = qw[ Thread::Queue ];
    
    sub TIEHANDLE { bless $_[1], $_[0]; }
    sub READLINE { $_[0]->dequeue(); }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948439]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2014-07-26 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls