Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Prima + MCE::Hobo demonstration

by zentara (Archbishop)
on Apr 29, 2017 at 11:57 UTC ( [id://1189162]=note: print w/replies, xml ) Need Help??


in reply to Prima + MCE::Hobo demonstration

Hi marioroy, I'm glad to see someone use Prima, as it is an under-appreciated toolkit. I did notice one unusual aspect of running your code. On my linux system, slackware, I notice a flickering in the $btn1 text as the background process runs. It almost looks like a "feature", indicating which step is active. :-)

Here is an unoptimized hack to fix the problem in the timer. It looks like this is a perfect opportunity to use a "state" variable in the timer, but this is just a brute force method, which makes it clear what is happening.

my $text = ''; my $timer = Prima::Timer->create( timeout => 100, onTick => sub { my $new_text = $msg->get; if ($new_text ne $text){ $btn1->set( text => $new_text ); $text = $new_text; } } );

I'm not really a human, but I play one on earth. ..... an animated JAPH

Replies are listed 'Best First'.
Re^2: Prima + MCE::Hobo demonstration
by marioroy (Prior) on Apr 29, 2017 at 14:51 UTC

    Hi zentara. That's nice++. Prima is new to me. I tried calling $btn1->text to obtain the string and that works too.

    my $timer = Prima::Timer->create( timeout => 100, onTick => sub { my $new_text = $msg->get; if ($new_text ne $btn1->text) { $btn1->set( text => $msg->get ); } } );

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-25 17:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found