Hi

I have a perl executable which recurses a filesystem using File::Find now I want to implement a pause and resume functionality such that the exe pauses in current state(or preserves current position) is some key is pressed or some other exe tells it to pause and then resume when key is pressed again or other exe tells to resume:

I thought of two approaches: 1.Remember the current file being recursed in a output file . Now this output file will give the last file traversed if we stop the program and restart it . But I cannot recurse from that file (I can skip all file till that file but that would take a lot of time and would not really be like a pause)to resume the recursion.

2. Maintain a second exe which calls some function to pause the state of the main exe and then resume again through the second exe. But how can I do it?? Please help??

Now I was having a look at Win32::Process and tried the following code ::

use Win32::Process; use Win32; sub ErrorReport { print Win32::FormatMessage( Win32::GetLastError() ); } Win32::Process::Create($ProcessObj, "C:\\Perl\\bin\\perl.exe", "perl CC4.4.pl ", 1, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport(); $ProcessObj->Suspend(); $ProcessObj->Resume(); #$ProcessObj->Wait(INFINITE);

The above code is Script A and CC4.4.pl is Script B. Questions: $ProcessObj->Suspend() is given at the time of execution how do i arbitarily invoke it at any time? As the script A is running so I cannot tell it to suspend at runtime?


In reply to Pause and Resume Exe by gautamparimoo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.