The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
CHANGES 042
META.yml 33
Makefile.PL 33
README 214
README.mkdn 214
dist.ini 11
lib/POE/Component/Resolver/Sidecar.pm 33
lib/POE/Component/Resolver.pm 1737
t/01-basic.t 45
9 files changed (This is a version diff) 35122
@@ -1,4 +1,46 @@
 ================================
+2011-07-30 04:02:15 -0400 v0_913
+================================
+
+  commit b2d2af51183d837e5e98d7cf0324ea9429ef54dc
+  Author: Rocco Caputo <rcaputo@cpan.org>
+  Date:   Sat Jul 30 04:02:15 2011 -0400
+  
+    Bump the release version.
+
+  commit 82af41c8ab2dd061acd7deb9979fa6cb5c4725ae
+  Author: Rocco Caputo <rcaputo@cpan.org>
+  Date:   Sat Jul 30 03:49:09 2011 -0400
+  
+    Allow developers to use sidecar-based modules with PAR and other
+    packagers.
+
+    Applied a modified versin of a patch from Markus Jansen at Ericsson.
+    It adds a parameter to POE::Component::Resolver so the developer can
+    point to a custom sidecar program. That program can be bundld in PAR
+    using special techniques. Thanks also go to Steffen Mueller and
+    Roderich Schupp, who helped design the patch.
+
+  commit f0d9d4484e3a3400c7b9ca6b712882e0e20a04d6
+  Author: Rocco Caputo <rcaputo@cpan.org>
+  Date:   Fri Jul 29 08:59:32 2011 -0400
+  
+    Use port 80 rather than string "http" on Solaris.
+
+    Chris Williams discovered tests would fail on Solaris with "service
+    name not available for the specified socket type". It turns out they
+    don't list "http" in /etc/services.
+
+  commit 638cd9e616a5b4ffbf413672784f41896de97430
+  Author: Rocco Caputo <rcaputo@cpan.org>
+  Date:   Fri Jul 29 00:44:00 2011 -0400
+  
+    Load the POE::Component::Resolver::Sidecar class.
+
+    The presence of this module is requested on MSWin32. Resolves
+    rt.cpan.org ticket 69172, reported by Gabor Szabo. 
+
+================================
 2011-05-03 22:38:41 -0400 v0_912
 ================================
 
@@ -4,9 +4,9 @@ author:
   - 'Rocco Caputo <rcaputo@cpan.org>'
 build_requires: {}
 configure_requires:
-  ExtUtils::MakeMaker: 6.31
+  ExtUtils::MakeMaker: 6.30
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.200004, CPAN::Meta::Converter version 2.102400'
+generated_by: 'Dist::Zilla version 4.200011, CPAN::Meta::Converter version 2.102400'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -21,4 +21,4 @@ requires:
   Time::HiRes: 1.9711
 resources:
   repository: git://github.com/rcaputo/poe-component-resolver.git
-version: 0.912
+version: 0.913
@@ -4,7 +4,7 @@ use warnings;
 
 
 
-use ExtUtils::MakeMaker 6.31;
+use ExtUtils::MakeMaker 6.30;
 
 
 
@@ -13,7 +13,7 @@ my %WriteMakefileArgs = (
   'AUTHOR' => 'Rocco Caputo <rcaputo@cpan.org>',
   'BUILD_REQUIRES' => {},
   'CONFIGURE_REQUIRES' => {
-    'ExtUtils::MakeMaker' => '6.31'
+    'ExtUtils::MakeMaker' => '6.30'
   },
   'DISTNAME' => 'POE-Component-Resolver',
   'EXE_FILES' => [],
@@ -27,7 +27,7 @@ my %WriteMakefileArgs = (
     'Test::More' => '0.96',
     'Time::HiRes' => '1.9711'
   },
-  'VERSION' => '0.912',
+  'VERSION' => '0.913',
   'test' => {
     'TESTS' => 't/*.t'
   }
@@ -2,7 +2,7 @@ NAME
     POE::Component::Resolver - A non-blocking getaddrinfo() resolver
 
 VERSION
-    version 0.912
+    version 0.913
 
 SYNOPSIS
             #!/usr/bin/perl
@@ -17,6 +17,7 @@ SYNOPSIS
                     max_resolvers => 8,
                     idle_timeout  => 5,
                     af_order      => [ AF_INET6, AF_INET ],
+                    # sidecar_program => $path_to_program,
             );
 
             my @hosts = qw( ipv6-test.com );
@@ -66,7 +67,7 @@ DESCRIPTION
     Create a new resolver. Returns an object that must be held and used to
     make requests. See the synopsis.
 
-    Accepts up to two optional named parameters.
+    Accepts up to four optional named parameters.
 
     "af_order" may contain an arrayref with the address families to permit,
     in the order in which they're preferred. Without "af_order", the
