perl -MO=Deparse t2.pl sub BEGIN { require v5.14; } package MyTestModule; sub foo { use strict; no feature; use feature ':5.12'; my $fh = shift(); foreach $_ (1 .. 100) { say 'PUT'; $fh->autoflush(1); print $fh "Heloo\n"; sleep 1; } } package main; use strict; no feature; use feature ':5.12'; {;}; use AnyEvent; use AnyEvent::Fork::Template; my $cv = 'AnyEvent'->condvar; $AnyEvent::Fork::Template->fork->run('MyTestModule::foo', sub { my $fh_fh_fh = shift(); my $w_w_w; $w_w_w = 'AnyEvent'->io('fh', $fh_fh_fh, 'poll', 'r', 'cb', sub { '???'; sysread $fh_fh_fh, my $rslt, 10; say 'GOT:', $rslt; } ); } ); $cv->wait;