Make pos(@array) and pos(%hash) into errors

Currently pos has an effective prototype of (;\[$@%*]), and what it
does is rather interesting.

First, it produces a strange uninitialized warning:

$ ./perl -Ilib -we 'pos my @a = 3'
Use of uninitialized value within @a in scalar assignment at -e line 1.

There is no uninitialized value here.  The value ‘within @a’ is actu-
ally @a itself.  The code that produces the error message was written
under the (perfectly logical) assumption that an array would never be
passed to report_uninit().

Secondly, it adds pos magic to the array itself:

$ ./perl -Ilib -e 'pos @a = 3; use Devel::Peek; Dump \@a'
SV = IV(0x8039fc) at 0x803a00
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x825b90
  SV = PVAV(0x804a04) at 0x825b90
    REFCNT = 2
    FLAGS = (SMG)
    MAGIC = 0x30cb20
      MG_VIRTUAL = &PL_vtbl_mglob
      MG_TYPE = PERL_MAGIC_regex_global(g)
    ARRAY = 0x0
    FILL = -1
    MAX = -1
    ARYLEN = 0x0
    FLAGS = (REAL)

This magic can never be used, as @a =~ /foo/g is equivalent to
scalar(@a) =~ /foo/g, and scalar(@a) returns a scalar containing the
length of the array, not the array itself.

This seems clearly a mistake.

pos forces lvalue context on its argument, making pos(3) a compile-
time error.

Internally, the main distinction between \$ (scalar lvalue) and
\[$@%*] (scalar lvalue, or some other type) prototypes is that the
function S_scalar_mod_type returns true for functions with the former,
but false for functions with the latter.  (Tangentially, \[$@%*] and
\[$@%&*] are distinguished by the special-casing in op_lvalue_flags
under case OP_ENTERSUB.)

S_scalar_mod_type returns false for pos.  I think it should return
true.  That is what this commit does, resulting in consistency
with read():

$ ./perl -Ilib -we 'read($1, @2, $3)'
Can't modify array dereference in read at -e line 1, near "$3)
"
Execution of -e aborted due to compilation errors.
$ ./perl -Ilib -we 'pos(@2)'
Can't modify array dereference in match position at -e line 1, near "@2)
"
Execution of -e aborted due to compilation errors.

Except when it comes to globs, since read refuses *foo for its second
argument, but pos(*foo) has always Just Worked, so there is no reason
to forbid it.

So, now, pos has an effective prototype of (;\[$*]).
Make cproto.t more stringent

It was allowing prototype() to return undef where an empty string
was expected.
cproto.t: Add tests for BEGIN, etc.
Test <> ovrld with glob override

While doing a PL_glob_index experiment on a branch, I almost screwed
up the stack for those cases where glob is overridden and there is
iterator overloading.  The tests passed anyway, meaning we need
more tests.
op.c:ck_glob: Check PL_globhook before loading File::Glob

By loading File::Glob when there is no CORE::GLOBAL::glob, we just end
up calling Perl_load_module for every glob op, since File::Glob no
longer uses CORE::GLOBAL::glob by default.

We could just as well check whether PL_globhook is set, which would
be faster.

(File::Glob sets PL_globhook when it loads.  In 5.14, it didn’t
set anything, but ck_glob itself would set CORE::GLOBAL::glob to
File::Glob::csh_glob.)
op.c: Remove a redundant ck_subr call from dofile

newUNOP(OP_ENTERSUB, ...) already calls ck_subr, so wrapping it in
ck_subr(...) is unnecessary and wasteful of precious CPU time.
op.c: Remove a redundant ck_subr call from ck_glob

newUNOP(OP_ENTERSUB, ...) already calls ck_subr, so calling ck_subr on
its return value is unnecessary and wasteful of precious CPU time.
op.c: Remove a redundant ck_subr call from ck_require

