This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
12 years agoIncrease perl5db.pl’s version to 1.35
Father Chrysostomos [Tue, 6 Dec 2011 21:17:56 +0000 (13:17 -0800)]
Increase perl5db.pl’s version to 1.35

12 years agocmpVERSION.pl: Check lib/*.pl, too
Father Chrysostomos [Tue, 6 Dec 2011 21:17:13 +0000 (13:17 -0800)]
cmpVERSION.pl: Check lib/*.pl, too

12 years agoUpgrade to Safe 2.30
Rafael Garcia-Suarez [Tue, 6 Dec 2011 21:02:21 +0000 (22:02 +0100)]
Upgrade to Safe 2.30

[rt.cpan.org #72872] Fix bad interaction with loading
Tie::Hash::NamedCapture on perls >= 5.14.0

12 years agoperlfunc/substr: Don’t mention dev release
Father Chrysostomos [Tue, 6 Dec 2011 17:24:23 +0000 (09:24 -0800)]
perlfunc/substr: Don’t mention dev release

Dev releases are an artefact of the developement process, so mentioning
them is not helpful to the average reader.

12 years agoDocument substr lv with negative offset
Father Chrysostomos [Tue, 6 Dec 2011 17:22:59 +0000 (09:22 -0800)]
Document substr lv with negative offset

12 years agoUpdate eval docs for list context fix
Father Chrysostomos [Tue, 6 Dec 2011 16:44:43 +0000 (08:44 -0800)]
Update eval docs for list context fix

12 years ago[perl #80630] Make eval"" return empty list for syntax errors
Father Chrysostomos [Sat, 19 Nov 2011 19:13:24 +0000 (11:13 -0800)]
[perl #80630] Make eval"" return empty list for syntax errors

Up till now, eval"" in list context was returning a list containing
undef for syntax errors and an empty list for run-time errors.

12 years agoDon’t LEAVE_with_name("evalcomp") for syntax errors
Father Chrysostomos [Tue, 6 Dec 2011 16:34:15 +0000 (08:34 -0800)]
Don’t LEAVE_with_name("evalcomp") for syntax errors

In S_doeval, if yystatus == 0 but there have been parser errors, then
there will be an extra scope on the scope stack inside the evalcomp
scope, causing an assertion failure with LEAVE_with_name("evalcomp").

This can happen with eval(q|""!=!~//|), which is a reduced version of
an eval in SNMP::Trapinfo’s test suite.

Under non-debugging builds, everything would have worked anyway,
as the LEAVE_with_name("evalcomp") would have left the scope
inside evalcomp.

Since POPBLOCK pops away the savestack markers on the scope stack, it
is not actually necessary to do LEAVE_with_name("evalcomp") at all
when there is a syntax error.

12 years ago|| instead of "or" (perl#78708)
Alexandr Ciornii [Tue, 6 Sep 2011 21:30:46 +0000 (00:30 +0300)]
|| instead of "or" (perl#78708)

12 years agoPut optimised substr assignment in void context
Father Chrysostomos [Mon, 5 Dec 2011 20:55:57 +0000 (12:55 -0800)]
Put optimised substr assignment in void context

24fcb59fc optimised substr assignment in void context down to four-arg
substr, causing considerable speed-up, but did not take the extra step
of marking the substr op itself as being in void context, so pp_substr
was still constructing a return value.  This commit speed things up
just a tiny bit more.

12 years agofix some foibles in perlintro.pod
Ricardo Signes [Mon, 5 Dec 2011 03:47:24 +0000 (22:47 -0500)]
fix some foibles in perlintro.pod

1. add a missing "of"
2. add a post-dot space missed in e8b5ae5
3. get the motto "right" as per common usage

12 years agoUpdate IO-Compress to CPAN version 2.045
Chris 'BinGOs' Williams [Sun, 4 Dec 2011 20:55:58 +0000 (20:55 +0000)]
Update IO-Compress to CPAN version 2.045

  [DELTA]

  2.045 3 December 2011

      * Restructured IO::Compress::FAQ.pod

12 years agoUpdate Compress-Raw-Zlib to CPAN version 2.045
Chris 'BinGOs' Williams [Sun, 4 Dec 2011 20:48:57 +0000 (20:48 +0000)]
Update Compress-Raw-Zlib to CPAN version 2.045

  [DELTA]

  2.045 3 December 2011

      * Moved FAQ.pod into Zlib.pm

12 years agoUpdate Compress-Raw-Bzip2 to CPAN version 2.045
Chris 'BinGOs' Williams [Sun, 4 Dec 2011 20:45:37 +0000 (20:45 +0000)]
Update Compress-Raw-Bzip2 to CPAN version 2.045

  [DELTA]

  2.045 3 December 2011

      * Moved FAQ.pod to IO::Compress

12 years agoAdjust substr offsets when using, not when creating, lvalue
Father Chrysostomos [Sun, 4 Dec 2011 18:47:40 +0000 (10:47 -0800)]
Adjust substr offsets when using, not when creating, lvalue

When substr() occurs in potential lvalue context, the offsets are
adjusted to the current string (negative being converted to positive,
lengths reaching beyond the end of the string being shortened, etc.)
as soon as the special lvalue to be returned is created.

When that lvalue is assigned to, the original scalar is stringified
once more.

That implementation results in two bugs:

1) Fetch is called twice in a simple substr() assignment (except in
void context, due to the special optimisation of commit 24fcb59fc).

2) These two calls are not equivalent:

$SIG{__WARN__} = sub { warn "w ",shift};
sub myprint { print @_; $_[0] = 1 }
print substr("", 2);
myprint substr("", 2);

The second one dies.  The first one only warns.  That’s mean.  The
error is also wrong, sometimes, if the original string is going to get
longer before the substr lvalue is actually used.

The behaviour of \substr($str, -1) if $str changes length is com-
pletely undocumented.  Before 5.10, it was documented as being unreli-
able and subject to change.

What this commit does is make the lvalue returned by substr remember
the original arguments and only adjust the offsets when the assign-
ment happens.

This means that the following now prints z, instead of xyz (which is
actually what I would expect):

$str = "a";
$substr = \substr($str,-1);
$str = "xyz";
print $substr;

12 years agoClarify docs for sv_usepvn_flags
Father Chrysostomos [Sat, 3 Dec 2011 19:02:32 +0000 (11:02 -0800)]
Clarify docs for sv_usepvn_flags

Note that the string must be the start of a mallocked block of memory,
and not a pointer to the middle of it.

12 years agoOn AIX, avoid a shell pipepline by making makedef.pl sort case insenitively.
Nicholas Clark [Fri, 25 Nov 2011 17:16:35 +0000 (18:16 +0100)]
On AIX, avoid a shell pipepline by making makedef.pl sort case insenitively.

Previously the Makefile piped the output of makedef.pl to sort. This had the
side effect of ignoring the exit code from makedef.pl, as make could only
see the exit code of the last command in the pipeline. This concealed the
causes of the parallel make failure when makedef.pl was missing a dependency
on Config.pm

12 years agoSimplify S_parse_body() by calling S_usage() and S_minus_v() directly.
Nicholas Clark [Thu, 24 Nov 2011 21:34:43 +0000 (22:34 +0100)]
Simplify S_parse_body() by calling S_usage() and S_minus_v() directly.

Previously the code for "--help" and "--version" set a local variable to a
string corresponding to the single character option ("h" or "v"
respectively), then restarted the option parsing code, which would then call
into Perl_moreswitches(), which would then use a switch statement to
dispatch to the final code.

This is not as clear as it could be.

12 years agoBreak the -v code out from Perl_moreswitches() into S_minus_v().
Nicholas Clark [Thu, 24 Nov 2011 20:40:40 +0000 (21:40 +0100)]
Break the -v code out from Perl_moreswitches() into S_minus_v().

12 years agoRefactor S_usage() to take 0 parameters and exit directly().
Nicholas Clark [Thu, 24 Nov 2011 20:28:27 +0000 (21:28 +0100)]
Refactor S_usage() to take 0 parameters and exit directly().

This simplifies the code, as it's only called from one spot, in
Perl_moreswitches().

12 years agoUpdate IO-Compress to CPAN version 2.044
Chris 'BinGOs' Williams [Sat, 3 Dec 2011 23:59:33 +0000 (23:59 +0000)]
Update IO-Compress to CPAN version 2.044

  [DELTA]

  2.044 2 December 2011

      * Moved FAQ.pod under the lib directory so it can get installed

      * Added bin/zipdetails

      * IO::Compress::Zip
        - In one-shot mode enable Zip64 mode if the input file/buffer
          >= 0xFFFFFFFF bytes.

      * IO::Compress::FAQ
        - Updates

12 years agoUpdate Compress-Raw-Zlib to CPAN version 2.044
Chris 'BinGOs' Williams [Sat, 3 Dec 2011 23:07:58 +0000 (23:07 +0000)]
Update Compress-Raw-Zlib to CPAN version 2.044

  [DELTA]

  2.044 2 December 2011

      * Moved FAQ.pod under the lib directory so it can get installed

12 years agoUpdate Compress-Raw-Bzip2 to CPAN version 2.044
Chris 'BinGOs' Williams [Sat, 3 Dec 2011 23:00:35 +0000 (23:00 +0000)]
Update Compress-Raw-Bzip2 to CPAN version 2.044

  [DELTA]

  2.044 2 December 2011

      * Moved FAQ.pod under the lib directory so it can get installed

12 years agoRemove the VMS-specific private len in S_mayberelocate.
Craig A. Berry [Sat, 3 Dec 2011 21:55:26 +0000 (15:55 -0600)]
Remove the VMS-specific private len in S_mayberelocate.

This particular C<STRLEN len;> came along almost 15 years ago, way
back in aa6893958c2b.  Back then it was a plain and simple block
scope variable.  But now this code lives in a function that takes
as an argument a variable of the same name and having the same
meaning (i.e., the length of the directory name to be added to
@INC).  Someone looking only at the argument list might reasonably
expect to be able to use len (though luckily there are no subsequent
uses of it currently).  So we really ought to update that len rather
than create our own when we hijack the directory name to make our
unixified version of it.

12 years agoRemove SvTAINT from sv_sethek
Father Chrysostomos [Sat, 3 Dec 2011 17:36:38 +0000 (09:36 -0800)]
Remove SvTAINT from sv_sethek

This was copied from sv_usepvn_flags in commit 58b643af9.  It is
unnecessary, and probably incorrect, as heks are not tainted.

Why sv_sethek used sv_usepvn_flags to begin with I don’t know, but I
imagine it was for brevity’s sake.  This code was ultimately derived
from newSVhek, which doesn’t use sv_usepvn_flags.  Because of that,
and because it is now far enough removed from sv_usepvn_flags, I have
removed the comment referring to it.

12 years agoperl -d bugfixes and tests
Shlomi Fish [Sat, 3 Dec 2011 14:56:53 +0000 (06:56 -0800)]
perl -d bugfixes and tests

This patch fixes some bugs in "perl -d" (see ticket #104820) and adds
some regression tests (for the bugfixes and for better test coverage).

12 years agoStop calling sv_usepvn_flags from sv_sethek
Peter Martini [Sat, 3 Dec 2011 12:01:44 +0000 (07:01 -0500)]
Stop calling sv_usepvn_flags from sv_sethek

sv_usepvn_flags assumes that ptr is at the head of a block
of memory allocated by malloc.  If perl's malloc is in use,
the data structures malloc uses and the data allocated for
perl are intermixed, and accounting done by malloced_size
in sv_usepvn_flags will overwrite valid memory if its called
on an address that is not the start of a malloced block.

The actual work being accomplished by sv_usepvn_flags, and
not undone immediately after by sv_sethek, is limited to 3 calls
on the SV.  Inlining those calls removes the dependency on malloc.

This fixes perl #104034.

12 years agoVMS-specific scope fix for S_mayberelocate.
Craig A. Berry [Sat, 3 Dec 2011 16:36:58 +0000 (10:36 -0600)]
VMS-specific scope fix for S_mayberelocate.

Back in 3185893b8dec106 I moved some code from the beginning of one
block to the middle of a different block.  Bad me.  The compiler
has been lax about allowing declarations in the middle of a block,
so we haven't noticed.  But as of c29067d7797853039, the code moved
to a new function while leaving the block it was in behind and we
end up with conflicting declarations of len.

Making our own block seems like the safest thing to do.  The
indentation in this section of code is a bit wacky -- I chose the
least intrusive alternative for clearer blame logs.

12 years agoSmall tidyups in S_incpush() and S_mayberelocate()
Nicholas Clark [Thu, 24 Nov 2011 19:38:08 +0000 (20:38 +0100)]
Small tidyups in S_incpush() and S_mayberelocate()

Following commit 816005240f1a3b99, which moved VMS-specific code, we can now
assign to subdir at the point of declaration. After the refactoring that
moved code into S_mayberelocate(), we can assign to libdir at the point of
declaration. In turn, this allows the merging of two #ifndef PERL_IS_MINIPERL
blocks. Remove a blank line from S_mayberelocate().

12 years agoAvoid attacks on sitecustomize by using NUL delimiters to wrap filenames.
Nicholas Clark [Thu, 24 Nov 2011 17:11:32 +0000 (18:11 +0100)]
Avoid attacks on sitecustomize by using NUL delimiters to wrap filenames.

Previously the generated code used regular '' strings, which meant that a
crafted pathname containing ' characters could be used to inject code.
Until the previous commit, this was only a problem if building in or
Configuring to install to such a directory. Which, hopefully, would be
"obviously wrong" to anyone capable of building Perl from source.

However, fixing the bug that prevented sitecustomize being subject to
relocatable include now means that for a relocatable pearl, an end-user
controlled path can now reach the sitecusomize code.

12 years agoMake sitecustomize relocatableinc aware
Carl Hayter [Thu, 24 Nov 2011 16:49:50 +0000 (17:49 +0100)]
Make sitecustomize relocatableinc aware

When -Dusesitecustomize is used with -Duserelocatableinc,
SITELIB_EXP/sitecustomize.pl is not found due to SITELIB_EXP having a
'.../..' relocation path.

This patch refactors the path relocation code from S_incpush() into
S_mayberelocate() so that it can be used in both S_incpush() and in
usesitecustomize's use of SITELIB_EXP.

12 years agoTidy up t/re/regexp.t
Nicholas Clark [Sat, 3 Dec 2011 11:59:05 +0000 (11:59 +0000)]
Tidy up t/re/regexp.t

Eliminate the declaration of $numtests, unused since commit 1a6108908b085da4.
Convert $iters and $OP to lexicals. Remove the vestigial logic for finding
t/re/re_tests - the MacOS classic style pathname is redundant now, and the
file can never be found at t/re/re_tests given that there is a chdir 't' in
the BEGIN block.

12 years agoRework vms/vms.c:Perl_flex_stat_int() to avoid underscore ambiguity.
Craig A. Berry [Sat, 3 Dec 2011 03:33:25 +0000 (21:33 -0600)]
Rework vms/vms.c:Perl_flex_stat_int() to avoid underscore ambiguity.

An apparently long-standing bug in the home-grown stat() wrapper
was exposed by b8ab4b0, which added the t/test_pl directory. On
VMS, file test operations using the Perl_flex_stat_int() function
would confuse t/test.pl with t/test_pl because dots are the directory
delimiter and not traditionally allowed in directory names, so when
doing a stat() of t/test.pl it would convert the dot to an underscore
and succeed because that directory now exists.  All tests using
t/test.pl would then fail.

The background is that traditionally, the CRTL stat() could not deal
with directory specifications in native format, so for example,
dev:[dir.dir2] had to be converted to dev:[dir]dir2.DIR for various
operations, including the stat() call, to succeed.  This is now the
exception; it's still necessary for rmdir(), but not for stat(), at
least not on OpenVMS VAX v7.3, OpenVMS Alpha v7.3-2, OpenVMS Alpha
v8.3, and OpenVMS I64 v8.4, i.e., anything released in the last
eight years.  A so-called "fileified" directory spec did not cause
problems on its own, but if converted to native syntax first, the
dot would get replace with the now-ambiguous underscore.

The balance was tipped in 312ac60b381, where the fatal conversion
to a native path was added.  The best path forward seems to be to
do less and allow the CRTL stat() or lstat() to do their thing
unimpeded, which in most cases they do just fine.  This has the
added benefit of optimizing for files instead of directories and
saving some unnecessary filename conversions and filename buffer
allocations.  More refactorings are likely desireable.

There is one new test failure in dist/ExtUtils-Manifest/t/Manifest.t
having to do with a filename containing a space, but this seems
preferable to the hundreds of test failures before this patch.  That
indicates, however, that there is more work to do.

12 years agoAdd Term::ReadLine to write_buildcustomize.pl.
Craig A. Berry [Sat, 3 Dec 2011 03:30:30 +0000 (21:30 -0600)]
Add Term::ReadLine to write_buildcustomize.pl.

If the build fails while building extensions, it's nice to have
the debugger available to help figure out what went wrong.  You
couldn't do that before because lib/perl5db.pl depends on
Term::ReadLine, which wouldn't be available since it hadn't been
built yet.  This commit makes Term::ReadLine available via the
same mechanism that makes other libraries available to miniperl
during the build.

An alternative would be to remove the debugger's dependency on
Term::ReadLine, but that would be more work and more risk for a
situation that hopefully doesn't come up that often.

12 years agomore reliably kill a runaway test process on cygwin
Tony Cook [Fri, 2 Dec 2011 12:23:00 +0000 (23:23 +1100)]
more reliably kill a runaway test process on cygwin

Sometimes a plain kill isn't enough.

Along with the previous change this reliably kills a blocked
t/op/threads.t on cygwin as needed.

This doesn't attempt to fix the underlying bug (which may be in
Win32, cygwin or perl itself)

12 years agodon't depend on threads to do a watchdog when testing threads
Tony Cook [Fri, 2 Dec 2011 12:25:33 +0000 (23:25 +1100)]
don't depend on threads to do a watchdog when testing threads

adds a "process" watchdog method that forces use of a separate
process for the watchdog "watcher".

12 years agoAdd Mark Dootson to AUTHORS
Father Chrysostomos [Sat, 3 Dec 2011 01:52:17 +0000 (17:52 -0800)]
Add Mark Dootson to AUTHORS

12 years agoIncrease $threads::VERSION to 1.86
Father Chrysostomos [Sat, 3 Dec 2011 01:51:26 +0000 (17:51 -0800)]
Increase $threads::VERSION to 1.86

12 years ago[perl #104776] Fix threads for latest 64bit mingw-w64 + gcc 4.6
Mark Dootson [Sat, 3 Dec 2011 00:50:26 +0000 (16:50 -0800)]
[perl #104776] Fix threads for latest 64bit mingw-w64 + gcc 4.6

Latest mingw-w64 64 bit + gcc >= 4.6.2 fails due to differences in
setjmp definition. (32 bit is OK) (t/exit.t fails a couple of tests
with access violation faults)

12 years ago$tied =~ s///e when FETCH returns a COW
Father Chrysostomos [Fri, 2 Dec 2011 21:04:41 +0000 (13:04 -0800)]
$tied =~ s///e when FETCH returns a COW

This used to cause an assertion failure, or sometimes ‘Attempt to free
nonexistent shared string’.

All that was required to fix it was the deletion of two cpp lines.

12 years agoskip Perl_my_symlink symbol on older VMS systems.
Craig A. Berry [Fri, 2 Dec 2011 17:30:11 +0000 (11:30 -0600)]
skip Perl_my_symlink symbol on older VMS systems.

It's a wrapper for cases where we have symlink, not a replacement
for cases where we don't (pre-v8.3).  Trying to include it on
older systems causes a link error.

12 years agoUpdate Locale-Codes version in Maintainers.pl
Chris 'BinGOs' Williams [Fri, 2 Dec 2011 13:20:26 +0000 (13:20 +0000)]
Update Locale-Codes version in Maintainers.pl

This should have been part of 4345d05bb848d49bf1bc348b0bf725f5679165bf

12 years agoAllow COW PVMGs to be tied
Father Chrysostomos [Fri, 2 Dec 2011 06:46:22 +0000 (22:46 -0800)]
Allow COW PVMGs to be tied

This logic in sv_magic is wrong:

    if (SvREADONLY(sv)) {
if (
    /* its okay to attach magic to shared strings; the subsequent
     * upgrade to PVMG will unshare the string */
    !(SvFAKE(sv) && SvTYPE(sv) < SVt_PVMG)

    && IN_PERL_RUNTIME
    && !PERL_MAGIC_TYPE_READONLY_ACCEPTABLE(how)
   )
{
    Perl_croak_no_modify(aTHX);
}
    }

