blib/lib/auto/share/dist/Cmd-Dwarf/app/lib/Dwarf/Plugin/Proctitle.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran n/a Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 36 CC 1 SCAR 6.9
CC
1
Cov
0%
init
2.0
_proctitle
2.0
BEGIN
2.0
CRAP 2.0
1 package Dwarf::Plugin::Proctitle;
2 use Dwarf::Pragma;
3 use Dwarf::Util qw/add_method load_class/;
4 use Config;
5  
6 sub init {
7 my ($class, $c, $conf) = @_;
8 $conf ||= {};
9  
10 $c->add_trigger('BEFORE_DISPATCH' => sub {
11 my $self = shift;
12 my $controller = $self->route->{controller};
13 _proctitle(sprintf "[Dwarf] %s::%s() (%s)", $controller, lc $self->method, $self->base_dir);
14 });
15  
16 $c->add_trigger('AFTER_DISPATCH' => sub {
17 my $self = shift;
18 _proctitle(sprintf "[Dwarf] idle (%s)", $self->base_dir);
19 });
20 }
21  
22 sub _proctitle {
23 my ($title) = @_;
24 $title ||= $0;
25 $0 = $title;
26 }
27  
28 1;