comparison auto-weave.pl @ 8:73beed20f7de

going to move refreshing the page to auto-weave
author Robert McIntyre <rlm@mit.edu>
date Tue, 25 Oct 2011 01:08:31 -0700
parents ce96610fe058
children d09937a6cb4b
comparison
equal deleted inserted replaced
7:ce96610fe058 8:73beed20f7de
9 9
10 10
11 @org_files = glob("./org/*.org"); 11 @org_files = glob("./org/*.org");
12 12
13 $" = "\n"; 13 $" = "\n";
14 print "@org_files"; 14 print "@org_files\n";
15 15
16 16
17 foreach(@org_files){ 17 foreach(@org_files){
18 # add watchers 18 # add watchers
19 $inotify->watch ($_, IN_MODIFY, sub 19 $inotify->watch ($_, IN_MODIFY, sub
20 { 20 {
21 my $e = shift; 21 my $e = shift;
22 my $name = $e->fullname; 22 my $name = $e->fullname;
23 print "$name was modified\n" if $e->IN_MODIFY; 23 print "$name was modified\n" if $e->IN_MODIFY;
24 `weave $name`; 24 system ("weave $name");
25 print ("$name\n");
26 $path = `readlink -f $name`;
27 $path =~ s|/home/r/proj|http://aurellem.localhost|;
28 print ("$path\n");
29 $path =~ s|org|html|g;
30 print ("$path\n");
31 system ("firefox $path");
32
25 }); 33 });
26
27
28
29
30 } 34 }
31 35
32 36
33 37
34 38
35 # integration into AnyEvent (works with EV, Glib, Tk, POE...) 39 # integration into AnyEvent (works with EV, Glib, Tk, POE...)
36 my $inotify_w = AnyEvent->io 40 #my $inotify_w = AnyEvent->io
37 ( 41 # (
38 fh => $inotify->fileno, poll => 'r', cb => sub { $inotify->poll } 42 # fh => $inotify->fileno, poll => 'r', cb => sub { $inotify->poll }
39 ); 43 # );
40 44
41 # manual event loop 45 # manual event loop
42 1 while $inotify->poll; 46 1 while $inotify->poll;