newUNOP(OP_ENTERSUB, ...) already calls ck_subr, so wrapping it in
ck_subr(...) is unnecessary and wasteful of precious CPU time.
op.c:ck_glob: Don’t do gv_fetchpv("CORE::GLOBAL::glob")

We have PL_globalstash precisely to avoid the nested stash lookup in
cases like these.
coreamp.t: rename badly-named tests
Remove OPpCONST_WARNING

This was added to op.h in commit 599cee73:

commit 599cee73f2261c5e09cde7ceba3f9a896989e117
Author: Paul Marquess <paul.marquess@btinternet.com>
Date:   Wed Jul 29 10:28:45 1998 +0100

    lexical warnings; tweaks to places that didn't apply correctly
    	Message-Id: <9807290828.AA26286@claudius.bfsec.bt.co.uk>
    	Subject: lexical warnings patch for 5.005_50

    p4raw-id: //depot/perl@1773

dump.c was modified to dump in, in this commit:

commit bf91b999b25fa75a3ef7a327742929592a2e7e9c
Author: Simon Cozens <simon@netthink.co.uk>
Date:   Sun May 13 21:20:36 2001 +0100

    Op private flags
    Message-ID: <20010513202036.A21896@netthink.co.uk>

    p4raw-id: //depot/perl@10117

But is apparently completely unused anywhere.  And I want that bit.
Remove OPpCONST_WARNING from B::Concise
Allow require_errors.t to be run from the top level
require_errors.t: Test <> error
override.t: Remove obsolete comment
Make while(each ...) imply defined($_ = ...)

This came up in ticket #108286.

Quoting Nicholas Clark:
>
>     while (<STDIN>)
>     while (<*>)
>
> These both always implicitly assigned to $_, always implicitly
> added defined.
>
>     while ($_ = <STDIN>)
>     while ($a = <STDIN>)
>     while ($_ = <*>)
>     while ($a = <*>)
>     while ($_ = readdir D)
>     while ($a = readdir D)
>     while ($_ = each %h)
>     while ($a = each %h)
>
> The implicit defined added was by commit 4b161ae29769b4a3,
> //depot/maint-5.004/perl@949
>
>
> BUT:
>
>     while (readdir D)
>
> The implicit assignment to $_ and defined test were both added in
> *2009* (by commit 114c60ecb1f7)
>
>
> leaving:
>
>     while (each %h)
>
>
> So it is the odd one out. And in 2009 we felt comfortable to add
> both the implicit assignment and the defined test in blead for
> readdir, as a bug fix, and have had no reports of it caus-
> ing problems.

[He asked:]
> > > So that's a bug?

[And I responded:]
> > That's what I was trying to ask. :-)
>
> OK, after a quite a bit of deliberation and digging, I'm of the opinion that
>
> 1: yes, it's a bug

...

> So, there's only one use of while(each %...) on CPAN outside of
> debugging or test code, and that's only go the potential to break
> due to assignment now happening to to $_. Compared with 29 matches
> for while\s*\(\s*readdir of which 4 are .pm files. So
>
> 2: I think it's safe to fix it, just like readdir was fixed.

Just *as* readdir was fixed! :-)
Test that ‘require v5’ ignores sub named v5

This is something I broke in my first (unapplied) attempt to clean up
require’s parsing madness.
Don’t crash with &CORE::foo after undefining *_

When a sub is called with & and no parentheses, no @_ is set up.  This
means the sub call sees the existing @_.  It also means that, if *_
has been undefined, there is no @_.

pp_coreargs was not accounting for this, and was doing
AvARRAY(GvAV(PL_defgv)) without checking that GvAV(PL_defgv) was non-
null.  It crashed as a result.
op.c: Remove redundant assignment

This was added unnecessarily in commit ddeae0f14c.  It is a local
variable assigned to just before the function returns, so the value
is never used in the OP_UNDEF case.
Consistent spaces after dots in CORE.pod