Father Chrysostomos [Tue, 22 May 2012 05:53:26 +0000 (22:53 -0700)]
perldelta for undef *_, &CORE::time crash
Father Chrysostomos [Tue, 22 May 2012 05:52:11 +0000 (22:52 -0700)]
perldelta for while(each %h)
Father Chrysostomos [Tue, 22 May 2012 05:50:41 +0000 (22:50 -0700)]
perldelta for pos %foo
Father Chrysostomos [Tue, 22 May 2012 05:49:31 +0000 (22:49 -0700)]
perldelta for ‘no overload "invalid"’ warnings
Father Chrysostomos [Tue, 22 May 2012 05:48:29 +0000 (22:48 -0700)]
perldelta for overload fallback inheritance
Father Chrysostomos [Tue, 22 May 2012 05:47:24 +0000 (22:47 -0700)]
perldelta for overload caching bug fixes
Father Chrysostomos [Tue, 22 May 2012 05:44:35 +0000 (22:44 -0700)]
perldelta for changed AMAGIC table mechanism
Father Chrysostomos [Tue, 22 May 2012 05:36:55 +0000 (22:36 -0700)]
perldelta for File::stat’s -p
Father Chrysostomos [Tue, 22 May 2012 05:32:17 +0000 (22:32 -0700)]
perldelta for vec w/2GB offsets
Father Chrysostomos [Tue, 22 May 2012 05:30:31 +0000 (22:30 -0700)]
perldelta for File::stat -r warning
Father Chrysostomos [Tue, 22 May 2012 05:24:00 +0000 (22:24 -0700)]
perldelta for method{}
Father Chrysostomos [Tue, 22 May 2012 05:20:41 +0000 (22:20 -0700)]
perldelta for CORE:: and TARG
Father Chrysostomos [Tue, 22 May 2012 05:15:33 +0000 (22:15 -0700)]
perldelta for undef *^H non-ambiguity
Father Chrysostomos [Tue, 22 May 2012 05:12:24 +0000 (22:12 -0700)]
perldelta for Hash::Util changes
Father Chrysostomos [Tue, 22 May 2012 05:02:20 +0000 (22:02 -0700)]
perldelta for modding $_[0] in STORABLE_freeze
Father Chrysostomos [Tue, 22 May 2012 05:01:02 +0000 (22:01 -0700)]
perldelta for setting $^N
Father Chrysostomos [Tue, 22 May 2012 04:59:31 +0000 (21:59 -0700)]
perldelta for copying call checkers to closures
Father Chrysostomos [Tue, 22 May 2012 04:57:11 +0000 (21:57 -0700)]
perldelta for hvstore and %^H
Father Chrysostomos [Tue, 22 May 2012 04:55:36 +0000 (21:55 -0700)]
perldelta for goto "\0"
Father Chrysostomos [Tue, 22 May 2012 04:52:16 +0000 (21:52 -0700)]
perldelta for goto ""
Father Chrysostomos [Tue, 22 May 2012 03:42:26 +0000 (20:42 -0700)]
Increase $Pod::Functions::VERSION to 1.06
The previous commit modified Pod::Functions by modifying perlfunc.pod,
but we have things set up in such a way that cmp_version.t won’t
see it.
Father Chrysostomos [Tue, 22 May 2012 03:41:14 +0000 (20:41 -0700)]
Remove double space from Pod::Functions descr
Father Chrysostomos [Tue, 15 May 2012 22:01:53 +0000 (15:01 -0700)]
Consistent spaces after dots in CORE.pod
Father Chrysostomos [Sun, 13 May 2012 06:10:58 +0000 (23:10 -0700)]
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.
Father Chrysostomos [Sun, 13 May 2012 01:43:13 +0000 (18:43 -0700)]
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.
Father Chrysostomos [Sat, 12 May 2012 03:27:46 +0000 (20:27 -0700)]
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.
Father Chrysostomos [Sat, 12 May 2012 03:13:01 +0000 (20:13 -0700)]
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! :-)
Father Chrysostomos [Thu, 3 May 2012 16:12:03 +0000 (09:12 -0700)]
override.t: Remove obsolete comment
Father Chrysostomos [Thu, 3 May 2012 03:37:12 +0000 (20:37 -0700)]
require_errors.t: Test <> error
Father Chrysostomos [Thu, 3 May 2012 03:36:20 +0000 (20:36 -0700)]
Allow require_errors.t to be run from the top level
Father Chrysostomos [Tue, 1 May 2012 01:04:23 +0000 (18:04 -0700)]
Remove OPpCONST_WARNING from B::Concise
Father Chrysostomos [Tue, 1 May 2012 00:46:48 +0000 (17:46 -0700)]
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.
Father Chrysostomos [Mon, 30 Apr 2012 04:16:51 +0000 (21:16 -0700)]
coreamp.t: rename badly-named tests
Father Chrysostomos [Sun, 29 Apr 2012 18:11:15 +0000 (11:11 -0700)]
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.
Father Chrysostomos [Sun, 29 Apr 2012 06:46:03 +0000 (23:46 -0700)]
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.
Father Chrysostomos [Sun, 29 Apr 2012 06:45:37 +0000 (23:45 -0700)]
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.
Father Chrysostomos [Sun, 29 Apr 2012 06:43:42 +0000 (23:43 -0700)]
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.
Father Chrysostomos [Sun, 29 Apr 2012 04:27:40 +0000 (21:27 -0700)]
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.)
Father Chrysostomos [Sat, 28 Apr 2012 07:16:25 +0000 (00:16 -0700)]
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.
Father Chrysostomos [Sun, 22 Apr 2012 01:55:38 +0000 (18:55 -0700)]
cproto.t: Add tests for BEGIN, etc.
Father Chrysostomos [Sun, 22 Apr 2012 01:30:35 +0000 (18:30 -0700)]
Make cproto.t more stringent
It was allowing prototype() to return undef where an empty string
was expected.
Father Chrysostomos [Sat, 12 May 2012 20:03:54 +0000 (13:03 -0700)]
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 (;\[$*]).
Eric Brine [Tue, 22 May 2012 03:23:29 +0000 (20:23 -0700)]
[perl #112692] perlfunc: waitpid takes two args
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!
Father Chrysostomos [Mon, 21 May 2012 21:15:53 +0000 (14:15 -0700)]
Correct Peek.t to account for flag changes
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.
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);
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.
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.
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*!
Father Chrysostomos [Sat, 19 May 2012 17:12:00 +0000 (10:12 -0700)]
overload.pm: This warning exists now
Father Chrysostomos [Sat, 19 May 2012 06:17:22 +0000 (23:17 -0700)]
Update overload docs
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.
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.
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.
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.
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.
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.
Father Chrysostomos [Sat, 19 May 2012 00:00:49 +0000 (17:00 -0700)]
Make ‘no overload’ also warn about invalid args
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.
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.
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"’.
Father Chrysostomos [Fri, 18 May 2012 21:19:28 +0000 (14:19 -0700)]
Correct comment typo in overload.t
Father Chrysostomos [Fri, 18 May 2012 21:00:03 +0000 (14:00 -0700)]
Increase $overload::VERSION to 1.19
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.
Father Chrysostomos [Fri, 18 May 2012 20:37:40 +0000 (13:37 -0700)]
overload.t: Move some tests above ‘keep last’ test
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.
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.
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.
Father Chrysostomos [Fri, 18 May 2012 16:25:26 +0000 (09:25 -0700)]
sv.h: define SvAMAGIC in terms of HvAMAGIC
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.
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.
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.
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.
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. :-)
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.
jkeenan [Sat, 5 May 2012 14:50:40 +0000 (10:50 -0400)]
Correct spelling error reported by rrt.
For RT #112772.
Moritz Lenz [Mon, 30 Apr 2012 08:21:49 +0000 (10:21 +0200)]
[perlfunc] fix usage of wait
Tony Cook [Sat, 31 Mar 2012 01:06:37 +0000 (12:06 +1100)]
document the return value of pipe()
Tony Cook [Fri, 30 Mar 2012 10:18:39 +0000 (21:18 +1100)]
[perl #111638] fix -p on File::stat objects
Tony Cook [Tue, 20 Mar 2012 06:35:42 +0000 (17:35 +1100)]
[perl #111638] TODO for -p on a File::stat object
Father Chrysostomos [Mon, 21 May 2012 21:43:23 +0000 (14:43 -0700)]
checkAUTHORS.pl: Another address for Matthew Horsfall
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".
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.
Lukas Mai [Mon, 2 Apr 2012 17:27:46 +0000 (19:27 +0200)]
document behavior of duplicate keys in hash assignment
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
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.
Tony Cook [Fri, 23 Mar 2012 22:36:27 +0000 (23:36 +0100)]
[rt #111730] TODO tests for vec() with large offsets
Tony Cook [Fri, 23 Mar 2012 12:11:48 +0000 (13:11 +0100)]
[rt #100514] regression test for read() with a 2Gib offset
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
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
Tony Cook [Mon, 12 Mar 2012 08:39:14 +0000 (19:39 +1100)]
[rt #111640] TODO tests for warnings from -X on File::stat
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.
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.
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.
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.
Father Chrysostomos [Tue, 1 May 2012 00:07:31 +0000 (17:07 -0700)]
Correct comment typo in op.h
Father Chrysostomos [Sat, 28 Apr 2012 21:33:17 +0000 (14:33 -0700)]
DosGlob.pm: Fix pod syntax
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.
Father Chrysostomos [Fri, 27 Apr 2012 20:18:07 +0000 (13:18 -0700)]
Increase $File::DosGlob::VERSION to 1.07