There is nothing wrong with attaching magic to a shared string that
will stay shared.  Also, shared strings are not always < SVt_PVMG.
 Sometimes a PVMG or PVLV can end up with a shared string.  In those
cases, the logic above treats them as read-only, which they ain’t.

The easiest example is a downgraded typeglob:

$x = *foo;        # now a PVGV
undef $x ;        # downgraded to PVMG
$x = __PACKAGE__; # now a shared string (COW)
tie $x, "main";   # bang! $x is considered read-only
sub main::TIESCALAR{bless[]}

12 years agoUse SvOOK_on
Father Chrysostomos [Thu, 1 Dec 2011 20:36:18 +0000 (12:36 -0800)]
Use SvOOK_on

Now that SvOOK_on has a usable definition (i.e., it leaves the
NIOK flags alone), we can use it and remove the comments warning
against it.

12 years agoBring SvOOK_on back, but simpler
Father Chrysostomos [Thu, 1 Dec 2011 20:29:06 +0000 (12:29 -0800)]
Bring SvOOK_on back, but simpler

Commit 404dce59 removed it, because nothing in core or CPAN was using
it and it is not part of the API.

Nothing in core was using it because it was unusable as previously
defined (with SvIOK_off).

This commit brings it back, but now it is a simple flag-setting macro,
that will actually be usable by the core.

12 years agoUpdate Locale-Codes to CPAN version 3.20
Chris 'BinGOs' Williams [Thu, 1 Dec 2011 14:32:01 +0000 (14:32 +0000)]
Update Locale-Codes to CPAN version 3.20

  [DELTA]

  VERSION 3.20 (2011-12-01)

  NEW CODE(s)

  Added limited support for deprecated codes

    The code2XXX, XXX2code, all_XXX_codes, and all_XXX_names functions now support retired codes. RT 71124

  Fixed capitalization

    The 'South Sudan' country was all caps. RT 71024

  Pod tests off by default

    The pod tests will not run at install time. RT 71122

  Codesets may be specified by name

    All codesets may be specified by a constant or by their name now. Previously, they were specified only by a constant.

  alias_code deprecated

    The alias_code function exists for backward compatibility. It has been replaced by rename_country_code.
    The alias_code function will be removed sometime after September, 2013.

  Code cleanup

    All work is now done in the central module (Locale::Codes). Previously, some was still
    done in the wrapper modules (Locale::Codes::*) but that is gone now.

  Added LangFam module

    Added Language Family codes (langfam) as defined in ISO 639-5.

12 years agoMerge branch 'dual-life-socket' into blead
Florian Ragwitz [Thu, 1 Dec 2011 14:23:25 +0000 (15:23 +0100)]
Merge branch 'dual-life-socket' into blead

* dual-life-socket:
  Bump Socket::VERSION to 1.95; to match CPAN release
  Snapshot of P/PE/PEVANS/Socket-1.94_07.tar.gz
  More fixups for dual-life to support out-of-core build
  Prepare Socket.pm for dual-life
  Fixups for older Perl versions:
  Rewrite ext/Socket/t/Socket.t to use Test::More rather than manual printing

12 years agoBump Socket::VERSION to 1.95; to match CPAN release
Paul \"LeoNerd\" Evans [Thu, 1 Dec 2011 14:10:48 +0000 (14:10 +0000)]
Bump Socket::VERSION to 1.95; to match CPAN release

12 years agoSnapshot of P/PE/PEVANS/Socket-1.94_07.tar.gz
Paul \"LeoNerd\" Evans [Tue, 22 Nov 2011 15:11:49 +0000 (15:11 +0000)]
Snapshot of P/PE/PEVANS/Socket-1.94_07.tar.gz

12 years agoMore fixups for dual-life to support out-of-core build
Paul \"LeoNerd\" Evans [Tue, 1 Nov 2011 16:16:33 +0000 (16:16 +0000)]
More fixups for dual-life to support out-of-core build

 * Use ExtUtils::CChecker when not in core to replace the Configure-time testing that core does
 * Don't actually need to dVAR in getaddrinfo/getnameinfo
 * Expand croak_xs_usage inline rather than rely on xsubpp to write one

