MozRepl-RemoteObject
view release on metacpan or search on metacpan
README.mkdn view on Meta::CPAN
my ($event) = @_;
print "I got a " . $event->{type} . " event\n";
print "on " . $event->{originalTarget};
});
# do other things...
Note that you cannot block the execution of Javascript that way.
The Javascript code has long continued running when you receive
the event.
Currently, only busy-waiting is implemented and there is no
way yet for Javascript to tell Perl it has something to say.
So in absence of a real mainloop, you have to call
$repl->poll;
from time to time to look for new events. Note that _any_
call to Javascript will carry all events back to Perl and trigger
the handlers there, so you only need to use poll if no other
activity happens.
lib/MozRepl/RemoteObject.pm view on Meta::CPAN
my ($event) = @_;
print "I got a " . $event->{type} . " event\n";
print "on " . $event->{originalTarget};
});
# do other things...
Note that you cannot block the execution of Javascript that way.
The Javascript code has long continued running when you receive
the event.
Currently, only busy-waiting is implemented and there is no
way yet for Javascript to tell Perl it has something to say.
So in absence of a real mainloop, you have to call
$repl->poll;
from time to time to look for new events. Note that I<any>
call to Javascript will carry all events back to Perl and trigger
the handlers there, so you only need to use poll if no other
activity happens.
( run in 0.350 second using v1.01-cache-2.11-cpan-87723dcf8b7 )