fatnode ships required core non-arch and non-core perl module files
[scpubgit/Object-Remote.git] / lib / Object / Remote / FatNode.pm
index d76a21d..bddebb8 100644 (file)
@@ -4,6 +4,9 @@ use strictures 1;
 use Config;
 use B qw(perlstring);
 
+#used by t/watchdog_fatnode 
+our $INHIBIT_RUN_NODE = 0; 
+
 sub stripspace {
   my ($text) = @_;
   $text =~ /^(\s+)/ && $text =~ s/^$1//mg;
@@ -40,17 +43,22 @@ chomp(my @inc = qx($command));
 
 my %mods = reverse @inc;
 
-my @non_core_non_arch = grep +(
+my @non_core = grep +(
   not (
     /^\Q$Config{privlibexp}/ or /^\Q$Config{archlibexp}/
-    or /^\Q$Config{vendorarchexp}/ or /^\Q$Config{sitearchexp}/
   )
 ), keys %mods;
 
 my @core_non_arch = grep +(
   /^\Q$Config{privlibexp}/
-  and not(/^\Q$Config{archlibexp}/ or /\Q$Config{archname}/ or /\Q$Config{myarchname}/)
-), keys %mods;
+), grep !/\Q$Config{archname}/, grep !/\Q$Config{myarchname}/, keys %mods;
+
+my $env_pass = '';
+if (defined($ENV{OBJECT_REMOTE_LOG_LEVEL})) {
+  my $level = $ENV{OBJECT_REMOTE_LOG_LEVEL};
+  return unless $level =~ /^\w+$/;
+  $env_pass = '$ENV{OBJECT_REMOTE_LOG_LEVEL} = "' . $level . "\";\n";
+}
 
 my $start = stripspace <<'END_START';
   # This chunk of stuff was generated by Object::Remote::FatNode. To find
@@ -79,11 +87,15 @@ my $end = stripspace <<'END_END';
 
   use strictures 1;
   use Object::Remote::Node;
-  Object::Remote::Node->run;
+  
+  unless ($Object::Remote::FatNode::INHIBIT_RUN_NODE) {
+    Object::Remote::Node->run(watchdog_timeout => $WATCHDOG_TIMEOUT);    
+  }
+  
 END_END
 
 my %files = map +($mods{$_} => scalar do { local (@ARGV, $/) = ($_); <> }),
-              @non_core_non_arch, @core_non_arch;
+              @non_core, @core_non_arch;
 
 sub generate_fatpack_hash {
   my ($hash_name, $orig) = @_;
@@ -95,10 +107,10 @@ sub generate_fatpack_hash {
 }
 
 my @segments = (
-    map(generate_fatpack_hash('fatpacked', $_), sort map $mods{$_}, @non_core_non_arch),
-    map(generate_fatpack_hash('fatpacked_extra', $_), sort map $mods{$_}, @core_non_arch),
+  map(generate_fatpack_hash('fatpacked', $_), sort map $mods{$_}, @non_core),
+  map(generate_fatpack_hash('fatpacked_extra', $_), sort map $mods{$_}, @core_non_arch),
 );
 
-our $DATA = join "\n", $start, @segments, $end;
+our $DATA = join "\n", $start, $env_pass, @segments, $end;
 
 1;