Auto-reload too fast when tool modifies $File

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Jon Saville

Auto-reload too fast when tool modifies $File

Post by Jon Saville »

Hi,

Many apologies if this has been addressed before.

I have a Perl script that re-writes the current editor file
to add an index.

The problem is that, with Auto-Reload enabled, it starts to
reload before the script has finished writing the file.
The net result is that only part of the file is reloaded.

Changing Auto-Reload to Prompt fixes the problem, but ideally
what I'd like is an option to delay an Auto-Reload until the
tool has completed. Or simply wait for n seconds after a tools
is executed before Auto-Reloading.

Any advice would be appreciated.

jon
Andreas

Re: Auto-reload too fast when tool modifies $File

Post by Andreas »

Why not modify your perlscript to output to a temp file and only when the work is finished copy the temp file to the original file?

Andreas
Jon Saville

Re: Auto-reload too fast when tool modifies $File

Post by Jon Saville »

To explain a bit further: I'm editing a HTML document. The Perl script adds
section numbering based on the <h1>..<h6> tags, and also creates an index
with links to the sections.

I like to run this script often, as I modify the structure of the document,
to see what the changes look like.

If I have to mess about with temp files I may as well do everything from the
command line. Changing Auto-Reload to Prompt fixes this, but I guess I want
everything to be perfect :)

jon
Post Reply