Merge branch 'devel' of h1dev:/srv/APKPM/
[APKPM.git] / lib / H1 / ZTE.pm
old mode 100755 (executable)
new mode 100644 (file)
index 2615ba3..9b423b9
@@ -35,7 +35,7 @@ sub telnet {
        return $telnet->{$ip} = $t;
 }
 
-sub command {
+sub command_out {
        my ($self,$command) = @_;
 
        my $t = $self->telnet;
@@ -53,6 +53,12 @@ sub command {
 
        warn "## out = [$out]" if $ENV{DEBUG};
 
+       return $out;
+}
+
+sub command {
+       my ($self,$command) = @_;
+       my $out  = $self->command_out( $command );
        my $hash = $self->parse( $out );
 
        warn "## ", $self->ip, " $command ",dump $hash;
@@ -84,6 +90,11 @@ sub hash {
                copy ref $commands->{$command} eq 'ARRAY' ? @{$commands->{$command}} : undef;
        }
 
+       if ( $self->can('custom') ) {
+               $hash = $self->custom( $port );
+               copy keys %$hash;
+       }
+
        warn "# row = ",dump $row if $ENV{DEBUG};
 
        $row = $self->fixup_row( $row ) if $self->can('fixup_row');
@@ -96,7 +107,8 @@ sub hash {
 sub logout {
        my $self = shift;
        my $ip = $self->ip;
-       my $t = delete $telnet->{$ip} || return;
+       my $t = delete $telnet->{$ip};
+       return unless $t;
 #      die "no $ip telnet in ",dump($telnet) unless $t;
 
        warn "logout $ip";
@@ -110,7 +122,7 @@ sub logout {
 
 sub DESTROY {
        my $self = shift;
-       warn "# DESTROY telnet = ",dump( keys %$telnet );
+#      warn "# DESTROY telnet = ",dump( keys %$telnet );
        $self->logout($_) foreach keys %$telnet;
 }