AOLserver-CtrlPort

 view release on metacpan or  search on metacpan

lib/AOLserver/CtrlPort.pm  view on Meta::CPAN

    my $t = Net::Telnet->new(%options);

    DEBUG("Connecting to port=$options{Host}:$options{Port}");
    $t->open();

    my $self = { telnet => $t,
               };

    $t->login("", "");

    DEBUG("Waiting for prompt");
    $t->waitfor();

    bless $self, $class;
}

=item $conn->send_cmds("$cmd1\ncmd2\n...")

Send one or more commands, separated by newlines, AOLserver's
control port. The method will return the server's response as a string.
Typically, this will look like

lib/AOLserver/CtrlPort.pm  view on Meta::CPAN

sub send_cmds {
############################################################
    my ($self, $lines) = @_;

    my $output = "";
    my $line_output;

    for (split "\n", $lines) {
        DEBUG("Send: [$_]");
        $line_output = join "", $self->{telnet}->cmd("$_");
        # Last line is the prompt, scrap it
        $line_output =~ s/^.*\Z//m;
        DEBUG("Recv: [$line_output]");
        $output .= $line_output;
    }

    return $output;
}

1;



( run in 0.728 second using v1.01-cache-2.11-cpan-6aa56a78535 )