Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overridden function in module is not covered (affects method modifiers and friends) #308

Open
wchristian opened this issue Nov 2, 2022 · 1 comment

Comments

@wchristian
Copy link
Contributor

In the following example, sub _do is not recognized at all.

$ cat Moop.pm
package Moop;
sub _stop { 10 }
sub _do { 5 }
my $old = \&_do;
*_do = sub {  $old->() . _stop };
1;

$ cover -delete && perl -I. -MDevel::Cover -MMoop -E 'say Moop->_do' && cover
[...]
510
[...]
------- ------ ------ ------ ------ ------ ------ ------
File      stmt   bran   cond    sub    pod   time  total
------- ------ ------ ------ ------ ------ ------ ------
Moop.pm  100.0    n/a    n/a  100.0    n/a  100.0  100.0
Total    100.0    n/a    n/a  100.0    n/a  100.0  100.0
------- ------ ------ ------ ------ ------ ------ ------

image

@wchristian
Copy link
Contributor Author

Oh yeah, just in case it's not clear. If you convert Moop to a script and run it directly instead of use()ing it, _do is recognized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant