From: Austin S. <te...@of...> - 2002-03-18 15:20:13
|
> I got a message here in logs telling that /dev/pts/7 which was used for > the first program interaction doesn't exist anymore (no such file or > directory) > > If I replace the second $expect->spawn with Expect->spawn the program > works Ok. Is there a way to skip creation of another Expect object, or > at least cloning settings from the first object to the second one? > You would be able to do something like: $new_expect = Expect->new(); %{ *$new_expect } = %{ *$old_expect }; except there are are a few variables you don't want to change, such as the name of the pty, etc. If there are a few settings in particular you are interested in setting it would probably be easiest to copy them before you destroy to old object, e.g.: sub copy_settings { my($old,$new) = @_; $new->exp_internal($old->exp_internal()); ... } $new = Expect->new(); copy_settings($old,$new); undef($old); As Roland says, we might want to make this a new sub in the Expect module. I'm not sure which items we'd want to have in there by default, e.g. terminal params(?). Austin |