in reply to Perl Expect module

Hi, I'm trying to write a script using the Perl Expect module and I have problems getting it to work :(
Great, now where is your code?
Is there someone that can give me a simple example for using the expect module and creating a new dtterm where I want som basic commands to execute for example 'ls -altr' ?
The documentation already provides examples. If they're not enough, you should think about hiring somebody to write this program for you.

Replies are listed 'Best First'.
Re: Re: Perl Expect module
by markd (Acolyte) on Nov 19, 2003 at 16:31 UTC
    I think that was a pretty arrogant and ignorant remark from the anonymous monk that replied to your last query. Perhaps if he doesn't have anything to offer he shouldn't offer anything at all. Heres an example of perl using expect (hope this helps):
    #!/usr/bin/perl use strict; use Expect; my $session = new Expect; $session->spawn("/usr/bin/bash"); print $session "cd \/home\/homedir\r"; $session->expect(90, -re, "bash"); print $session "ls -altr\r"; my @array = $session->expect(60, -re, "bash"); $session->clear_accum; my @array1 = split('\n', $array[3]); for (my $i = 0; $i <= $#array1; $i++) { print "\nElement $i is\n$array1[$i]\n"; }

    Edit: BazB, added code tags.