This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
12 years agoupdated podcheck data file to know about the changes from Leon's patch
Jesse Vincent [Sun, 11 Sep 2011 17:10:01 +0000 (13:10 -0400)]
updated podcheck data file to know about the changes from Leon's patch

12 years agoDoc patch to perlipc
Leon Timmermans [Sun, 11 Sep 2011 16:09:52 +0000 (12:09 -0400)]
Doc patch to perlipc

1. I've removed some erroneous code regarding signal names (it doesn't
handle signal aliases) with a reference to a module that does handle
it correctly.
2. Removed the sample on temporary signal ignoring; this is not likely
to do what users want it to do. Possibly this should be replaced by a
discussion on sigprocmask & friends, but perhaps we can skip in
altogether
3. Corrected the discussion on permissions to take the difference
between real, effective and saved UIDs into account.
4. Removed all mention of the SysV signaling issue. This was rather
relevant when perlipc was written 15 years ago but it isn't anymore
nowadays.
5. Removed the suggestion that you can longjmp out of a signal handler
(see CERT's SIG32-C).

12 years agoAdd missing win32/config_H.* files to Porting/makerel
Steve Hay [Sun, 11 Sep 2011 16:02:53 +0000 (17:02 +0100)]
Add missing win32/config_H.* files to Porting/makerel

Most Win32 shell environments take no notice of these permissions
anyway, but this seems like a safer option than removing them all.

12 years agoSimplify generated XS code by emitting a compatibility version of dVAR.
Nicholas Clark [Sat, 10 Sep 2011 11:11:21 +0000 (13:11 +0200)]
Simplify generated XS code by emitting a compatibility version of dVAR.

If ExtUtils::ParseXS emits conditional C pre-processor code once per XS file
to provide a default for dVAR, then it doesn't need to emit 4 lines per
function to cater for dVAR not being present.

12 years agoTeach B::Concise about OPpFT_STACKING
Father Chrysostomos [Sun, 11 Sep 2011 05:26:29 +0000 (22:26 -0700)]
Teach B::Concise about OPpFT_STACKING

12 years agoCollapse repetititive code in tie_fetch_count.t
Father Chrysostomos [Sun, 11 Sep 2011 05:10:19 +0000 (22:10 -0700)]
Collapse repetititive code in tie_fetch_count.t

12 years agoMake utime handle get-magic correctly for glob(ref)s
Father Chrysostomos [Sun, 11 Sep 2011 05:03:32 +0000 (22:03 -0700)]
Make utime handle get-magic correctly for glob(ref)s

It used to ignore get-magic for globs and globrefs.

12 years agoStop filetest ops from calling FETCH on parent op’s arg
Father Chrysostomos [Sun, 11 Sep 2011 02:47:59 +0000 (19:47 -0700)]
Stop filetest ops from calling FETCH on parent op’s arg

This is a regression in 5.14.0.

Commit 6f1401dc made ops call get-magic before overloading, but it
ended up making filetest ops call get-magic on the topmost item of the
stack even if the filetest op was not going to use the stack (which
happens for ‘-r bareword’ and plain ‘-r’).

This would affect cases like:

  push @foo, $tied, -r;

12 years agoMake filetest ops handle get-magic correctly for glob(ref)s
Father Chrysostomos [Sun, 11 Sep 2011 01:39:12 +0000 (18:39 -0700)]
Make filetest ops handle get-magic correctly for glob(ref)s

This patch uses the recently-added MAYBE_DEREF_GV macro which puts the
glob deref logic in one spot.  It also adds _nomg and _flags varia-
tions of it.  _flags understands the SV_GMAGIC flag.

12 years agoRestore changelog entry removed by 378eeda
Father Chrysostomos [Sat, 10 Sep 2011 21:08:25 +0000 (14:08 -0700)]
Restore changelog entry removed by 378eeda

Existence of this entry has nothing to do with Borland support. It
is merely history, that’s all.

12 years ago-l followed by bareword should leave the stack alone
Father Chrysostomos [Sat, 10 Sep 2011 21:02:45 +0000 (14:02 -0700)]
-l followed by bareword should leave the stack alone

$ ln -s /usr/bin/perl bar
$ perl -le' print "bar", -l foo'
1

The -l ate my bar.

It’s this naughty piece of code in doio.c:Perl_my_lstat_flags that is
the culprit:

  if (ckWARN(WARN_IO)) {
      Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %s",
      GvENAME(cGVOP_gv));
      return (PL_laststatval = -1);
  }

When -l is followed by a bareward, it has no argument on the stack,
but the filetest op itself is a gvop.  That snippet is from the bare-
word-handling code.

So, if warnings are off, it falls through to the argument-on-the-stack
code and pops off something does not belong to it (that belong to the
print, in the example above).

