Net::Rendezvous::Publish::Backend::Howl - interface to Porchdog software's Howl library


Net-Rendezvous-Publish-Backend-Howl documentation Contained in the Net-Rendezvous-Publish-Backend-Howl distribution.

Index


Code Index:

NAME

Top

Net::Rendezvous::Publish::Backend::Howl - interface to Porchdog software's Howl library

DESCRIPTION

Top

This module interfaces to the Porchdog's Howl library in order to allow service publishing.

AUTHOR

Top

Richard Clamp <richardc@unixbeard.net>

COPYRIGHT

Top

SEE ALSO

Top

Net::Rendezvous::Publish - the module this module supports

Howl


Net-Rendezvous-Publish-Backend-Howl documentation Contained in the Net-Rendezvous-Publish-Backend-Howl distribution.

package Net::Rendezvous::Publish::Backend::Howl;
use strict;
use warnings;
use XSLoader;
use base qw( Class::Accessor::Lvalue::Fast );
__PACKAGE__->mk_accessors(qw( _handle _salt ));
our $VERSION = 0.03;

XSLoader::load __PACKAGE__;

sub new {
    my $self = shift;
    $self = $self->SUPER::new;
    $self->_handle = init_rendezvous();
    $self->_salt   = get_salt( $self->_handle );
    return $self;
}

sub DESTROY {
    my $self = shift;
    sw_rendezvous_fina( $self->_handle );
}

sub publish {
    my $self = shift;
    my %args = @_;
    $args{txt} = [ split /\x{1}/, $args{txt} ];
    return xs_publish( $self->_handle, map {
        $_ || ''
    } @args{qw( object name type domain host port txt )} );
}

sub publish_stop {
    my $self = shift;
    my $id   = shift;
    return sw_discovery_cancel( $self->_handle, $id );
}

sub step {
    my $self = shift;
    my $howlong = @_ ? shift : 0.5;
    $howlong *= 1000; # millisecs
    run_step( $self->_salt, $howlong );
}

1;
__END__