12 years agoPrepare Socket.pm for dual-life
Paul \"LeoNerd\" Evans [Mon, 24 Oct 2011 18:02:43 +0000 (19:02 +0100)]
Prepare Socket.pm for dual-life

 * Moved from ext/Socket to cpan/Socket
 * Currently declared as PEVANS/Socket-1.95.tar.gz - which is what it
   will eventually become

12 years agoFixups for older Perl versions:
Paul \"LeoNerd\" Evans [Mon, 24 Oct 2011 17:07:42 +0000 (18:07 +0100)]
Fixups for older Perl versions:

 * Pass package and version to XSLoader::load to keep older perl versions happy
 * Older perls do not define croak_sv; #define a workaround for them

12 years agoRewrite ext/Socket/t/Socket.t to use Test::More rather than manual printing
Paul \"LeoNerd\" Evans [Mon, 24 Oct 2011 16:51:13 +0000 (17:51 +0100)]
Rewrite ext/Socket/t/Socket.t to use Test::More rather than manual printing

12 years agoInstall perlfaq and perlglossary manpages in section 1 of the manual
Rafael Garcia-Suarez [Thu, 1 Dec 2011 14:10:49 +0000 (15:10 +0100)]
Install perlfaq and perlglossary manpages in section 1 of the manual

12 years agoSkip executable Cygwin test in EUMM when in core
Chris 'BinGOs' Williams [Thu, 1 Dec 2011 11:23:41 +0000 (11:23 +0000)]
Skip executable Cygwin test in EUMM when in core

Change has been upstreamed as:

<https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/commit/d0172d0f>

12 years agoavoid conflicting static / dllexport on legacy perls too
Tony Cook [Thu, 1 Dec 2011 10:37:42 +0000 (21:37 +1100)]
avoid conflicting static / dllexport on legacy perls too

This probably fixes rt.cpan.org 72313 and 71964.

12 years agoignore a cygwin specific generated file
Tony Cook [Thu, 1 Dec 2011 08:39:18 +0000 (19:39 +1100)]
ignore a cygwin specific generated file

12 years agostatic and dllexport don't belong together on cygwin
Tony Cook [Thu, 1 Dec 2011 08:00:53 +0000 (19:00 +1100)]
static and dllexport don't belong together on cygwin

This was causing build errors like:

Cwd.c:553:1: error: external linkage required for symbol ‘XS_Cwd_getcwd’ because of ‘dllexport’ attribute

12 years agosv.c: fix comment typo added by ce2077b184
Father Chrysostomos [Thu, 1 Dec 2011 07:20:10 +0000 (23:20 -0800)]
sv.c: fix comment typo added by ce2077b184

12 years agoRemove SvOOK_on
Father Chrysostomos [Thu, 1 Dec 2011 07:06:55 +0000 (23:06 -0800)]
Remove SvOOK_on

Nothing is using in core or on CPAN.  It is not part of the API.

12 years agoperlintro: consistent use of spaces after dots
Father Chrysostomos [Thu, 1 Dec 2011 06:29:44 +0000 (22:29 -0800)]
perlintro: consistent use of spaces after dots

