AnyEvent-Digest

 view release on metacpan or  search on metacpan

lib/AnyEvent/Digest.pm  view on Meta::CPAN

You can choose L<IO::AIO> backend. You need install L<IO::AIO> and L<AnyEvent::AIO> for L<IO::AIO> backend.

=head1 METHODS

In addition to the following methods, other methods are forwarded to the base module.
So, you can use an object of this module as if it is an object of base module.
However, C<addfile()> calls C<recv()> internally so that L<AnyEvent> backend you use SHOULD supprot blocking wait.
If you want to avoid blocking wait, you can use C<addfile_base()> instead.

=head2 C<new($base, %args)>

This is a constructor method.
C<$base> specifies a module name for base digest implementation, which is expected to be one of C<Digest::*> modules.
C<'require'> is called for the base module, so you don't have to do C<'require'> explicitly.

Available keys of C<%args> are as follows:

=over 4

=item C<opts>

passed to C<$base::new> as C<@{$args{opts}}>. It MUST be an array reference.

=item C<unit>

specifies an amount of read unit for addfile(). Default to 65536 = 64KiB.

=item C<backend>

specifies a backend module to handle asynchronous read. Available backends are C<'idle'> and C<'aio'>. Default to C<'idle'>.

=back

=head2 C<add_async(@dat)>

Each item in C<@dat> are added by C<add($dat)>.
Between the adjacent C<add()>, other L<AnyEvent> watchers have chances to run.
It returns a condition variable receiving this object itself.

=head2 C<addfile_async($filename)>

=head2 C<addfile_async(*handle)>

C<add()> is called repeatedly read from C<$filename> or C<*handle> by the specified unit.
Between the adjacent C<add()>, other L<AnyEvent> watchers have chances to run.
It returns a condition variable receiving this object itself.

=head2 C<add_bits_async()>

Same as C<add_bits()>, except it returns a condition variable receiving this object itself.

B<CAUTION:> Currerntly, other L<AnyEvent> watchers have B<NO> chance to run during this call.

=head2 C<addfile()>

This method uses blocking wait + C<addfile_async()>.

=head2 C<addfile_base()>

Forwarded to C<addfile()> in the base module. If you need to avoid blocking wait somewhere, this might be helpful.
However, during the call, other L<AnyEvent> watchers  are blocked.

=head1 SEE ALSO

=over 4

=item *

L<AnyEvent>

=item *

L<AnyEvent::AIO>

=item *

L<IO::AIO>

=item *

L<Digest>

=back

=head1 AUTHOR

Yasutaka ATARASHI <yakex@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Yasutaka ATARASHI.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 2.439 seconds using v1.01-cache-2.11-cpan-e1769b4cff6 )