This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
11 years ago[perl #112692] perlfunc: waitpid takes two args
Eric Brine [Tue, 22 May 2012 03:23:29 +0000 (20:23 -0700)]
[perl #112692] perlfunc: waitpid takes two args

11 years ago[Merge] Update overload caches properly
Father Chrysostomos [Tue, 22 May 2012 01:12:02 +0000 (18:12 -0700)]
[Merge] Update overload caches properly

This branch causes overload caches to update properly, instead of
remaining stale till the next ‘bless’.  Overloading also applies now
to objects that were created before a class had overloading, if over-
loading is added to a class at run time.

In the process of doing this, I fixed a few other bugs:
•  Overloaded classes can now inherit fallback.
• ‘no overload’ warns about invalid arguments.
•  use overload '+' => 'method::name' now supports double colons in
   the method name.  This is a regression from 5.003.  Apostrophes
   never stopped working, though.

The changes to the way overloading worked allowed me to simplify
things significantly and delete of lot of code, including eliminat-
ing type ‘A’ magic, for which overloading itself is named throughout
the source!

11 years agoCorrect Peek.t to account for flag changes
Father Chrysostomos [Mon, 21 May 2012 21:15:53 +0000 (14:15 -0700)]
Correct Peek.t to account for flag changes

11 years agoCheck HvNAME in Gv_AMG
Father Chrysostomos [Sun, 20 May 2012 22:49:39 +0000 (15:49 -0700)]
Check HvNAME in Gv_AMG

If a stash is undeffed, simple stringification could cause method
lookup to croak, because Gv_AMupdate is trying to look up methods to
fill the overload table.  Gv_AMupdate could be called to begin with
because the isa and method changes now cause the AMAGIC flag to be set
on the stash.

It was for this reason that I added HvAMAGIC_off to hv_undef.  But
putting the name check here seems a much more robust solution, as mro
linearisation triggered by hv_undef could croak, causing the flag not
to be unset by hv_undef.

11 years agooverload.pm: Allow :: in method names
Father Chrysostomos [Sun, 20 May 2012 21:55:08 +0000 (14:55 -0700)]
overload.pm: Allow :: in method names

According to overload’s documentation, ‘[v]alues specified as strings
are interpreted as method names.’

But it behaves differently if the string contains a double colon:

use overload q\""\=>"bar::baz";
@bar::ISA = foo;
sub foo::baz{a}
warn bless[]
__END__
Undefined subroutine &bar::baz called at - line 4.

But apostrophes work as documented:

use overload q\""\=>"bar'baz";
@bar::ISA = foo;
sub foo::baz{a}
warn bless[]
__END__
a at - line 4.

I can’t see how the treatment of ::, introduced in a60067777, is not a
bug, though the method logic looks intentional:

+      if (not ref $sub and $sub !~ /::/) {

I suspect it was one of those things that was just not thought
through.  The pre-a60067777 logic was in gv.c, and treated strings
containing package separators just like any other strings:

          switch (SvTYPE(sv)) {
            default:
              if (!SvROK(sv)) {
                if (!SvOK(sv)) break;
gv = gv_fetchmethod(stash, SvPV(sv, na));
                if (gv) cv = GvCV(gv);
                break;
              }
              cv = (CV*)SvRV(sv);

11 years agooverload.t: Make the undef %overload:: test useful
Father Chrysostomos [Sat, 19 May 2012 21:41:50 +0000 (14:41 -0700)]
overload.t: Make the undef %overload:: test useful

The test for undefining %overload:: no longer goes through the code
path that used to crash, because bless[] no longer updates overload
tables.  That now happens when overload methods are called.  So, even
if the bug were reintroduced, the test would pass without this change.

11 years agooverload.t: Translate a comment into English :-)
Father Chrysostomos [Sat, 19 May 2012 20:28:47 +0000 (13:28 -0700)]
overload.t: Translate a comment into English :-)

Added by 0bdaccee3 and partly corrected by b0bf6df7d, this comment had
me befuddled enough to have to read it three times.

11 years agooverload.t: Move a test
Father Chrysostomos [Sat, 19 May 2012 20:25:28 +0000 (13:25 -0700)]
overload.t: Move a test

This block of tests was added by commit d411a6a9eb in the middle
of the numify tests, separating the Numify package from the tests
that used it.

The diff makes it look as though the Numify package got moved down,
but I can assure you that I moved the perl31793 block *up*!

11 years agooverload.pm: This warning exists now
Father Chrysostomos [Sat, 19 May 2012 17:12:00 +0000 (10:12 -0700)]
overload.pm: This warning exists now

11 years agoUpdate overload docs
Father Chrysostomos [Sat, 19 May 2012 06:17:22 +0000 (23:17 -0700)]
Update overload docs

11 years agoConsign magic_setamagic to oblivion
Father Chrysostomos [Sat, 19 May 2012 05:44:30 +0000 (22:44 -0700)]
Consign magic_setamagic to oblivion

Now that ‘A’ magic is gone, nothing is using this function.

11 years agoAnnihilate ‘A’ magic
Father Chrysostomos [Sat, 19 May 2012 05:37:31 +0000 (22:37 -0700)]
Annihilate ‘A’ magic

How ironic!  Overloading is called ‘A’ magic internally all over the
place, because of the letter used as its magic type.  But now it does
not even use that magic.

I left a comment in mg_vtable.pl, so that future maintainers will have
some clue as to what AMAGIC means.

11 years agoDon’t magicalise %OVERLOAD
Father Chrysostomos [Sat, 19 May 2012 05:26:23 +0000 (22:26 -0700)]
Don’t magicalise %OVERLOAD

It’s not necessary any more, now that mro_method_changed_in sets the
AMAGIC flag on the stash.

11 years agosv.c: Don’t do SvAMAGIC_off in newSVrv
Father Chrysostomos [Sat, 19 May 2012 01:10:24 +0000 (18:10 -0700)]
sv.c: Don’t do SvAMAGIC_off in newSVrv

This has been useless since the flag was moved to the referent in com-
mit dd2eae66.  rv is undefined by the time this statement is reached
if it was a reference.

11 years agosv.c: Don’t do SvAMAGIC_off in sv_setsv_flags
Father Chrysostomos [Sat, 19 May 2012 01:09:42 +0000 (18:09 -0700)]
sv.c: Don’t do SvAMAGIC_off in sv_setsv_flags

This has been useless since the flag was moved to the referent in com-
mit dd2eae66.  dstr is undefined by the time this statement is reached
if it was a reference.

11 years agosv.c: Don’t fiddle with AMAGIC in sv_bless
Father Chrysostomos [Sat, 19 May 2012 00:02:39 +0000 (17:02 -0700)]
sv.c: Don’t fiddle with AMAGIC in sv_bless

Since overloading itself now checks whether caches are up to date, and
since changes to the stash (@ISA, methods) turn the flag on and over-
loading itself turns the flag off when it can, sv_bless no longer
needs to deal with it at all.

11 years agoMake ‘no overload’ also warn about invalid args
Father Chrysostomos [Sat, 19 May 2012 00:00:49 +0000 (17:00 -0700)]
Make ‘no overload’ also warn about invalid args

11 years agooverload.pm: Don’t touch %OVERLOAD’s dummy entry
Father Chrysostomos [Fri, 18 May 2012 23:56:50 +0000 (16:56 -0700)]
overload.pm: Don’t touch %OVERLOAD’s dummy entry

Now that mro_method_changed_in (triggered by the
‘*{$package . "::()"} = \&nil;’ assignment) causes overloadedness to
be checked the next time a overloaded operation occurs, it is not nec-
essary to trigger %OVERLOAD’s magic explicitly.

This also means that PL_amagic_generation is not incremented any more.
Unfortunately, we cannot eliminate it, as there are XS modules that
expect to increment it themselves to mark their caches as stale.

11 years agoMake overloaded classes inherit fallback
Father Chrysostomos [Sun, 20 May 2012 06:46:04 +0000 (23:46 -0700)]
Make overloaded classes inherit fallback

Before this commit, only classes that had no overloading defined could
inherit the fallback from other classes.  If a subclass wanted to
override a single overload setting, it would have to specify the fall-
back value explicitly, to avoid implying fallback=>undef.

We do this by separating the fallback value from overloadedness
itself, so it is possible to have a class that is overloaded, but with
no fallback value.

Previously, the ‘()’ stash entry was used for two purposes.  It had a
sub in it so it could be found using usual method lookup mechanims.
The failure to find any such method would be taken for efficiency’s
sake to mean that there was no overloaded, and the search for methods
could end early.  The scalar slot contained the fallback entry itself.

To preserve the effiency, we still use &{"()"} to indicate that there
is overloadedness.

Fallback now uses its own entry, named ‘(fallback’.  Since it
has to be special-cased anyway, there is no need to add it to
regen/overload.pl.

11 years agooverload.t: Tests for no overload "fallback"
Father Chrysostomos [Sun, 20 May 2012 06:12:16 +0000 (23:12 -0700)]
overload.t: Tests for no overload "fallback"

This is something I almost broke in trying to fix a bug in ‘no
overload "fallback"’.

11 years agoCorrect comment typo in overload.t
Father Chrysostomos [Fri, 18 May 2012 21:19:28 +0000 (14:19 -0700)]
Correct comment typo in overload.t

11 years agoIncrease $overload::VERSION to 1.19
Father Chrysostomos [Fri, 18 May 2012 21:00:03 +0000 (14:00 -0700)]
Increase $overload::VERSION to 1.19

11 years agoMake @ISA changes update overloadedness
Father Chrysostomos [Fri, 18 May 2012 20:46:59 +0000 (13:46 -0700)]
Make @ISA changes update overloadedness

If a non-overloaded class begins inheriting overloading due to @ISA
changes, we need to set the overloaded (AMAGIC) flag on the stash to
indicate that.  Updating caches shouldn’t require a dummy blessing.

11 years agooverload.t: Move some tests above ‘keep last’ test
Father Chrysostomos [Fri, 18 May 2012 20:37:40 +0000 (13:37 -0700)]
overload.t: Move some tests above ‘keep last’ test

11 years ago[perl #112708] Update overloadedness with ‘use overload’
Father Chrysostomos [Fri, 18 May 2012 20:36:48 +0000 (13:36 -0700)]
[perl #112708] Update overloadedness with ‘use overload’

Instead of setting a class’s overloaded (HvAMAGIC) flag when bless
happens, we should do it in ‘use overload’.  Otherwise, if a non-over-
loaded class gains overloading via ‘use overload’, existing objects
won’t get overloading until another object is blessed into the
same class.

Inherited overloading that is turned on due to @ISA changes still
won’t work yet.  That will come in a later commit.

Doing this via %OVERLOAD magic would require referencing
the stash from magic.  Since overload.pm already does
‘*{$package . "::()"} = \&nil’, triggering mro_method_changed_in,
the simplest approach is to turn on the stash’s AMAGIC flag in
mro_method_changed_in.  Since, if there is no overloading, the flag
will be turned off on the next attempted overload call (in Gv_AM in
sv.h), there should be noticeable slowdown.

I had to turn off HvAMAGIC in hv_undef, to prevent ‘Can't use anony-
nous symbol table for method lookup’ from occurring when stringifying
an object whose package has been undefined.

11 years agooverload.t: Another to-do test for isa changes
Father Chrysostomos [Fri, 18 May 2012 19:54:12 +0000 (12:54 -0700)]
overload.t: Another to-do test for isa changes

Changing a non-overloaded class’s @ISA such that it starts inheriting
overloading should apply to objects already in that class, without
requiring an explicit ‘bless \$dummy’ to update things.

11 years agogv.c: Check overload tables when overloading is used
Father Chrysostomos [Fri, 18 May 2012 16:56:15 +0000 (09:56 -0700)]
gv.c: Check overload tables when overloading is used

Instead of checking whether overload tables are up to date only during
bless, do this check whenever using overloading.

This allows changes to methods and @ISA that affect overloading to
come into effect immediately, instead of requiring a dummy ‘bless[]’
to reset things.  (This does not yet apply to @ISA changes that cause
non-overloaded classes to start inheriting overloading.)

This fixes a bug brought up in ticket #112708, though the original bug
still exists.

Some tests had to change, but those tests were checking to make sure
that caches could go stale and still be used, which made no sense.

11 years agosv.h: define SvAMAGIC in terms of HvAMAGIC
Father Chrysostomos [Fri, 18 May 2012 16:25:26 +0000 (09:25 -0700)]
sv.h: define SvAMAGIC in terms of HvAMAGIC

11 years agosv.h: Turn off AMAGIC flag in Gv_AMG
Father Chrysostomos [Fri, 18 May 2012 15:52:02 +0000 (08:52 -0700)]
sv.h: Turn off AMAGIC flag in Gv_AMG

This makes no functional changes.

If a stash has its AMAGIC flag on, then when the overload caches are
updated we can turn off the flag if it turns out that there is no
overloading.

Gv_AMG is the easiest place to unset this flag, as Gv_AMupdate has
‘return 0’ in more than one place.

This is for efficiency’s sake, as an object that inherits overloading
but then loses it through @ISA changes will still have to go through
extra checks due to SvAMAGIC returning true.

This also offsets an inefficiency to be introduced in later commits:
changes to @ISA will set the AMAGIC flag.

11 years agosv.h: Add HvAMAGIC macros
Father Chrysostomos [Fri, 18 May 2012 16:20:32 +0000 (09:20 -0700)]
sv.h: Add HvAMAGIC macros

These are the only Hv* macros in sv.h, so I may be putting them in the
wrong place.  However, they are very closely related to those that
immediately precede them.

11 years agoDon’t incr PL_amagic_generation in universal.c
Father Chrysostomos [Fri, 18 May 2012 13:30:18 +0000 (06:30 -0700)]
Don’t incr PL_amagic_generation in universal.c

In boot_core_UNIVERSAL, there is no need to increment
PL_amagic_generation to indicate that there are classes using over-
loading.  The previous commit removed the only use of it that required
it to be non-zero for overloading to work.

11 years agoDon’t check PL_amagic_generation in Gv_AMG
Father Chrysostomos [Fri, 18 May 2012 13:26:58 +0000 (06:26 -0700)]
Don’t check PL_amagic_generation in Gv_AMG

Because version.pm is now part of perl, PL_amagic_generation is always
non-zero, so there’s no point in doing that check.

11 years agoMove SvAMAGIC flag from object to stash
Father Chrysostomos [Fri, 18 May 2012 05:26:20 +0000 (22:26 -0700)]
Move SvAMAGIC flag from object to stash

By putting the flag on the stash, we can allow the overloaded status
of all objects of a particular class to change without having to
change the flag on every object (which would require traversing arenas
or keeping caches).

This partially fixes bug #112708, in that objects that existed before
their class had any overloading will start working after overloading
is introduced if other objects are blessed into that class.

Without blessings of other objects, they still don’t work yet.  The
fix for that is yet to come....

This was also a good excuse for deleting a comment that contained two
typos.  :-)

11 years agoTo-do tests for method/isa/overload updates and overloading
Father Chrysostomos [Fri, 18 May 2012 03:44:48 +0000 (20:44 -0700)]
To-do tests for method/isa/overload updates and overloading

Changes to methods, @ISA, or overload settings should affect objects
that are already blessed into the class.

Currently, objects that existed before any overload settings were in
place do not do overloading at all (bug #112708).  Objects that were
blessed when overload settings were in place are not affected by
changes to methods or @ISA until another object is blessed into the
same class.

11 years agoCorrect spelling error reported by rrt.
jkeenan [Sat, 5 May 2012 14:50:40 +0000 (10:50 -0400)]
Correct spelling error reported by rrt.

For RT #112772.

11 years ago[perlfunc] fix usage of wait
Moritz Lenz [Mon, 30 Apr 2012 08:21:49 +0000 (10:21 +0200)]
[perlfunc] fix usage of wait

11 years agodocument the return value of pipe()
Tony Cook [Sat, 31 Mar 2012 01:06:37 +0000 (12:06 +1100)]
document the return value of pipe()

11 years ago[perl #111638] fix -p on File::stat objects
Tony Cook [Fri, 30 Mar 2012 10:18:39 +0000 (21:18 +1100)]
[perl #111638] fix -p on File::stat objects

11 years ago[perl #111638] TODO for -p on a File::stat object
Tony Cook [Tue, 20 Mar 2012 06:35:42 +0000 (17:35 +1100)]
[perl #111638] TODO for -p on a File::stat object

11 years agocheckAUTHORS.pl: Another address for Matthew Horsfall
Father Chrysostomos [Mon, 21 May 2012 21:43:23 +0000 (14:43 -0700)]
checkAUTHORS.pl: Another address for Matthew Horsfall

11 years agoperldiag: Rewrap symref error for better splain output
Father Chrysostomos [Mon, 21 May 2012 20:52:29 +0000 (13:52 -0700)]
perldiag: Rewrap symref error for better splain output

Before:

    (F) You've told Perl to dereference a string, something which use strict
    blocks to prevent it happening accidentally. See
    "Symbolic references" in perlref. This can be triggered by an @ or $ in a
    double-quoted string immediately before interpolating a variable, for example
    in "user @$twitter_id", which says to treat the contents of $twitter_id
    as an array reference; use a \ to have a literal @ symbol followed by the
    contents of $twitter_id: "user \@$twitter_id".

After:

    (F) You've told Perl to dereference a string, something which
    use strict blocks to prevent it happening accidentally.  See
    "Symbolic references" in perlref.  This can be triggered by an @ or $
    in a double-quoted string immediately before interpolating a variable,
    for example in "user @$twitter_id", which says to treat the contents
    of $twitter_id as an array reference; use a \ to have a literal @
    symbol followed by the contents of $twitter_id: "user \@$twitter_id".

11 years agoMake symbolic references diagnostic less cryptic
Smylers [Thu, 12 Apr 2012 12:30:37 +0000 (13:30 +0100)]
Make symbolic references diagnostic less cryptic

If somebody has accidentally used a symbolic reference with strict enabled and
are looking for diagnostics then it's likely they didn't intend to use a
symbolic reference at all. A beginner may not even know what a symbolic
reference is, or even a reference.

So explain the error in terms of what the user has done, not what sort of
references are allowed. Provide a simple example of how this error can occur,
so even those who don't know about references have a chance of spotting and
fixing their mistake.

11 years agodocument behavior of duplicate keys in hash assignment
Lukas Mai [Mon, 2 Apr 2012 17:27:46 +0000 (19:27 +0200)]
document behavior of duplicate keys in hash assignment

11 years agoFix --authors to work and fix documentation as well.
Matthew Horsfall (alh) [Thu, 29 Mar 2012 15:25:36 +0000 (11:25 -0400)]
Fix --authors to work and fix documentation as well.

The '=s' is needed for Getopt::Long

11 years ago[rt #111730] don't use I32 for offsets in vec()
Tony Cook [Fri, 23 Mar 2012 23:27:52 +0000 (00:27 +0100)]
[rt #111730] don't use I32 for offsets in vec()

do_vecset() do_vecget() used I32 for the offset, which meant that
offsets outside the -2Gb - +2Gb offset were truncated, resulting in
various misbehaviours.

11 years ago[rt #111730] TODO tests for vec() with large offsets
Tony Cook [Fri, 23 Mar 2012 22:36:27 +0000 (23:36 +0100)]
[rt #111730] TODO tests for vec() with large offsets

11 years ago[rt #100514] regression test for read() with a 2Gib offset
Tony Cook [Fri, 23 Mar 2012 12:11:48 +0000 (13:11 +0100)]
[rt #100514] regression test for read() with a 2Gib offset

11 years agoadd a directory of tests to run with large available memory
Tony Cook [Fri, 23 Mar 2012 12:11:03 +0000 (13:11 +0100)]
add a directory of tests to run with large available memory

Intended for testing 64-bit behavious

11 years ago[rt #111640] warn on the right -X operators used on a File::stat object
Tony Cook [Mon, 12 Mar 2012 09:08:01 +0000 (20:08 +1100)]
[rt #111640] warn on the right -X operators used on a File::stat object

11 years ago[rt #111640] TODO tests for warnings from -X on File::stat
Tony Cook [Mon, 12 Mar 2012 08:39:14 +0000 (19:39 +1100)]
[rt #111640] TODO tests for warnings from -X on File::stat

11 years agoDon’t stringify GV in numeric cx outside warnings scope
Father Chrysostomos [Mon, 21 May 2012 06:37:36 +0000 (23:37 -0700)]
Don’t stringify GV in numeric cx outside warnings scope

The GV is only stringified for the sake of the warning message, so
there is no point in wasting CPU cycle if it will be unused.

11 years agofeature.pl: Make 5.even bundle imply 5.odd
Father Chrysostomos [Mon, 21 May 2012 06:01:58 +0000 (23:01 -0700)]
feature.pl: Make 5.even bundle imply 5.odd

Since the 5.18 feature bundle should be added long before 5.18, to
avoid last-minute blunders, and since it’s easy to forget to do it in
advance, have feature.pl do it automatically.

11 years agoDon’t let method-BLOCK read beyond the stack
Father Chrysostomos [Tue, 15 May 2012 19:52:13 +0000 (12:52 -0700)]
Don’t let method-BLOCK read beyond the stack

$ ./perl -Ilib -e 'use B::Deparse; warn for new{}'
Can't call method "new" on an undefined value at -e line 1.
$ ./perl -Ilib -e 'use B::Deparse; warn for "foo", new{}'
Can't call method "new" without a package or object reference at -e line 1.

Now, why did adding "foo" there change the error message?  Because
new{} looks one past the end of the stack.  Adding "foo" just caused
it to look at the next dropping left behind by B::Deparse, which just
happened to be some non-ref that was not recognised as a package name.

In fact, I can even do this to control what value it picks up:

$ ./perl -Ilib -e '@_ = ("foo"); new{}'
Can't locate object method "new" via package "foo" (perhaps you forgot to load "foo"?) at -e line 1.

And then it calls a method with literally no arguments in @_:

$ ./perl -Ilib -we 'use B::Deparse; @_ = "B::Deparse"; warn new{}'
Use of uninitialized value $class in bless at lib/B/Deparse.pm line 569.
Explicit blessing to '' (assuming package main) at lib/B/Deparse.pm line 569.
Can't locate object method "init" via package "main" at lib/B/Deparse.pm line 588.

And the ultimate:

$ ./perl -Ilib -we 'for(1..1000000) {eval " warn +(1)x$_, new{}"}'
Bus error
$ ./perl -Ilib -we 'for(866..1018) { eval { warn +(1)x$_, new{} }}'
Bus error

OK, that’s enough fun.

With this commit, I’m making it an error to call a method this way
with no arguments.  I’m using the ‘without a package or object refer-
ence’ error message, as opposed to ‘on an undefined value’, because
there isn’t any undefined value; there’s nothing at all.

11 years agoDocument hashref_locked() and hashref_unlocked(). Add tests for them, include debugg...
jkeenan [Sat, 12 May 2012 05:32:38 +0000 (22:32 -0700)]
Document hashref_locked() and hashref_unlocked().  Add tests for them, include debugging by Father C++.

Make lock_hash_recurse() unlock_hash_recurse() exportable; include them in
SYNOPSIS; write tests for them.

Revise 'carp test' test. In general, tests of error messages should be written
with like() rather than is().  Why?  Because we rarely want to test for the
complete error message if that requires us to exactly calculate strings such
as the line number at which an error occurred.

11 years agoCorrect comment typo in op.h
Father Chrysostomos [Tue, 1 May 2012 00:07:31 +0000 (17:07 -0700)]
Correct comment typo in op.h

11 years agoDosGlob.pm: Fix pod syntax
Father Chrysostomos [Sat, 28 Apr 2012 21:33:17 +0000 (14:33 -0700)]
DosGlob.pm: Fix pod syntax

11 years agoRemove obsolete comment from DosGlob.pm
Father Chrysostomos [Fri, 27 Apr 2012 20:18:36 +0000 (13:18 -0700)]
Remove obsolete comment from DosGlob.pm

This comment was added by commit 37248846, without explanation.

DosGlob.pm already had ‘use strict’ three days before that, added in
commit b75c8c73, three days earlier.

I can only assume that 37248846 was written before b75c8c73 was
applied, and that simply adding ‘use strict’ didn’t work, considering
that b75c8c73 changed quite a few things to make things strict-safe.

11 years agoIncrease $File::DosGlob::VERSION to 1.07
Father Chrysostomos [Fri, 27 Apr 2012 20:18:07 +0000 (13:18 -0700)]
Increase $File::DosGlob::VERSION to 1.07

11 years agoMake lvalue subs copy returned PADTMPs in rvalue cx
Father Chrysostomos [Thu, 26 Apr 2012 01:29:12 +0000 (18:29 -0700)]
Make lvalue subs copy returned PADTMPs in rvalue cx

I was trying to write a JAPH, but did not get what I expected:

$ ./perl -Ilib -e '@UNIVERSAL::ISA = CORE; print "just another "->ucfirst, "perl hacker,\n"->ucfirst'
Perl hacker,
Perl hacker,

This happened because coresubs use leavesublv, to avoid copying the
return value wastefully.

But since this is exactly the same ucfirst op being called each time
(the one in &CORE::ucfirst’s op tree), and since ucfirst uses TARG, we
end up with the same scalar.

We have the same problem with lvalue subs:

$ ./perl -Ilib -e 'sub UNIVERSAL::ucfirst :lvalue { ucfirst $_[0] } print "just another "->ucfirst, "perl hacker,\n"->ucfirst'
Perl hacker,
Perl hacker,

(This is not a regression, as 5.14 gave ‘Can't modify ucfirst in
lvalue subroutine return’.)

So ‘fixing’ coresubs would not be a solution, but a workaround.

The solution therefore is for leavesublv to copy PADTMPs in
rvalue context.

Commit 80422e24c fixed this for potential lvalue list context (i.e.,
for(lvsub()) {...}), but it wasn’t sufficient.

11 years agoscope.c: Simplify and clarify comment
Father Chrysostomos [Wed, 25 Apr 2012 21:08:48 +0000 (14:08 -0700)]
scope.c: Simplify and clarify comment

This comment seems to imply that this code is just working around a
problem in gv.c, which we could simply correct there.  I’ve already
tried making the quoted code in gv.c handle *^H without a hash, but it
doesn’t actually solve the problem.  The real problem is that rv2hv
could also add a hash to *^H, via GvHVn, and that is simply not set up
to deal with autovivifying magic at all, and probably shouldn’t be.

Also, quoting a piece of code that occurs elsewhere is just asking for
it to drift apart.  By this time, the code in gv.c that is quoted in
scope.c is actually three times the length now, and looks completely
different.

11 years agoDon't warn about "ambiguous without parens" for ctrl-glob
Dagfinn Ilmari Mannsåker [Mon, 16 Apr 2012 00:05:52 +0000 (01:05 +0100)]
Don't warn about "ambiguous without parens" for ctrl-glob

This fixes the following bogus warning [perl #112456]:

  $ perl -e 'undef *^H'
  Warning: Use of "undef" without parentheses is ambiguous at -e line 1.

Compare to the non-warning variant:

    $ perl -e 'undef *{^H}'

11 years ago[perl #112418] Fix POD paragraph formatting
Father Chrysostomos [Wed, 25 Apr 2012 01:10:21 +0000 (18:10 -0700)]
[perl #112418] Fix POD paragraph formatting

There was no empty line before a verbatim paragraph, making it
not verbatim.

11 years agoIncrease $Hash::Util::VERSION to 0.12
Father Chrysostomos [Wed, 25 Apr 2012 01:01:50 +0000 (18:01 -0700)]
Increase $Hash::Util::VERSION to 0.12

11 years agoAdd subroutines hash_locked() and hashref_locked() to Hash::Util.
jkeenan [Mon, 23 Apr 2012 00:59:33 +0000 (20:59 -0400)]
Add subroutines hash_locked() and hashref_locked() to Hash::Util.

Make @EXPORT_OK, synopsis, and list of functions tested with
can_ok() consistent with one another.  Rationalize the way
functions are grouped within @EXPORT_OK and the other locations.
Add tests for hash_locked(), hashref_locked(), hash_unlocked() and
hashref_unlocked().  Add descriptions for several unit tests which
lacked them.

For RT #112126.

11 years agoFile::Find: typo
Father Chrysostomos [Wed, 25 Apr 2012 00:58:04 +0000 (17:58 -0700)]
File::Find: typo

11 years agoIndividual files may appear in list of directories to be searched.
jkeenan [Sat, 7 Apr 2012 00:20:59 +0000 (20:20 -0400)]
Individual files may appear in list of directories to be searched.

Document that, then demonstrate that with additional tests.

For RT #59750.

11 years agoIndividual files may appear in list of directories to be searched.
jkeenan [Fri, 6 Apr 2012 00:41:14 +0000 (20:41 -0400)]
Individual files may appear in list of directories to be searched.

Document that, then demonstrate that with additional tests.

For RT #59750.

11 years agoIncrease $File::Find::VERSION to 1.21
Father Chrysostomos [Wed, 25 Apr 2012 00:01:00 +0000 (17:01 -0700)]
Increase $File::Find::VERSION to 1.21

11 years ago[perl #112358] Storable: Don’t create RV with no refcnt
Father Chrysostomos [Tue, 24 Apr 2012 23:00:36 +0000 (16:00 -0700)]
[perl #112358] Storable: Don’t create RV with no refcnt

Otherwise assigning to it will cause the referent to be freed, because
nothing but Storable knows that it has no reference count.

Storable.xs was creating a new RV without increasing the refe-
rence count on the referent.  It was then using it to call the
STORABLE_freeze method on the object.  Since Perl passes arguments
by reference, it was possible to unref the reference by assigning to
$_[0] within STORABLE_freeze.  That would cause the object’s reference
count to go down.

11 years agoIncrease $Storable::VERSION to 2.35
Father Chrysostomos [Tue, 24 Apr 2012 23:00:13 +0000 (16:00 -0700)]
Increase $Storable::VERSION to 2.35

11 years agoRemove todo for UTF8 source filters
Father Chrysostomos [Tue, 24 Apr 2012 20:48:19 +0000 (13:48 -0700)]
Remove todo for UTF8 source filters

Source filters don’t really make sense on character streams.  They are
designed for streams of bytes coming straight from a file.  Things
stop making sense if you have ‘use utf8’ in a UTF-8 scalar (does that
mean double-decode?).

It’s for this reason that evalbytes respects source filters, while
eval does not.  (It doesn’t outside the unicode_eval feature, because
it was never really thought about and the implementation didn’t take
it into account, resulting in strange behaviour.  It doesn’t with the
unicode_eval feature, because it was intentionally prohibited.)

11 years ago[perl #112184] Handle $^N in Perl_magic_set
Father Chrysostomos [Tue, 24 Apr 2012 20:31:45 +0000 (13:31 -0700)]
[perl #112184] Handle $^N in Perl_magic_set

$^N is a magical variable, like $1 and $2, with the usual ‘sv’
magic.  So it is handled by Perl_magic_get and Perl_magic_set.  But
Perl_magic_set didn’t have a case for it, so it simply ignored it and
did nothing, like a tied variable with an empty STORE method.

Now assigning to $^N has the same affect as assigned to the numbered
variable to which it corresponds.  If there is no corresponding cap-
ture from the last match, or in the absence of regexp plugins, it
croaks with ‘Modification of a read-only value’.

11 years agoperldata: Consistent spaces after dots
Father Chrysostomos [Tue, 24 Apr 2012 06:03:17 +0000 (23:03 -0700)]
perldata: Consistent spaces after dots

11 years agoCopy call checker when cloning closure prototype
Father Chrysostomos [Tue, 24 Apr 2012 03:29:13 +0000 (20:29 -0700)]
Copy call checker when cloning closure prototype

Otherwise cv_set_call_checker has no effect inside an attribute han-
dler for a closure.

11 years ago[perl #111000] Let hv_store work on hint hashes
Father Chrysostomos [Mon, 23 Apr 2012 05:32:09 +0000 (22:32 -0700)]
[perl #111000] Let hv_store work on hint hashes

Magic attached to hash elements has its key stored differently depend-
ing on how it was supplied to hv_common.  hv_store passes a string/
length pair to hv_common, while hv_store_ent passes an SV.

magic_clearhint wasn’t able to handle string/length pairs, and only
worked with SVs, resulting in assertion failures or crashes.

This commit fixes magic_clearhint, so that XS code can use hv_store on
hint hashes.

11 years agomg.c:magic_clearhint: remove redundant PERL_UNUSED_ARG
Father Chrysostomos [Mon, 23 Apr 2012 05:27:50 +0000 (22:27 -0700)]
mg.c:magic_clearhint: remove redundant PERL_UNUSED_ARG

11 years agoXS-APItest/t/hash.t: comment typo
Father Chrysostomos [Mon, 23 Apr 2012 05:06:57 +0000 (22:06 -0700)]
XS-APItest/t/hash.t: comment typo

11 years agoIncrease $XS::APItest::VERSION to 0.39
Father Chrysostomos [Mon, 23 Apr 2012 05:05:24 +0000 (22:05 -0700)]
Increase $XS::APItest::VERSION to 0.39

11 years agopp_ctl.c:pp_goto: Don’t repeat yourself
Father Chrysostomos [Mon, 23 Apr 2012 03:35:43 +0000 (20:35 -0700)]
pp_ctl.c:pp_goto: Don’t repeat yourself

No need to say DIE three times.

11 years agoProduce the right error for goto "\0"
Father Chrysostomos [Mon, 23 Apr 2012 03:34:24 +0000 (20:34 -0700)]
Produce the right error for goto "\0"

Since we have supported for embedded nulls in strings, we shouldn’t
be using if(*label) to see whether label has a non-zero length.

It’s probably not possible to get a null into a label, but we should
still say ‘can’t find’ rather than ‘must have’ in that case.

11 years ago[perl #111794] Make goto "" like goto ${\""}
Father Chrysostomos [Mon, 23 Apr 2012 03:19:15 +0000 (20:19 -0700)]
[perl #111794] Make goto "" like goto ${\""}

The logic was written in such a way that goto "" just happened to slip
past all the checks and cause pp_goto to return NULL for the next op,
which means the end of the program.

goto ${\""} dies with ‘goto must have label’, so goto ""
should as well.

This also adds other tests for that error, which was apparently
untested till now.

11 years agoTeach B::Concise about UTF8 labels
Father Chrysostomos [Mon, 23 Apr 2012 03:00:14 +0000 (20:00 -0700)]
Teach B::Concise about UTF8 labels

11 years agoIncrease $B::Concise::VERSION to 0.90
Father Chrysostomos [Mon, 23 Apr 2012 02:58:26 +0000 (19:58 -0700)]
Increase $B::Concise::VERSION to 0.90

11 years agoCorrections to AUTHORS should go to perlbug
Father Chrysostomos [Sun, 22 Apr 2012 22:47:38 +0000 (15:47 -0700)]
Corrections to AUTHORS should go to perlbug

11 years agoregen/opcodes: Rmv evalonce comment
Father Chrysostomos [Sun, 22 Apr 2012 06:28:51 +0000 (23:28 -0700)]
regen/opcodes: Rmv evalonce comment

This goes all the way back to when perl 5.0 was being polished up.
The idea behind evalonce is that eval "constant string" should be
optimisable by being compiled ahead of time, just like eval { ... }.
But this could never work properly, because BEGIN blocks would only
fire once.  Also, eval '$x .. $y' is an easy way to create two separ-
ate flip-flops.  There are undoubtedly many other reasons why this
could never work.

So there is no reason to keep this comment any longer, as it is not
(or should not be) a to-do item.

11 years agopp_hot.c:pp_entersub: Rmv comment about setting PL_compcv
Father Chrysostomos [Sun, 22 Apr 2012 06:25:33 +0000 (23:25 -0700)]
pp_hot.c:pp_entersub: Rmv comment about setting PL_compcv

PL_compcv is meant to point to the currently compiling sub, even dur-
ing an eval’s run time.  (See commit 676a678.)  Therefore, this com-
ment’s suggestion is incorrect.

11 years agoRemoved a redundant 'once'
Alan Haggai Alavi [Tue, 28 Feb 2012 15:48:58 +0000 (21:18 +0530)]
Removed a redundant 'once'

11 years agoFix non-GCC compilation
Father Chrysostomos [Mon, 21 May 2012 22:59:37 +0000 (15:59 -0700)]
Fix non-GCC compilation

I mistakenly thought XPUSHs(...) was an expression.  Now it is.

11 years ago[Merge] Filetest refactoring
Father Chrysostomos [Mon, 21 May 2012 18:35:34 +0000 (11:35 -0700)]
[Merge] Filetest refactoring

This changes the way filetests handle the stack, allowing for sig-
nificant simplification of the code.  It also fixes a bug with ‘-t
bareword’ writing one past the end of the stack.

11 years agopp_sys.c:S_try_amagic_ftest: Remove SPAGAIN
Father Chrysostomos [Thu, 29 Mar 2012 22:58:56 +0000 (15:58 -0700)]
pp_sys.c:S_try_amagic_ftest: Remove SPAGAIN

Overloading pushes a new stack to prevent the need for this.

11 years agopp_sys.c: Remove SPAGAIN after my_(l)stat_flags
Father Chrysostomos [Thu, 29 Mar 2012 22:58:12 +0000 (15:58 -0700)]
pp_sys.c: Remove SPAGAIN after my_(l)stat_flags

As of the previous commit, these two functions no longer affect
the stack.

11 years agoMove stack extension into FT_* macros
Father Chrysostomos [Thu, 29 Mar 2012 22:55:22 +0000 (15:55 -0700)]
Move stack extension into FT_* macros

Every filetest operator with the OPf_REF flag set has to extend the
stack for the argument.  One operator was missing it until the previ-
ous commit.  Since we have special return macros for these operators,
put the stack extension there, to avoid a repeat of this type of mis-
take and reduce repetitiveness.

11 years agoMake -t BAREWORD extend the stack
Father Chrysostomos [Thu, 29 Mar 2012 21:52:45 +0000 (14:52 -0700)]
Make -t BAREWORD extend the stack

It appears always to have been this way.  It was writing past the end
of the stack.

11 years agopp.h: Missing macro parentheses
Father Chrysostomos [Thu, 29 Mar 2012 21:50:45 +0000 (14:50 -0700)]
pp.h: Missing macro parentheses

This wasn’t affecting anything, but was a bug waiting to happen.

11 years agoMake filetest ops fiddle the stack less
Father Chrysostomos [Thu, 29 Mar 2012 21:49:58 +0000 (14:49 -0700)]
Make filetest ops fiddle the stack less

See commits 8db8f6b697e and d6642e439 for the background.

Instead of sometimes popping items off the stack for filetest operat-
ors and sometimes not, just leave the item on the stack and use SETs
to return the value (which the overload code was doing already any-
way).  This simplifies the code and allows d6642e439 to be reverted.
It also makes things theoretically faster, simply because there is
less stuff happening.

11 years agomktables: Defer accepting Unicode's BELL character
Karl Williamson [Mon, 21 May 2012 13:53:50 +0000 (07:53 -0600)]
mktables: Defer accepting Unicode's BELL character

As soon as 5.17 started, this created a failing test, which was to
remind us that the deprecation cycle was over, and that the name BELL
should be now used for U+1F514 instead of U+0007.  See commit messages
for 3ffed8c228f4a59b1527ae7ed584ca21386420f7 and
10914c783fe2ea3ee73a870599f30cedb7de96d0

This change puts off the failure unless we try to ship a 5.18 without
dealing with the issue.  I'm not quite ready to deal with it, but will
do so shortly, long before 5.18.

11 years agoupdate the release schedule: 5.16 is 2012-2013
Ricardo Signes [Mon, 21 May 2012 13:03:13 +0000 (09:03 -0400)]
update the release schedule: 5.16 is 2012-2013

11 years agoupdate the release schedule for 5.16, 5.17, 5.18
Ricardo Signes [Mon, 21 May 2012 00:47:49 +0000 (20:47 -0400)]
update the release schedule for 5.16, 5.17, 5.18

11 years agothere are no longer any scheduled 5.12 releases
Ricardo Signes [Mon, 21 May 2012 00:40:52 +0000 (20:40 -0400)]
there are no longer any scheduled 5.12 releases

11 years agoadd the 5.17 feature bundle
Ricardo Signes [Mon, 21 May 2012 00:15:36 +0000 (20:15 -0400)]
add the 5.17 feature bundle