This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
12 years agoFix DD’s vstring tests unter 5.6
Father Chrysostomos [Mon, 26 Dec 2011 00:53:16 +0000 (16:53 -0800)]
Fix DD’s vstring tests unter 5.6

12 years agoMake DD dump *{''} correctly under 5.6
Father Chrysostomos [Mon, 26 Dec 2011 00:42:54 +0000 (16:42 -0800)]
Make DD dump *{''} correctly under 5.6

5.6 is strangely buggy, in that *{""} stringifies as "*main::\0".  And
then there are some other strange eval bugs that the tests have to
work around.

12 years agoperldiag: Make 2 errors match the actual message
Father Chrysostomos [Mon, 26 Dec 2011 00:09:59 +0000 (16:09 -0800)]
perldiag: Make 2 errors match the actual message

12 years agoMake DD dump *{''} properly
Father Chrysostomos [Mon, 26 Dec 2011 00:07:26 +0000 (16:07 -0800)]
Make DD dump *{''} properly

This typeglob is an oddity, in that it stringifies as *main::,
but cannot be reached under that name, because *main:: produces
*main::main::.  The former is $::{""}; the latter $::{"main::"}.

I was inadvertently triggering this in 5.8 when I added a test a while
back for typeglobs will nulls in their names.

12 years agoUpdate concise-xs.t for recent DD change
Father Chrysostomos [Sun, 25 Dec 2011 21:56:50 +0000 (13:56 -0800)]
Update concise-xs.t for recent DD change