12 years ago[perl #105024] UNIVERSAL::AUTOLOAD and %+
Father Chrysostomos [Thu, 1 Dec 2011 06:05:03 +0000 (22:05 -0800)]
[perl #105024] UNIVERSAL::AUTOLOAD and %+

The code in gv.c for loading a tie module automatically
(S_require_tie_mod) was only loading the module if its stash did not
exist or if a particular method (usually TIEHASH) could not be found.
But it was triggering autoloading, such that a universal AUTOLOAD
method would allow it to ‘find’ the method it was looking for, even if
it did not exist.  So autovivifying the package somehow (e.g., by men-
tioning one of its symbols) could prevent the module from loading.

12 years agoteach podcheck.t about newly linked-to module in perlfunc
Ricardo Signes [Thu, 1 Dec 2011 00:40:54 +0000 (19:40 -0500)]
teach podcheck.t about newly linked-to module in perlfunc

12 years agoDon't suggest using srand for "cryptographic purposes"
Abhijit Menon-Sen [Thu, 1 Dec 2011 00:02:35 +0000 (05:32 +0530)]
Don't suggest using srand for "cryptographic purposes"

Also, don't suggest Math::Random::MT::Perl as a source of
cryptographically secure randomness, because it isn't.

12 years agopod/perlintro: mention that "foreach" is really a synonym for "for"
Ævar Arnfjörð Bjarmason [Sat, 26 Nov 2011 23:07:15 +0000 (23:07 +0000)]
pod/perlintro: mention that "foreach" is really a synonym for "for"

The perlintro section on for/foreach would have you believe that "for"
is always C-style and "foreach" is always Perl-style. This isn't
actually the case, so link to the perlsyn section that covers that.

12 years agopod/perlsyn: for is equivalent to "foreach'
Ævar Arnfjörð Bjarmason [Sat, 26 Nov 2011 22:58:22 +0000 (22:58 +0000)]
pod/perlsyn: for is equivalent to "foreach'

Change the Compound Statements section to not like by omission. Both
for and foreach can be used as C-style and Perl-style for-loops, but
the documentation pretended that "for" was always C-style and
"foreach" was always Perl-style.

12 years agoperlhacktips: typo
Father Chrysostomos [Wed, 30 Nov 2011 21:16:06 +0000 (13:16 -0800)]
perlhacktips: typo

12 years agoperlsource.pod: toolks → tools
Father Chrysostomos [Wed, 30 Nov 2011 17:42:58 +0000 (09:42 -0800)]
perlsource.pod: toolks → tools

12 years agoAnother confusing comment; this time in regcomp.c
Father Chrysostomos [Wed, 30 Nov 2011 17:34:46 +0000 (09:34 -0800)]
Another confusing comment; this time in regcomp.c

This one comes from c2123ae38.

And we shouldn’t be suing our mothers’ tykes. :-)

12 years agoCorrect comment in hv.c:S_share_hek_flags
Father Chrysostomos [Wed, 30 Nov 2011 06:43:15 +0000 (22:43 -0800)]
Correct comment in hv.c:S_share_hek_flags

It says that allocate one block of memory with the HEK immediately
following the HE, so we can find the HEK from the HE.  Of course we
can find the HEK from the HE, as the HE points to it.  The two terms
were apparently transposed.

12 years agoRemove obsolete comment about SvPOKp in sv.h
Father Chrysostomos [Wed, 30 Nov 2011 06:39:26 +0000 (22:39 -0800)]
Remove obsolete comment about SvPOKp in sv.h

This comment was added in 373b357f1, and then invalidated by the same
person in 8eeaf79a, seventeen days later.

12 years agohv.h: Don’t call a char * parameter ‘sv’!
Father Chrysostomos [Wed, 30 Nov 2011 04:12:56 +0000 (20:12 -0800)]
hv.h: Don’t call a char * parameter ‘sv’!

This goes all the way back to bbce6d6978 (inseparable changes from
patch from perl5.003_08 to perl5.003_09).  It is mightily confusing
for anyone trying to figure out how these things work.

12 years agohv.h: remove obsolete comment
Father Chrysostomos [Wed, 30 Nov 2011 04:08:51 +0000 (20:08 -0800)]
hv.h: remove obsolete comment

This comment was made obsolete by commit bc5cdc2388.

12 years agosv.c/find_uninit_var: Explain kid-scanning loop better
Father Chrysostomos [Wed, 30 Nov 2011 02:04:35 +0000 (18:04 -0800)]
sv.c/find_uninit_var: Explain kid-scanning loop better

Hopefully this explanation will be clearer and will prevent clumsy
individuals like me from introducing bugs like #103766.

12 years agosv.c: typo
Father Chrysostomos [Wed, 30 Nov 2011 01:59:26 +0000 (17:59 -0800)]
sv.c: typo

12 years agopanic after cow-to-stash assignment
Father Chrysostomos [Tue, 29 Nov 2011 02:31:55 +0000 (18:31 -0800)]
panic after cow-to-stash assignment

This type of thing isn’t officially supported, but perl shouldn’t be
freeing unallocated memory (the 9th octet of a freed HEK) as a result:

    $::{whatever} = __PACKAGE__;
    *{"whatever"};

A string stored in the symbol table like that is actually a subroutine
stub.  ‘sub foo($)’ is stored as '$' in the "foo" slot to save space.

gv_init_pvn (formerly known as gv_init) checks SvPOK first thing,
assuming, if it is set, that it can reuse SvPVX as the CV’s prototype,
without reallocating or copying it.  That works most of the time.

For COW strings (such as those returned by __PACKAGE__), SvPVX points
to the hek_key field (the 9th octet) of a shared HEK.  When the CV is
freed, it ends up trying to do Safefree(that_hek + 8) effectively,
which is bad.

12 years agoAs perldoc is linked from perl.pod, it shouldn't be in perltoc's sin list.
Nicholas Clark [Mon, 28 Nov 2011 15:40:28 +0000 (15:40 +0000)]
As perldoc is linked from perl.pod, it shouldn't be in perltoc's sin list.

perldoc has a manpage prominently linked from the perl manpage. Hence it
makes no sense to also have it listed at the end of perltoc in the section
described as "Here should be listed all the extra programs' documentation,
but they don't all have manual pages yet"

12 years agoEliminate vestigial reference to unpushed.h from descrip_mms.template
Nicholas Clark [Mon, 28 Nov 2011 14:38:55 +0000 (14:38 +0000)]
Eliminate vestigial reference to unpushed.h from descrip_mms.template

Commit dcff826f70bf3f64 renamed unpushed.h to git_version.h in early 2009.
So code to delete it is no longer needed :-)

12 years agopod/buildtoc now generates pod/roffitall
Nicholas Clark [Sun, 27 Nov 2011 22:02:54 +0000 (23:02 +0100)]
pod/buildtoc now generates pod/roffitall

roffitall remains a shell script, identical apart from a dynamically
generated list of man pages (and removal of the comment from 2000 that
this should be done).

12 years agoavoid double defining the POSIX::TCSANOW constant sub
Tony Cook [Mon, 28 Nov 2011 07:18:25 +0000 (18:18 +1100)]
avoid double defining the POSIX::TCSANOW constant sub

On Win32 which has no native TCSANOW definition this would produce:

