Mercurial > org-tools
view auto-weave.pl @ 15:6ef9ccf7a17e
fixed critical english bug
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 26 Oct 2011 05:13:16 -0700 |
parents | be73e58d4b24 |
children | f433fae15c50 |
line wrap: on
line source
1 #!/usr/bin/perl3 use Linux::Inotify2;4 use WWW::Mechanize::Firefox;5 my $mech = WWW::Mechanize::Firefox->new();7 my $inotify = new Linux::Inotify28 or die "unable to create new inotify object: $!";10 @org_files = glob("./org/*.org");12 $" = "\n";13 print "@org_files\n";15 $ignore_next = 0;18 foreach(@org_files){19 # add watchers20 $inotify->watch ($_, IN_MODIFY, sub21 {22 print ("IGNORE : $ignore_next\n");23 # ok, for some reason this gets called exactly24 # twice every time the file is saved from emacs.25 # so ignore every other invocation.26 if ($ignore_next) {27 $ignore_next = 0;28 return;29 }30 $ignore_next = 1;32 my $e = shift;33 my $name = $e->fullname;34 print "$name was modified\n" if $e->IN_MODIFY;35 $output = `weave $name`;36 $path = `readlink -f $name`;37 $path =~ s|/home/r/proj|http://aurellem.localhost|;38 $path =~ s|org|html|g;39 $mech->get($path);40 });41 }44 # manual event loop45 1 while $inotify->poll;