@@ -94,6 +95,17 @@ DESCRIPTION
             # One at a time, but without the pesky blocking.
             my $r3 = POE::Component::Resolver->new( max_resolvers => 1 );
 
+    "sidecar_program" contains the disk location of a program that will
+    perform blocking lookups on standard input and print the results on
+    standard output. The sidecar program is needed only in special
+    environments where the bundling and execution of extra utilities is
+    tricky. PAR is one such environment.
+
+    The sidecar program needs to contain at least two statements:
+
+            use POE::Component::Resolver::Sidecar;
+            POE::Component::Resover::Sidecar->main();
+
    resolve
     resolve() begins a new request to resolve a domain. The request will be
     enqueued in the component until a sidecar process can service it.
@@ -4,7 +4,7 @@ POE::Component::Resolver - A non-blocking getaddrinfo() resolver
 
 # VERSION
 
-version 0.912
+version 0.913
 
 # SYNOPSIS
 
@@ -20,6 +20,7 @@ version 0.912
 		max_resolvers => 8,
 		idle_timeout  => 5,
 		af_order      => [ AF_INET6, AF_INET ],
+		# sidecar_program => $path_to_program,
 	);
 
 	my @hosts = qw( ipv6-test.com );
@@ -72,7 +73,7 @@ can be overridden with constructor parameters.
 Create a new resolver.  Returns an object that must be held and used
 to make requests.  See the synopsis.
 
-Accepts up to two optional named parameters.
+Accepts up to four optional named parameters.
 
 "af_order" may contain an arrayref with the address families to
 permit, in the order in which they're preferred.  Without "af_order",
@@ -100,6 +101,17 @@ you have available and the amount of parallelism you require.
 	# One at a time, but without the pesky blocking.
 	my $r3 = POE::Component::Resolver->new( max_resolvers => 1 );
 
+"sidecar_program" contains the disk location of a program that will
+perform blocking lookups on standard input and print the results on
+standard output.  The sidecar program is needed only in special
+environments where the bundling and execution of extra utilities is
+tricky.  PAR is one such environment.
+
+The sidecar program needs to contain at least two statements:
+
+	use POE::Component::Resolver::Sidecar;
+	POE::Component::Resover::Sidecar->main();
+
 ### resolve
 
 resolve() begins a new request to resolve a domain.  The request will
@@ -1,5 +1,5 @@
 name              = POE-Component-Resolver
-version           = 0.912
+version           = 0.913
 author            = Rocco Caputo <rcaputo@cpan.org>
 license           = Perl_5
 copyright_holder  = Rocco Caputo
@@ -1,6 +1,6 @@
 package POE::Component::Resolver::Sidecar;
 BEGIN {
-  $POE::Component::Resolver::Sidecar::VERSION = '0.912';
+  $POE::Component::Resolver::Sidecar::VERSION = '0.913';
 }
 
 use warnings;
@@ -60,7 +60,7 @@ POE::Component::Resolver::Sidecar - delegate subprocess to call getaddrinfo()
 
 =head1 VERSION
 
-version 0.912
+version 0.913
 
 =head1 SYNOPSIS
 
@@ -104,4 +104,4 @@ Rocco Caputo.  All rights reserved.  This distribution is free
 software; you may redistribute it and/or modify it under the same
 terms as Perl itself.
 
-=cut
\ No newline at end of file
+=cut
@@ -1,6 +1,6 @@
 package POE::Component::Resolver;
 BEGIN {
-  $POE::Component::Resolver::VERSION = '0.912';
+  $POE::Component::Resolver::VERSION = '0.913';
 }
 
 use warnings;
@@ -12,6 +12,8 @@ use Time::HiRes qw(time);
 use Socket qw(unpack_sockaddr_in AF_INET AF_INET6);
 use Socket::GetAddrInfo qw(:newapi getnameinfo NI_NUMERICHOST NI_NUMERICSERV);
 
+use POE::Component::Resolver::Sidecar;
+
 use Exporter;
 use base 'Exporter';
 our (@EXPORT_OK) = qw(AF_INET AF_INET6);