Constant subroutine TCSANOW redefined at ../lib/POSIX.pm line -1.

because the macro wasn't defined when building the unknown symbols
table but was defined when building the defined symbols table.

12 years agosv.c: Turn a FIXME comment into an explanation
Father Chrysostomos [Mon, 28 Nov 2011 02:37:14 +0000 (18:37 -0800)]
sv.c: Turn a FIXME comment into an explanation

12 years agoRemove duplicate comment from sv.h
Father Chrysostomos [Mon, 28 Nov 2011 02:27:09 +0000 (18:27 -0800)]
Remove duplicate comment from sv.h

The ‘or lexical’ in this ‘glob or lexical is just a copy’ comment was
added in perl 5.001 (748a9306), which added closures.

This comment was later duplicated in commit 120ff8e9d (‘Document a
sixth use for SVf_FAKE’), but in a clearer fashion.

This commit removes the ‘or lexical’ part, as it is now confusing.

12 years agoUpdate Module-Loaded to CPAN version 0.08
Chris 'BinGOs' Williams [Sun, 27 Nov 2011 21:03:49 +0000 (21:03 +0000)]
Update Module-Loaded to CPAN version 0.08

  [DELTA]

  Changes for 0.08    Sun Nov 27 20:44:00 GMT 2011
  =================================================
  * Remove trailing spaces and update Makefile.PL

12 years agoFix two bugs related to pod files outside of pod/
Nicholas Clark [Sun, 27 Nov 2011 20:26:46 +0000 (21:26 +0100)]
Fix two bugs related to pod files outside of pod/

Commit 1721346e4e420217, which allowed buildtoc to handle files outside of
pod/, had two bugs when processing files from outside of pod/

Firstly, the call to podset() for the core pods needs to pass in the short
name of the pod, not the name with the path in it (ie $_->[4], not $_->[1]),
else the =head2 entry for that pod will have the pathname in it.

Secondly, buildtoc must take care to avoid outputting the contents for these
pods twice - once when read from cpan/ or dist/ using the path in pod.lst,
and once from the file as found in lib/

