Rand Stats

The uploading author of cpan:THINCH does not match the META author of github:spidererrol.

Channel::Pauseable

cpan:THINCH

NAME

Channel::Pauseable - A Channel which can be paused and more

SYNOPSIS

use Channel::Pauseable;

my $channel = Channel::Pauseable.new;

$channel.send: ...;

$channel.pause;
$channel.resume;

say $channel.recieve;

DESCRIPTION

Channel::Pauseable is a Channel which can be paused and resumed.

It also offers the ability to automatically collect from Supplys or Tappables. And can be tapped much like a Supply.

EXAMPLES

There are various usage examples in the "examples" directory.

METHODS

See Channel for methods inherited from there.

new(:$source,:$paused)

$source is optional and can be either a Supply or a Tappable. Automatically taps the $source and feeds it into the channel.

$paused is a Boolean and defaults to False. It determines the initial state of the Channel.

pause()

Pause output of the Channel. This method will throw an exception if Channel is already paused.

resume()

Resume output of the Channel. This method will throw an exception if Channel isn't paused.

is-paused

True if Channel is paused.

poll()

This is the same as per a normal Channel but will always return Nil whilst the channel is paused.

tap(Tappable $source)

tap(Supply $source)

These methods tap the given $source and feeds it into the channel.

tap(&emit,:&done,:&quit,:&tap)

This taps the channel as if it was a (live) Supply. See Supply/tap for details.

Supply

Returns a live Supply that is supplied by this channel.

AUTHOR

Timothy Hinchcliffe gitprojects.qm@spidererrol.co.uk

COPYRIGHT AND LICENSE

Copyright 2019 Timothy Hinchcliffe

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.