The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

IO::AsyncX::Notifier - easier IO::Async::Notifiers with Object::Pad

SYNOPSIS

 use Object::Pad;
 class Example isa IO::AsyncX::Notifier {
  # This will be populated by ->configure(example_field => ...)
  # or ->new(example_field => ...)
  has $example_field;
  # This will be updated by ->configure (or ->new) in a similar fashion
  use Ryu::Observable;
  has $observable_field { Ryu::Observable->new };

  # You can have as many other fields as you want, main limitation
  # at the moment is that they have to be scalars.

  method current_values () {
   'Example field: ' . $example_field,
   ' and observable set to ' . $observable_field->as_string
  }
 }
 my $obj = Example->new(
  example_field    => 'xyz',
  observable_field => 'starting value'
 );
 print join "\n", $obj->current_values;

DESCRIPTION

Provides some helper logic to simplify Object::Pad-based IO::Async::Notifier subclasses.

INHERITED METHODS

IO::Async::Notifier

add_child, adopt_future, adopted_futures, can_event, children, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, notifier_name, parent, remove_child, remove_from_parent

Object::Pad::UNIVERSAL

BUILDARGS

AUTHOR

Tom Molesworth <TEAM@cpan.org>

LICENSE

Copyright Tom Molesworth 2021. Licensed under the same terms as Perl itself.