AnyEvent-Porttracker

 view release on metacpan or  search on metacpan

Porttracker.pm  view on Meta::CPAN

verification you need to provide your own C<tls_ctx> object with C<<
verify => 1, verify_peername => [1, 1, 1] >> or whatever verification mode
you wish to use.

=item tls_ctx => $tls_ctx

The L<AnyEvent::TLS> object to use. See C<tls>, above.

=item on_XYZ => $coderef

You can specify event callbacks either by sub-classing and overriding the
respective methods or by specifying code-refs as key-value pairs when
constructing the object. You add or remove event handlers at any time with
the C<event> method.

=back

=cut

sub new {
   my $class = shift;

Porttracker.pm  view on Meta::CPAN

   package MyClass;

   use base AnyEvent::Porttracker;

   sub on_error {
      my ($api, $msg) = @_;
      warn $msg;
      exit 1;
   }

Event callbacks are not expected to return anything and are always passed
the API object as first argument. Some might have default implementations
(for example, C<on_error>), others are ignored unless overriden.

Description of individual events follow:

=over 4

=item on_error $api, $msg

Is called for every (fatal) error, including C<error> notifies. The

README  view on Meta::CPAN

            sensible/verifiable certificate, no attempt at verifying it will
            be done (which means man-in-the-middle-attacks will be trivial).
            If you want some form of verification you need to provide your
            own "tls_ctx" object with "verify => 1, verify_peername => [1,
            1, 1]" or whatever verification mode you wish to use.

        tls_ctx => $tls_ctx
            The AnyEvent::TLS object to use. See "tls", above.

        on_XYZ => $coderef
            You can specify event callbacks either by sub-classing and
            overriding the respective methods or by specifying code-refs as
            key-value pairs when constructing the object. You add or remove
            event handlers at any time with the "event" method.

    $api->req ($type => @args, $callback->($api, @reply))
        Sends a generic request of type $type to the server. When the server
        responds, the API object and the response arguments (without the
        success status) are passed to the callback, which is the last
        argument to this method.

README  view on Meta::CPAN

       package MyClass;

       use base AnyEvent::Porttracker;

       sub on_error {
          my ($api, $msg) = @_;
          warn $msg;
          exit 1;
       }

    Event callbacks are not expected to return anything and are always
    passed the API object as first argument. Some might have default
    implementations (for example, "on_error"), others are ignored unless
    overriden.

    Description of individual events follow:

    on_error $api, $msg
        Is called for every (fatal) error, including "error" notifies. The
        default prints the message and destroys the object, so it is highly
        advisable to override this event.



( run in 1.896 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )