Mercurial > org-tools
view auto-weave.pl @ 18:993b8d7d9bec
buggy garbage
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 02 Nov 2011 09:24:54 -0700 |
parents | 6da973a6b93d |
children | c14f3a4af7fd |
line wrap: on
line source
1 #!/usr/bin/perl3 use Linux::Inotify2;5 my $inotify = new Linux::Inotify26 or die "unable to create new inotify object: $!";8 $org_files = `find /home/r/proj -name "*.org" -print0`;9 @org_files = split /\0/, $org_files;11 for $file(@org_files){print "$file\n";}12 $ignore_next = 0;15 foreach(@org_files){16 # add watchers17 $inotify->watch ($_, IN_MODIFY, sub18 {19 print ("IGNORE : $ignore_next\n");20 # ok, for some reason this gets called exactly21 # twice every time the file is saved from emacs.22 # so ignore every other invocation.23 if ($ignore_next) {24 $ignore_next = 0;25 return;26 }27 $ignore_next = 1;29 my $e = shift;30 my $name = $e->fullname;31 print "$name was modified\n" if $e->IN_MODIFY;32 system "weave $name &";34 });35 }37 # manual event loop38 1 while $inotify->poll;