Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Good morning Monks,
I have a sub routine that runs in my application to create a log file of the actions taken by the user. But how could I stop this sub to run if the user simple refresh the screen instead of clicking on something?
Thank you!
  • Comment on How do I keep a subroutine from running on a refresh?

Replies are listed 'Best First'.
Re: How do I keep a subroutine from running on a refresh?
by QM (Parson) on May 06, 2004 at 13:44 UTC
    What is your application? Perl-TK?

    We need a few more details to be helpful, otherwise we're just guessing.

    Without a crystal ball, we may end up telling you the equivalent of

    use Firearm; my $pistol = Firearm->new; $pistol->magazine->load; $pistol->chamber(round); $pistol->unlock(); my $foot = [x=>0, y=>0, z=>-1]; $pistol->aim($foot); $pistol->fire(); $pistol->lock();
    ...or worse :)

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

Re: How do I keep a subroutine from running on a refresh?
by blue_cowdawg (Monsignor) on May 06, 2004 at 13:49 UTC

    Two words: Problem Definition
    What's the environment? What have you tried so far? How is the sub routine (sic) invoked? What am I clicking on? Is this a CGI application or a Perl/TK or an interactive application?

Re: How do I keep a subroutine from running on a refresh?
by Happy-the-monk (Canon) on May 06, 2004 at 13:50 UTC

    Hmm, maybe you would like to use some kind of session with a history of the pages loaded - if the page or screen to be loaded is the one most recently loaded, do not perform that certain action.

    Cheers, Sören