Permalink
Browse files

Resolve a runaway fork when running in EmbedPerl.

Sjors Gielen reported a runaway fork in irc.perl.org #poe.  $^X is not
always a path to the perl binary.  Resolved by using Configure's
notion of perlpath and _exe, per Sjors' recommendation and discussion
of $^X in perlvar.
  • Loading branch information...
1 parent b2d2af5 commit e4f3fb11df5d5bf43a1445edc498cb4ee75839ae @rcaputo committed Sep 15, 2011
Showing with 12 additions and 2 deletions.
  1. +1 −1 dist.ini
  2. +11 −1 lib/POE/Component/Resolver.pm
View
@@ -1,5 +1,5 @@
name = POE-Component-Resolver
-version = 0.913
+version = 0.914
author = Rocco Caputo <rcaputo@cpan.org>
license = Perl_5
copyright_holder = Rocco Caputo
@@ -15,6 +15,16 @@ use Exporter;
use base 'Exporter';
our (@EXPORT_OK) = qw(AF_INET AF_INET6);
+# Determine Perl's location, per perldoc perlvar's treatment of $^X.
+
+use Config;
+my $perl_path = $Config{perlpath};
+if ($^O ne 'VMS') {
+ $perl_path .= $Config{_exe} unless (
+ $perl_path =~ /$Config{_exe}$/i
+ );
+}
+
# Plain Perl constructor.
sub new {
@@ -54,7 +64,7 @@ sub new {
}
else {
$sidecar_program = [
- $^X,
+ $perl_path,
(map { "-I$_" } @INC),
'-MPOE::Component::Resolver::Sidecar',
'-e', 'POE::Component::Resolver::Sidecar->main()'

0 comments on commit e4f3fb1

Please sign in to comment.