/usr/share/perl5/Bot/BasicBot/Pluggable/Store/Storable.pm is in libbot-basicbot-pluggable-perl 1.20-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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | package Bot::BasicBot::Pluggable::Store::Storable;
$Bot::BasicBot::Pluggable::Store::Storable::VERSION = '1.20';
use warnings;
use strict;
use Storable qw( nstore retrieve );
use File::Spec;
use File::Temp qw(tempfile);
use base qw( Bot::BasicBot::Pluggable::Store );
sub init {
my $self = shift;
if ( !$self->{dir} ) {
$self->{dir} = File::Spec->curdir();
}
}
sub save {
my $self = shift;
my $namespace = shift;
my @modules = $namespace ? ($namespace) : keys( %{ $self->{store} } );
for my $name (@modules) {
my $filename = File::Spec->catfile( $self->{dir}, $name . ".storable" );
my ( $fh, $tempfile ) = tempfile( DIR => $self->{dir}, UNLINK => 0 );
nstore( $self->{store}{$name}, $tempfile )
or die "Cannot save to $tempfile\n";
rename $tempfile, $filename
or die "Cannot create $filename: $!\n";
}
}
sub load {
my $self = shift;
for my $file ( glob File::Spec->catfile( $self->{dir}, '*.storable' ) ) {
my (undef, undef, $name) = map {File::Spec->splitpath($_)} $file =~ /^(.*?)\.storable$/;
$self->{store}{$name} = retrieve($file);
}
}
1;
__END__
=head1 NAME
Bot::BasicBot::Pluggable::Store::Storable - use Storable to provide a storage backend
=head1 VERSION
version 1.20
=head1 SYNOPSIS
my $store = Bot::BasicBot::Pluggable::Store::Storable->new(
dir => "directory"
);
$store->set( "namespace", "key", "value" );
=head1 DESCRIPTION
This is a L<Bot::BasicBot::Pluggable::Store> that uses Storable to store
the values set by modules.
=head1 AUTHOR
Mario Domgoergen <mdom@cpan.org>
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
|