Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hakobe/p5-fiber
Ruby like Fiber on Perl
https://github.com/hakobe/p5-fiber
Last synced: 8 days ago
JSON representation
Ruby like Fiber on Perl
- Host: GitHub
- URL: https://github.com/hakobe/p5-fiber
- Owner: hakobe
- License: other
- Created: 2009-03-22T04:29:42.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2014-01-28T13:04:00.000Z (almost 11 years ago)
- Last Synced: 2024-04-15T02:42:49.097Z (7 months ago)
- Language: Perl
- Homepage:
- Size: 199 KB
- Stars: 20
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/hakobe/p5-Fiber.png?branch=master)](https://travis-ci.org/hakobe/p5-Fiber)
# NAMEFiber - Coroutine like Ruby Fiber
# SYNOPSIS
use Fiber;
my $counter = Fiber->new(sub {
my $n = 0;
while (1) {
Fiber->yield($n++);
}
});$counter->resume; # => 0
$counter->resume; # => 1
$counter->resume; # => 2# DESCRIPTION
Fiber is a coroutine implementaion like Ruby Fiber.
This module is built upon Coro.# METHODS
- new
my $fiber = Fiber->new(sub { ... });
Creates a new Fiber object that processes a given subrotuine reference.
- yield
my @ret = Fiber->yield(@vals);
Control back to the context that resume the fiber, and passing @valus to it.
- resume
my @ret = $fiber->resume(@vals);
Resumes the fiber from the point at which the last Fiber->yield was called,
or starts running it if it is the first call to resume.# AUTHOR
Yohei Fushii
# LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.