1 package System::Introspector::Gatherer;
4 use Object::Remote::Future;
5 use System::Introspector::Gatherer::Bridge;
6 use Module::Runtime qw( use_module );
8 has introspectors => (is => 'ro', required => 1);
13 alarm($ENV{SI_GATHER_TIMEOUT} || 60*60);
14 for my $spec (@{ $self->introspectors }) {
15 my ($base, $args) = @$spec;
16 $report{$base} = use_module("System::Introspector::Probe::$base")
24 my ($class, $remote, $args) = @_;
25 return $class->new::on($remote, $args || {});
29 my ($class, $bridge, $remote, $args) = @_;
30 return System::Introspector::Gatherer::Bridge->new::on($bridge,
31 remote_spec => $remote,
32 remote_class => $class,
33 remote_args => $args || {},
38 my ($class, %arg) = @_;
39 my ($user, $host, $sudo_user) = @arg{qw( user host sudo_user )};
40 my $sudo = defined($sudo_user) ? sprintf('%s@', $sudo_user) : undef;
41 my $args = { introspectors => $arg{introspectors} };
43 my $remote = join '@', grep defined, $user, $host;
44 if (defined $sudo_user) {
45 return $class->_new_bridged($remote, $sudo, $args);
48 return $class->_new_direct($remote, $args);
52 if (defined $sudo_user) {
53 return $class->_new_direct($sudo, $args);
56 return $class->new($args);