The reason for this is that "use" is "exactly equivalent to"
BEGIN { require Module; Module->import( LIST ); }
(See perldoc -f use.)
And then "BEGIN" is basically the same as "sub BEGIN" - you can put the "sub" there if you want to. See perldoc perlmod
.
So what you really do have is a subroutine, and that is what Devel::Cover
is reporting.
Like many parts of Devel::Cover
, the details of perl's implementation, or at least the semantics, are leaking through. There is no way to stop this, though I would be amenable to changes in this area.