Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Prima + MCE::Hobo demonstration

by zentara (Archbishop)
on Apr 29, 2017 at 11:57 UTC ( #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 (Priest) 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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2018-08-20 16:15 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (192 votes). Check out past polls.