lib/Remote/Perl/Bootstrap.pm

filter: Statementstmt 100% 40 / 40 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 2 totaltotal 93.1% 54 / 58 CC 4 SCAR 4.8
CC
4
Cov
96%
wait_for_ready
3.0
bootstrap_payload
2.0
BEGIN
1.0
CRAP 1.6
« lib/Remote/Perl/Protocol.pm ↑ Summary
1 133 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Remote::Perl::Bootstrap;
3 133 our $VERSION = '0.005';
4  
5 133 ▶use autodie qw(open close);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 133 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 133 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 133 our @EXPORT_OK = qw(bootstrap_payload wait_for_ready READY_MARKER);
9  
10 # The pre-protocol readiness marker the client sends after being eval'd.
11 133 ▶use constant READY_MARKER => "REMOTEPERL1\n";
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # Sentinel that terminates the client code in the DATA section.
14 133 ▶use constant BOOT_END => '__REMOTE_PERL_BOOT_END__';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # The wrapper script sent as the "perl script" over the pipe.
17 # Remote perl compiles and runs this; it reads client code from <DATA>
18 # up to the sentinel, then eval's it.
19 # NOTE: the __END__ token here is intentional and parsed by the remote perl.
20 # NOTE: use strict/warnings explicitly rather than `use v5.36` so that no
21 # feature pragmas leak into eval'd user code via the outer bootstrap scope.
22 # NOTE: WRAPPER runs on the remote side and must stay compatible with Perl 5.10+.
23 133 ▶use constant WRAPPER => <<'END_WRAPPER';
Subroutine BEGIN: called CC=1 SCAR=0.0
24 use strict; use warnings;
25 binmode(STDIN); binmode(STDOUT); $| = 1;
26 eval(do {
27 my $c = '';
28 while (defined(my $line = <DATA>)) {
29 last if $line eq "__REMOTE_PERL_BOOT_END__\n";
30 $c .= $line;
31 }
32 $c
33 }) or do { print STDERR "remperl bootstrap failed: $@\n"; exit 1 };
34 __END__
« lib/Remote/Perl/Protocol.pm ↑ Summary