@@ -24,8 +26,9 @@ sub new {
 	croak "new() requires an even number of parameters" if @args % 2;
 	my %args = @args;
 
-	my $max_resolvers = delete($args{max_resolvers}) || 8;
-	my $idle_timeout  = delete($args{idle_timeout})  || 15;
+	my $max_resolvers   = delete($args{max_resolvers}) || 8;
+	my $idle_timeout    = delete($args{idle_timeout})  || 15;
+	my $sidecar_program = delete($args{sidecar_program});
 
 	my $af_order = delete($args{af_order});
 	if (defined $af_order and @$af_order) {
@@ -48,6 +51,20 @@ sub new {
 	my @error = sort keys %args;
 	croak "unknown new() parameter(s): @error" if @error;
 
+	unless (defined $sidecar_program and length $sidecar_program) {
+		if ($^O eq "MSWin32") {
+			$sidecar_program = \&POE::Component::Resolver::Sidecar::main;
+		}
+		else {
+			$sidecar_program = [
+				$^X,
+				(map { "-I$_" } @INC),
+				'-MPOE::Component::Resolver::Sidecar',
+				'-e', 'POE::Component::Resolver::Sidecar->main()'
+			];
+		}
+	}
+
 	my $self = bless { }, $class;
 
 	POE::Session->create(
@@ -73,6 +90,7 @@ sub new {
 			max_resolvers   => $max_resolvers,
 			requests        => { },
 			sidecar_ring    => [ ],
+			sidecar_program => $sidecar_program,
 		}
 	);
 
@@ -192,17 +210,7 @@ sub _poe_setup_sidecar_ring {
 			StdoutEvent  => 'sidecar_response',
 			StderrEvent  => 'sidecar_error',
 			CloseEvent   => 'sidecar_closed',
-			Program      => (
-				($^O eq "MSWin32")
-				? \&POE::Component::Resolver::Sidecar::main
-				: [
-					$^X,
-					(map { "-I$_" } @INC),
-					'-MPOE::Component::Resolver::Sidecar',
-					'-e',
-					'POE::Component::Resolver::Sidecar->main()'
-				]
-			),
+			Program      => $heap->{sidecar_program},
 		);
 
 		$heap->{sidecar}{$sidecar->PID}   = $sidecar;
@@ -428,7 +436,7 @@ POE::Component::Resolver - A non-blocking getaddrinfo() resolver
 
 =head1 VERSION
 
-version 0.912
+version 0.913
 
 =head1 SYNOPSIS
 
@@ -444,6 +452,7 @@ version 0.912
 		max_resolvers => 8,
 		idle_timeout  => 5,
 		af_order      => [ AF_INET6, AF_INET ],
+		# sidecar_program => $path_to_program,
 	);
 
 	my @hosts = qw( ipv6-test.com );
@@ -496,7 +505,7 @@ can be overridden with constructor parameters.
 Create a new resolver.  Returns an object that must be held and used
 to make requests.  See the synopsis.
 
-Accepts up to two optional named parameters.
+Accepts up to four optional named parameters.
 
 "af_order" may contain an arrayref with the address families to
 permit, in the order in which they're preferred.  Without "af_order",
@@ -524,6 +533,17 @@ you have available and the amount of parallelism you require.
 	# One at a time, but without the pesky blocking.
 	my $r3 = POE::Component::Resolver->new( max_resolvers => 1 );
 
+"sidecar_program" contains the disk location of a program that will
+perform blocking lookups on standard input and print the results on
+standard output.  The sidecar program is needed only in special
+environments where the bundling and execution of extra utilities is
+tricky.  PAR is one such environment.
+
+The sidecar program needs to contain at least two statements:
+
+	use POE::Component::Resolver::Sidecar;
+	POE::Component::Resover::Sidecar->main();
+
 =head3 resolve
 
 resolve() begins a new request to resolve a domain.  The request will
@@ -674,4 +694,4 @@ Rocco Caputo.  All rights reserved.  This distribution is free
 software; you may redistribute it and/or modify it under the same
 terms as Perl itself.
 
-=cut
\ No newline at end of file
+=cut
@@ -53,13 +53,14 @@ if ($has_ipv6) {
 
 my $host = 'ipv6-test.com';
 my $tcp  = getprotobyname("tcp");
+my $service = $^O eq 'solaris' ? 80 : 'http';
 
 POE::Session->create(
 	inline_states => {
 		_start => sub {
 			$r4->resolve(
 				host    => $host,
-				service => 'http',
+				service => $service,,
 				hints   => { protocol => $tcp },
 				misc    => [ AF_INET ],
 			) or die $!;
@@ -69,21 +70,21 @@ POE::Session->create(
 
 				$r6->resolve(
 					host    => $host,
-					service => 'http',
+					service => $service,
 					hints   => { protocol => $tcp },
 					misc    => [ AF_INET6 ],
 				) or die $!;
 
 				$r46->resolve(
 					host    => $host,
-					service => 'http',
+					service => $service,
 					hints   => { protocol => $tcp },
 					misc    => [ AF_INET, AF_INET6 ],
 				) or die $!;
 
 				$r64->resolve(
 					host    => $host,
-					service => 'http',
+					service => $service,
 					hints   => { protocol => $tcp },
 					misc    => [ AF_INET6, AF_INET ],
 				) or die $!;