Reading database from ...
------------------- ------ ------ ------ ------ ------
File stmt bran cond sub total
------------------- ------ ------ ------ ------ ------
tests/overload_bool 69.2 50.0 50.0 25.0 56.5
Total 69.2 50.0 50.0 25.0 56.5
------------------- ------ ------ ------ ------ ------
Run: ...
Perl version: ...
OS: ...
Start: ...
Finish: ...
tests/overload_bool
line err stmt bran cond sub code
1 #!/usr/bin/perl
2
3 # Copyright 2006-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 package Foo;
11 use overload
12 *** *0 *0 '""' => sub { shift->render},
13 1 1 bool => sub { die "I was used as a bool and shouldn't be\n"; 1 };
*** 1 *0
1
*** *0
*** *0
14
15 sub render {
16 *** *0 *0 "foo";
17 }
18
19 1 my $foo = 1;
20 *** 1 * 50 bless {}, 'Foo' if $foo;
21
22 1 my $boolobj = bless {}, 'Foo';
23 *** 1 * 50 $boolobj //= 5;
24 *** 1 * 50 my $var; $var //= bless {}, "Foo";
1
25
26 1;
Branches
--------
line err % true false branch
----- --- ------ ------ ------ ------
20 *** 50 1 0 if $foo
Conditions
----------
or 2 conditions
line err % l !l expr
----- --- ------ ------ ------ ----
23 *** 50 1 0 $boolobj //= 5
24 *** 50 0 1 $var //= bless({}, "Foo")
Covered Subroutines
-------------------
Subroutine Count Location
---------- ----- ----------------------
BEGIN 1 tests/overload_bool:13
Uncovered Subroutines
---------------------
Subroutine Count Location
---------- ----- ----------------------
__ANON__ 0 tests/overload_bool:12
__ANON__ 0 tests/overload_bool:13
render 0 tests/overload_bool:16