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 for my $spec (@{ $self->introspectors }) {
14 my ($base, $args) = @$spec;
15 $report{$base} = use_module("System::Introspector::Probe::$base")
23 my ($class, $remote, $args) = @_;
24 return $class->new::on($remote, $args || {});
28 my ($class, $bridge, $remote, $args) = @_;
29 return System::Introspector::Gatherer::Bridge->new::on($bridge,
30 remote_spec => $remote,
31 remote_class => $class,
32 remote_args => $args || {},
37 my ($class, %arg) = @_;
38 my ($user, $host, $sudo_user) = @arg{qw( user host sudo_user )};
39 my $sudo = defined($sudo_user) ? sprintf('%s@', $sudo_user) : undef;
40 my $args = { introspectors => $arg{introspectors} };
42 my $remote = join '@', grep defined, $user, $host;
43 if (defined $sudo_user) {
44 return $class->_new_bridged($remote, $sudo, $args);
47 return $class->_new_direct($remote, $args);
51 if (defined $sudo_user) {
52 return $class->_new_direct($sudo, $args);
55 return $class->new($args);