]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/LI2Wrap.pm
imap+nntp: share COMPRESS implementation
[public-inbox.git] / lib / PublicInbox / LI2Wrap.pm
1 # Copyright (C) all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # Wrapper for Linux::Inotify2 < 2.3 which lacked ->fh and auto-close
5 # Remove this when supported LTS/enterprise distros are all
6 # Linux::Inotify2 >= 2.3
7 package PublicInbox::LI2Wrap;
8 use v5.10.1;
9 our @ISA = qw(Linux::Inotify2);
10
11 sub wrapclose {
12         my ($inot) = @_;
13         my $fd = $inot->fileno;
14         open my $fh, '<&=', $fd or die "open <&= $fd $!";
15         bless $inot, __PACKAGE__;
16 }
17
18 sub DESTROY {} # no-op
19
20 1