Perl-File-Watcher

File::ChangeNotify 模块, 需要 Sub::Identify 模块.

基本用法:

1
2
3
4
5
6
7
8
9
10
11
12
use File::ChangeNotify;

my $watcher =
File::ChangeNotify->instantiate_watcher
( directories => [ '/my/path', '/my/other' ],
filter => qr/\.(?:pm|conf|yml)$/,
);

if ( my @events = $watcher->new_events ) { ... }

# blocking
while ( my @events = $watcher->wait_for_events ) { ... }

这里的 $watcher->new_events 用于判断是否有 events 发生.


Perl-File-Watcher
http://example.com/2023/09/17/Perl-File-Watcher/
作者
Jie
发布于
2023年9月17日
许可协议