platform/upstream/perl.git
11 years ago[perl #118139] Storable 2.42 - die in global destruction
Reini Urban [Tue, 28 May 2013 20:46:12 +0000 (22:46 +0200)]
[perl #118139] Storable 2.42 - die in global destruction

Protect against SEGV during global destruction, e.g. when used
in DESTROY blocks.

[Part of a patch submitted by Reini. MANIFEST change added by the committer]

11 years agoUse magic rather than DESTROY to free memory in Storable's context.
Nicholas Clark [Tue, 28 May 2013 20:36:48 +0000 (22:36 +0200)]
Use magic rather than DESTROY to free memory in Storable's context.

Suggested by Leon Timmermans.

11 years agoRestore Storable support for 5.005 and (astoundingly) 5.004
Nicholas Clark [Tue, 28 May 2013 19:37:06 +0000 (21:37 +0200)]
Restore Storable support for 5.005 and (astoundingly) 5.004

It even passes all tests on 5.004.

11 years agoMerge the refactoring of the Makefile install targets into blead.
Nicholas Clark [Sat, 13 Jul 2013 11:29:38 +0000 (13:29 +0200)]
Merge the refactoring of the Makefile install targets into blead.

11 years agoDon't call CPAN to install any "extra" modules for the install-notify target.
Nicholas Clark [Wed, 25 Apr 2012 20:00:09 +0000 (22:00 +0200)]
Don't call CPAN to install any "extra" modules for the install-notify target.

Previously the Makefile's install-notify target built extra.install just like
the other 5 install targets. However, the other 5 actually install perl,
whereas install-notify (a.k.a. no-install) runs installperl and installman
with the --notify option (formerly -n), to cause them to print what they would
do but take no action. Hence if -Dextras was used, make no-install would
actually install the extra modules, but nothing else. This is inconsistent.

11 years agoInline the Makefile rule for extra.install into all 6 targets which use it.
Nicholas Clark [Wed, 25 Apr 2012 18:04:08 +0000 (20:04 +0200)]
Inline the Makefile rule for extra.install into all 6 targets which use it.

This eliminates 6 recursive calls from Makefile to itself. As five of these
are generated from a loop in Makefile.SH, this isn't massive code
duplication. It's not obvious how to merge the sixth without increasing the
code complexity.

Additionally, if the user has specified extra modules to download and build
from CPAN using Configure's -Dextra, this avoids building perl, the non-XS
modules and the CPAN modules twice on make install.

11 years agoRefactor Makefile.SH to generate the install-* targets in a loop.
Nicholas Clark [Wed, 25 Apr 2012 16:28:39 +0000 (18:28 +0200)]
Refactor Makefile.SH to generate the install-* targets in a loop.

This slightly reduces the line count, merges five-fold duplication into one,
and works toward removing 5 recursive calls from Makefile to itself.

11 years agoIn Makefile.SH, use the long names for options passed to install{perl,man}
Nicholas Clark [Wed, 25 Apr 2012 16:05:24 +0000 (18:05 +0200)]
In Makefile.SH, use the long names for options passed to install{perl,man}

This makes it clearer what is going on, and enables a simplifying refactoring.

11 years agoRefactor the Makefile so that the install target depends on install-all.
Nicholas Clark [Tue, 24 Apr 2012 16:41:47 +0000 (18:41 +0200)]
Refactor the Makefile so that the install target depends on install-all.

Also, add targets install_notify and install-notify, as synonyms for
no_install and no-install. Previously install, install-all and install_all
were all generated by the same rule.

These changes make future refactoring easier.

11 years agoMerge installperl and installman refactoring to blead.
Nicholas Clark [Sat, 13 Jul 2013 10:16:57 +0000 (12:16 +0200)]
Merge installperl and installman refactoring to blead.

11 years agoDocument installperl and installman refactoring in perldelta.pod
Nicholas Clark [Sat, 13 Jul 2013 10:16:20 +0000 (12:16 +0200)]
Document installperl and installman refactoring in perldelta.pod

11 years agoAdd a no-op option --strip to installman.
Nicholas Clark [Wed, 25 Apr 2012 13:48:33 +0000 (15:48 +0200)]
Add a no-op option --strip to installman.

This intentionally does nothing.

--strip for installperl instructs it to strip the installed binaries. Hence
by permitting installman to accept --strip without error Makefile.SH can be
simplified, as it's possible to pass identical flags to both install scripts.

11 years agoRefactor installman's option handling to use Getopt::Long's "multiple names".
Nicholas Clark [Wed, 25 Apr 2012 13:21:54 +0000 (15:21 +0200)]
Refactor installman's option handling to use Getopt::Long's "multiple names".

Previously installman specified synonyms for options as distinct
options, and then used explicit code to merge them.

Also add -h and -? as synonyms for --help.

11 years agoConvert installperl to use Getopt::Long.
Nicholas Clark [Wed, 25 Apr 2012 12:38:00 +0000 (14:38 +0200)]
Convert installperl to use Getopt::Long.

This requires some special handling for the +v option. Fortunately, we can
cheat, because we know that no other non-options are acceptable. This does
change the behaviour slightly from before:

* single letter options now also have long names
* invalid options are now rejected
* command line arguments that are not options are now rejected

However, the behaviour for all valid documented invocations is unchanged.

Also, add a --help option to display the usage message.

11 years agoIn installperl rename $opt{dostrip} to $opt{strip}.
Nicholas Clark [Wed, 25 Apr 2012 14:57:22 +0000 (16:57 +0200)]
In installperl rename $opt{dostrip} to $opt{strip}.

This will provide a more meaningful long option name once installperl is
converted to Getopt::Long.

11 years agoIn installperl, record the state of options in %opts instead of lexicals.
Nicholas Clark [Wed, 25 Apr 2012 11:17:41 +0000 (13:17 +0200)]
In installperl, record the state of options in %opts instead of lexicals.

Replace all lexicals used to track the state of command line options with
entries in the hash %opts. Make an exception for $versiononly, as it is
controlled by 2 different command line options, and accessed in significantly
more places than the state of any other command line option.

11 years agoIn installperl, invert the sense of the variable used for the -o option.
Nicholas Clark [Wed, 25 Apr 2012 10:47:53 +0000 (12:47 +0200)]
In installperl, invert the sense of the variable used for the -o option.

Previously it was $otherperls, and had to have its default of 1 explicitly
set. Change it to $skip_otherperls, and the default default of undef is
perfect.

11 years agoRemove dead code from installperl, related to a 5.000->5.001 change.
Nicholas Clark [Wed, 25 Apr 2012 10:06:26 +0000 (12:06 +0200)]
Remove dead code from installperl, related to a 5.000->5.001 change.

5.000 installed autosplit files into archlib. 5.001 and later install into
privlib. archlib is earlier in @INC. It wasn't until 5.005 that perl put the
version number into the paths used for privlib and archlib, hence without
special treatment, the files installed by 5.001 would not be found, because
those from 5.000 would be earlier in @INC.

See commit a841533b5cf319b3 (Oct 2009) which removes similar special casing
code dealing with perldiag.pod confusion between 5.003 and 5.004

All this code became redundant when 5.005 added the version number to
library paths. (strictly, commit bfb7748a896459cc in Jul 1998)

11 years agoGenerate Errno and Pod::Functions with deterministic order.
Nicholas Clark [Fri, 12 Jul 2013 14:50:13 +0000 (16:50 +0200)]
Generate Errno and Pod::Functions with deterministic order.

Previously the order of duplicate names in Errno was determined by hash
iteration order, as was the order of the list of types for built-ins in
Pod::Functions. With hash randomisation this meant that the generated file
could differ between builds, which isn't ideal if the input is the same.

(Spotted as a side effect of running a diff on two installation trees.)

11 years ago[perl #118567] Add a warning for prototypes if a missing
Peter Martini [Sat, 13 Jul 2013 02:10:06 +0000 (22:10 -0400)]
[perl #118567] Add a warning for prototypes if a missing
 closing bracket is detected

11 years agodiagnostics.t: Adjust tests
Father Chrysostomos [Sat, 13 Jul 2013 07:38:39 +0000 (00:38 -0700)]
diagnostics.t: Adjust tests

They are sensitive to changes in perldiag.pod

11 years agoperlvar: Don’t mention dev version
Father Chrysostomos [Sat, 13 Jul 2013 07:27:00 +0000 (00:27 -0700)]
perlvar: Don’t mention dev version

Also, use the v convention used elsewhere in the same doc.

11 years agocheckAUTHORS.pl: Add alt addr for Kent Fredric
Father Chrysostomos [Sat, 13 Jul 2013 07:25:04 +0000 (00:25 -0700)]
checkAUTHORS.pl: Add alt addr for Kent Fredric

11 years agopod/perl5180delta.pod: Clarify %ENV Changes
Kent Fredric [Sat, 15 Dec 2012 13:13:39 +0000 (02:13 +1300)]
pod/perl5180delta.pod: Clarify %ENV Changes

Clarifies the slightly vague ( and  possibly wrong ) explanation for the change in %ENV behaviour.

11 years agopod/perlvar.pod: Document changes to %ENV
Kent Fredric [Sat, 15 Dec 2012 10:21:29 +0000 (23:21 +1300)]
pod/perlvar.pod: Document changes to %ENV

Including Historical context, and relevance to IPC.

reformatted with Jim Keenans Suggestions

11 years agodiag.t: Handle ckWARN2reg_d properly
Father Chrysostomos [Sat, 13 Jul 2013 07:13:20 +0000 (00:13 -0700)]
diag.t: Handle ckWARN2reg_d properly

11 years agoMove folding rules warning from 'D' to 'S'.
James E Keenan [Sun, 17 Feb 2013 00:58:26 +0000 (19:58 -0500)]
Move folding rules warning from 'D' to 'S'.

For RT #89648

11 years ago[perl #89648] Remove ‘Perl folding rules...’ from dep cat
Father Chrysostomos [Sat, 13 Jul 2013 07:07:20 +0000 (00:07 -0700)]
[perl #89648] Remove ‘Perl folding rules...’ from dep cat

This warning message:

Perl folding rules are not up-to-date for 0x%x; please use the perlbug utility to report;

is in both ‘regexp’ and ‘deprecated’ warning categories. It is under
deprecated warnings so that it has a better chance of showing up.

I think this logic is faulty, because it’s not the deprecatedness that
makes a warning show up by default, but its defaultness; i.e., whether
Perl_ck_warner_d is used instead of Perl_ck_warner. The wide character
warning, for instance, is not under ‘deprecated’, but only ‘utf8’. Yet
it’s a default warning marked as S in perldiag. I think this message
should be treated similarly (and listed with (S regex)).

The next commit will update perldiag accordingly.

11 years agoRevert "[perl #118525] Return B::HEK for B::CV::GV of lexical subs"
Father Chrysostomos [Sat, 13 Jul 2013 06:33:06 +0000 (23:33 -0700)]
Revert "[perl #118525] Return B::HEK for B::CV::GV of lexical subs"

This reverts commit 8748370e90a24f3901d476f43ed77f1ac3d861f4.

There appears to be a typemap problem.  I accidentally pushed the patch
too soon.  Sorry for the noise.

11 years agoRevert "Allow => to quote built-in keywords across lines"
Father Chrysostomos [Sat, 13 Jul 2013 06:23:20 +0000 (23:23 -0700)]
Revert "Allow => to quote built-in keywords across lines"

This reverts commit 5969c5766a5d3f6b42a5140548d7c3d6812fec8b.

It appears to be failing with non-mad builds.

11 years ago[perl #118525] Return B::HEK for B::CV::GV of lexical subs
Reini Urban [Thu, 11 Jul 2013 17:09:15 +0000 (12:09 -0500)]
[perl #118525] Return B::HEK for B::CV::GV of lexical subs

A lexsub has a hek instead of a gv. Provide a ref to a PV for the name
in the new B::HEK class.
This crashed previously accessing the not existing SvFLAGS of the hek.

11 years ago[perl #118857] Test punct vars’ exemption from ‘once’ warnings
Father Chrysostomos [Sat, 13 Jul 2013 06:18:08 +0000 (23:18 -0700)]
[perl #118857] Test punct vars’ exemption from ‘once’ warnings

11 years ago[perl #113932] Make UNIVERSAL::can("STDOUT"...) work
Father Chrysostomos [Sat, 13 Jul 2013 05:53:48 +0000 (22:53 -0700)]
[perl #113932] Make UNIVERSAL::can("STDOUT"...) work

For consistency with the way method lookup works, UNIVERSAL::can(...)
should treat a bareword representing a filehandle as a lookup in the
IO::File package (or whichever package implements that filehandle
object).

11 years agoperldiag: reflow an entry for better splain output
Father Chrysostomos [Sat, 13 Jul 2013 05:40:04 +0000 (22:40 -0700)]
perldiag: reflow an entry for better splain output

11 years agoAllow => to quote built-in keywords across lines
Father Chrysostomos [Sat, 13 Jul 2013 05:34:48 +0000 (22:34 -0700)]
Allow => to quote built-in keywords across lines

If I have a sub I can use its name as a bareword as long as I suffix
it with =>, even if the => is on the next line:

$ ./perl -Ilib -e 'sub tim; warn tim' -e '=>'
tim at -e line 1.

If I want to use a built-in keyword’s name as a bareword, I can put =>
after it:

$ ./perl -Ilib -e 'warn time =>'
time at -e line 1.

But if I combine the two (keyword + newline), it does not work:

$ ./perl -Ilib -e 'warn time' -e ' =>'
1373611283 at -e line 1.

unless I override the keyword:

$ ./perl -Ilib -Msubs=time -e 'warn time' -e ' =>'
time at -e line 1.

=> after a bareword is checked for in two places in toke.c.  The first
comes before a comment saying ‘NO SKIPSPACE BEFORE HERE!’; it only
skips spaces and finds a => on the same line.  The second comes later;
it skips vertical space and comments, too.

But the second check is in a code path that is not reached by keywords
that are not overridden (as is the ‘NO SKIPSPACE’ comment).

This commit adds an extra check for built-in keywords after we have
determined that the keyword is not overridden.  In that case, there is
no reason we cannot use skipspace, as we no longer have to worry about
what PL_oldbufptr etc. point to.

This commit leaves __DATA__ and __END__ alone, since they
are special, problematic and controversial.  (See, e.g.,
<https://rt.perl.org/rt3/Ticket/Display.html?id=78348#txn-1234355>.)

11 years agot/base/lex.t: Test pyoq with comment before delim
Father Chrysostomos [Fri, 12 Jul 2013 05:46:22 +0000 (22:46 -0700)]
t/base/lex.t: Test pyoq with comment before delim

perlop says:

There can be whitespace between the operator and the quoting
characters, except when C<#> is being used as the quoting character.
C<q#foo#> is parsed as the string C<foo>, while C<q #foo#> is the
operator C<q> followed by a comment.  Its argument will be taken
from the next line.

But I do not find tests for this anywhere.  Here are some.

11 years agoPOD inside of a function call is inadvisable.
James E Keenan [Sat, 13 Jul 2013 00:59:22 +0000 (02:59 +0200)]
POD inside of a function call is inadvisable.

Documentation suggestions based largely on suggestions by
Aaron J Trevena and Brad Gilbert.

For: RT #68706

11 years agoAdd a const qualifier for the arg to the S_CvGV inline function in cv.h.
Andy Dougherty [Fri, 12 Jul 2013 13:26:18 +0000 (09:26 -0400)]
Add a const qualifier for the arg to the S_CvGV inline function in cv.h.

In addition to correctly describing the behavior of S_CvGV, this avoids
warnings in op.c:Perl_report_redefined_cv, where the old (CV *) cast
removed the 'const' qualifier.  Observed on OpenBSD 5.2 with gcc-4.2.1.

11 years agoperldiag: note the exceptions for "once" warnings
Ricardo Signes [Fri, 12 Jul 2013 15:33:44 +0000 (11:33 -0400)]
perldiag: note the exceptions for "once" warnings

11 years agoFor -DPERL_GLOBAL_STRUCT, eliminate local variable plvarsp in main().
Nicholas Clark [Wed, 26 Jun 2013 16:24:19 +0000 (18:24 +0200)]
For -DPERL_GLOBAL_STRUCT, eliminate local variable plvarsp in main().

11 years agoFix SEGVs and test failures for -DPERL_GLOBAL_STRUCT_PRIVATE
Nicholas Clark [Wed, 26 Jun 2013 16:01:09 +0000 (18:01 +0200)]
Fix SEGVs and test failures for -DPERL_GLOBAL_STRUCT_PRIVATE

With PERL_GLOBAL_STRUCT_PRIVATE "global" variables are in a structure in
malloc()ed memory, not in global static variables or a global static
structure. Hence no global variables are implicitly initialised to zero.

* PL_curinterp and PL_op_sequence need initialising to NULL
* The global structure is free()d before handlers registered with atexit()
  run, so be defensive about this.
* Some C code checks SvOK(PL_sv_placeholder) so ensure that its SvFLAGS()
  are 0.
* Zero PL_hash_seed

11 years agoSpecify the versions of ExtUtils::MiniPerl and ExtUtils::Embed needed.
Nicholas Clark [Thu, 11 Jul 2013 11:51:31 +0000 (13:51 +0200)]
Specify the versions of ExtUtils::MiniPerl and ExtUtils::Embed needed.

Without this, regen/miniperlmain.pl could end up finding versions which are
out of date, and silently generate an incorrect miniperlmain.c

11 years agoInline the Makefile target perl.valgrind.config into its only remaining user.
Nicholas Clark [Thu, 11 Jul 2013 09:33:41 +0000 (11:33 +0200)]
Inline the Makefile target perl.valgrind.config into its only remaining user.

Add the 3 recently deleted Makefile targets to the list in perldelta.pod, and
reflow the list.

11 years agoEliminate the Makefile targets test_notty.valgrind and test_prep.valgrind.
Nicholas Clark [Thu, 11 Jul 2013 09:00:54 +0000 (11:00 +0200)]
Eliminate the Makefile targets test_notty.valgrind and test_prep.valgrind.

The target test_notty.valgrind depends on the target test_prep.valgrind.
The target test_prep.valgrind depends on the target perl.valgrind.
The target perl.valgrind does not exist!

perl.valgrind never existed. The targets which depend on it were added as
part of commit 7a834142adbc51cc (Aug 2003), which added code and
documentation for running the test suite with valgrind. However, that commit
did not add a perl.valgrind target, despite adding dependencies on it. Hence
the various targets which depended on it could never have worked. Of the
4 similar targets, only test.valgrind works because unlike the other 3,
it depends on test_prep, not test_prep.valgrind

11 years agoswitchd.t: correct bug number
Father Chrysostomos [Fri, 12 Jul 2013 05:01:39 +0000 (22:01 -0700)]
switchd.t: correct bug number

11 years agoConsistent spaces after dots in perlvar
Father Chrysostomos [Thu, 11 Jul 2013 19:40:03 +0000 (12:40 -0700)]
Consistent spaces after dots in perlvar

11 years ago[perl #118627] Don’t do COW when creating ${"_<-e"}[0]
Father Chrysostomos [Thu, 11 Jul 2013 20:13:58 +0000 (13:13 -0700)]
[perl #118627] Don’t do COW when creating ${"_<-e"}[0]

The lexer does not expect PL_linestr (an SV holding the current line
of Perl code being parsed) to do copy-on-write.  It expects to be able
to manipulate that SV to its hearts content with impunity.  The one
piece of code that can cause it to do that is S_update_debugger_info,
when called with a SV for the first argument.  The only time it is
called that way is for line 0 of the main script, containing state-
ments generated from command line arguments (e.g., ‘use strict’ from
‘-Mstrict’), and it is called with PL_linestr as its argument.

If ${"_<-e"}[0] ends up sharing the buffer with PL_linestr, bad things
will happen, as the lexer is going to continue to modify that buffer.

Usually we get this:

$ ./perl -It/lib -d:switchd_empty -e'print @{"_<-e"}' |less
^@se Devel::switchd_empty;
print @{"_<-e"}

So force S_update_debugger_info to do a non-COW copy.

11 years agoRefactor perlmodlib.PL to use regen_lib.pl and avoid FindBin.
Nicholas Clark [Wed, 10 Jul 2013 11:59:57 +0000 (13:59 +0200)]
Refactor perlmodlib.PL to use regen_lib.pl and avoid FindBin.

Instead of using FindBin, pass a directory to use on the command line.
Use regen_lib for handling the output file.
die if any file opened for reading has errors on closing.
Run with the cwd as the top level of the distribution, instead of pod/

11 years agoSplit the handling for "Illegal character" and "Illegal character after '_'"
Peter Martini [Tue, 25 Jun 2013 08:47:56 +0000 (04:47 -0400)]
Split the handling for "Illegal character" and "Illegal character after '_'"

After applying this patch, both can now be triggered at once, whereas
previously any use of '_' would trigger the "after '_'" variant.  Since
the two warnings warn for different reasons, there's no reason to
conflate the two.  Also updated perldiag with a clearer explanation
of the tighter restrictions after an underscore.

(In the tests, the change of uniproto12 to uniproto13 is merely correcting
an error from a previous patch, reusing the name would conflate
two kinds of tests in one statement).

11 years agoperldelta: document locale changes
Karl Williamson [Thu, 11 Jul 2013 02:26:39 +0000 (20:26 -0600)]
perldelta: document locale changes

11 years agoperldelta for 2c179de53ae082
Tony Cook [Thu, 11 Jul 2013 01:23:49 +0000 (11:23 +1000)]
perldelta for 2c179de53ae082

11 years ago[perl #118829] Memory leaks in STORABLE_attach
Vladimir Timofeev [Thu, 11 Jul 2013 01:05:44 +0000 (11:05 +1000)]
[perl #118829] Memory leaks in STORABLE_attach

11 years agoFix typo in docs for SvPV: ") => >"
Brian Gottreu [Wed, 10 Jul 2013 13:14:35 +0000 (08:14 -0500)]
Fix typo in docs for SvPV: ") => >"

11 years agoUpdate comment in autodoc.pl - it's not run from regen.pl
Nicholas Clark [Wed, 10 Jul 2013 13:34:00 +0000 (15:34 +0200)]
Update comment in autodoc.pl - it's not run from regen.pl

This should have been done as part of commit 22b7b87b206c3e0c.

11 years agoConvert to use of Test::More. Boost test coverage.
James E Keenan [Tue, 9 Jul 2013 15:54:44 +0000 (17:54 +0200)]
Convert to use of Test::More. Boost test coverage.

Since File::Compare's functions are documented to return 1, 0, or -1, we will
continue to examine the return value in our tests, rather than simply checking
for truth when 0 or 1 is returned.

Following code review, eliminate trailing whitespace.

For: RT #118823

11 years ago'Prototype after' and 'Illegal character' warnings should both pretty print the proto...
Peter Martini [Tue, 9 Jul 2013 04:29:48 +0000 (00:29 -0400)]
'Prototype after' and 'Illegal character' warnings should both pretty print the prototype text.

For example, prior to this patch,
eval "sub foo (@\0) {}"
would give two warnings:

Prototype after '@' for main::foo : @ at (eval 1) line 1.
Illegal character in prototype for main::foo : @\0 at (eval 1) line 1.

In both cases, the representation which makes a NULL visible
is useful, and of course since we're printing the same warning twice,
it doesn't hurt to display it consistently.

11 years agoSuppress system Term::ReadLine::Gnu
Petr Písař [Mon, 8 Jul 2013 14:10:38 +0000 (16:10 +0200)]
Suppress system Term::ReadLine::Gnu

perl5db.t will die in Term::ReadLine if Term::ReadLine::Gnu is installed
in the system. Let's favour core implementation.

Best solution would be to prune @INC to prevent from loading already
installed modules like this:

BEGIN {
    use Config;
    @INC = grep { ! /^\Q$Config{installprefix}\E(\/|\z)/ } @INC;
}

However that is not possible (now) due to various execs (even without
proper -I) in the harness chain. perl should implement -nostdinc
option.

Signed-off-by: Petr Písař <ppisar@redhat.com>
11 years agoAdd Nathan Trapuzzano to AUTHORS
Father Chrysostomos [Wed, 10 Jul 2013 03:39:00 +0000 (20:39 -0700)]
Add Nathan Trapuzzano to AUTHORS

11 years agoFix typo in perlreapi(1perl).
Nathan Trapuzzano [Wed, 10 Jul 2013 00:59:34 +0000 (20:59 -0400)]
Fix typo in perlreapi(1perl).

11 years agoQuiet warning in a DEBUG print
Peter Martini [Wed, 10 Jul 2013 03:07:10 +0000 (23:07 -0400)]
Quiet warning in a DEBUG print

The variable type is STRLEN, and the format
code is expecting a UV, so just cast it to UV
to quiet a warning.

11 years agolocale documentation: Grammaar and appearance nits
Karl Williamson [Wed, 10 Jul 2013 04:08:00 +0000 (22:08 -0600)]
locale documentation: Grammaar and appearance nits

11 years agoPATCH: [perl #38193] embedded perl always calls setlocale(LC_ALL,"")
Karl Williamson [Mon, 8 Jul 2013 20:04:45 +0000 (14:04 -0600)]
PATCH: [perl #38193] embedded perl always calls setlocale(LC_ALL,"")

This commit causes the locale initialization to skip calling
setlocal(foo, "") if the environment variable PERL_SKIP_LOCALE_INIT is
set.  Instead, the setup code calls setlocale(LC_ALL, NULL) (plus other
similar calls for the subcategories) in order to find out what the
current locale is.

The original poster for this ticket has a workaround for it which
involves using a modified copy of Perl core code.  This patch defines
the C preprocessor variable HAS_SKIP_LOCALE_INIT that can be used by XS
writers to discover if the current Perl version needs the workaround or
not.

I was unable to come up with a test for this patch that did not involve
building extensive infrastructure for testing embedded Perl.  That does
not seem worth it for such a trivial patch.  I tested by hand.

11 years agoMake method lookup treat *foo as \*foo
Father Chrysostomos [Tue, 9 Jul 2013 15:26:05 +0000 (08:26 -0700)]
Make method lookup treat *foo as \*foo

It is possible to call a method on a typeglob with an IO thingy, as in
*ARGV->getline.  This treats the invocant as a handle and looks up its
methods in IO::File.

As of commit 7156e69, a typeglob without an IO thingy is treated
as a class:

$ ./perl -Ilib -e 'sub foo::oof { print "foof!\n" } *foo->oof'
foof!

It did not occur to me back then that globs were being stringified in
method lookup.

Before that commit, names beginning with a non-alphabetic character
were permitted for handle names, but not for package names.  That
fact, and the fact that symbol lookup in general will ignore an ini-
tial * followed by a letter, allowed *ARGV->getline to work.

For *Package->foo to work was a mistake.

It turns out, also, that the glob stringification could cause the
wrong handle to be used, e.g., after glob aliasing.  Also, a handle
whose stringification begins with * followed by a non-alphabetic char-
acter will not work, because symbol lookup does not strip * from the
stringified glob:

$ ./perl -Ilib -e '$::Foo::VERSION; package Foo; open FH, "perl"; *FH->getline'
Can't locate object method "getline" via package "*::Foo::FH" (perhaps you forgot to load "*::Foo::FH"?) at -e line 1.

This commit fixes all this inconsistency by simply not stringifying
the glob.  *FH->foo is now treated the same way as (\*FH)->foo (as it
already was in those cases where it worked).

This does allow PVLV globs to reach code that they couldn’t reach
before, so this patch has to handle those, too.  (newRV probably ought
to handle PVLVs, but it currently doesn’t.)

11 years agoBetter document setlocale, "use locale" interactions
Karl Williamson [Wed, 10 Jul 2013 00:27:45 +0000 (18:27 -0600)]
Better document setlocale, "use locale" interactions

The POSIX::setlocale() documentation failed to mention that "use locale"
is also usually necessary.

11 years agoUpdate Getopt-Long to CPAN version 2.41
Chris 'BinGOs' Williams [Tue, 9 Jul 2013 19:39:11 +0000 (20:39 +0100)]
Update Getopt-Long to CPAN version 2.41

  [DELTA]

Changes in version 2.41
-----------------------

* Change INSTALLDIRS to site for perl >= 5.011.

  See https://rt.perl.org/rt3//Ticket/Display.html?id=116479
  for details.

11 years agomethod.t: Correct miniperl skip count
Father Chrysostomos [Tue, 9 Jul 2013 13:15:04 +0000 (06:15 -0700)]
method.t: Correct miniperl skip count

210fdecd missed this.

11 years agoadd entries to various .gitignore files for Win32 builds
Daniel Dragan [Sat, 6 Jul 2013 03:19:57 +0000 (23:19 -0400)]
add entries to various .gitignore files for Win32 builds

win32/html and cpan/Module-Build/t/install_test* generate dozens of
non-versioned files on a Win32 build which makes committing cumbersome

11 years agoMerge the refactoring of ExtUtils::Miniperl and ExtUtils::Embed.
Nicholas Clark [Tue, 9 Jul 2013 06:24:38 +0000 (08:24 +0200)]
Merge the refactoring of ExtUtils::Miniperl and ExtUtils::Embed.

11 years agoDescribe the changes to ExtUtils::{Embed,Miniperl} in perldelta.
Nicholas Clark [Mon, 8 Jul 2013 15:23:52 +0000 (17:23 +0200)]
Describe the changes to ExtUtils::{Embed,Miniperl} in perldelta.

11 years agoChange the *nix and VMS Makefiles to to pass a filename to writemain().
Nicholas Clark [Mon, 8 Jul 2013 15:00:35 +0000 (17:00 +0200)]
Change the *nix and VMS Makefiles to to pass a filename to writemain().

Adding a first argument as a reference to the filename "perlmain.c" makes
ExtUtils::Miniperl::writemain() open and close the file for us. This is
safer than having the Makefile create the file using output redirection as
that can create an empty file if compilation aborts. This change means that
the file is only moved into place with the correct name if it has been
written completely without error. If an error happens the file is not
created, the make aborts, and any subsequent make will re-attempt to create
the file, instead of continuing with an incorrect file, hiding the real
cause of the problems.

11 years agoExtUtils::Miniperl::writemain()'s first argument can also be a filename.
Nicholas Clark [Mon, 8 Jul 2013 14:41:30 +0000 (16:41 +0200)]
ExtUtils::Miniperl::writemain()'s first argument can also be a filename.

Treat a reference to a scalar as the name of a file to open for output.
Any other reference is used as an output filehandle.
Otherwise the default remains to write to STDOUT.

11 years agoUse more semantic markup in the Pod for ExtUtils::Embed.
Nicholas Clark [Mon, 8 Jul 2013 13:23:48 +0000 (15:23 +0200)]
Use more semantic markup in the Pod for ExtUtils::Embed.

Instead of B<> use F<> for filenames.
Instead of B<> use C<> for code.
Instead of B<> use I<> for parameter names.
Instead of F<> use C<> for e-mail addresses.

Remove semantically unnecessary blank lines, and trailing spaces from edited
lines.

11 years agoRefactor ExtUtils::Embed::xsi_{protos,body} to use a scalar $retval.
Nicholas Clark [Mon, 8 Jul 2013 13:12:28 +0000 (15:12 +0200)]
Refactor ExtUtils::Embed::xsi_{protos,body} to use a scalar $retval.

Previously the code was accumulating the return value by pushing lines
onto an array @retval, then joining it to a single scalar on return.
As nothing needs the individual lines, reduce the complexity by concatenating
directly to a scalar.

11 years agoRefactor xsinit generation code in ExtUtils::Embed.
Nicholas Clark [Mon, 8 Jul 2013 10:11:35 +0000 (12:11 +0200)]
Refactor xsinit generation code in ExtUtils::Embed.

Remove tautological comments about loading modules.
Simplify xsi_protos() and static_ext().
canon('/','DynaLoader') is just 'DynaLoader' so inline the constant.
Refactor canon() to consistently use 1 regex pattern delimiter, avoid map
in void context, and teach it that extensions can be in 'dist' and 'cpan' as
well as 'ext'.
Remove obsolete C<require 5.002> statement.

11 years agoRefactor ExtUtils::Miniperl to use ExtUtils::Embed.
Nicholas Clark [Mon, 8 Jul 2013 09:21:15 +0000 (11:21 +0200)]
Refactor ExtUtils::Miniperl to use ExtUtils::Embed.

There is now only one copy of Perl code to generate the C for an xsinit()
function.

This also eliminates ExtUtils::Miniperl::canon(), which was not exported, and
is no longer needed.

11 years agoTweak ExtUtils::Embed's generated C code to be closer to ExtUtils::Miniperl.
Nicholas Clark [Mon, 8 Jul 2013 09:08:12 +0000 (11:08 +0200)]
Tweak ExtUtils::Embed's generated C code to be closer to ExtUtils::Miniperl.

Use #include "..." instead of #include <...> in xsi_header(), and don't add
a trailing newline (and add a newline in xsinit() to compensate).
Use four spaces instead of a tab for indenting.
If there are no extensions and hence no calls to newXS() don't declare file[]
and don't add a trailing newline.

11 years agoPropagate bugfixes from {mini,}perlmain.c into ExtUtils::Embed.
Nicholas Clark [Mon, 8 Jul 2013 08:39:50 +0000 (10:39 +0200)]
Propagate bugfixes from {mini,}perlmain.c into ExtUtils::Embed.

xs_init() must pass a static char* when creating &DynaLoader::boot_DynaLoader
(commit 1b77350017006d9e)

Avoid linker errors on Win32 by including perlapi.h (via XSUB.h)
(commit 3ecadf9633330795)

my_perl might be unused
(commit 96a5add60f1f39d3)

11 years agoRefactor ExtUtils::Embed to work with miniperl.
Nicholas Clark [Sun, 7 Jul 2013 13:12:42 +0000 (15:12 +0200)]
Refactor ExtUtils::Embed to work with miniperl.

Remove the use of FileHandle, which relies on IO, and XS module.
Only load Getopt::Std if it is needed (in xsinit()), to avoid needing to add
Getopt::Std to lib/buildcustomize.pl
Require File::Spec instead of using it, as it exports nothing, so there is no
benefit to using it (but it costs a BEGIN block).

11 years agoOn Win32 run autodoc.pl and pod/perlmodlib.PL using miniperl, not perl.
Nicholas Clark [Tue, 24 Apr 2012 20:48:38 +0000 (22:48 +0200)]
On Win32 run autodoc.pl and pod/perlmodlib.PL using miniperl, not perl.

*nix and VMS both use miniperl to run these two build scripts. This makes
Win32 consistent.

This eliminates the last two uses of the ICWD macro, so eliminate it too.

11 years ago[perl #116975] perlfunc require: fix example subroutine
David Golden [Tue, 9 Jul 2013 01:45:42 +0000 (11:45 +1000)]
[perl #116975] perlfunc require: fix example subroutine

11 years ago[perl #117033] wrong .packlist creation at installation on Cygwin with destdir
Tony Cook [Tue, 9 Jul 2013 00:37:32 +0000 (10:37 +1000)]
[perl #117033] wrong .packlist creation at installation on Cygwin with destdir

11 years agoperldelta template: consistent spaces after dots
Father Chrysostomos [Mon, 8 Jul 2013 20:52:30 +0000 (13:52 -0700)]
perldelta template: consistent spaces after dots

(pod2man or nroff [whichever] treats a dot at the end of a line
as a dot followed by two spaces.)

11 years agoperldelta: consistent spaces after dots
Father Chrysostomos [Mon, 8 Jul 2013 20:51:04 +0000 (13:51 -0700)]
perldelta: consistent spaces after dots

11 years ago[perl #113932] UNIVERSAL::can with globs and globrefs
Father Chrysostomos [Sun, 7 Jul 2013 19:31:00 +0000 (12:31 -0700)]
[perl #113932] UNIVERSAL::can with globs and globrefs

(Also perl #118105.)

This allows *ARGV->can("print") to work as long as IO::Handle is
loaded.  This translates into UNIVERSAL::can(\*ARGV,"print").  This
commit also changes UNIVERSAL::can to accept a plain *ARGV as well.

UNIVERSAL::can("ARGV",...) is left as it is (ARGV is treated as a pack-
age name), because changing that requires a bigger patch, and I don’t
know when I will get to it.

11 years agoperldelta for b2b69a966b47abd2cb4c320da60619b27c6c8abf
Chris 'BinGOs' Williams [Mon, 8 Jul 2013 19:46:08 +0000 (20:46 +0100)]
perldelta for b2b69a966b47abd2cb4c320da60619b27c6c8abf

11 years agoperldelta: Verbatim lines into 79 columns
Karl Williamson [Mon, 8 Jul 2013 19:00:39 +0000 (13:00 -0600)]
perldelta: Verbatim lines into 79 columns

11 years agoperllocale.pod: Fix misstatements, and some nits
Karl Williamson [Mon, 8 Jul 2013 18:48:28 +0000 (12:48 -0600)]
perllocale.pod: Fix misstatements, and some nits

"$!" (stringified) is always subject to the current locale, even outside
'use locale'.  The motiviation, I believe, for this is that these are
operating system messages that are generally of most value to the
end-user, and so should be expressed in terms that are understandable to
the end-user, regardless of what the Perl programmer did or didn't do.

11 years agoPATCH: [perl #115808]: POSIX::setlocale returns bizarre value on failure
Karl Williamson [Mon, 8 Jul 2013 04:42:43 +0000 (22:42 -0600)]
PATCH: [perl #115808]: POSIX::setlocale returns bizarre value on failure

It turns out that this bug is caused by a more general one, covered by
[perl #118693].  But in the meantime, this commit fixes the problem for
setlocale(), and makes the code slightly cleaner besides.

11 years agoperlexperiment: linux abstract domains sockets
Ricardo Signes [Mon, 8 Jul 2013 15:07:29 +0000 (11:07 -0400)]
perlexperiment: linux abstract domains sockets

...now they are upstream-cpan and supported

11 years agoperlexperiment: MLDBM is not part of core
Ricardo Signes [Mon, 8 Jul 2013 13:35:08 +0000 (09:35 -0400)]
perlexperiment: MLDBM is not part of core

11 years agoAdd block to exercise case of very large buffer in lib/File/Copy.pm.
James E Keenan [Fri, 5 Jul 2013 01:09:04 +0000 (03:09 +0200)]
Add block to exercise case of very large buffer in lib/File/Copy.pm.

11 years agoAdd tests for two previously unexercised sections of lib/Symbol.pm.
James E Keenan [Thu, 4 Jul 2013 13:33:40 +0000 (15:33 +0200)]
Add tests for two previously unexercised sections of lib/Symbol.pm.

11 years agoRemove trailing dots in t/porting/readme.t on VMS.
Craig A. Berry [Sun, 7 Jul 2013 19:28:21 +0000 (14:28 -0500)]
Remove trailing dots in t/porting/readme.t on VMS.

Because on VMS a zero-length extension still has a dot.

11 years agoRestore $(ARCHDIR)vmspipe.com to VMS build after 2d11a7e9678.
Craig A. Berry [Sun, 7 Jul 2013 19:03:33 +0000 (14:03 -0500)]
Restore $(ARCHDIR)vmspipe.com to VMS build after 2d11a7e9678.

That commit moved VMS::Filespec from vms/ext to ext/, but it also
deleted the vmspipe.com dependency from the LIBPREREQ target in
vms/descrip_mms.template.  (vmspipe.com has nothing to do with
VMS::Filespec.)  Which meant vmspipe.com was not availabe for
building extensions or running tests, and -- worse yet -- would
not get installed.  So every pipe creation would involve creating
a temporary version of this file using fallback code in vms/vms.c,
thus making the very pokey pipe implementation even more expensive.

11 years agoperl.c: Use Strerror instead of strerror
Karl Williamson [Thu, 20 Jun 2013 19:17:13 +0000 (13:17 -0600)]
perl.c: Use Strerror instead of strerror

The former works on more systems.

11 years agopp_sys.c: Use macro instead of reinventing it
Karl Williamson [Thu, 20 Jun 2013 19:13:40 +0000 (13:13 -0600)]
pp_sys.c: Use macro instead of reinventing it

The Strerror macro is defined properly to handle either case here.

11 years agoutil.c: Avoid unnecessary setlocale() calls
Karl Williamson [Thu, 20 Jun 2013 18:28:12 +0000 (12:28 -0600)]
util.c: Avoid unnecessary setlocale() calls

This code sets the locale to C around its work.  This is unnecessary if
the locale is already C, and there is an existing global that indicates
this, that can be tested to avoid the sets.

11 years agoPATCH: [perl #118197] Cope with non-ASCII decimal separators
Karl Williamson [Sat, 22 Jun 2013 18:49:01 +0000 (12:49 -0600)]
PATCH: [perl #118197] Cope with non-ASCII decimal separators

This patch causes the radix string to be examined upon a new numeric
locale being set.  If the string isn't ASCII, and the new locale is
UTF-8, it turns on the UTF-8 flag in the scalar that holds the radix.
When a floating point number is formatted in Perl_sv_vcatpvfn_flags(),
and the flag is on, the result's flag will be set on too.

11 years agoProperly determine if in locale for NV stringification
Karl Williamson [Fri, 28 Jun 2013 21:43:54 +0000 (15:43 -0600)]
Properly determine if in locale for NV stringification

Commit 68e8f474bc686a86c064b695b9c7400313d7af65 used the wrong macro to
determine if the operation is within the scope of 'use locale'.  It also
has to operate under 'use locale 'not_characters'.

Tests for this are coming in the patch for [perl #118197].

11 years agoUpdate DB_File to CPAN version 1.829
Chris 'BinGOs' Williams [Sun, 7 Jul 2013 18:42:27 +0000 (19:42 +0100)]
Update DB_File to CPAN version 1.829

  [DELTA]

  1.829 7 July 2013

   * make realclean: removing all files
     RT #68214

   * Documented the issue where the error below

        BDB0588 At least one secondary cursor must be specified to DB->join

   * DB_File installs to wrong place for CPAN version
     RT #70420
     Makefile.PL prevents INSTALLDIRS on command line.
     RT #68287: Makefile.PL prevents INSTALLDIRS on command line.

   * typo fix
     RT #85335