http://www.perlmonks.org?node_id=1041235


in reply to Re^3: using Net::OpenSSH in a MCE worker thread
in thread using Net::OpenSSH in a MCE worker thread

oops, there is a bug in that part of the code that causes it to fail silently (instead of failing with an error that tells you what has gone wrong).

Try replacing it by the following version:

sub _load_module { my ($module, $version) = @_; $loaded_module{$module} ||= do { do { local ($@, $SIG{__DIE__}); eval "require $module; 1" } or croak "unable to load Perl module $module"; 1 }; if (defined $version) { my $mv = do { local ($@, $SIG{__DIE__}); eval "\$${module}::VERSION" || 0; }; (my $mv1 = $mv) =~ s/_\d*$//; croak "$module version $version required, $mv is available" if $mv1 < $version; } 1 }

Replies are listed 'Best First'.
Re^5: using Net::OpenSSH in a MCE worker thread
by Andy16 (Acolyte) on Jun 28, 2013 at 12:26 UTC
    Hi salva - thats fast! :)

    tried, but with no success... Problem, MCE worker threads have no strout/stderr to use...

    I don't get the magic of that code, but if I preload IO::Pty it works.
    Your change was for a load having a version - and IP::Pty is loaded without version specified.

    to me it still points towards using signals while running in MCE....

    hope it helps
      Try tracing the program with strace (or your favorite OS equivalent) and check the last things it does before crashing (or post here the output).
        hi
        made it to stderr (my fault supressing it - sorry....)
        error msg is:
        unable to load Perl module IO::Pty

        not that surprising - but still funny that I can preload it.