Net::Rendezvous::Publish::Service - a Rendezvous odvertised service


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

Index


Code Index:

NAME

Top

  Net::Rendezvous::Publish::Service - a Rendezvous odvertised service

SYNOPSIS

Top

  use Net::Rendezvous::Publish;
  my $z = Net::Rendezvous::Publish->new;
  # publish a webserver on an odd port
  my $service = $z->publish( name => "My Webserver",
                             type => "_http._tcp",
                             port => 8231 );
  # handle callbacks for 10 seconds
  for (1..100) { $z->step( 0.1 ) }

  # stop publishing the service
  $service->stop;

DESCRIPTION

Top

A Net::Rendezvous::Publish::Service represents a service you tried to publish.

You never create one directly, and instead are handed one by the publish method.

METHODS

Top

stop

Stop advertising the service.

AUTHOR

Top

Richard Clamp <richardc@unixbeard.net>

COPYRIGHT

Top

SEE ALSO

Top

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


Net-Rendezvous-Publish documentation Contained in the Net-Rendezvous-Publish distribution.
package Net::Rendezvous::Publish::Service;
use strict;
use warnings;
use base qw( Class::Accessor::Lvalue );
__PACKAGE__->mk_accessors(qw( _session _handle name type port domain published ));

sub stop {
    my $self = shift;
    $self->_session->_backend->publish_stop( $self->_handle );
    $self->published = 0;
}

sub _publish_callback {
    my $self = shift;
    my $result = shift;
    $self->published = $result eq 'success' ? 1 : 0;
}

1;

__END__