]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/In2Tie.pm
db1dc1045c14b52480ba5189d589593d76137a02
[public-inbox.git] / lib / PublicInbox / In2Tie.pm
1 # Copyright (C) 2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # used to ensure PublicInbox::DS can call fileno() as a function
5 # on Linux::Inotify2 objects
6 package PublicInbox::In2Tie;
7 use strict;
8
9 sub TIEHANDLE {
10         my ($class, $in2) = @_;
11         bless \$in2, $class; # a scalar reference to an existing reference
12 }
13
14 # this calls Linux::Inotify2::fileno
15 sub FILENO { ${$_[0]}->fileno }
16
17 1;