This file is indexed.

/usr/share/perl5/Plack/Middleware/Refresh.pm is in libplack-perl 1.0033-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
package Plack::Middleware::Refresh;
use strict;
use parent qw(Plack::Middleware);
use Module::Refresh;
use Plack::Util::Accessor qw(last cooldown);

sub prepare_app {
    my $self = shift;
    $self->cooldown(10) unless defined $self->cooldown;

    Module::Refresh->new;
    $self->last(time - $self->cooldown);
}

sub call {
    my($self, $env) = @_;

    if (time > $self->last + $self->cooldown) {
        Module::Refresh->refresh;
        $self->last(time);
    }

    $self->app->($env);
}

1;

__END__

=head1 NAME

Plack::Middleware::Refresh - Refresh all modules in %INC

=head1 SYNOPSIS

  enable "Refresh", cooldown => 3;
  $app;

=head1 DESCRIPTION

This is I<yet another> approach to refresh modules in C<%INC> during
the development cycle, without the need to have a forking process to
watch for filesystem updates. This middleware, in a request time,
compares the last refresh time and the current time and if the
difference is bigger than I<cooldown> seconds which defaults to 10,
call L<Module::Refresh> to reload all Perl modules in C<%INC> if the
files have been modified.

Note that this only reloads modules and not other files such as
templates.

This middleware is quite similar to what Rack::Reoader does. If you
have issues with this reloading technique, for instance when you have
in-file templates that needs to be recompiled, or Moose classes that
has C<make_immutable>, take a look at L<plackup>'s default -r option
or L<Plack::Loader::Shotgun> instead.

=head1 AUTHOR

Tatsuhiko Miyagawa

=head1 SEE ALSO

L<Module::Refresh> Rack::Reloader

=cut