12 years ago[perl #101162] DD support for vstrings
Father Chrysostomos [Sun, 25 Dec 2011 21:45:31 +0000 (13:45 -0800)]
[perl #101162] DD support for vstrings

This commit adds support for vstrings to Data::Dumper, in both Perl
and XS implementations.

Since the actual vstring cannot be obtained from pure Perl, there is a
new _vstring XS function that the PP implementation uses, falling back
to sprintf "%vd" if XS is not available.  The former dumps v1.2_3 cor-
rectly, while the latter produces v1.23.  (I could make it use B to
extract the correct string, but XS is likely to be unavailable in
those circumstances where B is also unavailable [i.e., miniperl], so
it didn’t seem worth the effort.)

Some Perl versions (read: *all* released versions as of this message)
let vstring magic linger too long on strings that have been modified.
So that is checked for, but the bug is probed at compile time and the
code is #ifdeffed or use-constanted out when the bug is not present.

Due to the definition of the _bad_vsmg constant, I had to move
XSLoader::load into the BEGIN block.  Since I was putting it there,
I combined it, the $Useperl = 1 and the eval{} into one statement,
for speed.

Since I was putting XSLoader::load into a BEGIN block, $VERSION needed
to be in one, too.

12 years agoIncrease $Data::Dumper::VERSION to 2.135_02
Father Chrysostomos [Sun, 25 Dec 2011 08:56:27 +0000 (00:56 -0800)]
Increase $Data::Dumper::VERSION to 2.135_02

12 years agoSupress warning in XS::APItest’s hash.t
Father Chrysostomos [Sun, 25 Dec 2011 21:09:58 +0000 (13:09 -0800)]
Supress warning in XS::APItest’s hash.t

12 years agosv.c:dirp_dup: Avoid compiler warning
Father Chrysostomos [Sun, 25 Dec 2011 20:39:47 +0000 (12:39 -0800)]
sv.c:dirp_dup: Avoid compiler warning

Some compilers complain, because -1 is being assigned to an unsigned
variable.  This variable is not actually used before being assigned
to, but we have to initialise it as some other compilers cannot
detect that.

12 years agodiag.t: Remove documented entry
Father Chrysostomos [Sun, 25 Dec 2011 08:52:17 +0000 (00:52 -0800)]
diag.t: Remove documented entry

It was only listed here because originally the perldiag entry had
nonexistent spelt correctly, while the perl source had it hyphenated.
That was corrected a while ago.

12 years ago[perl #99426] op.c: Remove dead code from ck_sort
Father Chrysostomos [Sun, 25 Dec 2011 08:49:58 +0000 (00:49 -0800)]
[perl #99426] op.c: Remove dead code from ck_sort

The op that the else block (see the diff) is trying to null is already
a null.  So this else block can be deleted.

The null I’m referring to is

$ perl -MO=Concise -e 'sort $fo @fo'
8  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 1 -e:1) v:{ ->3
7     <@> sort vKS ->8
3        <0> pushmark s ->4
-        <1> null K/1 ->5                  <-- over here.
-           <1> ex-rv2sv sK/1 ->-
4              <#> gvsv[*fo] s ->5
6        <1> rv2av[t3] lK/1 ->7
5           <#> gv[*fo] s ->6
-e syntax OK

12 years agoDocument ‘Attempt to clear deleted array’ in perldiag
Father Chrysostomos [Sun, 25 Dec 2011 08:44:49 +0000 (00:44 -0800)]
Document ‘Attempt to clear deleted array’ in perldiag

12 years agoAdd diag_listed_as for non-numeric warnings
Father Chrysostomos [Sun, 25 Dec 2011 08:38:34 +0000 (00:38 -0800)]
Add diag_listed_as for non-numeric warnings

12 years agoPerlIO::get_layers: Treat numbers as strings
Father Chrysostomos [Sun, 25 Dec 2011 08:16:21 +0000 (00:16 -0800)]
PerlIO::get_layers: Treat numbers as strings

PerlIO::get_layers should not be ignoring an argument like 12, but
treating "12" (the string) as a filehandle, as those are both the
same value.

It’s an instance of the string/num bug, which is a bit like the
Unicode Bug.

This commit takes the conservative approach of expanding it to flat
scalars in general, but not references (in case we decide to do
something interesting later on, even though I think that would be a
bad idea).

12 years ago[perl #97956] PerlIO::get_layers: call get-magic
Father Chrysostomos [Sun, 25 Dec 2011 08:04:18 +0000 (00:04 -0800)]
[perl #97956] PerlIO::get_layers: call get-magic

12 years agoRun more substr tests under a new thread
Father Chrysostomos [Sun, 25 Dec 2011 07:47:12 +0000 (23:47 -0800)]
Run more substr tests under a new thread

Yours truly added tests to substr.t outside of sub run_tests.

12 years agoselect() can return undef when defoutgv is set
Father Chrysostomos [Sun, 25 Dec 2011 07:35:52 +0000 (23:35 -0800)]
select() can return undef when defoutgv is set

If PL_defoutgv has been deleted from its stash, select() returns it
as a ref, but if the stash has been freed (even though the gv still
exists), it returns undef.

That makes no sense.

This is one of those nice cases where simplifying the code
fixes a bug.

12 years agoselect() sometimes returns invalid string
Father Chrysostomos [Sun, 25 Dec 2011 07:27:30 +0000 (23:27 -0800)]
select() sometimes returns invalid string

The return value from select() is sometimes a string, and sometimes a
globref.  It was originally always a string, but typeglobs not to be
found under their names in their stashes started being returned as
references in 5.002 beta 1 (4633a7c4b).  The logic is a little faulty,
though, as sometimes the name that is returned cannot be used to find
the glob:

$ perl -le '
    open "foo::bar", ">/dev/ttys009";
    select foo::bar;
    my $handle = \*foo::bar;
    my $stash = \%foo::bar;
    *foo:: = *bar::;
    print "hello";
    select select;
    print "hello" or warn $!
'
Bad file descriptor at -e line 9.

In this example, /dev/ttys009 is another terminal window.  "hello"
only appears once, not twice.

12 years agoAdd basic tests for select()
Father Chrysostomos [Sun, 25 Dec 2011 03:35:26 +0000 (19:35 -0800)]
Add basic tests for select()

12 years ago[perl #86060] $( $| $) need braces in regexps
Father Chrysostomos [Sun, 25 Dec 2011 03:21:17 +0000 (19:21 -0800)]
[perl #86060] $( $| $) need braces in regexps

12 years agofeature.pl: Get HINT_UNI_8_BIT from perl.h
Father Chrysostomos [Sun, 25 Dec 2011 03:13:19 +0000 (19:13 -0800)]
feature.pl: Get HINT_UNI_8_BIT from perl.h

Since feature.pm is now a generated file, there is no reason to hard-
code constants from perl.h into it.  We can get them from perl.h auto-
matically.

12 years agocoresubs.t: Call done_testing with an arg
Father Chrysostomos [Sun, 25 Dec 2011 03:01:48 +0000 (19:01 -0800)]
coresubs.t: Call done_testing with an arg

12 years agocoreamp.t: Call done_testing with an arg
Father Chrysostomos [Sun, 25 Dec 2011 03:01:04 +0000 (19:01 -0800)]
coreamp.t: Call done_testing with an arg

12 years agodeparse.t: Automatically count __DATA__ tests
Father Chrysostomos [Sun, 25 Dec 2011 02:59:47 +0000 (18:59 -0800)]
deparse.t: Automatically count __DATA__ tests

I didn’t know that done_testing could take an argument.  This elimi-
nates the manual fiddling of the test count every time a test is added
to __DATA__.  For other tests, which are the exception, we still have
the safety of a test count to make sure the tests actually run.

12 years agoDeparse the /d flag with implicit features
Father Chrysostomos [Sun, 25 Dec 2011 02:07:33 +0000 (18:07 -0800)]
Deparse the /d flag with implicit features

Before the recent feature revamp (2fc860ee1e0), loading the
unicode_strings feature would always set the feature_unicode %^H ele-
ment, even though the core did not actually use it.  Now it is some-
times not set.  So we have to check the hint bits as well.  Since
feature.pm has it hardcoded, load feature.pm to get the right bit.

The stuff with $feature_bundle_mask is redundant, but it avoids load-
ing feature.pm unnecessarily.

12 years agoDeparse /$#a/ correctly
Father Chrysostomos [Sun, 25 Dec 2011 01:54:16 +0000 (17:54 -0800)]
Deparse /$#a/ correctly

This is related to 4b58603b60.

This time it’s this op tree that pure_string can’t handle:

8     </> match() vK/RTIME ->9
7        <|> regcomp(other->8) sK/1 ->8
3           <1> regcreset sK/1 ->4
6              <1> av2arylen sK/1 ->7
5                 <1> rv2av[t2] sKR/1 ->6
4                    <#> gv[*a] s ->5

In writing a test for this, I triggered a case that 415d4c68d missed
(only $a and $b are exempt from strict vars, not @a and @b), so that
is fixed in the same commit.

12 years agoDon’t warn for open(foo::bar)
Father Chrysostomos [Sun, 25 Dec 2011 00:58:54 +0000 (16:58 -0800)]
Don’t warn for open(foo::bar)

12 years agoDeparse.pm: Document that strict vars and subs work
Father Chrysostomos [Sun, 25 Dec 2011 00:22:48 +0000 (16:22 -0800)]
Deparse.pm: Document that strict vars and subs work

12 years agoPort regen/regen_lib.pl to 5.6.2
Father Chrysostomos [Sun, 25 Dec 2011 00:27:47 +0000 (16:27 -0800)]
Port regen/regen_lib.pl to 5.6.2

Since the regen scripts use the system perl, I thought I might as
well test regen/feature.pl with 5.6.2, the earliest I have installed.
It failed.

12 years ago[perl #24027] Deparse strict vars and subs
Father Chrysostomos [Sat, 24 Dec 2011 22:44:30 +0000 (14:44 -0800)]
[perl #24027] Deparse strict vars and subs

B::Deparse only supported strict refs till now, and not the other two.
The hints were always present, but were being ignored.  It was more
complicated than simply printing out the pragma settings.  Variables
have to be qualified, too, under strict vars.

12 years agoFix Deparse ambient_pragmas/strict regression
Father Chrysostomos [Sat, 24 Dec 2011 21:07:38 +0000 (13:07 -0800)]
Fix Deparse ambient_pragmas/strict regression

This commit fixes a regression introduced by b50b2058.
ambient_pragmas makes changes to %^H, which affect the currently com-
piling scope.

    BEGIN {
new B'Deparse -> ambient_pragmas strict => 'all';
    }
    use 5.012;
    # no strict here

B::Deparse really does know too much about perl’s internals.  It is
calling strict.pm’s internal routines, which now set %^H, so Deparse
has to localise it.

Since it is very easy to write tests in evals that simply do not run
(I actually did that when trying to test this, and was puzzled as to
why everything was passing anyway), I have restored the test count.
Sorry, Nicholas.

12 years agoDon’t crash when writing to null hash elem
Father Chrysostomos [Sat, 24 Dec 2011 15:05:42 +0000 (07:05 -0800)]
Don’t crash when writing to null hash elem

It’s possible for XS code to create hash entries with null values.
pp_helem and pp_slice were not taking that into account.  In fact,
the core produces such hash entries, but they are rarely visible from
Perl.  It’s good to check for them anyway.

12 years agohv.c: Make newHVhv work on tied hashes
Father Chrysostomos [Sat, 24 Dec 2011 07:38:23 +0000 (23:38 -0800)]
hv.c: Make newHVhv work on tied hashes

12 years ago*Now* increase $XS::APItest::VERSION to 0.35
Father Chrysostomos [Sat, 24 Dec 2011 07:29:32 +0000 (23:29 -0800)]
*Now* increase $XS::APItest::VERSION to 0.35

without touching anything else.

12 years agoDeparse.pm: Document that use feature is supported
Father Chrysostomos [Sat, 24 Dec 2011 20:51:09 +0000 (12:51 -0800)]
Deparse.pm: Document that use feature is supported

12 years agoDeparse all features with ‘use/no feature’
Father Chrysostomos [Sat, 24 Dec 2011 20:46:49 +0000 (12:46 -0800)]
Deparse all features with ‘use/no feature’

12 years ago[Merge] Feature-loading revamp
Father Chrysostomos [Sat, 24 Dec 2011 17:35:21 +0000 (09:35 -0800)]
[Merge] Feature-loading revamp

Features can now be loaded by version declarations without feature.pm
having to be loaded.

feature.pm is now a generated file.  feature.h is a new file with mac-
ros to make this work.  regen/feature.pl is a new script to generate
those two files.

A few hint bits are used to represent the current feature bundle.  If
the ‘custom’ bundle is active, this means that the hint hash is used,
as before.

There is no longer any need for ‘negative’ features--those whose
entries in %^H turn them off.  The only feature in that category was a
default feature.  Now we use the default bundle in PL_hints, which is
indicated by 0 (see feature.h), so we don’t even have to set it.

feature.pm, when it sees bundle hints active, updates %^H to match
and then sets the current bundle to ‘custom’, before enabling or disa-
bling features.

12 years agormg: feature.pl needs to be run
Father Chrysostomos [Sat, 24 Dec 2011 17:23:41 +0000 (09:23 -0800)]
rmg: feature.pl needs to be run

12 years agoDeparse implicit with ‘use feature’
Father Chrysostomos [Sat, 24 Dec 2011 14:47:41 +0000 (06:47 -0800)]
Deparse implicit with ‘use feature’

When a version declaration has been seen, it’s not possible to deparse
the code perfectly correctly, but using ‘no feature; use feature
"5.14"’ is a reasonable tradeoff.  See also commit 1c74777c25.

This necessitated sorting %^H keys that are output to keep tests pass-
ing.  Previously they were relying on phases of the moon.

12 years agoDeparse CORE::say, etc., when bundle hints are in use
Father Chrysostomos [Sat, 24 Dec 2011 08:06:20 +0000 (00:06 -0800)]
Deparse CORE::say, etc., when bundle hints are in use

12 years agouse VERSION needs to enable uni8bit hint
Father Chrysostomos [Sat, 24 Dec 2011 04:46:00 +0000 (20:46 -0800)]
use VERSION needs to enable uni8bit hint

12 years agoUpdate rmg concerning feature bundles
Father Chrysostomos [Sat, 24 Dec 2011 03:14:25 +0000 (19:14 -0800)]
Update rmg concerning feature bundles

The data are now to be modified in regen/feature.pl, rather than
lib/feature.pm.

12 years agoUpdate perlfunc/use: feature.pm is not loaded
Father Chrysostomos [Sat, 24 Dec 2011 02:19:48 +0000 (18:19 -0800)]
Update perlfunc/use: feature.pm is not loaded

12 years agofeature.pl: Make the perl.h search more resilient
Father Chrysostomos [Fri, 23 Dec 2011 16:27:02 +0000 (08:27 -0800)]
feature.pl: Make the perl.h search more resilient

In case #define is changed to # define some day.  (Not likely, but
this will make things easier for future maintainers.)

12 years agofeature.pl: Mention perl.h as a source
Father Chrysostomos [Fri, 23 Dec 2011 16:25:51 +0000 (08:25 -0800)]
feature.pl: Mention perl.h as a source

12 years agotoke.c: Add assertion to feature_is_enabled
Father Chrysostomos [Fri, 23 Dec 2011 16:21:45 +0000 (08:21 -0800)]
toke.c: Add assertion to feature_is_enabled

This should now only be called by macros in feature.h when PL_hints
indicates that %^H is where the features are.

12 years agoMake MAX_FEATURE_LEN reflect reality
Father Chrysostomos [Fri, 23 Dec 2011 06:51:50 +0000 (22:51 -0800)]
Make MAX_FEATURE_LEN reflect reality

unicode_strings was not the longest string.  We can determine it auto-
matically, now that this macro is in a generated file.

12 years agofeature.h: FEATURE_IS_ENABLED can use CURRENT_HINTS
Father Chrysostomos [Fri, 23 Dec 2011 06:48:58 +0000 (22:48 -0800)]
feature.h: FEATURE_IS_ENABLED can use CURRENT_HINTS

12 years agofeature.pl: Remove unused var
Father Chrysostomos [Fri, 23 Dec 2011 06:47:21 +0000 (22:47 -0800)]
feature.pl: Remove unused var

12 years agoFix up t/lib/feature/implicit
Father Chrysostomos [Fri, 23 Dec 2011 06:37:39 +0000 (22:37 -0800)]
Fix up t/lib/feature/implicit

Some tests were relying on the side effect of ‘use 5.9.5’ loading
feature.pm.

12 years agofeature.pm: Move hint normalisation to separate function
Father Chrysostomos [Fri, 23 Dec 2011 06:31:59 +0000 (22:31 -0800)]
feature.pm: Move hint normalisation to separate function

PL_hints/$^H can hold feature bundle hints that cause %^H to be
ignored when features are looked up.

When feature->import and ->unimport are invoked, they set bits in $^H
such that %^H is used once more.  But they have to modify %^H to con-
tain what the bits in $^H imply.

Up till now, unimport was delegating to import, which meant that more
work was being done than necessary, because import would then detect
the special condition of $^H and repeat (some of) that work.

12 years agoop.c: Use new feature bundle hints
Father Chrysostomos [Fri, 23 Dec 2011 06:22:51 +0000 (22:22 -0800)]
op.c: Use new feature bundle hints

Now ‘use v5.22’ and ‘use 5.005’ no longer have to load feature.pm
to enable the current feature bundle.  All they do is twiddle bits
in PL_hints.

Since version declarations no longer call feature->unimport, there
may be junk left over in %^H (which we leave for speed’s sake), so
feature.pm has to delete that junk before enabling features.

12 years agofeature.h: Function for enabling bundles
Father Chrysostomos [Fri, 23 Dec 2011 06:12:23 +0000 (22:12 -0800)]
feature.h: Function for enabling bundles

12 years agoMove FEATURE_IS_ENABLED to feature.h
Father Chrysostomos [Fri, 23 Dec 2011 05:42:54 +0000 (21:42 -0800)]
Move FEATURE_IS_ENABLED to feature.h

It makes little sense to have it in perl.h any more.  (Until
recently, feature.h didn’t exist.)

12 years agotoke.c: include feature.h
Father Chrysostomos [Fri, 23 Dec 2011 14:29:18 +0000 (06:29 -0800)]
toke.c: include feature.h

It’s going to need it in the next commit.

12 years agoEliminate ‘negative’ features
Father Chrysostomos [Fri, 23 Dec 2011 05:41:00 +0000 (21:41 -0800)]
Eliminate ‘negative’ features

Now that we have hints in $^H to indicate the default feature bun-
dle, there is no need for entries in %^H that turn features off by
their presence.

12 years agofeature.pl: Tweak comment
Father Chrysostomos [Fri, 23 Dec 2011 05:31:34 +0000 (21:31 -0800)]
feature.pl: Tweak comment

so that people as crazy as I won’t try to add internal
names like ~~_--~!_.

12 years agofeature.h: Avoid compiler warning
Father Chrysostomos [Fri, 23 Dec 2011 05:26:33 +0000 (21:26 -0800)]
feature.h: Avoid compiler warning

unsigned >= 0 produces a warning, even if the 0 is actually a macro.

12 years agoUse new feature-testing macros
Father Chrysostomos [Fri, 23 Dec 2011 04:37:59 +0000 (20:37 -0800)]
Use new feature-testing macros

Instead of using FEATURE_IS_ENABLED("say"), etc., now use
FEATURE_SAY_IS_ENABLED instead.  These new macros, in feature.h, also
check feature bundle hints in PL_hints, so we can start using those
hints.  Two commits ago, feature.pm started setting them.

12 years agoExclude regen/feature.pl from podcheck.t
Father Chrysostomos [Fri, 23 Dec 2011 02:26:01 +0000 (18:26 -0800)]
Exclude regen/feature.pl from podcheck.t

12 years agofeature.pm: Set bundle hints when dis/enabling features
Father Chrysostomos [Fri, 23 Dec 2011 02:22:41 +0000 (18:22 -0800)]
feature.pm: Set bundle hints when dis/enabling features

The core does not use these hints just yet, but feature.pm can start
setting them.

Currently, the hint bits for feature bundles (CURRENT_FEATURE_BUNDLE
in feature.h) are equal to FEATURE_BUNDLE_DEFAULT (0) by default.
feature.pm sets them to FEATURE_BUNDLE_CUSTOM when modifying
hint settings.

12 years agofeature.pm: Add function for getting the current bundle
Father Chrysostomos [Fri, 23 Dec 2011 02:12:58 +0000 (18:12 -0800)]
feature.pm: Add function for getting the current bundle

This is for when we switch over to using hints in $^H for feature bun-
dles.  When $bundle_number == $hint_mask, it means that the hints in
%^H apply.

12 years agofeature.pl: Use @HintedBundles for generating feature.h
Father Chrysostomos [Fri, 23 Dec 2011 02:12:35 +0000 (18:12 -0800)]
feature.pl: Use @HintedBundles for generating feature.h

This variable, added in the previous commit for feature.pm’s sake,
also makes generating constants in feature.h simpler.

12 years agoGive feature.pm the bundle hints
Father Chrysostomos [Fri, 23 Dec 2011 02:07:49 +0000 (18:07 -0800)]
Give feature.pm the bundle hints

It’s going to need them, in order to determine which list of features
is currently enabled.

12 years agofeature.pl: Generate list of feature bundles in pod
Father Chrysostomos [Fri, 23 Dec 2011 00:52:10 +0000 (16:52 -0800)]
feature.pl: Generate list of feature bundles in pod

12 years agofeature.pl: Add section headers
Father Chrysostomos [Fri, 23 Dec 2011 00:37:50 +0000 (16:37 -0800)]
feature.pl: Add section headers

This commit adds comments that give this file some semblance of
structure.

12 years agofeature.pl: Move hint-checking code up
Father Chrysostomos [Fri, 23 Dec 2011 00:34:36 +0000 (16:34 -0800)]
feature.pl: Move hint-checking code up

This puts it with the other code that generates ‘global’ variables
used by generation code.

12 years agoAdd macros for checking individual features
Father Chrysostomos [Fri, 23 Dec 2011 00:33:01 +0000 (16:33 -0800)]
Add macros for checking individual features

12 years agofeature.pl: %BundleRanges
Father Chrysostomos [Fri, 23 Dec 2011 00:13:17 +0000 (16:13 -0800)]
feature.pl: %BundleRanges

This hash will be used by subsequent commits to generate macros for
checking individual features.

12 years agoregen.t: update test count
Father Chrysostomos [Thu, 22 Dec 2011 21:30:06 +0000 (13:30 -0800)]
regen.t: update test count

12 years agofeature.h: Add macros for current hints
Father Chrysostomos [Thu, 22 Dec 2011 18:20:01 +0000 (10:20 -0800)]
feature.h: Add macros for current hints

CURRENT_HINTS is not specific to features, but for now will be used by
nothing else.  It returns the compile-time or run-time hints, depend-
ing on whether PL_curcop points to &PL_compiling.

CURRENT_FEATURE_BUNDLE extracts the feature bundle number from the
current hints.

12 years agofeature.h: Parenthesise macro definition
Father Chrysostomos [Thu, 22 Dec 2011 18:16:10 +0000 (10:16 -0800)]
feature.h: Parenthesise macro definition

12 years agoMake feature.pl executable
Father Chrysostomos [Thu, 22 Dec 2011 18:11:47 +0000 (10:11 -0800)]
Make feature.pl executable

12 years agoUse only \w+ for internal feature names
Father Chrysostomos [Thu, 22 Dec 2011 18:10:53 +0000 (10:10 -0800)]
Use only \w+ for internal feature names

This will make it possible to create macros for each.

12 years agofeature.pl: Remove the feature_ prefix from the data
Father Chrysostomos [Thu, 22 Dec 2011 18:07:27 +0000 (10:07 -0800)]
feature.pl: Remove the feature_ prefix from the data

It’s not necessary to repeat it, as we can simply add it to feature.pm
when we generate it.

Removing it makes these data usable for feature.h, too.

12 years agofeature.pl: Gen %feature_bundle from %UniqueBundles
Father Chrysostomos [Thu, 22 Dec 2011 18:05:16 +0000 (10:05 -0800)]
feature.pl: Gen %feature_bundle from %UniqueBundles

%UniqueBundles was added for generating constants in feature.h, but
we can use it for feature.pm’s %feature_bundle as well, simplify-
ing the code.

This eliminates this piece of code in feature.pm, spelling it
out longhand:

# Each of these is the same as the previous bundle
for (12,13,14,16) {
    $feature_bundle{"5.$_"} = $feature_bundle{"5.".($_-1)}
}

While that code might be neat, it would make the generation code
unduly complex.  (It was designed for hand-editing anyway.)

12 years agoAdd lib/feature.pm to makerel’s writables
Father Chrysostomos [Thu, 22 Dec 2011 17:43:54 +0000 (09:43 -0800)]
Add lib/feature.pm to makerel’s writables

12 years agoAdd feature.h, with constants for feature bundles
Father Chrysostomos [Thu, 22 Dec 2011 17:41:37 +0000 (09:41 -0800)]
Add feature.h, with constants for feature bundles

12 years agoParse the feature hint bits & assert their usability
Father Chrysostomos [Thu, 22 Dec 2011 16:34:31 +0000 (08:34 -0800)]
Parse the feature hint bits & assert their usability

12 years agoSet aside hint bits for feature bundles
Father Chrysostomos [Thu, 22 Dec 2011 16:18:45 +0000 (08:18 -0800)]
Set aside hint bits for feature bundles

12 years agoCreate regen/feature.pl
Father Chrysostomos [Thu, 22 Dec 2011 06:46:41 +0000 (22:46 -0800)]
Create regen/feature.pl

This script generates lib/feature.pm.  Soon it will be made to gener-
ate other files, too.

12 years agoIncrease $feature::VERSION to 1.25
Father Chrysostomos [Thu, 22 Dec 2011 06:45:22 +0000 (22:45 -0800)]
Increase $feature::VERSION to 1.25

12 years agoEliminate a couple more suidperl and sperl references.
Nicholas Clark [Sat, 24 Dec 2011 12:19:23 +0000 (13:19 +0100)]
Eliminate a couple more suidperl and sperl references.

Remove a superfluous C<LD_LIBRARY_PATH=`pwd`> - make test does this
automatically.

12 years agoMerge the refactoring of Pod scanning code in installman and buildtoc.
Nicholas Clark [Sat, 24 Dec 2011 09:30:20 +0000 (10:30 +0100)]
Merge the refactoring of Pod scanning code in installman and buildtoc.

12 years agoSome tidying in installman.
Nicholas Clark [Fri, 23 Dec 2011 18:58:50 +0000 (19:58 +0100)]
Some tidying in installman.

Avoid the unnecessary lexicals $xnew and $xold.
Use lexicals for file handles, and check the return of close.
Why import mkpath() from File::Path and then comment its provenance at the
point of use?
Remove an exit(0) which is only 20 lines from the end of the script.
Note why we can't re-use a file handle open on the Pod file we're currently
processing.

12 years agoAdd x2p/a2p.pod to the 'master' array returned by get_pod_metadata().
Nicholas Clark [Fri, 23 Dec 2011 16:15:59 +0000 (17:15 +0100)]
Add x2p/a2p.pod to the 'master' array returned by get_pod_metadata().

This makes installman install it correctly. Flagging it as 'toc_omit' means
that everything else ignores it. This eliminates the last remaining use of the
"pod =" feature of utils.lst, permitting related code to be removed from
installperl and installman.

This change has the possibly unfortunate cosmetic side effect of installman
now installing a2p.1 first, before perl.1

12 years agoAvoid installman warning about "no documentation in pod/perldoc.pod"
Nicholas Clark [Thu, 22 Dec 2011 16:02:01 +0000 (17:02 +0100)]
Avoid installman warning about "no documentation in pod/perldoc.pod"

Since commit a2afbef4476f724a in July 2011 moved perldoc.pod from pod/ to
dist/Pod-Perldoc/lib/ installman will have been warning
"no documentation in pod/perldoc.pod", having already installed the perldoc
man page earlier in the process.

However, the reference in utils.lst has actually been arguably erroneous
since it was added in commit cd0cddc9814dd65e (July 2003) to stop installman
installing an empty perldoc.1 manpage. (Which it had been doing since commit
1a67fee7d910c677 (December 2002), as a side effect of overwriting the
correct file (sourced from pod/perldoc.pod) with an incorrect file (sourced
from scanning utils/perldoc for Pod). The fix "worked" by causing perldoc.1
to be written correctly twice, both times sourced from pod/perldoc.pod :-)

The best fix seems to be to remember the names of the manpages we install
in man1, and automatically skip processing for any utility whose manpage
has already been installed.

12 years agoIn pods_to_install(), use $File::Find::prune to skip t/ directories.
Nicholas Clark [Thu, 22 Dec 2011 11:07:33 +0000 (12:07 +0100)]
In pods_to_install(), use $File::Find::prune to skip t/ directories.

We don't want to install anything within a t/ directory. Previously the code
was determining this based on pattern matching the path. Instead of rejecting
what we find, it's more efficient to avoid scanning the directory tree in the
first place.

12 years agoMove the common Pod scanning code from installman and buildtoc to pod_lib.pl
Nicholas Clark [Thu, 22 Dec 2011 10:26:29 +0000 (11:26 +0100)]
Move the common Pod scanning code from installman and buildtoc to pod_lib.pl

The unified code to scan lib/ for Pod is now in pods_to_install().
It returns found Pods partitioned into 'MODULE' and 'PRAGMA', as buildtoc
needs this distinction. installman installs Pods in the same order as before,
as 'PRAGMA' sort lexically after 'MODULE'.

12 years agoRefactor buildtoc's use of File::Find::find() to converge with installman's.
Nicholas Clark [Thu, 22 Dec 2011 09:41:58 +0000 (10:41 +0100)]
Refactor buildtoc's use of File::Find::find() to converge with installman's.

12 years agoRefactor installman's use of File::Find::find() to converge with buildtoc's.
Nicholas Clark [Thu, 22 Dec 2011 09:31:38 +0000 (10:31 +0100)]
Refactor installman's use of File::Find::find() to converge with buildtoc's.

12 years agoRevert "Increase $XS::APItest::VERSION to 0.35"
Father Chrysostomos [Sat, 24 Dec 2011 07:27:53 +0000 (23:27 -0800)]
Revert "Increase $XS::APItest::VERSION to 0.35"

This reverts commit d54b00ad7f0e9db12ac11e897406b8888fd895bf.

I didn’t mean to push that yet, and it was more than a
version bump.

12 years agoIncrease $XS::APItest::VERSION to 0.35
Father Chrysostomos [Sat, 24 Dec 2011 07:07:48 +0000 (23:07 -0800)]
Increase $XS::APItest::VERSION to 0.35

12 years agoDeparse.pm: More ->pmflags clean-up
Father Chrysostomos [Sat, 24 Dec 2011 06:33:28 +0000 (22:33 -0800)]
Deparse.pm: More ->pmflags clean-up

It should run faster with fewer method calls.

12 years agoDeparse.pm: Add another substword
Father Chrysostomos [Sat, 24 Dec 2011 06:30:55 +0000 (22:30 -0800)]
Deparse.pm: Add another substword

Just couldn’t resist.

Before:

$ ./perl -Ilib -MO=Deparse -e 's///egoru'
s//();/egoru;
-e syntax OK

After:

$ ./perl -Ilib -MO=Deparse -e 's///egoru'
s//();/rogue;
-e syntax OK

12 years agoDeparse.pm: Put re flag logic into its own function
Father Chrysostomos [Sat, 24 Dec 2011 06:22:18 +0000 (22:22 -0800)]
Deparse.pm: Put re flag logic into its own function

Also, sort the flags so that matchwords still work.  It seems they never
did work properly for s///r, so this commit causes this Freudian slip:

$ perl5.14.2 -MO=Deparse -e 's///rose'
s//();/eros;
-e syntax OK

to become this:

$ ./perl -Ilib -MO=Deparse -e 's///sore'
s//();/rose;
-e syntax OK

12 years agoFollowup to b9bc576fd0: deparse s///applaud
Father Chrysostomos [Sat, 24 Dec 2011 06:15:15 +0000 (22:15 -0800)]
Followup to b9bc576fd0: deparse s///applaud

12 years agoDeparse.pm: Don’t call ->pmflags so many times
Father Chrysostomos [Sat, 24 Dec 2011 06:11:23 +0000 (22:11 -0800)]
Deparse.pm: Don’t call ->pmflags so many times

12 years agoDeparse: Ignore strict hh hints
Father Chrysostomos [Sat, 24 Dec 2011 06:09:00 +0000 (22:09 -0800)]
Deparse: Ignore strict hh hints

As of 5.15.6, strict.pm puts hints in %^H.  B::Deparse still deparses
strict hints in $^H with ‘use strict’.  Strictly speaking, deparsing
$^H  hints with ‘use strict’ is not strictly correct any more, because
the result of ‘eval 'use v5.10; ...'’ within the same scope is differ-
ent, in that ‘use v5.10’ will disable strictures enabled only through
$^H, but will not disable those enabled also through %^H.

(Strict entries in %^H strictly indicate that strict.pm is overriding
any version declaration.  They are always set to undef.)

So the correct way to deparse $^H without %^H would be ‘use 5.011’ or
‘use 5.012’ or ‘use 5.011001000000001’, which all work.  The correct
way to deparse $^H *with* %^H is ‘use strict’.

Determining the actual version number to use is a problem.  It is
nowhere to be seen in the op tree.  It is visible in the implied BEGIN
block (BEGIN{require 5.012}).  Due to limitations in Perl itself,
it is not possible to know exactly where the BEGIN block should go,
so trying to pair up $^H changes with BEGIN blocks could never work
reliably.  Simply guessing the version number and printing one the
code did not contain would cause more confusion than the strict
hints in %^H.

Since B::Deparse has special-cased strict mode as far as I can remem-
ber, always putting it in the right place, falling back to relying
BEGIN blocks (collapsing them to version declarations) would be a
regression.

So it seems the best choice is simply to suppress strict hints in %^H
and deparse strict as it has always been deparsed.  It’s not strictly
correct, but neither are the alternatives, and it seems the least bad.

12 years agoUpdate concise-xs.t for B::Deparse’s new imports
Father Chrysostomos [Sat, 24 Dec 2011 05:50:19 +0000 (21:50 -0800)]
Update concise-xs.t for B::Deparse’s new imports