Reading database from ...
------------------- ------ ------ ------ ------ ------
File stmt bran cond sub total
------------------- ------ ------ ------ ------ ------
tests/recursive_sub 100.0 100.0 n/a 100.0 100.0
Total 100.0 100.0 n/a 100.0 100.0
------------------- ------ ------ ------ ------ ------
Run: ...
Perl version: ...
OS: ...
Start: ...
Finish: ...
tests/recursive_sub
line err stmt bran cond sub code
1 #!/usr/bin/perl
2
3 # Copyright 2022-2025, Paul Johnson (paul@pjcj.net)
4
5 # This software is free. It is licensed under the same terms as Perl itself.
6
7 # The latest version of this software should be available from my homepage:
8 # https://pjcj.net
9
10 # __COVER__ skip_test $] < 5.016
11 # __COVER__ skip_reason __SUB__ is available from 5.16
12
13 1 1 use feature "current_sub";
1
1
14
15 sub recursive_func
16 {
17 4 4 my ($ref) = @_;
18 4 100 return $ref unless ref $ref eq "ARRAY";
19 3 return __SUB__->($ref->[0]);
20 }
21
22 1 recursive_func([[[]]]);
Branches
--------
line err % true false branch
----- --- ------ ------ ------ ------
18 100 1 3 unless ref $ref eq "ARRAY"
Covered Subroutines
-------------------
Subroutine Count Location
-------------- ----- ----------------------
BEGIN 1 tests/recursive_sub:13
recursive_func 4 tests/recursive_sub:17