$data .= $self->cmd('some other command', undef, $output_ref); #### $data .= $self->cmd('command | grep string | last 3', undef, $output_ref); #### $data .= $self->cmd('runthis', undef, $output_ref); #### sub smart_cmd { my($self,$cmd,@args) = @_; return $self->show_mem if ($cmd =~ /^\s*show mem/); return $self->show_cfg if ($cmd =~ /^\s*show (conf|run)/); return $self->show_start if ($cmd =~ /^\s*show start/); return $self->set_pass($1,$2) if ($cmd =~ /^\s*set pass\S*\s+(\S+)\s+(\S+)/); return $self->set_enablepass($1,$2) if ($cmd =~ /^\s*set enablepass\S*\s+(\S+)\s+(\S+)/); my($data,$match,$remainder) = $self->cmd($cmd,@args); return (wantarray)?($data,$match,$remainder):$data; } =head2 cmd(); $data = $host->cmd($cmd); ($data,$matched_prompt) = $host->cmd($cmd,$prompt);