Eventloop - Online Linux Manual Page

Section : 3pm
Updated : 2020-11-09
Source : perl v5.32.0
Note : User Contributed Perl Documentation

NAMETk::Event − ToolKit for Events

SYNOPSIS​ use Tk::Event; ​ ​ Tk::Event−>fileevent(\*FH, 'readable' => callback); ​ ​ Tk::Event−>lineavail(\*FH, callback); ​ ​ use Tk::Event::Signal qw(INT); ​ ​ $SIG{'INT'} = callback; ​ ​ use Tk::Event::process; ​ ​ Tk::Event−>proc($pid, callback); ​ ​ QueueEvent(callback [, position])

DESCRIPTIONThat is better than nothing but still hard to use. Most scripts want higher level result (a line, a block of data etc.) So it has occured to me that we could use new-ish TIEHANDLE thus: ​ my $obj = tie SOMEHANDLE,Tk::Event::IO; ​ ​ while (<SOMEHANDLE>){} Then the READLINE routine registers a callback and looks something like: ​ sub READLINE ​ { ​ my $obj = shift; ​ Event−>io(*$obj,'readable',sub { sysread(*$obj,${*$obj},1,length(${*$obj}) }); ​ my $pos; ​ while (($pos = index(${*$obj},$/) < 0){ ​ DoOneEvent(); ​ } ​ Event−>io(*$obj,'readable',''); # unregister ​ $pos += length($/); ​ my $result = substr(${*$obj},0,$pos); ​ substr(${*$obj},0,$pos) = ''; ​ return $result; ​ } This is using the scalar part of the glob representing the _inner_ IO as a buffer in which to accumulate chars.
0
Johanes Gumabo
Data Size   :   5,753 byte
man-Tk::Eventloop.3pmBuild   :   2025-03-22, 13:26   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   12 / 1,208,783
Visitor ID   :     :  
Visitor IP   :   3.145.38.89   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 25.03.22
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36


Very long time ago, I have the best tutor, Wenzel Svojanovsky. If someone knows the email address of Wenzel Svojanovsky, please send an email to johanesgumabo@gmail.com.
Help me, linux0001.com will expire on July 16, 2025. I have no money to renew it. View detail

If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|254|Tk::Eventloop.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|160|Tk::Eventloop.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|254|Tk::Eventloop.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|160|Tk::Eventloop.3pm|43|'br══─}─══ |'br══─}─══ )