8 use Data::Dump qw/dump/;
16 my ( $uri, $command, $path ) = @ARGV;
17 die "usage: $0 login:passwd\@host show /system1\n" unless $uri && $command;
19 my $ssh = Net::OpenSSH->new( $uri );
20 my ( $pty, $pid ) = $ssh->open2pty;
21 my $expect = Expect->init($pty);
23 $expect->log_user(1) if $debug;
25 $expect->expect( $timeout, '$' );
26 $expect->send( "smclp\n" );
28 $expect->expect( $timeout, '>' );
33 my ( $command, $path ) = @_;
35 warn "smclp $command $path\n" if $debug;
37 $expect->send( "$command $path\n" );
39 $expect->expect( $timeout, '>' );
41 my $got = $expect->before;
45 foreach ( split(/\r\n/, $got ) ) {
48 } elsif ( m{^\s{2}(\w+):} ) {
50 } elsif ( m{^\s{4}(.+)} ) {
51 if ( $section eq 'Properties' ) {
52 my ( $k, $v ) = split(/\s+=\s+/,$1,2);
53 $data->{$path}->{$section}->{$k} = $v;
55 push @{ $data->{$path}->{$section} }, $1;
58 print "# IGNORE [$_]\n" if $debug;
62 warn "# data = ",dump $data;
65 smclp $command => $path;