OpusVL/perldoc.perl.org

Definition of __SUB__ is incorrect

Opened this issue · 4 comments

On page: https://perldoc.perl.org/5.30.0/index-functions.html#S the definition of SUB is incorrect:

SUB

  • the current subroutine, or C if not in a subroutine

In what way is it wrong?

As in #137 the pod is not being rendered correctly here (it's supposed to be a C<undef>)

In the following please replace the word underscore with the underscore letter and the word comment with the hash letter to unmangle the effects of markdown.

The issue relates to underscore underscore SUB underscore underscore (which unfortunately is the markdown for SUB) not to SUB per se.

Executing the code below does not produce C if not in a subroutine as promised by the one liner on page: https://perldoc.perl.org/5.30.0/index-functions.html#S . Possibly the C shown is meant to be undef as correctly described in: https://perldoc.perl.org/5.30.0/functions/__SUB__.html

use Data::Dump qw(dump);
use feature qw(say current_sub);

say dump(underscore underscore SUB underscore underscore);

comment undef

sub aaa()
{say dump(SUB);
}

aaa;


comment  sub { ... }

@Grinnz - yes - I see - that is the problem. It is very disconcerting - thank you for clarifying this important matter.