in reply to Re^3: Remote Session Starting
in thread Remote Session Starting

If I get rid of the sleep the session goes away.
Erm, that wouldn't be because that's the end of the script, which would close the telnet session and disconnect the programs? Can't you just start your Win32::GuiTest code right where you now have the sleep?

update: IIRC, if you let the $session variable go out of scope (or otherwise overwrite it) that would close the session too. As far as I can see, you only have to make sure the $session variable (and with it, the session) is kept as is while you carry out whatever tasks you need.

update2: s/$telnet/$session/

Replies are listed 'Best First'.
Re^5: Remote Session Starting
by gman (Friar) on Feb 29, 2008 at 03:09 UTC
      The code that I am using id from that post.

      Unfortunately I am trying to modify its usage but am not doing a very good apparently as I need to keep the session variable in scope as joost points out.
        The nohup (from post http://www.perlmonks.org/?node_id=378036) application is responsible for disconnecting your X window/application from the parent tty. Allowing you to end your telnet and continue in the X application.
Re^5: Remote Session Starting
by Anonymous Monk on Feb 29, 2008 at 17:28 UTC
    I did try the WIn32::GUITest in place of the sleep but the session went away.

    Based on what you have said about keeping the session in scope is more than likely the probelm but I am not sure how to do this, a failing on my part to really understanding variable scoping.
      The very short (and incomplete) explanation is this:
      some_block_creating_statement_like_if_or_sub { my $session = ....; # do stuff with $session some_other_block { # $session is available here } # end of block } # $session will be out of scope here. # so it won't be available and if it's not passed to # some other variable that is available here it will # be gone, and the telnet session will be closed.
      See also perlfaq7's "What’s the difference between dynamic and lexical (static) scoping?"