view auto-weave.pl @ 6:5370428e673e

experimenting with a perlscript for weaving
author Robert McIntyre <rlm@mit.edu>
date Mon, 24 Oct 2011 09:29:17 -0700
parents
children ce96610fe058
line wrap: on
line source
1 #!/usr/bin/perl
3 use Linux::Inotify2;
4 use AnyEvent;
7 my $inotify = new Linux::Inotify2
8 or die "unable to create new inotify object: $!";
11 @org_files = glob("./org/*.org");
13 $" = "\n";
14 print "@org_files";
17 foreach(@org_files){
18 # add watchers
19 $inotify->watch ($_, IN_MODIFY, sub
20 {
21 my $e = shift;
22 my $name = $e->fullname;
23 print "$name was modified\n" if $e->IN_MODIFY;
24 `
26 });
31 }
36 # integration into AnyEvent (works with EV, Glib, Tk, POE...)
37 my $inotify_w = AnyEvent->io
38 (
39 fh => $inotify->fileno, poll => 'r', cb => sub { $inotify->poll }
40 );
42 # manual event loop
43 1 while $inotify->poll;