| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
[DELTA]
5.0150037 Sun 8 Jan 2012 21:24:39 +0100
* Better XML parsing recommendations (apeiron)
* Remove various old questions & update a few (ranguard)
* Change auto generate of questions a bit (ranguard)
* Autogenerate question index in perlfaq.pod (doherty)
* Cleanups / typos, updating nested expressions (dami, reviewed by schwern)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This little snippet:
sub TIESCALAR{bless[]}
sub STORE{}
tie $^H{foo}, '';
$^H{foo} = 1;
delete $^H{foo};
dies with ‘Can't locate object method "DELETE"...’.
This bug was introduced for %^H by commit b3ca2e834c, but it is actu-
ally an older bug that already affected %ENV before that.
Clear-magic on a scalar is only called when it is an element of a mag-
ical aggregate.
For hashes, this clear-magic is called whenever the hash itself
is RMAGICAL.
Tied scalars and elements of tied aggregates use the same magic vta-
ble, under the assumption that mg_clear will never be called on a tied
scalar. That assumption is wrong.
Commit b3ca2e834c is the one that made %^H magical, which is why it
caused this problem for %^H.
The obvious solution, giving tied scalars their own vtable, is not as
simple as it sounds, because then tied scalars are no longer RMAGICAL,
and at least some of the tie code assumes that they are.
So the easiest fix is to skip the DELETE call in Perl_magic_clearpack
if the type of magic is PERL_MAGIC_tiedscalar.
|
| |
|
|
|
|
|
|
|
| |
It can return via 'goto &sub', but not via 'goto LABEL'.
The docs originally just said 'via goto'
See [perl #44367].
|
| |
|
|
|
|
|
| |
It's now twelve years since Y2K, so the documentation should not make
such a fuss about it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Tue Mar 08 07:26:35 2011, thospel wrote:
> #!/usr/bin/perl -l
> use Data::Dumper;
> use Scalar::Util qw(weaken);
> our @ISA;
>
> for (1..2) {
> @ISA = qw(Foo);
> weaken($a = \@ISA);
> weaken($a = \$ISA[0]);
> print STDERR Dumper(\@ISA);
> }
>
> This prints:
> $VAR1 = [
> 'Foo'
> ];
> $VAR1 = [
> 'Foo',
> \$VAR1->[0]
> ];
>
> So the first time it's the expected @ISA, but the second time round it
> automagically added a reference to to the first ISA element
>
> (bug also exists in blead)
Shorter:
#!/usr/bin/perl -l
use Scalar::Util qw(weaken);
weaken($a = \@ISA);
@ISA = qw(Foo);
use Devel::Peek; Dump \@ISA;
weaken($a = \$ISA[0]);
print scalar @ISA; # prints 2
The dump shows the problem. backref magic is being copied to the ele-
ment. Put the magic in a different order, and everything is fine:
#!/usr/bin/perl -l
use Scalar::Util qw(weaken);
weaken($a = $b = []);
*ISA = $a;
@ISA = qw(Foo);
use Devel::Peek; Dump \@ISA;
weaken($a = \$ISA[0]);
print scalar @ISA; # prints 2
This code in av_store is so wrong:
if (SvSMAGICAL(av)) {
const MAGIC* const mg = SvMAGIC(av);
if (val != &PL_sv_undef) {
sv_magic(val, MUTABLE_SV(av), toLOWER(mg->mg_type), 0, key);
}
if (PL_delaymagic && mg->mg_type == PERL_MAGIC_isa)
PL_delaymagic |= DM_ARRAY_ISA;
else
mg_set(MUTABLE_SV(av));
}
It doesn’t follow the magic chain at all. So anything magic could get
attached to the @ISA array, and that will be copied to the element
instead of isa magic.
Notice that MUTABLE_SV(av) is the second argument to sv_magic, so
mg->mg_obj for the element always points back to the array.
Since backref magic’s mg->mg_obj points to the backrefs array, @ISA
ends up being used as this element’s backrefs array.
What if arylen_p gets copied instead? Let’s see:
$#ISA = -1;
@ISA = qw(Foo);
$ISA[0] = "Bar";
main->ber;
sub Bar::ber { warn "shave" }
__END__
Can't locate object method "ber" via package "main" at - line 7.
I’ve fixed this by making av_store walk the magic chain, copying any
magic for which toLOWER(mg->mg_type) != mg->mg_type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In pp_undef and pp_aassign, we should put the av or hv that is being
cleared on the mortals stack (with an increased refcount), so that
destructors fired during the clearing do not free the av or hv.
I was going to put this in av_undef, etc., but pp_aassign also needs
to access the aggregate after clearing it. We still get a crash with
that approach.
Putting the aggregate on the mortals stack in av_undef, av_clear and
h_freeentries would work, too, but might cause the aggregate to leak
too far. That may cause problems, e.g., if it is %^H, because it may
last until the end of the current compilation unit.
Directly inside a runloop (in a pp function), it should be OK to use
the mortals stack, as it *will* be cleared ‘soon’. This seems the
least intrusive approach.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I couldn't stand the way the documenation for `split' was written;
it felt like a kludge of broken English dumped into a messy pile by
several people, each of whom was unaware of the other's work.
This variation completes sentences, adds new ones, rearranges ideas,
expands on ideas, simplifies and unifies examples, and includes more
cross references.
While the original text seemed to be written in a way that touched upon
the arguments in reverse order (which did have a hint of elegance), this
version attempts to provide the reader with the most useful information
upfront.
Thanks to Brad Baxter and Thomas R. Sibley for their constructive
criticism.
[Modified by the committer to incorporate suggestions from Aristotle
Pagaltzis and Tom Christiansen.]
|
| |
|
|
|
|
| |
do not test them as if they were Pod we ship
|
| |
|
|
|
|
|
| |
These were commented out temporarily during development.
I forgot to uncomment them before committing.
|
|
|
|
|
|
|
| |
It used to crash if the PVX buffer happened to be null.
If the PVX buffer happened to be left over from before,
it would use that instead of the numeric value, even for
!SvPOK scalars.
|
|
|
|
| |
Otherwise, it won’t work with an overloaded object.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Otherwise we get assertion failures.
In fact, since seeking might be just for reading, we can’t coerce and
SvGROW either.
In fact, since the scalar might be modified between seek and write,
there is no *point* in SvGROW during seek, even for SvPOK scalars.
PerlIO::scalar assumes in too many places that the scalar it is using
is its own private scalar that nothing else can modify. Nothing could
be farther from the truth.
This commit moves the zero-fill that usually happens when seeking past
the end from seek to write. During a write, if the current position
is past the end of the string, the intervening bytes are zero-filled
at that point, since the seek hasn’t done it.
|
|
|
|
|
|
| |
This adds the index entries to perlsyn that were removed in
the previous commit, and mentions in perlsyn that the ellipsis
is also called a triple-dot.
|
|
|
|
|
| |
This has been superseded by c2f1e229, which adds it
to perlsyn.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Here is a patch against the second patch,
fixing typos reported to me.
|
|
|
|
|
|
| |
As previously explained, this patch against perlsyn
is part and parcel of the previous one against perlop
(two commits ago; perl #90906).
|
|
|
|
|
| |
Here is a patch against the first patch,
fixing typos reported to me.
|
|
|
|
|
|
|
| |
The thrust of this patch is to move the description of the ~~
operator into perlop where it properly belongs; given and when
remain relegated to perlsyn. This is also (nearly) the first-ever
set of examples for the smartmatch operator. Staggerment.
|
|
|
|
|
|
|
|
|
|
| |
[DELTA]
Changes for 0.9116 Thu Jan 5 22:45:06 2012
================================================
* add NAME headings in modules with POD, Debian
Lintian fixes, http://bugs.debian.org/65045
* Implement reload command in the shell
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
[dagolden bumped $VERSION and added ambs to the AUTHORS file]
Signed-off-by: David Golden <dagolden@cpan.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This eliminates the error ‘sort is now a reserved word’, which was
added for the sake of code that does close(sort) at about the time
that sort became a keyword.
As Tom Christiansen pointed out, it has been long enough.
This error only occurred with ) or ; after the keyword. In other
cases with no arguments, like {sort} and (sort,0), it was treated as
an empty list.
So this commit makes it follow that.
Since the tests triggered it, this commit also fixes a crash caused by
commit 540dd770, which, when seeing whether it can optimise something
like ‘@a = sort @a’, assumes that there is something after the sort,
and crashes when there isn’t, as in {@a = sort}.
|
|
|
|
|
|
|
|
|
|
|
| |
This reminds users to put version guards on their neologisms.
We're changing Perl's basic sytnax a great deal, and users need
to understand that to use those syntactic changes will cause
weird errors if they don't put this sort of thing in. This
sort of thing really should have gone in all along. Let's
please continue what I have begun.
I also fixed the order: untie does not precede unshift. :(
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
return and leavesub, for speed, were not copying temp variables with a
refcount of 1, which is fine as long as the fact that it was not cop-
ied is not observable.
With magical variables, that *can* be observed, so we have to forego
the optimisation and copy the variable if it’s magical.
This obviously applies only to rvalue subs.
|
|
|
|
|
| |
If we are going to skip all set-magic when restoring a localised tied
$_, there’s no point in looping through it.
|
|
|
|
|
|
| |
$#a > $[ is a legitimate use of $[ with >. So warning in that case
is not nice. Most version comparisons are done with constants, like
5.006, so warn only for constants.
|
|
|
|
|
|
|
|
| |
installperl now requires Porting/pod_lib.pl, which uses Digest::MD5,
which means we need something that can do dynamic loading (or has
extensions statically linked in). But it doesn't really matter
because presumably we wouldn't be installing Perl if we hadn't
built it, so use the perl we've built rather than miniperl.
|
| |
|
| |
|
|
|
|
|
| |
This commit finishes the work of 658a9f3 by skipping FETCH as well as
STORE during local($_).
|
|
|
|
| |
This was mentioned in ticket #75156.
|