Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

scrottie (4167)

scrottie
  scott@slowass.net
http://slowass.net/

My email address is scott@slowass.net. Spam me harder! *moan*

Journal of scrottie (4167)

Friday May 18, 2007
09:27 PM

Self-reloading Continuity daemons

[ #33309 ]
  async {
    my $timer = Coro::Event->timer( interval => 2, );
    my $mod_time = -M __FILE__;
    while(1) {
        $timer->next;
        if(-M __FILE__ != $mod_time) {
            $mod_time = -M __FILE__;
            Storable::nstore { board => $board, players => $players, }, "$0.store";
            STDERR->print("Exec-ing self!\n\n");
            exec '/usr/bin/perl', __FILE__ or warn $!;
        }
    }
  };

On startup, it initializes its two main objects from the .store file.

Saving from vi causes it to immediately reload itself.

Wee!

-scott
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.