method Supply() { supply { sub subscribe { say "building a supply for $.root: files = " ~ @.files; my $events = Supply.merge( @.files.map( { .watch } ) ); $events.merge( %.subdirs.values.map( { .Supply } ) ); my $watch = supply { whenever $events { emit ( False, $_ ) }; whenever $.root.watch { emit ( True, $_ ); done }; }; whenever $watch { .say; if ( .[0] ) { self.scan(); subscribe; } .[1].emit; } } subscribe; } }