App-SlideServer
view release on metacpan or search on metacpan
lib/App/SlideServer.pm view on Meta::CPAN
# TODO: wrap inotify in an object with a more convenient API and detect things like file renames
$self->{_inotify} //= do {
require Linux::Inotify2;
my $inotify= Linux::Inotify2->new;
my $i_fh= IO::Handle->new_from_fd($inotify->fileno, 'r');
Mojo::IOLoop->singleton->reactor
->io( $i_fh, sub($reactor, $writable) { $inotify->poll if $inotify && !$writable })
->watch($i_fh, 1, 0);
{ inotify => $inotify, inotify_fh => $i_fh }
};
Scalar::Util::weaken( my $app= $self );
my $watch= $self->{_inotify}{inotify}->watch("$f", Linux::Inotify2::IN_MODIFY(), sub { $app->build_slides });
$self->slides_source_monitor($watch);
} else {
$self->slides_source_monitor(undef);
}
}
sub markdown_to_html($self, $md, %opts) {
return markdown($md, extensions => (
( run in 0.355 second using v1.01-cache-2.11-cpan-65fba6d93b7 )