From: Sascha G. (02838) <Sas...@al...> - 2003-04-22 12:21:23
|
I am using Expect-1.15 and IO-Tty-1.02 on Sun Solaris 2.6 A little code: #!/tools/perl-5.6.0.sol26/bin/perl #use strict; $^W = 1; # warnings too use Expect; #$Expect::Exp_Internal = 1; #$Expect::Debug = 1; &start; $mtnm->hard_close(); exit(0); sub start { $mtnm = Expect->spawn("csteMTNM -c"); $mtnm->raw_pty(1); $mtnm->log_file("rmtest.log", "w"); $mtnm->expect(30, "STARTUP FINISHED\r\n"); } What's wrong? |
From: John M. <ex...@h0...> - 2003-04-22 12:40:32
|
On Tue, Apr 22, 2003 at 02:21:09PM +0200, Sascha Gagalon (02838) wrote: > I am using Expect-1.15 and IO-Tty-1.02 on Sun Solaris 2.6 > > A little code: > > #!/tools/perl-5.6.0.sol26/bin/perl > > #use strict; > $^W = 1; # warnings too > > > use Expect; > #$Expect::Exp_Internal = 1; > #$Expect::Debug = 1; > > > &start; > $mtnm->hard_close(); > exit(0); > > > > sub start > { > $mtnm = Expect->spawn("csteMTNM -c"); > $mtnm->raw_pty(1); > $mtnm->log_file("rmtest.log", "w"); > $mtnm->expect(30, "STARTUP FINISHED\r\n"); > } > > > What's wrong? > I believe that you need to place $mtnm->raw_pty(1); BEFORE $mtnm = Expect->spawn("csteMTNM -c"); At least my notes tell that I must set pty to raw mode before spawning... -- John Mahoney <ex...@h0...> |
From: Chris S. <cas...@pe...> - 2003-04-22 12:59:01
|
You might find that "$mtnm = new Expect;" will do wonders for providing an object upon which to call methods such as 'raw_pty();' God bless, Chris At 08:39 AM 4/22/2003 -0400, John Mahoney wrote: >On Tue, Apr 22, 2003 at 02:21:09PM +0200, Sascha Gagalon (02838) wrote: >> I am using Expect-1.15 and IO-Tty-1.02 on Sun Solaris 2.6 >> >> A little code: >> >> #!/tools/perl-5.6.0.sol26/bin/perl >> >> #use strict; >> $^W = 1; # warnings too >> >> >> use Expect; >> #$Expect::Exp_Internal = 1; >> #$Expect::Debug = 1; >> >> >> &start; >> $mtnm->hard_close(); >> exit(0); >> >> >> >> sub start >> { >> $mtnm = Expect->spawn("csteMTNM -c"); >> $mtnm->raw_pty(1); >> $mtnm->log_file("rmtest.log", "w"); >> $mtnm->expect(30, "STARTUP FINISHED\r\n"); >> } >> >> >> What's wrong? >> > >I believe that you need to place > $mtnm->raw_pty(1); >BEFORE > $mtnm = Expect->spawn("csteMTNM -c"); > >At least my notes tell that I must set pty to raw mode >before spawning... > >-- >John Mahoney <ex...@h0...> > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Expectperl-discuss mailing list >Exp...@li... >https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Sascha G. (02838) <Sas...@al...> - 2003-04-22 12:55:00
|
thx, my fault. now it looks like that: #!/tools/perl-5.6.0.sol26/bin/perl #use strict; $^W = 1; # warnings too use Expect; #$Expect::Exp_Internal = 1; #$Expect::Debug = 1; &start; $mtnm->hard_close(); exit(0); sub start { $mtnm = new Expect; $mtnm->raw_pty(1); $mtnm->spawn("csteMTNM -c"); $mtnm->log_file("rmtest.log", "w"); $mtnm->expect(30, "STARTUP FINISHED\r\n"); } and the error message tells me: ERROR: cannot find method `raw_pty' in class Expect at ./rmtest.pl line 25 Cannot exec `': |
From: Chris S. <cas...@pe...> - 2003-04-22 13:19:49
|
A copy and paste of your code, replacing the: $mtnm->spawn("csteMTNM -c"); with: $mtnm->spawn("ls"); seems to indicate success. Are you sure your Expect install is kosher? Chris At 02:54 PM 4/22/2003 +0200, Sascha Gagalon (02838) wrote: >thx, my fault. > >now it looks like that: > >#!/tools/perl-5.6.0.sol26/bin/perl > >#use strict; >$^W = 1; # warnings too > > >use Expect; >#$Expect::Exp_Internal = 1; >#$Expect::Debug = 1; > > >&start; >$mtnm->hard_close(); >exit(0); > > > >sub start >{ > $mtnm = new Expect; > $mtnm->raw_pty(1); > $mtnm->spawn("csteMTNM -c"); > $mtnm->log_file("rmtest.log", "w"); > $mtnm->expect(30, "STARTUP FINISHED\r\n"); >} > > >and the error message tells me: > >ERROR: cannot find method `raw_pty' in class Expect at ./rmtest.pl line 25 > >Cannot exec `': > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Expectperl-discuss mailing list >Exp...@li... >https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Sascha G. (02838) <Sas...@al...> - 2003-04-22 13:37:14
|
Chris Snyder wrote: > A copy and paste of your code, replacing the: > $mtnm->spawn("csteMTNM -c"); > with: > $mtnm->spawn("ls"); > seems to indicate success. > > Are you sure your Expect install is kosher? > Chris I did not install Expect cause i have no root privilegs. I use it locally but the test.pl and also my script worked until now. If i modify my code this way: sub start { $mtnm = new Expect; # $mtnm->raw_pty(1); $mtnm->spawn("csteMTNM -c"); $mtnm->log_file("rmtest.log", "w"); $mtnm->expect(30, "STARTUP FINISHED\r\n"); } I get the following error message: Can't locate object method "_init_vars" via package "Expect=GLOB(0x109088)" at /tools/perl-5.6.0/lib/site_perl/5.6.0/Expect.pm line 93. Cannot exec `': Maybe it is all about the Expect installation like you mentioned. I think it is weired that $var = new Expect; $var->spawn("ls"); does not work but $var = Expect->spawn("ls); does work for me. |