bin/karr

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/App/karr/Role/DependencyCheck.pm ↑ Summary blib/lib/App/karr/Role/BoardAccess.pm »
1 #!/usr/bin/env perl
2 # PODNAME: karr
3 # ABSTRACT: Kanban Assignment & Responsibility Registry
4  
5 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 our $VERSION = '0.602';
8 0 ▶use App::karr::SyncGuard;
Subroutine BEGIN: called CC=1 SCAR=2.6
9 use App::karr::Dispatch qw( dispatch );
10  
11 # Push insurance, flushed at the last safe moment (ticket #37).
12 #
13 # App::karr::Role::SyncLifecycle arms an App::karr::SyncGuard for every writing
14 # command and stashes it on the command object, so that a body dying before
15 # sync_after still pushes what it wrote. On this CLI that never fired: the run
16 # below is wrapped in an eval, the handler exits, and MooX::Cmd's command chain
17 # holds the command object -- so the guard was first reaped in global
18 # destruction, where App::karr::Git refuses to work at all (#34) and the guard
19 # can do nothing but print "run karr sync".
20 #
21 # END is the fix: it runs before global destruction with the interpreter still
22 # whole, and unlike the error handler it also covers the exit() calls inside
23 # command bodies and the option-parse exits from App::karr::Role::ExitCodes.
24 # This stays in the executable rather than moving into App::karr::Dispatch: it
25 # is a process-lifecycle hook, and an in-process host that calls dispatch()
26 # repeatedly must flush after EACH call, not once at interpreter shutdown.
27 #
28 # $? is localized because the exit code is a documented contract (see EXIT CODES
29 # below) and the push may shell out to `git` on App::karr::Git's CLI-fallback
30 # path, whose open3/waitpid would otherwise overwrite it. flush_armed is
31 # documented never to die, which is the other half of protecting that contract:
32 # an exception here would abort perl's END queue and set its own exit status.
33 END {
34 local $?;
35 App::karr::SyncGuard->flush_armed;
36 }
37  
38 # Everything between program start and App::karr->new_with_cmd -- the
39 # character/octet boundary, the record of the caller's argv, the empty-argument
40 # and dashed-option rewrites, and the central exit-code handler (ADR 0002) --
41 # lives in App::karr::Dispatch, so this executable and the in-process test
42 # runner (t/lib/TestKarr.pm) share one dispatch path rather than two copies.
43 dispatch(@ARGV);
44  
45 __END__
« blib/lib/App/karr/Role/DependencyCheck.pm ↑ Summary blib/lib/App/karr/Role/BoardAccess.pm »