r10956 - in /branches/upstream/libnet-rendezvous-publish-perl: ./ current/ current/lib/ current/lib/Net/ current/lib/Net/Rendezvous/ current/lib/Net/Rendezvous/Publish/ current/lib/Net/Rendezvous/Publish/Backend/ current/t/

ghostbar-guest at users.alioth.debian.org ghostbar-guest at users.alioth.debian.org
Fri Dec 7 03:12:37 UTC 2007


Author: ghostbar-guest
Date: Fri Dec  7 03:12:37 2007
New Revision: 10956

URL: http://svn.debian.org/wsvn/?sc=1&rev=10956
Log:
[svn-inject] Installing original source of libnet-rendezvous-publish-perl

Added:
    branches/upstream/libnet-rendezvous-publish-perl/
    branches/upstream/libnet-rendezvous-publish-perl/current/
    branches/upstream/libnet-rendezvous-publish-perl/current/Build.PL
    branches/upstream/libnet-rendezvous-publish-perl/current/Changes
    branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST
    branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST.SKIP
    branches/upstream/libnet-rendezvous-publish-perl/current/META.yml
    branches/upstream/libnet-rendezvous-publish-perl/current/Makefile.PL
    branches/upstream/libnet-rendezvous-publish-perl/current/lib/
    branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/
    branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/
    branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/
    branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish.pm
    branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Backend/
    branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Backend/Null.pm
    branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Service.pm
    branches/upstream/libnet-rendezvous-publish-perl/current/t/
    branches/upstream/libnet-rendezvous-publish-perl/current/t/simple.t

Added: branches/upstream/libnet-rendezvous-publish-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/Build.PL?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/Build.PL (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/Build.PL Fri Dec  7 03:12:37 2007
@@ -1,0 +1,15 @@
+use 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;

Added: branches/upstream/libnet-rendezvous-publish-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/Changes?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/Changes (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/Changes Fri Dec  7 03:12:37 2007
@@ -1,0 +1,13 @@
+0.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

Added: branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST Fri Dec  7 03:12:37 2007
@@ -1,0 +1,10 @@
+Makefile.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

Added: branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST.SKIP?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/MANIFEST.SKIP Fri Dec  7 03:12:37 2007
@@ -1,0 +1,20 @@
+CVS/.*
+\.svn/.*
+\.cvsignore$
+\.Inline/.*
+_Inline/.*
+\.bak$
+\.tar$
+\.tgz$
+\.tar\.gz$
+~$
+^mess/
+^tmp/
+^testdata/
+^blib/
+^Makefile$
+^Makefile\.[a-z]+$
+^Build$
+^pm_to_blib$
+^_build/.*
+~$

Added: branches/upstream/libnet-rendezvous-publish-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/META.yml?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/META.yml (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/META.yml Fri Dec  7 03:12:37 2007
@@ -1,0 +1,22 @@
+---
+name: Net-Rendezvous-Publish
+version: 0.04
+author:
+  - Richard Clamp <richardc at unixbeard.net>
+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

Added: branches/upstream/libnet-rendezvous-publish-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/Makefile.PL?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/Makefile.PL (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/Makefile.PL Fri Dec  7 03:12:37 2007
@@ -1,0 +1,15 @@
+# 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' => {}
+        )
+;

Added: branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish.pm?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish.pm (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish.pm Fri Dec  7 03:12:37 2007
@@ -1,0 +1,132 @@
+package 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<local.>
+
+=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 <richardc at unixbeard.net>
+
+=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<Net::Rendezous> - for service browsing.
+
+L<Net::Rendezvous::Publish::Backend::*> - you'll need one of these to talk
+to your local mDNS responder.
+
+=cut

Added: branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Backend/Null.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Backend/Null.pm?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Backend/Null.pm (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Backend/Null.pm Fri Dec  7 03:12:37 2007
@@ -1,0 +1,12 @@
+package 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;

Added: branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Service.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Service.pm?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Service.pm (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/lib/Net/Rendezvous/Publish/Service.pm Fri Dec  7 03:12:37 2007
@@ -1,0 +1,73 @@
+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 ));
+
+=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 <richardc at unixbeard.net>
+
+=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
+

Added: branches/upstream/libnet-rendezvous-publish-perl/current/t/simple.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rendezvous-publish-perl/current/t/simple.t?rev=10956&op=file
==============================================================================
--- branches/upstream/libnet-rendezvous-publish-perl/current/t/simple.t (added)
+++ branches/upstream/libnet-rendezvous-publish-perl/current/t/simple.t Fri Dec  7 03:12:37 2007
@@ -1,0 +1,5 @@
+#!perl -w
+use strict;
+use Test::More tests => 1;
+
+require_ok( "Net::Rendezvous::Publish" );




More information about the Pkg-perl-cvs-commits mailing list