12 years ago[perl #99850] SEGV when destructor undefs goto &sub
Father Chrysostomos [Sun, 27 Nov 2011 19:41:44 +0000 (11:41 -0800)]
[perl #99850] SEGV when destructor undefs goto &sub

If goto &sub triggers a destructor that undefines &sub, a
crash ensues.

This commit adds an extra check in pp_goto after the unwinding of the
previous sub’s scope.

12 years agotypo in perlre.pod
Father Chrysostomos [Sun, 27 Nov 2011 19:07:44 +0000 (11:07 -0800)]
typo in perlre.pod

12 years agoChange a semicolon to a colon. This is necessary for the shared mem example to compile
Peter Martini [Fri, 25 Nov 2011 23:23:53 +0000 (18:23 -0500)]
Change a semicolon to a colon. This is necessary for the shared mem example to compile

12 years agoFix two post 5.15.0 perltoc.pod generation bugs.
Nicholas Clark [Sun, 27 Nov 2011 12:05:11 +0000 (13:05 +0100)]
Fix two post 5.15.0 perltoc.pod generation bugs.

Commit 1721346e4e420217, which allowed buildtoc to handle files outside of
pod, changed the number of entries in the master structure, but missed
changing one test from 3 to 5, which resulted in all the core documentation
being omitted from the generated perltoc.pod

Commit f37610d895e1d30b, which eliminated the use of absolute pathnames,
failed to change two regular expressions in the subroutine passed to
File::Find::find(), which resulted in all module pod filenames having
lib/ prepended, and thus all modules being treated as pragmata.
This commit also contained an error in the call to podset() for the core
documentation, which wasn't noticed because that code was never called,
due to the bug introduced by commit 1721346e4e420217.

perltoc.pod now builds correctly once again. Whether anyone uses it is
another matter.

12 years agoIn roffitall, explicitly use perl to run rofftoc.
Nicholas Clark [Sat, 26 Nov 2011 21:20:30 +0000 (22:20 +0100)]
In roffitall, explicitly use perl to run rofftoc.

Previously roffitall invoked rofftoc as ./rofftoc (implying a shell script),
and in turn rofftoc used the "sh or perl" construction to cause sh to pass
itself to perl. This was a bit obfuscated at the best of times, and broke
completely when commit ff906f87ce151941 removed execute permission in 2010.

12 years ago[perl #97980] Stop tied() from returning a copy
Father Chrysostomos [Sun, 27 Nov 2011 02:17:45 +0000 (18:17 -0800)]
[perl #97980] Stop tied() from returning a copy

Now tied() returns the actual scalar used to hold the tie object,
so one can write weaken(tied $foo).

12 years agoMake inlined &CORE::__SUB__ the right-sized op
Father Chrysostomos [Sun, 27 Nov 2011 00:58:56 +0000 (16:58 -0800)]
Make inlined &CORE::__SUB__ the right-sized op

In commit 1a35f9ffb I forgot to make an inlined OP_RUNCV op a PVOP in
ck_entersub_args_core (which inlines a &CORE::sub).

This caused crashes on Linux, but not on OS X, for some reason.

12 years ago[perl #98352] perlre: Clarify visibility of $1 in (??{...})
Father Chrysostomos [Sat, 26 Nov 2011 23:55:48 +0000 (15:55 -0800)]
[perl #98352] perlre: Clarify visibility of $1 in (??{...})

12 years agoOops!
Father Chrysostomos [Sat, 26 Nov 2011 23:39:05 +0000 (15:39 -0800)]
Oops!

Well, I at least ran test_porting after making that ‘only doc’ change!
But then I committed with -a by mistake.  Oh well.

12 years agosv.h: Consistent use of spaces after dots
Father Chrysostomos [Sat, 26 Nov 2011 20:49:52 +0000 (12:49 -0800)]
sv.h: Consistent use of spaces after dots

12 years ago[perl #97632] Improve SvTAINT docs
Father Chrysostomos [Sat, 26 Nov 2011 20:42:55 +0000 (12:42 -0800)]
[perl #97632] Improve SvTAINT docs

Copied almost verbatim from text supplied by Kevin Ryde.

12 years agoRemove ‘no warnings deprecated’ from two .t’s
Father Chrysostomos [Sat, 26 Nov 2011 19:46:58 +0000 (11:46 -0800)]
Remove ‘no warnings deprecated’ from two .t’s

This was added to avoid the warning from $[, but these two test
scripts no longer mention $[.

12 years agoOptimise substr assignment in void context
Father Chrysostomos [Sat, 26 Nov 2011 07:04:22 +0000 (23:04 -0800)]
Optimise substr assignment in void context

In void context we can optimise

    substr($foo, $bar, $baz) = $replacement;

to something like

    substr($foo, $bar, $baz, $replacement);

except that the execution order must be preserved.  So what we actu-
ally do is

    substr($replacement, $foo, $bar, $baz);

with a flag to indicate that the replacement comes first.  This means
we can also optimise assignment to two-argument substr the same way.

Although optimisations are not supposed to change behaviour,
this one does.

• It stops substr assignment from calling get-magic twice, which means
  the optimisation makes things less buggy than usual.
• It causes the uninitialized warning (for an undefined first argu-
  ment) to mention the substr operator, as it did before the previous
  commit, rather than the assignment operator.  I think that sort of
  detail is minor enough.

I had to make the warning about clobbering references apply whenever
substr does a replacement, and not only when used as an lvalue.  So
four-argument substr now emits that warning.  I would consider that a
bug fix, too.

Also, if the numeric arguments to four-argument substr and the
replacement string are undefined, the order of the uninitialized warn-
ings is slightly different, but is consistent regardless of whether
the optimisation is in effect.

I believe this will make 95% of substr assignments run faster.  So
there is less incentive to use what I consider the less readable form
(the four-argument form, which is not self-documenting).

Since I like naïve benchmarks, here are Before and After:

$ time ./miniperl -le 'do{$x="hello"; substr ($x,0,0) = 34;0}for 1..1000000'

real 0m2.391s
user 0m2.381s
sys 0m0.005s
$ time ./miniperl -le 'do{$x="hello"; substr ($x,0,0) = 34;0}for 1..1000000'

real 0m0.936s
user 0m0.927s
sys 0m0.005s

12 years agoDon’t coerce $x immediately in foo(substr $x...)
Father Chrysostomos [Sat, 26 Nov 2011 00:22:01 +0000 (16:22 -0800)]
Don’t coerce $x immediately in foo(substr $x...)

This program:

    #!perl -l
    sub myprint { print @_ }
    print substr *foo, 1;
    myprint substr *foo, 1;

produces:

    main::foo
    Can't coerce GLOB to string in substr at - line 4.

Ouch!

I would expect \substr simply to give me a scalar that peeks into the
original string, but without modifying the original until the return
value of \substr is actually assigned to.

But it turns out that it coerces the original into a string immedi-
ately, unless it’s GMAGICAL.  I find the exception for magical varia-
ble rather befuddling.  I can only imagine it was for efficency (since
the stringified form will be overwritten when magic_setsubstr calls
SvGETMAGIC), but that doesn’t make sense as the original variable can
itself be modified between the return of the special lvalue and the
assignment to that lvalue.

Since magic_setsubstr itself coerces the variable into a string upon
assignment to the lvalue, we can just remove the coercion code from
pp_substr.

But that causes double uninitialized warnings in cases like
substr($undef, 0,0) = "lrep".

That happens because pp_substr is still stringifying the variable (but
without modifying it).  It has to do that, as it looks at the length
of the original string and accordingly adjusts the offsets stored in
the lvalue if they are negative or if they extend beyond the end of
the string.

So this commit takes the simple route of avoiding the warning in
pp_substr by only stringifying a variable that is SvOK if called in
lvalue context.

Hence, assignment to substr($tied...) will continue to call FETCH
twice, but that is not a new bug.

The ideal solution would be for the offsets to be translated in mg.c,
rather than in pp_substr.  But that would be a more involved change
(including most of this commit, which is therefore not wasted) with
potential backward-compatibility issue with negative numbers.

A side effect it that the ‘Attempt to use reference as lvalue in
substr’ warning now occurs during the assignment to the substr lvalue,
rather that substr itself.  This means it occurs even for tied varia-
bles, so things are now more consistent.

The example at the beginning could still croak if the glob were
replaced with a null string, so this commit only partially allevi-
ates the pain.

12 years agoOptimise __SUB__ to a constant
Father Chrysostomos [Fri, 25 Nov 2011 21:36:29 +0000 (13:36 -0800)]
Optimise __SUB__ to a constant

If __SUB__ is not inside a closure, it can be optimised to a constant.
We can only do this in the peephole optimiser, as we cannot tell
whether PL_compcv will become a closure until we reach the end
of the sub.

The __SUB__ op cannot simply be replaced with a const op, as the par-
ent op is not readily available in the peephole optimiser and, hence,
we cannot change its pointer.

So we have to convert the runcv op itself into a const op.  So it
has to be the same size.  This commit makes it a PVOP, since newPVOP,
unlike newSVOP, allows a null pv.  To avoid adding workarounds to B
modules, I put an exception in newPVOP’s assertion, instead of chang-
ing the type in regen/opcodes.

But B::Deparse still had to be updated to avoid infinite recursion.

12 years agoUpdate Unicode-Collate to CPAN version 0.87
Chris 'BinGOs' Williams [Sat, 26 Nov 2011 21:22:55 +0000 (21:22 +0000)]
Update Unicode-Collate to CPAN version 0.87

  [DELTA]

  0.87  Sat Nov 26 17:01:42 2011
    - Now Locale/*.pl files are searched in @INC. (see [rt.cpan.org #72666])
    - added locale_version method to access the version number of Locale/*.pl.