/usr/share/perl5/IPC/PubSub/Cacheable.pm is in libipc-pubsub-perl 0.29-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | package IPC::PubSub::Cacheable;
use strict;
use warnings;
use Scalar::Util qw( refaddr );
my %Cache;
sub new {
my $class = shift;
my $self = bless(\@_, $class);
$self->BUILD;
return $self;
}
sub BUILD {
my $self = shift;
$Cache{ refaddr($self) } ||= do {
require "IPC/PubSub/Cache/$self->[0].pm";
"IPC::PubSub::Cache::$self->[0]"->new(@{$self->[1]});
};
}
sub AUTOLOAD {
no strict 'refs';
no warnings 'uninitialized';
my $meth = (substr(our $AUTOLOAD, rindex($AUTOLOAD, '::') + 2) || $AUTOLOAD);
my $code = sub {
my $self = shift;
my $cache = $self->BUILD;
unshift @_, $cache;
goto &{$cache->can($meth)};
};
*$meth = $code;
goto &$code;
}
sub DESTROY {
my $self = shift;
delete $Cache{ refaddr($self) };
}
1;
|