/usr/share/perl5/Dancer/SharedData.pm is in libdancer-perl 1.3091+dfsg-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 | package Dancer::SharedData;
use strict;
use warnings;
use Dancer::Timer;
use Dancer::Response;
# shared variables
my $vars = {};
sub vars {$vars}
sub var {
my ($class, $key, $value) = @_;
$vars->{$key} = $value if (@_ == 3);
return $vars->{$key};
}
# request headers
my $_headers;
sub headers { (@_ == 2) ? $_headers = $_[1] : $_headers }
# request singleton
my $_request;
sub request { (@_ == 2) ? $_request = $_[1] : $_request }
# current response
my $_response;
sub response {
if (@_ == 2) {
$_response = $_[1];
}else{
$_response = Dancer::Response->new() if !defined $_response;
return $_response;
}
}
sub reset_response { $_response = undef }
# request timer
my $_timer;
sub timer { $_timer ||= Dancer::Timer->new }
sub reset_timer { $_timer = Dancer::Timer->new }
# purging accessor
sub reset_all {
my ($self, %options) = @_;
if (!exists($options{reset_vars}) || $options{reset_vars}) {
$vars = {};
}
undef $_request;
undef $_headers;
reset_timer();
reset_response();
}
'Dancer::SharedData';
|