Net-Rendezvous-Publish-0.04/0002775000175000017500000000000010366630163016061 5ustar richardcrichardcNet-Rendezvous-Publish-0.04/lib/0002775000175000017500000000000010366630163016627 5ustar richardcrichardcNet-Rendezvous-Publish-0.04/lib/Net/0002775000175000017500000000000010366630163017355 5ustar richardcrichardcNet-Rendezvous-Publish-0.04/lib/Net/Rendezvous/0002775000175000017500000000000010366630163021521 5ustar richardcrichardcNet-Rendezvous-Publish-0.04/lib/Net/Rendezvous/Publish/0002775000175000017500000000000010366630163023127 5ustar richardcrichardcNet-Rendezvous-Publish-0.04/lib/Net/Rendezvous/Publish/Service.pm0000664000175000017500000000274610366630163025074 0ustar richardcrichardcpackage 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 )); =head1 NAME Net::Rendezvous::Publish::Service - a Rendezvous odvertised service =head1 SYNOPSIS 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; =head1 DESCRIPTION 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. =head1 METHODS =head2 stop Stop advertising the service. =cut 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__ =head1 AUTHOR Richard Clamp =head1 COPYRIGHT Copyright 2004, Richard Clamp. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO Net::Rendezvous::Publish - the module this module supports =cut Net-Rendezvous-Publish-0.04/lib/Net/Rendezvous/Publish/Backend/0002775000175000017500000000000010366630163024456 5ustar richardcrichardcNet-Rendezvous-Publish-0.04/lib/Net/Rendezvous/Publish/Backend/Null.pm0000664000175000017500000000036710366630163025732 0ustar richardcrichardcpackage Net::Rendezvous::Publish::Backend::Null; sub new { warn "We won't be doing any rendezvous publishing, please install a Net::Rendezvous::Publish::Backend:: module\n"; bless {}; } sub publish {} sub publish_stop {} sub step {} 1; Net-Rendezvous-Publish-0.04/lib/Net/Rendezvous/Publish.pm0000664000175000017500000000532010366630163023463 0ustar richardcrichardcpackage Net::Rendezvous::Publish; use strict; use warnings; use Net::Rendezvous::Publish::Service; use Module::Pluggable search_path => [ "Net::Rendezvous::Publish::Backend" ], sub_name => 'backends'; use base qw( Class::Accessor::Lvalue ); __PACKAGE__->mk_accessors(qw( _backend _published )); our $VERSION = 0.04; sub new { my $class = shift; my %args = @_; my $self = $class->SUPER::new; my ($backend) = $args{backend} || (grep !/::Null$/, $self->backends)[0]; $backend ||= "Net::Rendezvous::Publish::Backend::Null"; eval "require $backend" or die $@; return unless $backend; $self->_backend = $backend->new or return; $self->_published = []; return $self; } sub publish { my $self = shift; my $service = Net::Rendezvous::Publish::Service->new; $service->_session = $self; $service->_handle = $self->_backend->publish( object => $service, @_ ) or return; return $service; } sub step { my $self = shift; $self->_backend->step( shift ); return $self; } 1; __END__ =head1 NAME Net::Rendezvous::Publish - publish Rendezvous services =head1 SYNOPSIS use Net::Rendezvous::Publish; my $publisher = Net::Rendezvous::Publish->new or die "couldn't make a Responder object"; my $service = $publisher->publish( name => "My HTTP Server", type => '_http._tcp', port => 12345, ); while (1) { $publisher->step( 0.01 ) } =head1 DESCRIPTION =head1 METHODS =head2 new Creates a new publisher handle =head2 publish( %definition ) Returns a Net::Rendezvous::Publish::Service object. The following keys are meaningful in the service definition hash. =over =item name A descriptive name for the service. =item type The type of service. This is string of the form _service._protocol. =item port The port on which you're advertising the service. If you're not using a port (and instead just using mDNS as a way of propogating other service information) it's common practice to use 9 (the discard service) =item domain The domain in which to advertise a service. Defaults to C =back =head2 step( $seconds ) Spend at most $seconds seconds handling network events and updating internal state. =head TODO At some point I may learn enough of the mDNS protocol to write a pure-perl responder. That'll be nifty. =head1 AUTHOR Richard Clamp =head1 COPYRIGHT Copyright 2004, 2005, 2006, Richard Clamp. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO L - for service browsing. L - you'll need one of these to talk to your local mDNS responder. =cut Net-Rendezvous-Publish-0.04/META.yml0000664000175000017500000000110010366630163017320 0ustar richardcrichardc--- name: Net-Rendezvous-Publish version: 0.04 author: - Richard Clamp abstract: publish Rendezvous services license: perl requires: Class::Accessor::Lvalue: 0 Module::Pluggable: 0 perl: 5.006 build_requires: Test::More: 0 provides: Net::Rendezvous::Publish: file: lib/Net/Rendezvous/Publish.pm version: 0.04 Net::Rendezvous::Publish::Backend::Null: file: lib/Net/Rendezvous/Publish/Backend/Null.pm Net::Rendezvous::Publish::Service: file: lib/Net/Rendezvous/Publish/Service.pm generated_by: Module::Build version 0.25 Net-Rendezvous-Publish-0.04/Changes0000664000175000017500000000055410366630163017356 0ustar richardcrichardc0.04 Saturday 28th January, 2005 Fix the automatic backend selection to never pick ::Null if there's a better one available (Tatsuhiko Miyagawa) 0.03 Friday 18th February, 2005 Fix the null backend 0.02 Friday 18th February, 2005 Add a Null backend, so we don't blow up if people didn't fricking install one. 0.01 February 21st, 2004 Initial CPAN release Net-Rendezvous-Publish-0.04/t/0002775000175000017500000000000010366630163016324 5ustar richardcrichardcNet-Rendezvous-Publish-0.04/t/simple.t0000664000175000017500000000013310366630163017775 0ustar richardcrichardc#!perl -w use strict; use Test::More tests => 1; require_ok( "Net::Rendezvous::Publish" );Net-Rendezvous-Publish-0.04/MANIFEST0000664000175000017500000000026710366630163017215 0ustar richardcrichardcMakefile.PL META.yml Build.PL Changes lib/Net/Rendezvous/Publish.pm lib/Net/Rendezvous/Publish/Service.pm lib/Net/Rendezvous/Publish/Backend/Null.pm MANIFEST MANIFEST.SKIP t/simple.t Net-Rendezvous-Publish-0.04/MANIFEST.SKIP0000664000175000017500000000026610366630163017761 0ustar richardcrichardcCVS/.* \.svn/.* \.cvsignore$ \.Inline/.* _Inline/.* \.bak$ \.tar$ \.tgz$ \.tar\.gz$ ~$ ^mess/ ^tmp/ ^testdata/ ^blib/ ^Makefile$ ^Makefile\.[a-z]+$ ^Build$ ^pm_to_blib$ ^_build/.* ~$Net-Rendezvous-Publish-0.04/Makefile.PL0000664000175000017500000000100510366630163020025 0ustar richardcrichardc# Note: this file was auto-generated by Module::Build::Compat version 0.03 use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'Net::Rendezvous::Publish', 'VERSION_FROM' => 'lib/Net/Rendezvous/Publish.pm', 'PREREQ_PM' => { 'Class::Accessor::Lvalue' => '0', 'Module::Pluggable' => '0', 'Test::More' => '0' }, 'INSTALLDIRS' => 'site', 'PL_FILES' => {} ) ; Net-Rendezvous-Publish-0.04/Build.PL0000664000175000017500000000057210366630163017357 0ustar richardcrichardcuse strict; use Module::Build; Module::Build->new( module_name => 'Net::Rendezvous::Publish', license => 'perl', requires => { 'perl' => 5.006, 'Module::Pluggable' => 0, 'Class::Accessor::Lvalue' => 0, }, build_requires => { 'Test::More' => 0, }, create_makefile_pl => 'traditional', )->create_build_script;