| 1 | package Langertha::Raider::Binary; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Internal check whether raider runs as the standalone binary | ||||||||||||||||||||||||||||
| 3 | 92 | our $VERSION = '0.503'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 92 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 92 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 92 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 92 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 92 | our @EXPORT_OK = qw( packed_binary ); | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 143 | ▶ | sub packed_binary { | ||||||||||||||||||||||||||
|
Subroutine
packed_binary: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 143 | ▶ | return unless $INC{'PAR.pm'} && $ENV{PAR_PROGNAME}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$INC{"PAR.pm"} and $ENV{"PAR_PROGNAME"}
MC/DC50%1/2
$INC{"PAR.pm"} and $ENV{"PAR_PROGNAME"}
$INC{"PAR.pm"}
$ENV{"PAR_PROGNAME"}
Truth table66%2/3
A and B
A= $INC{"PAR.pm"}B= $ENV{"PAR_PROGNAME"}
| |||||||||||||||||||||||||||||
| 15 | 12 | return path($ENV{PAR_PROGNAME})->absolute->stringify; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 92 | 1; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | __END__ | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =pod | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =head1 NAME | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | Langertha::Raider::Binary - Internal check whether raider runs as the standalone binary | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =head1 VERSION | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | version 0.503 | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | B<Internal module.> Its interface may change without notice. | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | The standalone C<raider> binary is built with PAR::Packer. Inside it there | ||||||||||||||||||||||||||||
| 39 | is no usable perl of its own: C<$^X> is a bare C<perl> off C<PATH>, and | ||||||||||||||||||||||||||||
| 40 | C<perl E<lt>binaryE<gt>> dies on the ELF. Code that starts a perl, or a | ||||||||||||||||||||||||||||
| 41 | raider, asks this module first. | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =head2 packed_binary | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | my $exe = packed_binary(); # undef unless this is the standalone binary | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | Returns the absolute path of the executable this process runs from when it | ||||||||||||||||||||||||||||
| 48 | is a PAR::Packer binary, else C<undef>. F<PAR.pm> loaded in this process is | ||||||||||||||||||||||||||||
| 49 | the signal, together with C<PAR_PROGNAME>. The variable alone is not: a | ||||||||||||||||||||||||||||
| 50 | plain perl started from the binary inherits it. | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =head2 Issues | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | Please report bugs and feature requests on GitHub at | ||||||||||||||||||||||||||||
| 57 | L<https://github.com/Getty/langertha-raider/issues>. | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =head2 IRC | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | Join C<#langertha> on C<irc.perl.org> or message Getty directly. | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =head1 CONTRIBUTING | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/> | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | This software is copyright (c) 2026 by Torsten Raudssus. | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 76 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =cut | ||||||||||||||||||||||||||||