12 years agoUpdate Archive-Tar to CPAN version 1.78
Chris 'BinGOs' Williams [Sat, 10 Sep 2011 20:18:14 +0000 (21:18 +0100)]
Update Archive-Tar to CPAN version 1.78

  [DELTA]

  * important changes in version 1.78 08/09/2011
  - patch from Rocky Bernstein to add chown() method [rt#70623]
  - blead patch from Alexandr Ciornii to resolve [perl#78708]

12 years agoDon’t call get-magic on a referenced array in chdir, etc.
Father Chrysostomos [Sat, 10 Sep 2011 17:01:00 +0000 (10:01 -0700)]
Don’t call get-magic on a referenced array in chdir, etc.

Commit 557fbd17eb added the MAYBE_DEREF_GV macro, which 2ea1cce
applied to chdir, chmod and chown.

That macro calls get-magic on its arguments checks to see if it might
be a gv or ref and, if it’s a ref, calls get-magic on the referent,
to see whether it will turn into a gv.  That means we’ll end up with
chdir($array_obj) calling get-magic on the array.  While probably
harmless, calling get-magic is superfluous and probably incorrect.  I
don’t know that there is a reasonable way to test this.

12 years agoAnother update to comments about regen_config_h target
Steve Hay [Sat, 10 Sep 2011 20:02:58 +0000 (21:02 +0100)]
Another update to comments about regen_config_h target

(Support for gc64nox was added to the vc64 configurations by commit
925798f29c, and the gc64 and gc64nox files were not mentioned at all)

12 years agoUpdate comments about regen_config_h target
Steve Hay [Sat, 10 Sep 2011 19:52:49 +0000 (20:52 +0100)]
Update comments about regen_config_h target

(Support for disabling HAS_CRYPT via Makefile options was removed
by commit 9cef830622, so building with a "minimal configuration" no
longer involves switching that option off.)

12 years agoFix MSWin32 skip in porting/globvar.t
Steve Hay [Sat, 10 Sep 2011 19:46:00 +0000 (20:46 +0100)]
Fix MSWin32 skip in porting/globvar.t

(With VC it skipped anyway due to 'nm' not being available, but with GCC
it ran further and crashed out on the open '-|' call.)

12 years agoThe Borland Chainsaw Massacre
Steve Hay [Sat, 10 Sep 2011 16:21:58 +0000 (17:21 +0100)]
The Borland Chainsaw Massacre

Remove support for the Borland C++ compiler on Win32, as agreed here:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2011-09/msg00034.html

12 years agoAdd plain ~ expansion for Windows system in File::Glob
Douglas Christopher Wilson [Sat, 10 Sep 2011 16:44:18 +0000 (09:44 -0700)]
Add plain ~ expansion for Windows system in File::Glob

Previously in File::Glob, a plain ~ expansion will check
the $HOME environment variable, but that does not normally
exist on Windows systems. There is another variable that
holds the appropriate home path value, which is $USERPROFILE.

This adds a fallback to check $USERPROFILE when $HOME is
not there, the system does not support checking the password
file and the system is DOSISH.

12 years agoAdd Douglas Christopher Wilson to AUTHORS
Father Chrysostomos [Sat, 10 Sep 2011 06:35:49 +0000 (23:35 -0700)]
Add Douglas Christopher Wilson to AUTHORS

12 years agoch(dir|mod|own) should also call FETCH on refs to tied globs
Father Chrysostomos [Sat, 10 Sep 2011 13:17:53 +0000 (06:17 -0700)]
ch(dir|mod|own) should also call FETCH on refs to tied globs

Following on from commit 935647290357b277, which corrected the beha-
viour for tied globs, this commit corrects the behaviour for refer-
ences to tied globs.

(With tests by Nicholas Clark.)

12 years agoAdd MAYBE_DEREF_GV macro
Father Chrysostomos [Sat, 10 Sep 2011 13:09:26 +0000 (06:09 -0700)]
Add MAYBE_DEREF_GV macro

There are so many parts of the core (mostly pp functions or functions
they call) that need a glob or a globref, including many that call
get-magic at the wrong time (or not at all in some cases, that it
makes sense to add a macro to do it.

It can be used like this:

   if (gv = MAYBE_DEREF_GV(sv)) /* calls get-magic */
   {

   }
   else { /* avoid magic here */

   }

12 years agoTweaks to tie_fetch_count.t
Nicholas Clark [Sat, 10 Sep 2011 13:08:21 +0000 (06:08 -0700)]
Tweaks to tie_fetch_count.t

Improve error diagnostics by reporting the caller's line number if
check_count() fails, and correct a thinko in a test description.

12 years ago"state" in perlfunc should point to "Persistent Private Variables"
Vincent Pit [Sat, 10 Sep 2011 13:20:55 +0000 (15:20 +0200)]
"state" in perlfunc should point to "Persistent Private Variables"

12 years agoAdd HOMEGROWN_POSIX_SIGNALS to PL_non_bincompat_options, and hence -V output.
Nicholas Clark [Thu, 8 Sep 2011 08:35:48 +0000 (10:35 +0200)]
Add HOMEGROWN_POSIX_SIGNALS to PL_non_bincompat_options, and hence -V output.

HOMEGROWN_POSIX_SIGNALS is only relevant on VMS.

12 years agoregen/opcode.pl: generate OP_IS_DIRHOP, use in gv.c
Jim Cromie [Thu, 2 Jun 2011 06:27:49 +0000 (00:27 -0600)]
regen/opcode.pl: generate OP_IS_DIRHOP, use in gv.c

Generate OP_IS_DIRHOP like other OP_IS_* macros,
use in gv.c:Perl_gv_add_by_type().
Modifies 'F' operand type to 'DF'.
This yields a micro-optimization.

12 years agoimplement OP_IS_NUMCOMPARE like other OP_IS macros
Jim Cromie [Mon, 18 Apr 2011 20:05:35 +0000 (14:05 -0600)]
implement OP_IS_NUMCOMPARE like other OP_IS macros

other macros are written by regen/opcode.pl into opnames.h
Generate OP_IS_NUMCOMPARE the same way, and get a micro-optimization.
Adds a new 'S<' operand type for the numeric comparison ops.
Needs make regen.

12 years ago[perl #92436] Filter::Simple can’t find end of POD
Father Chrysostomos [Sat, 10 Sep 2011 06:21:48 +0000 (23:21 -0700)]
[perl #92436] Filter::Simple can’t find end of POD

Filter::Simple’s $pod_or_DATA regexp was mistakenly written to look
for =end if the pod section began with =begin, and to look for the
end of the paragraph if the pod began with =for.  Only =cut and EOF
can end pod.

This patch does not fix Filter::Simple’s naïve way of finding the
beginning of pod.

12 years agoFixed repeated words
Walt Mankowski [Sat, 10 Sep 2011 04:00:31 +0000 (00:00 -0400)]
Fixed repeated words

12 years agoadjust TEST's valgrind invocation to also work with linux's perf stat
Jim Cromie [Sat, 10 Sep 2011 03:18:45 +0000 (20:18 -0700)]
adjust TEST's valgrind invocation to also work with linux's perf stat

Move --log-fd=3 option from unconditional invocation into VG_OPTS
default value.  A future version of perf will understand --log-fd=3,
but other tools probably will not, with this we can accommodate them,
and the current version of perf.

Makefile.SH:

Set VALGRIND var conditionally, to allow cmdline override (this is
probably non-portable, will need review at least).

perl.valgrind.config target's test of $(VALGRIND) is simplified to use
$(VG_TEST), which defaults to its legacy value: ./perl -e 1
2>/dev/null.  Setting it to '--help' is needed for perf, and would
also work to verify that valgrind is runnable, but current test is
slightly more comprehensive for valgrind, so Ive left that for user to
change in the environment.

t/TEST:

1. --log-fd=3 is in default, but can be overridden by setting VG_OPTS
2. several variable renames to clarify purpose
3. $toolnm to rename output file with flexible suffix,
    ie: valgrind, cachegrind, perf-stat
4. add perf to cachegrind as a special case, avoid culling of valgrind
   output files by their content

With above, and following env, make test.valgrind works:

  # --log-fd isnt mainline yet.
  VALGRIND=/home/jimc/projects/lx/linux-2.6/tools/perf/perf
  VG_TEST=--help
  VG_OPTS='stat --log-fd=3 -- '

$> make test.valgrind;
PERL_VALGRIND=1 VALGRIND='/home/jimc/projects/lx/linux-2.6/tools/perf/perf'  ./runtests choose
t/base/cond....................................................ok
t/base/if......................................................ok
t/base/lex.....................................................ok
...

[jimc@groucho perl]$ cat t/base/*.perf-stat

 Performance counter stats for './perl base/cond.t':

          5.882071 task-clock                #    0.850 CPUs utilized
                 1 context-switches          #    0.000 M/sec
                 1 CPU-migrations            #    0.000 M/sec
               483 page-faults               #    0.082 M/sec
         4,688,843 cycles                    #    0.797 GHz
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
         3,368,118 instructions              #    0.72  insns per cycle
           718,821 branches                  #  122.205 M/sec
            48,053 branch-misses             #    6.68% of all branches

       0.006920536 seconds time elapsed

This patch will allow you to use released version of perf,
just drop the --log-fd from VG_OPTS.  The tests will fail,
because perf will write to STDOUT, and foul the harness.

The following runs cachegrind, creates t/*/*.cachegrind files.
It is much slower than using perf-stat.

$> export VG_OPTS='--tool=cachegrind --log-fd=3 -- '
$> make test.valgrind

==25822== Cachegrind, a cache and branch-prediction profiler
==25822== Copyright (C) 2002-2009, and GNU GPL'd, by Nicholas Nethercote et al.
==25822== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==25822== Command: ./perl base/cond.t
==25822==
==25822==
==25822== I   refs:      1,680,072
==25822== I1  misses:        8,129
==25822== L2i misses:        3,675
==25822== I1  miss rate:      0.48%
==25822== L2i miss rate:      0.21%
==25822==
==25822== D   refs:        604,393  (400,033 rd   + 204,360 wr)
==25822== D1  misses:       12,599  (  8,838 rd   +   3,761 wr)
==25822== L2d misses:        6,261  (  2,966 rd   +   3,295 wr)
==25822== D1  miss rate:       2.0% (    2.2%     +     1.8%  )
==25822== L2d miss rate:       1.0% (    0.7%     +     1.6%  )
==25822==
==25822== L2 refs:          20,728  ( 16,967 rd   +   3,761 wr)
==25822== L2 misses:         9,936  (  6,641 rd   +   3,295 wr)
==25822== L2 miss rate:        0.4% (    0.3%     +     1.6%  )

NB: The following almost works; t runs the 1st test 5 times, and
produces 1 statistics file, but it fails, because TEST sees multiple
leaders, (FAILED--seen duplicate leader) and exits immediately,
because it happens in t/base.  A work-around is easy enough, but adds
yet another knob. TBD.

$> VALGRIND=perf VG_OPTS='stat -r5 --log-fd=3 --' make test.valgrind

 Performance counter stats for './perl base/cond.t' (5 runs):

          5.568965 task-clock                #    0.833 CPUs utilized            ( +-  1.82% )
                 0 context-switches          #    0.000 M/sec                    ( +- 61.24% )
                 0 CPU-migrations            #    0.000 M/sec                    ( +-100.00% )
               478 page-faults               #    0.086 M/sec                    ( +-  0.37% )
         4,441,737 cycles                    #    0.798 GHz                      ( +-  1.84% )
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
         3,183,574 instructions              #    0.72  insns per cycle          ( +-  2.30% )
           669,241 branches                  #  120.173 M/sec                    ( +-  2.87% )
            41,826 branch-misses             #    6.25% of all branches          ( +-  3.78% )

       0.006688160 seconds time elapsed                                          ( +-  1.49% )

This patch is really a proof-of-concept; perf tool has far more
capabilities than t/TEST can exploit well, but this is a start,
and makes perf foo experimentation easier.

12 years agot/TEST: collect user, sys cpu times for each testfile
Jim Cromie [Sun, 13 Mar 2011 20:13:15 +0000 (14:13 -0600)]
t/TEST: collect user, sys cpu times for each testfile

In t/TEST, run times() before and after each testfile, and save diffs
into $timings{$testname}, currently containing $etms only.

When run as HARNESS_TIMER=../../perl make test, (also when HARNESS_TIMER=2 or more)
harness output now looks like this:

t/base/cond ................................................... ok        7 ms     0 ms     0 ms
t/base/if ..................................................... ok        4 ms     0 ms     0 ms
t/base/lex .................................................... ok       13 ms     0 ms     0 ms
t/base/num .................................................... ok        9 ms    10 ms     0 ms
t/base/pat .................................................... ok        4 ms     0 ms    10 ms
t/base/rs ..................................................... ok       14 ms    10 ms     0 ms
t/base/term ................................................... ok       20 ms     0 ms    10 ms
t/base/while .................................................. ok        8 ms     0 ms    10 ms
t/comp/bproto ................................................. ok        9 ms    10 ms     0 ms

The additional timing data is also written into the Storable file:

  'perf' => {
    '../cpan/Archive-Extract/t/01_Archive-Extract.t' => [
      '3916.87417030334',
      '1700',
      '2380'
    ],
    '../cpan/Archive-Tar/t/01_use.t' => [
      '92.1041965484619',
      '70.0000000000003',
      '19.9999999999996'
    ],
    ...

The numbers are: elapsed time, user-time, system-time.  The latter 2
are children-times from times(); self-times are those of the harness,
which are uninteresting.

They often dont add up (in naive sense); ET can be greater than sum of
others, especially if the process blocks on IO, or can be less than
others, if the process forks and both children are busy.  Also, child
times have 10 ms resolution on Linux, other OS or kernel build options
may vary.

Calling times() in harness will likely also collect bogus child data
if 2 testfiles are run in parallel.

12 years agoif -d HARNESS_TIMER, t/TEST saves timings in Storable file
Jim Cromie [Sun, 13 Mar 2011 19:13:27 +0000 (13:13 -0600)]
if -d HARNESS_TIMER, t/TEST saves timings in Storable file

if HARNESS_TIMER envar is an existing directory, write timings data
and various platform and configuration data to a Storable file.
Given a large collection of files, the variance of each test can be
determined.

The configuration data should be sufficient to compare different
builds done on the same box.  The platform data will hopefully allow
meaningful comparison of tests done on similar boxes, with same or
other OS, compiler, memory, etc.  Both are subject to change, for both
content and format, latter being less important because of the
normalization possible during analysis, if the data is there.

Harness output still looks the same:

t/porting/cmp_version ......................................... ok      757 ms
t/porting/diag ................................................ ok     1172 ms
t/porting/dual-life ........................................... ok       88 ms
t/porting/exec-bit ............................................ ok       86 ms
t/porting/filenames ........................................... ok      176 ms
t/porting/globvar ............................................. ok       99 ms
t/porting/maintainers ......................................... ok      501 ms
t/porting/manifest ............................................ ok      251 ms
t/porting/podcheck ............................................ ok    15013 ms
t/porting/regen ............................................... ok     1033 ms
t/porting/test_bootstrap ...................................... ok       36 ms
All tests successful.
u=11.67  s=5.07  cu=375.07  cs=84.26  scripts=2045  tests=471995
wrote storable file: ../../perf/2011-9-7-2-45.ttimes

The Storable file data looks like:

$VAR1 = {
  'conf' => {
    'byacc' => 'byacc',
    'cc' => 'cc',
    'cccdlflags' => '-fPIC',
    'ccdlflags' => '-Wl,-E',
    ...
  },
  'host' => 'groucho.jimc.earth',
  'perf' => {
    '../cpan/Archive-Extract/t/01_Archive-Extract.t' => '3960.50214767456',
    '../cpan/Archive-Tar/t/01_use.t' => '94.3360328674316',
    '../cpan/Archive-Tar/t/02_methods.t' => '737.880945205688',
    '../cpan/Archive-Tar/t/03_file.t' => '118.676900863647',
    '../cpan/Archive-Tar/t/04_resolved_issues.t' => '130.842924118042',
    ...

12 years agosave elapsed-time-ms in global hash for later reporting
Jim Cromie [Sun, 13 Mar 2011 19:07:42 +0000 (13:07 -0600)]
save elapsed-time-ms in global hash for later reporting

12 years agoadd space after testfile name, and before ok/not ok
Jim Cromie [Sun, 13 Mar 2011 18:44:34 +0000 (12:44 -0600)]
add space after testfile name, and before ok/not ok

Adding space between testfile name and ...... lets user double-click
on just the name, instead of getting all the dots too, reducing the
cmdline editing to resubmit the test manually.  Space before ok/not-ok
allows easier parsing with split /\s/, $line.  Both make output agree
more closely with that from Test::*

12 years agoUpgrade to threads::shared 1.40
Jerry D. Hedden [Fri, 9 Sep 2011 23:54:52 +0000 (19:54 -0400)]
Upgrade to threads::shared 1.40

12 years agoremove index offsetting ($[)
Zefram [Fri, 9 Sep 2011 22:27:16 +0000 (23:27 +0100)]
remove index offsetting ($[)

$[ remains as a variable.  It no longer has compile-time magic.
At runtime, it always reads as zero, accepts a write of zero, but dies
on writing any other value.

12 years agoCorrect mro.c typo added by 006d9e7b3
Father Chrysostomos [Fri, 9 Sep 2011 20:48:28 +0000 (13:48 -0700)]
Correct mro.c typo added by 006d9e7b3

12 years agorelease Carp-1.23 to CPAN
Zefram [Fri, 9 Sep 2011 19:38:57 +0000 (20:38 +0100)]
release Carp-1.23 to CPAN

12 years agomake Carp::Heavy load Carp for backcompat
Zefram [Fri, 9 Sep 2011 19:09:47 +0000 (20:09 +0100)]
make Carp::Heavy load Carp for backcompat

12 years agoWhen probing strxfrm, consider a consistent return value of 0 as sane
Nicholas Clark [Fri, 9 Sep 2011 16:15:00 +0000 (18:15 +0200)]
When probing strxfrm, consider a consistent return value of 0 as sane

12 years agoProvide more information in the message for "strxfrm() gets absurd".
Nicholas Clark [Fri, 9 Sep 2011 13:53:06 +0000 (15:53 +0200)]
Provide more information in the message for "strxfrm() gets absurd".

Prefix it with "panic", report the two lengths that caused the sanity test
failure, and add the message to perldiag.pod.

12 years agoRemove a Devel::DProf error from perldiag.pod
Nicholas Clark [Fri, 9 Sep 2011 13:41:52 +0000 (15:41 +0200)]
Remove a Devel::DProf error from perldiag.pod

Devel::DProf is no longer in the core distribution, hence the core
distribution can no longer generate this particular warning message.

12 years agoIn pp_chdir, move SvGETMAGIC(sv) out of the if() condition.
Nicholas Clark [Fri, 9 Sep 2011 11:02:46 +0000 (13:02 +0200)]
In pp_chdir, move SvGETMAGIC(sv) out of the if() condition.

It was added to the if() condition as part of 935647290357b277.
Unfortunately the syntax used to implemented SvGETMAGIC(sv) is considered by
gcc to be valid in an expression, but is not valid in other compilers.

12 years agoCollapse some code in shared.xs
Father Chrysostomos [Fri, 9 Sep 2011 05:49:12 +0000 (22:49 -0700)]
Collapse some code in shared.xs

In the previous commit, I added duplicate code to make it obvious what
was going on.

12 years ago[perl #98204] Shared objects not destoryed
Father Chrysostomos [Fri, 9 Sep 2011 05:35:44 +0000 (22:35 -0700)]
[perl #98204] Shared objects not destoryed

Jerry wrote:
> threads::shared objects stored inside other
> threads::shared structures are not properly destroyed.
>  When a threads::shared object is 'removed' from a
> threads::shared structure (e.g., a hash), the object's
> DESTROY method is not called.

Later, he said:
> When PL_destroyhook and Perl_shared_object_destroy were
> added, the problem they were overcoming was that the
> destruction of each threads::shared proxy was causing the
> underlying shared object's DESTROY method to be called. The
> fix provided a refcount check on the shared object so that
> the DESTROY method was only called with the shared object
> was no longer in use.
>
> The above works fine when delete() and pop() are used,
> because a proxy is created for the stored shared object that
> is being deleted (i.e., the value returned by the delete()
> call), and when the proxy is destroyed, the object's DESTROY
> method is called.
>
> However, when the stored shared object is 'removed' in some
> other manner (e.g., setting the storage location to
> 'undef'), there is no proxy involved, and hence DESTROY does
> not get called for the object.

This commit fixes that by modifying sharedsv_scalar_store,
sharedsv_scalar_mg_free and sharedsv_array_mg_CLEAR.

Each of those functions now checks whether the current item being
freed has sub-items with reference counts of 1.  If so, that means the
sub-item will be freed as a result of the outer SV’s being freed.  It
also means that there are no proxy objects and that destructors will
hence not be called.  So it pushes a new proxy on to the calling con-
text’s mortals stack.  If there are multiple levels of nested objects,
then, when the proxy on the mortals stack is freed, it triggers
sharedsv_scalar_mg_free, which goes through the process again.

This does not fix the problem for shared objects that still exist
(without proxies) at global destruction time.  I cannot make that
work, as circularities will cause new proxies to be created continu-
ously and pushed on to the mortals stack.  Also, the proxies may end
up being created too late during global destruction, after the mor-
tals stack has been emptied, and when there is not enough of the run-
time environment left for destructors to run.  That will happen if
the shared object is referenced by a shared SV that is not an object.
The calling context doesn’t know about the object, so it won’t fire
the destructor at the object-destroying stage of global destruction.
Detecting circularities is also problematic: We would have to keep
a hash of ‘seen’ objects in the shared space, but then how would we
know when to free that?  Letting it leak would affect embedded
environments.

So this whole trick of creating mortal proxy objects is skipped during
global destruction.

12 years agoshared.xs: Refactor to simplify S_get_RV’s callers
Father Chrysostomos [Thu, 8 Sep 2011 05:43:34 +0000 (22:43 -0700)]
shared.xs: Refactor to simplify S_get_RV’s callers

Every function that calls S_get_RV needs this same incantation:

        S_get_RV(aTHX_ sv, ssv);
        /* Look ahead for refs of refs */
        if (SvROK(SvRV(ssv))) {
            SvROK_on(SvRV(sv));
            S_get_RV(aTHX_ SvRV(sv), SvRV(ssv));
        }

Also, S_get_RV keeps repeating SvRV(ssv), even though it assigns it to
sobj at the top.

Also, an upcoming commit will need the ability to pass the referent to
S_get_RV.

So this patch changes S_get_RV to accept a referent instead (eliminat-
ing its multiple use of SvRV) and adds a get_RV macro to take care of
the standard calling rite.

12 years agoSimplify example pack code in perlpacktut
Mark Jason Dominus [Fri, 9 Sep 2011 05:18:47 +0000 (00:18 -0500)]
Simplify example pack code in perlpacktut

12 years agoEnter gv_fetchsv_nomg
Father Chrysostomos [Fri, 9 Sep 2011 03:45:20 +0000 (20:45 -0700)]
Enter gv_fetchsv_nomg

There are so many cases that use this incantation to get around
gv_fetchsv’s calling of get-magic--

    STRLEN len;
    const char *name = SvPV_nomg_const(sv,len);
    gv = gv_fetchpvn_flags(name, len, flags | SvUTF8(sv), type);

--that it’s about time we had a shorthand.

12 years agoremove bogus < in B<> formatting code
Ricardo Signes [Fri, 9 Sep 2011 02:52:09 +0000 (22:52 -0400)]
remove bogus < in B<> formatting code

12 years agoadd known issues for new OO docs
Dave Rolsky [Fri, 9 Sep 2011 03:06:02 +0000 (22:06 -0500)]
add known issues for new OO docs

12 years agosome small fixes to make porting/podcheck.t happy
Dave Rolsky [Fri, 9 Sep 2011 03:04:12 +0000 (22:04 -0500)]
some small fixes to make porting/podcheck.t happy

12 years agoTweak line length of comment in verbatim section per podcheck.t
Dave Rolsky [Fri, 9 Sep 2011 02:58:12 +0000 (21:58 -0500)]
Tweak line length of comment in verbatim section per podcheck.t

12 years agoLots of updates based on feedback from sprout, including a few new sections
Dave Rolsky [Mon, 11 Jul 2011 02:58:33 +0000 (21:58 -0500)]
Lots of updates based on feedback from sprout, including a few new sections

12 years agoSome changes based no sprout's feedback
Dave Rolsky [Sun, 10 Jul 2011 23:52:33 +0000 (18:52 -0500)]
Some changes based no sprout's feedback

12 years agofix now-broken link to removed section in perlobj
Dave Rolsky [Fri, 8 Jul 2011 22:49:13 +0000 (17:49 -0500)]
fix now-broken link to removed section in perlobj

12 years agoAdd perldelta entries for all doc changes
Dave Rolsky [Thu, 7 Jul 2011 19:32:59 +0000 (14:32 -0500)]
Add perldelta entries for all doc changes

12 years agoRedo all examples using File and File::MP3
Dave Rolsky [Thu, 7 Jul 2011 19:07:53 +0000 (14:07 -0500)]
Redo all examples using File and File::MP3

12 years agoRemove all references to old OO tutorial docs, and add refs to perlootut where approp...
Dave Rolsky [Thu, 7 Jul 2011 18:45:45 +0000 (13:45 -0500)]
Remove all references to old OO tutorial docs, and add refs to perlootut where appropriate

Used buildtoc to regenerate pod-related files

12 years agoremove all old OO tutorials (and perlbot)
Dave Rolsky [Thu, 7 Jul 2011 16:43:25 +0000 (11:43 -0500)]
remove all old OO tutorials (and perlbot)

12 years agoSmall revisions to the text to increase clarity, suggested by Philip Monsen
Dave Rolsky [Thu, 7 Jul 2011 18:51:28 +0000 (13:51 -0500)]
Small revisions to the text to increase clarity, suggested by Philip Monsen

12 years agoAdd more details on inside-out objects from David Golden, and an inside-out class...
Dave Rolsky [Thu, 7 Jul 2011 15:47:35 +0000 (10:47 -0500)]
Add more details on inside-out objects from David Golden, and an inside-out class example from Abigail.

Add strict & warning to blessed scalar class example

12 years agoheavily revised perlobj.pod
Dave Rolsky [Thu, 7 Jul 2011 16:35:00 +0000 (11:35 -0500)]
heavily revised perlobj.pod

12 years agoUse same list of "when to use OO" criteria in perlmodstyle as in perlootut
Dave Rolsky [Wed, 23 Mar 2011 15:38:28 +0000 (10:38 -0500)]
Use same list of "when to use OO" criteria in perlmodstyle as in perlootut

See my previous commit message for permission from ORA to use this text under
the same license as Perl itself.

12 years agoAdd Damian's list of when to use OO - copied from PBP
Dave Rolsky [Wed, 23 Mar 2011 15:00:05 +0000 (10:00 -0500)]
Add Damian's list of when to use OO - copied from PBP

Here's the email from Teri Finn at O'Reilly giving us permission to do so:

-------------------------------------------------------------------------

Dave,

O'Reilly Media is happy to grant you the permissions you have requested below.

If you are able to include the copyright notice in the attribution that would be great.

Damian Conway wrote about when to use OO in Perl Best Practices, Copyright © 2004, Published by O'Reilly Media, Inc.
 His list of criteria for doing so is:

Our best to you on your project.

Teri Finn
O'Reilly Media, Inc.

----- Original Message -----
From: "Dave Rolsky" <autarch@urth.org>
To: permissions@oreilly.com
Cc: damian@conway.org
Sent: Sunday, March 6, 2011 6:58:34 PM GMT -08:00 US/Canada Pacific
Subject: Usage of text from Perl Best Practices

Hi, ORA,

I'm working on the Perl 5 core documentation, specifically on a new OO
tutorial. I'd like to include Damian's "when to use OO" list as published
in Perl Best Practices (pages 320-321).

I don't want to include the entire text verbatim, just the bullet points.

I wrote to Damian and he is okay with having this included in the docs,
just as an FYI.

To do this, I'd need permission to include the text and distribute it
under the same license as Perl 5 itself, which is currently version 1 of
the Artistic license.

I would of course credit Damian and note the book, something like ....

   Damian Conway wrote about when to use OO in Perl Best Practices. His
   list of criteria for doing so is:

Thanks,

-dave

12 years agoCheck in new OO tutorial - perlootut
Dave Rolsky [Thu, 7 Jul 2011 16:36:37 +0000 (11:36 -0500)]
Check in new OO tutorial - perlootut

12 years agoch(dir|mod|own) should not ignore get-magic on glob(ref)s
Father Chrysostomos [Fri, 9 Sep 2011 01:03:02 +0000 (18:03 -0700)]
ch(dir|mod|own) should not ignore get-magic on glob(ref)s

When the chdir(*handle) feature was added in 5.8.8, the fact that
globs and refs could be magical was not taken into account.

They can easily be magical if a typeglob or reference is returned from
or assigned to a tied variable.

12 years agoCall get-magic once for *glob=$tied
Father Chrysostomos [Thu, 8 Sep 2011 21:51:07 +0000 (14:51 -0700)]
Call get-magic once for *glob=$tied

This is a regression in 5.10.0.

12 years agoUpdate perlfaq to CPAN version 5.0150033
Chris 'BinGOs' Williams [Thu, 8 Sep 2011 14:54:31 +0000 (15:54 +0100)]
Update perlfaq to CPAN version 5.0150033

  [DELTA]

  5.0150033 Tue 30 Aug 2011 21:46:25 +0100
    * Perl 6 changes (apeiron)
    * Replace tabs with spaces (ranguard)
    * Link to www.cpan.org/ports/ for binary (ranguard)
    * Switch C<> over to L<> for any module on CPAN (ranguard)
    * Change brace stype (apeiron)
    * Extra dzil tests (rafl)
    * Changes so more semantic, and better rendered HTML (ranguard)
    * Point to repo for how to update perlfaq (ranguard)

12 years agoUpdate Module-Load-Conditional to CPAN version 0.46
Chris 'BinGOs' Williams [Thu, 8 Sep 2011 14:41:20 +0000 (15:41 +0100)]
Update Module-Load-Conditional to CPAN version 0.46

  [DELTA]

  Changes for 0.46    Wed Sep  7 23:57:03 BST 2011
  =================================================
  * Use || instead of "or" (perl#78708) (chorny)

12 years agoremove unused variables and assignments
Robin Barker [Wed, 7 Sep 2011 21:22:42 +0000 (22:22 +0100)]
remove unused variables and assignments

and silences some compiler warnings.
I do not understand the code in toke.c but the change aligns the code
with other uses of FUN0OP, it has no warnings and does not break any test.

12 years agoSuppress warning from tie_fetch_count.t
Father Chrysostomos [Thu, 8 Sep 2011 07:02:39 +0000 (00:02 -0700)]
Suppress warning from tie_fetch_count.t

12 years agoavoid " in Carp.t test programs, due to Win32 shell issues
Tony Cook [Tue, 6 Sep 2011 13:45:02 +0000 (23:45 +1000)]
avoid " in Carp.t test programs, due to Win32 shell issues

Win32 doesn't have a real execv(), so the " end up in the
command-line, interfering with the normal quoted command-line
processing.

12 years agoIncrease $attributes::version to 0.16
Father Chrysostomos [Thu, 8 Sep 2011 05:14:09 +0000 (22:14 -0700)]
Increase $attributes::version to 0.16

12 years agoConvert some files from Latin-1 to UTF-8
Keith Thompson [Mon, 5 Sep 2011 23:37:46 +0000 (16:37 -0700)]
Convert some files from Latin-1 to UTF-8

12 years agoUpdate Module-Metadata to CPAN version 1.000007
Chris 'BinGOs' Williams [Wed, 7 Sep 2011 22:18:03 +0000 (23:18 +0100)]
Update Module-Metadata to CPAN version 1.000007

  [DELTA]

  1.0.7 2001-09-07 12:00:00
    - Apply VMS fixes backported from blead (Craig A. Berry)

12 years agoIn Dumper.xs, use sv_newmortal() instead of sv_mortalcopy(&PL_sv_undef).
Nicholas Clark [Wed, 7 Sep 2011 21:00:10 +0000 (23:00 +0200)]
In Dumper.xs, use sv_newmortal() instead of sv_mortalcopy(&PL_sv_undef).

The two produce identical results. The former is terser, and far more
efficient.

12 years agoODBM_File can use the same T_PTROBJ typemap as the other ?DBM_File modules.
Nicholas Clark [Wed, 7 Sep 2011 20:30:52 +0000 (21:30 +0100)]
ODBM_File can use the same T_PTROBJ typemap as the other ?DBM_File modules.

This simplifies the RETVAL handling in TIEHASH, and makes the code closer
to the other 3 ?DBM_File modules. The difference in TIEHASH handling dates
back to 5.000, where only ODBM_File needed helper code around the dbm_open()
call. The other 3 were able to #define it as dbm_TIEHASH, and hence had no
CODE: section when first written.

12 years agoUpdate Module-Metadata to CPAN version 1.000006
Chris 'BinGOs' Williams [Wed, 7 Sep 2011 09:00:41 +0000 (10:00 +0100)]
Update Module-Metadata to CPAN version 1.000006

  [DELTA]

  1.0.6 2011-08-29 04:00:00
    - Support PACKAGE BLOCK syntax (VPIT)

  [Additional info]

  Reapplied the changes made by Craig Berry for VMS in commit
  63f27fd71dd22aa00021eb1e4fde4faa55ec9524

  Raised [https://rt.cpan.org/Public/Bug/Display.html?id=70781] to
  upstream these changes.

12 years agoIn Glob.xs, use memset() instead of bzero()
Nicholas Clark [Tue, 6 Sep 2011 13:06:06 +0000 (15:06 +0200)]
In Glob.xs, use memset() instead of bzero()

3c97495f56fb647c used bzero(), which isn't available on some platforms.

12 years agoRelease managers guide changed to rmv stale perldeltas
Karl Williamson [Fri, 2 Sep 2011 21:05:48 +0000 (15:05 -0600)]
Release managers guide changed to rmv stale perldeltas

We have decided to not deliver the BLEAD-POINT perldeltas, as their
information should have been consolidated into the BLEAD-FINAL
perldelta.

12 years agoRemove old odd-numbered releases perldeltas
Karl Williamson [Mon, 29 Aug 2011 14:40:13 +0000 (08:40 -0600)]
Remove old odd-numbered releases perldeltas

The odd-numbered releases are for internal development, and their
individual perldeltas are collated togeter for the next even numbered
dot 0 release.  This means that the individual perldeltas are no longer
useful once that dot 0 release is made, and they clutter things up,
giving duplicate information.

12 years agoRT #4682: given() didn't scope $_ correctly
David Mitchell [Tue, 6 Sep 2011 11:16:23 +0000 (12:16 +0100)]
RT #4682: given() didn't scope $_ correctly

given(expr) {...} behaves similarly to { my $_ = expr; ...},
except that, prior to this commit, it wasn't doing the SAVECLEARSV()
that pp_padsv would do.  This meant that $_ was still marked as stale
while in scope, and wasn't getting cleared at the end of scope.

12 years agoS_op_integerize() needs a dVAR, else -DPERL_GLOBAL_STRUCT doesn't build.
Nicholas Clark [Tue, 6 Sep 2011 11:16:58 +0000 (13:16 +0200)]
S_op_integerize() needs a dVAR, else -DPERL_GLOBAL_STRUCT doesn't build.

12 years agoExtUtils::ParseXS: Fix INCLUDE: $cmd |
Steffen Mueller [Tue, 6 Sep 2011 06:20:54 +0000 (08:20 +0200)]
ExtUtils::ParseXS: Fix INCLUDE: $cmd |

INCLUDE: $cmd | is the old, deprecated way of reading the output of
a command into a stream of XS code. Unfortunately, it was accidentally
broken by fe7ae66bc2e4a8bbc90ba0d852e511116d6e97bb by replacing the
two-arg open with a three-arg open that opens in read-mode.
This change fixes the issue, reported as CPAN RT #70213.

12 years agoMove non-constant folding parts of fold_constants into a separate functions.
Gerard Goossen [Sat, 20 Aug 2011 19:18:44 +0000 (21:18 +0200)]
Move non-constant folding parts of fold_constants into a separate functions.

The non-constant folding parts of fold_constants are moved into
separate functions. op_integerize handles converting ops to integer
(and special case of OP_NEGATE), op_std_init handling some standard
functionality (forced scalar context and allocating the TARGET).
Both functions are called where fold_constants is called (but we might
want to make that a bit some selective and use op_std_init in other
places).

12 years ago[perl #98414] Update Math-BigInt-FastCalc to CPAN version 0.30.
Peter John Acklam [Mon, 5 Sep 2011 15:24:33 +0000 (08:24 -0700)]
[perl #98414] Update Math-BigInt-FastCalc to CPAN version 0.30.

12 years agoNo more special socket header handling for VMS.
Craig A. Berry [Mon, 5 Sep 2011 13:25:24 +0000 (08:25 -0500)]
No more special socket header handling for VMS.

This is necessary after 046cc26cf77f76bc63fd4d206fef560054f5d298,
which removed the special handling in vmsish.h.  Building with
threads masked the need for the current change because reentr.h
also does the equivalent.

12 years agoAdd enable/disable commands for breakpoints in perl -d
Shlomi Fish [Sun, 4 Sep 2011 19:29:59 +0000 (12:29 -0700)]
Add enable/disable commands for breakpoints in perl -d

12 years agoFix a skip count in base's t/fields.t
Florian Ragwitz [Sun, 4 Sep 2011 23:50:58 +0000 (01:50 +0200)]
Fix a skip count in base's t/fields.t

12 years agoPass -Idist/Carp/lib to miniperl
Vincent Pit [Sun, 4 Sep 2011 22:11:24 +0000 (00:11 +0200)]
Pass -Idist/Carp/lib to miniperl

The build was broken by the move of Carp from lib to dist, because
miniperl calls perlmodlib.PL, perlmodlib.PL loads FindBin, and FindBin
wants Carp.

12 years agoUpdate CPANPLUS-Dist-Build to CPAN version 0.58
Chris 'BinGOs' Williams [Sun, 4 Sep 2011 20:47:29 +0000 (21:47 +0100)]
Update CPANPLUS-Dist-Build to CPAN version 0.58

  [DELTA]

  0.58 Sun Sep  4 20:42:48 BST 2011
    - Added local::lib type behaviour detection to disable use of 'sudo'

12 years agoInclude negative index of array in warnings about an unitialized value wen constant...
Gerard Goossen [Sat, 3 Sep 2011 10:28:45 +0000 (12:28 +0200)]
Include negative index of array in warnings about an unitialized value wen constant folding isn't done.

When constant folding isn't done OP_NEGATE isn't merged with
a constant, and the index isn't detected when warning about
unintialized values. This patch adds special handling for OP_NEGATE to
the index detection.

12 years agoCompare to newer ExtUtils::ParseXS from CPAN
Steffen Mueller [Sun, 4 Sep 2011 16:56:23 +0000 (18:56 +0200)]
Compare to newer ExtUtils::ParseXS from CPAN

12 years agoExtUtils::ParseXS: Allow users to enforce linkage of XSUBs
Steffen Mueller [Sun, 4 Sep 2011 16:55:06 +0000 (18:55 +0200)]
ExtUtils::ParseXS: Allow users to enforce linkage of XSUBs

... using defines.
For easy backwards-compatibility of XS modules, we allow XS authors
to use
  #define PERL_EUPXS_ALWAYS_EXPORT
or
  #define PERL_EUPXS_NEVER_EXPORT
to choose one or the other behaviour. Since "always export" has been
the default behaviour of ExtUtils::ParseXS for virtually ever, defining
PERL_EUPXS_ALWAYS_EXPORT means that you get that behaviour in a very
backwards compatible way (barring a few broken EU::PXS releases).

12 years agoimprove Carp portability to earlier perls
Zefram [Sat, 3 Sep 2011 13:39:25 +0000 (14:39 +0100)]
improve Carp portability to earlier perls

* avoid vivifying globs in utf8::
* skip caller override completeness check if it would leak
* regularise format of Carp::Heavy for CPAN indexing

12 years agodual-life Carp
Zefram [Fri, 2 Sep 2011 23:54:36 +0000 (00:54 +0100)]
dual-life Carp

Make Carp portable to older Perl versions:
* check minimum Perl version (5.6) at load time
* use || instead of //
* attempt downgrading to avoid loading Unicode tables when that might fail
* check whether utf8::is_utf8() exists before calling it
* lower IPC::Open3 version requirement in Carp tests

12 years agomove Carp to ext/Carp, preparing for dual-lifing
Zefram [Wed, 31 Aug 2011 19:59:01 +0000 (20:59 +0100)]
move Carp to ext/Carp, preparing for dual-lifing

12 years agoRemove WITH_THR() and WITH_THX(), which are not used.
Nicholas Clark [Tue, 30 Aug 2011 10:48:43 +0000 (12:48 +0200)]
Remove WITH_THR() and WITH_THX(), which are not used.

grep.cpan.me and Google's codesearch find no use of WITH_THR or WITH_THX.

WITH_THX() was added in June 1999 in cea2e8a9dd23747f, and the last user
eliminated with 0b250b9ef0d5134f in August 1999. WITH_THX() was used again
for DEBUG_CX() in 1c98cc53150c4860, and eliminated in d9f81b50694a810f.

WITH_THR() was added in 1997 in 0f15f207c55ce70f. Use everywhere except
DEBUG_SCOPE() was eliminated in 2006 in 11206fddaf7ef068. WITH_THR() was
removed from DEBUG_SCOPE() in d9f81b50694a810f.

12 years agoUCD.t: Add tests for sped-up lookups
Karl Williamson [Mon, 29 Aug 2011 15:15:52 +0000 (09:15 -0600)]
UCD.t: Add tests for sped-up lookups

This adds some tests for commit 5c3b35c95645d687026b198c24e884914bfb6ce6

12 years agomktables: make_Heavy.pl smaller
Karl Williamson [Sat, 3 Sep 2011 19:47:19 +0000 (13:47 -0600)]
mktables: make_Heavy.pl smaller

During the time that mktables was being heavily revamped, Unicode
proposed a number of new properties whose names began with 'Is'.  Perl
since 5.6 has alllowed properties to have an optional 'Is' prefix.  Thus
there was the possibility that a new property name from Unicode would
conflict with one of Perl's name extensions.  Thus, the code was written
to individually suppress such an extension when there was a conflict;
though this would be an undesirable state of affairs, where previously
working code would have to be changed due to a new Unicode release.
However, it turns out that other Unicode implementors had done the same
thing Perl had done, and the protests forced the new Unicode standard to
remove the 'Is' from the new properties; and apparently they won't try
to do this again.

However, the more general case code was still in mktables, doing no
harm, except enlarging significantly several of the hashes in Heavy.pl
to have essentially double the entries; one for the 'Is', and one
without.  There have been some murmurings that Heavy.pl takes up too
much memory.  Further, future commits are planned that would take up
space as well, and that could be made much smaller by not having the
individual basis for having Is/non-Is.

So, this commit takes away the individual property Is/non-Is and
replaces it with a blanket approach that has it for all Unicode
properties.  This requires a single extra statement in utf8_heavy.
This has already been added mistakenly, but harmlessly, in commit
45376db692c38e06f27b8331d036652ec5fbb3d1

Note that perl extensions still have the individual Is/non-Is.  This is
because the blanket approach won't work for them, as some of the 'Is'
synonyms do routinely get approaced in the case of the Block property.
It is documented that one shouldn't use the 'Is' prefix for the Block
property, because future Unicode versions could break your code.

12 years agoRemove sockadapt layer from the VMS build.
Craig A. Berry [Sat, 3 Sep 2011 19:44:11 +0000 (14:44 -0500)]
Remove sockadapt layer from the VMS build.

SOCKETSHR is/was an interface to abstract out TCP/IP calls for the
various vendors' networking implementations, including the freeware
CMU-IP stack.  Neither SOCKETSHR nor CMU-IP has seen any maintenance
for over a decade and are likely not even C89-compliant.  The CRTL
socket routines have been supported by the different vendors' stacks
for many years so there is no reason to maintain an alternative, and
there probably hasn't been a real working alternative for some years
anyway.

The code is still there in maint-5.14 and earlier branches if
anyone has need of it.