From: Alexey M. <mo...@no...> - 2002-03-19 05:06:06
|
=F7 =F0=CE=C4, 18.03.2002, =D7 21:18, Austin Schutz =CE=C1=D0=C9=D3=C1=CC: > You would be able to do something like: > $new_expect =3D Expect->new(); > %{ *$new_expect } =3D %{ *$old_expect }; Looks like an ugly hack probably leading to memory leaks and unpredictable behaviour :-). My C++'ish past protests against things like this :-) > 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) =3D @_; > $new->exp_internal($old->exp_internal()); > ... > } sounds reasonable. May be it's time to add a 'clone' function to Expect? All 'shareable' settings are to be copied inside the func, and unique ones get re-created... Unfortunately I know too little about an Expect's object insides for the moment and probably can't say exactly whether 'clone' should allocate a new pty for each new instance etc... > 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(?). Hmm, looks like I just repeated your words before reading entire message :-)... Thank you and Roland a lot (but I can't see his mail in my box yet :-( ). Alexey Morozov |