Father Chrysostomos [Fri, 23 Sep 2011 05:32:48 +0000 (22:32 -0700)]
Test perl #96008: use and require affected by open.pm
Brian Fraser [Fri, 23 Sep 2011 05:31:46 +0000 (22:31 -0700)]
[perl #96008] use and require are affected by the open pragma
% perl -e 'print "package F;\n # \xF1\n;1;"' > x.pl
% perl '-Mopen=:encoding(utf8)' -e 'require "x.pl"'
utf8 "\xF1" does not map to Unicode at x.pl line 1.
Bit of a surprising discovery; Turns out that passing a single ":" for
the layers skips the fetch from the context layers:
perl -wE 'use open qw( :encoding(UTF-8) ); open my $fh, "<:", "etc"; say PerlIO::get_layers($fh);'
That will only get the relevant default layers, while removing the
colons makes it work as usual -- So we can abuse this (mis)feature to
fix the bug.
Father Chrysostomos [Fri, 23 Sep 2011 05:29:16 +0000 (22:29 -0700)]
Move/rewrite test for Recursive call to Perl_load_module
This test was relying on a bug in require that causes it to use what-
ever I/O layers are active in require‘s *caller* when opening a file
[perl #96008].
This rewrites the test using the example in ticket #75722.
Since it no longer has anything to do with open.pm, it is now in
t/lib/warnings/perlio.
Father Chrysostomos [Thu, 22 Sep 2011 23:28:46 +0000 (16:28 -0700)]
Make CORE->method work
This will probably not be used, but ought to be here for complete-
ness’ sake.
Method lookup needs to trigger the autovivification of coresubs.
Since it does not use gv_fetchpvn_flags, the coresub-autovification is
now in a separate static function, so that both standard gv lookup and
method lookup can share it.
Karl Williamson [Thu, 22 Sep 2011 16:42:30 +0000 (10:42 -0600)]
perlre: Note a bug's existence
Karl Williamson [Thu, 22 Sep 2011 16:40:15 +0000 (10:40 -0600)]
re_tests: Add TODO test
Karl Williamson [Thu, 22 Sep 2011 16:17:36 +0000 (10:17 -0600)]
podcheck.t: Add comment
Karl Williamson [Thu, 22 Sep 2011 16:16:27 +0000 (10:16 -0600)]
Porting/cherrymaint: Add comment
Karl Williamson [Thu, 22 Sep 2011 16:15:34 +0000 (10:15 -0600)]
manifest.t: Clarify a test's wording
David Golden [Thu, 22 Sep 2011 17:38:52 +0000 (13:38 -0400)]
base.pm: remove unused variable
David Golden [Thu, 22 Sep 2011 17:33:06 +0000 (13:33 -0400)]
base.pm no longer tracks loaded modules
Tracking modules loaded by base.pm to avoid reloading them means
that any module that wishes to force a reload can't just modify
%INC but must also interact with base.pm to clear its cache.
Removing the module-loaded checks have minimal impact. The internal
call to require() is a NOP for a loaded module. For an internal
package, the require() will fail with the same error message as
before, which base.pm then ignores. Tracking modules loaded to avoid
this slight extra overhead is not worth the complexity for other
modules that wish to manipulate %INC.
H.Merijn Brand [Thu, 22 Sep 2011 15:26:34 +0000 (17:26 +0200)]
Use a real compile to test for stdbool.h
On some Solaris systems, <stdbool.h> is present, but will give an
error if used by a compiler that is not sufficiently c99-compliant.
Check for this by including <stdbool.h> and trying to compile a
short program that uses bool.
Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Karl Williamson [Thu, 22 Sep 2011 15:19:02 +0000 (09:19 -0600)]
podcheck.t: clarify its pod
Karl Williamson [Thu, 22 Sep 2011 15:08:30 +0000 (09:08 -0600)]
podcheck.t: Is problem if cpan/non-cpan have same NAME
If a module whose upstream is cpan has the same NAME as a module that
isn't, that is a problem that should be warned about, as we shouldn't be
shipping two identically named modules, even if one is not under Perl
core's control. (If two cpan modules have the same name, it is a
problem as well, but not anything we can do anything about, so warn only
when cpan warnings are enabled.)
Karl Williamson [Thu, 22 Sep 2011 15:05:26 +0000 (09:05 -0600)]
podcheck.t: Process files sorted caselessly
In some situations previously, case was not important in the sort order;
this extends that to all situations.
Karl Williamson [Thu, 22 Sep 2011 15:04:39 +0000 (09:04 -0600)]
podcheck: Nits in comments
David Golden [Thu, 22 Sep 2011 15:09:33 +0000 (11:09 -0400)]
base.pm no longer modifies $VERSION
Previously, base.pm modified the $VERSION of modules it loaded to
the string "-1, set by base.pm". This is not a valid lax version
string and thus could not be parsed by version.pm. (It is also an
encapsulation violation, as it modifies a global in another package.)
This patch removes the $VERSION modification code entirely and uses
a private hash to track which modules base.pm has successfully loaded.
This also eliminates a subtle bug in how base.pm was checking for
the existence of a package's VERSION scalar.
[Though the final mechanism is different, thank you to John Peacock for
proposing the initial patch to eliminate the "-1..." code from base.pm]
Karl Williamson [Wed, 21 Sep 2011 16:15:02 +0000 (10:15 -0600)]
fold_grind.t: Ignore blank lines
This is in preparation for Unicode 6.1, which has blank lines in the
.txt file that fold_grind reads. The line that strips off comments did
not work on plain null lines.
Karl Williamson [Wed, 21 Sep 2011 16:07:38 +0000 (10:07 -0600)]
UCD.pm: accommodate non-standard mktables output
Generally mktables generates the most compact tables possible. But this
should not be relied on, and when called with the -anotate option,
the mktables tables will not be compact. This will compact
non-compacted tables when reading them.
Karl Williamson [Wed, 21 Sep 2011 16:06:21 +0000 (10:06 -0600)]
UCD.pm: Only calculate hex once
This uses intermediate variables to store the output of hex(), with the
result that if there is an $end, its hex only is calculated once.
Stevan Little [Wed, 21 Sep 2011 14:23:10 +0000 (10:23 -0400)]
adding in the list archive URL for the announcement
Nicholas Clark [Fri, 16 Sep 2011 17:32:03 +0000 (19:32 +0200)]
Add an option to checkcfgvar.pl to add defaults for missing variables.
This eases the updates of the config.sh-format files when a new Configure
variable is added.
Nicholas Clark [Fri, 16 Sep 2011 17:01:33 +0000 (19:01 +0200)]
Add a --regen option to checkcfgvar.pl to regenerate config files.
Verify that the section of config file containing probed files is sorted
lexically. If --regen is used, updated the file on disk with a correctly
sorted version. (Except for configure.com, which has a different structure
not amenable to automatic analysis and update, hence still has to be
updated manually.)
Ensure all config files are correctly sorted.
Nicholas Clark [Fri, 16 Sep 2011 13:03:40 +0000 (15:03 +0200)]
Add empty Author and zip entries to symbian/config.sh and uconfig{,64}.sh
This brackets the probed values sections consistently across all config.sh
type files, between Author and zip inclusive.
Move PERL_CONFIG_SH to the end of NetWare/config.wc and symbian/config.sh,
and PERL_CONFIG_SH CONFIGDOTSH to the end of win32/config.ce, to be
consistent with the other config.sh files.
Nicholas Clark [Fri, 16 Sep 2011 12:09:07 +0000 (14:09 +0200)]
Sort epoc/config.sh
This brings it back to the regular order: header information, probed values,
information about arguments to Configure, and values propagated from a
previous run.
Nicholas Clark [Fri, 16 Sep 2011 11:33:07 +0000 (13:33 +0200)]
De-duplicate epoc/config.sh
"Don't Repeat Yourself" :-)
Nicholas Clark [Fri, 16 Sep 2011 10:59:51 +0000 (12:59 +0200)]
Eliminate duplicate contradictory values from epoc/config.sh.
The two values for quadtype have been present since epoc/config.sh was added
in
3a2f06e93704a418. quadtype is signed, (uquadtype is its unsigned
equivalent) hence remove the definition that uses unsigned long long.
The duplicate contradictory values for d_vendorarch were merged in by
b250498faaf6fbd0 (along with a lot of the non-contradictory duplication),
originating from commit
eb0d51032951025d on the cfgperl branch.
The contradictory values for socksizetype arrived with the same commits.
Nicholas Clark [Fri, 16 Sep 2011 14:09:33 +0000 (16:09 +0200)]
Change checkcfgvar.pl to permit trailing comments on config lines.
Convert the comment for _a in config.ce to a trailing comment.
Nicholas Clark [Fri, 16 Sep 2011 13:36:07 +0000 (15:36 +0200)]
Tighten the checking regex in checkcfgvar.pl.
Fix the dubious line in symbian/config.sh which this exposes.
Nicholas Clark [Fri, 16 Sep 2011 10:19:15 +0000 (12:19 +0200)]
In checkcfgvar.pl, split the configure.com code out.
The configure.com handling is actually sufficiently different that it's
simpler to do it in its own loop. The two regexs for config.sh-style parsing
can be merged. Use non-capturing parens for the parts of regexs that don't
need to be captured.
Father Chrysostomos [Wed, 21 Sep 2011 07:59:02 +0000 (00:59 -0700)]
[perl #99660] Remove elems from hashes before freeing them
Commit
f50383f58 made the ‘HeVAL(entry) = &PL_sv_placeholder;’ in the
hash-element-deletion code unconditional. In doing so, it put it
after the if/else statement containing the SvREFCNT_dec. So the freed
SV was visible in the hash to destructors called by SvREFCNT_dec.
Father Chrysostomos [Tue, 20 Sep 2011 15:55:09 +0000 (08:55 -0700)]
[perl #93590] $tainted ~~ [...] failing
When smartmatch is about to start, to avoid calling get-magic (e.g.,
FETCH methods) more than once, it copies any argument that has
get-magic.
Tainting uses get-magic to taint the expression. Calling mg_get(sv)
on a tainted scalar causes PL_tainted to be set, causing any scalars
modified by sv_setsv_flags to be tainted. That means that tainting
magic gets copied from one scalar to another.
So when smartmatch tries to copy the variable to avoid repeated calls
to magic, it still copies taint magic to the new variable.
For $scalar ~~ @array (or ~~ [...]), S_do_smartmatch calls itself
recursively for each element of @array, with $scalar (on the suppos-
edly non-magical copy of $scalar) on the left and the element on
the right.
In that recursive call, it again does the get-magic check and copies
the argument. Since the copied of a tainted variable on the LHS is
magical, it gets copied again. Since the first copy is a mortal
(marked TEMP) with a refcount of one, the second copy steal its
string buffer.
The outer call to S_do_smartmatch then proceeds with the second ele-
ment of @array, without realising that its copy of $scalar has lost
its string buffer and is now undefined.
So these produce incorrect results under -T (where $^X is ‘perl’):
$^X =~ ["whatever", undef] # matches
$^X =~ ["whatever", "perl"] # fails
This problem did not start occurring until this commit:
commit
8985fe98dcc5c0af2fadeac15dfbc13f553ee7fc
Author: David Mitchell <davem@iabyn.com>
Date: Thu Dec 30 10:32:44 2010 +0000
Better handling of magic methods freeing the SV
mg_get used to increase the refcount unconditionally, pushing it on to
the mortals stack. So the magical copy would have had a refcount of
2, preventing its string buffer from being stolen. Now it has a ref-
erence count of 1.
This commit solves it by adding a new parameter to S_do_smartmatch
telling it that the variable has already been copied and does not even
need to be checked. The $scalar~~@array case sets that parameter for
the recursive calls. That avoids the whole string-stealing problem
*and* avoids extra unnecessary SVs.
Eric Brine [Tue, 20 Sep 2011 00:16:41 +0000 (20:16 -0400)]
Fix inability of lex_read_unichar to handle 80-FF under "no utf8;". lex_peek_unichar is already correct.
Stevan Little [Wed, 21 Sep 2011 03:54:55 +0000 (23:54 -0400)]
update TOC for perl5153delta
Stevan Little [Wed, 21 Sep 2011 03:41:54 +0000 (23:41 -0400)]
moving old perldelta and creating new one
Stevan Little [Wed, 21 Sep 2011 03:31:15 +0000 (23:31 -0400)]
Adding in my choice of epigraph to epigraph.pod
Stevan Little [Wed, 21 Sep 2011 00:42:50 +0000 (20:42 -0400)]
No need to go into this much detail in the pod (also podcheck doesn't like it)
Stevan Little [Tue, 20 Sep 2011 22:12:39 +0000 (18:12 -0400)]
Tweak wording of the Notice based on Jesse's feedback
Stevan Little [Tue, 20 Sep 2011 21:46:40 +0000 (17:46 -0400)]
Adding some Known Problems to perldelta
Stevan Little [Tue, 20 Sep 2011 17:48:26 +0000 (13:48 -0400)]
removing the comment from the perldelta (and the previous perldelta as well)
Stevan Little [Tue, 20 Sep 2011 16:53:49 +0000 (12:53 -0400)]
finalize perldelta
Stevan Little [Tue, 20 Sep 2011 16:51:29 +0000 (12:51 -0400)]
adding new release to perlhist
Stevan Little [Tue, 20 Sep 2011 16:43:46 +0000 (12:43 -0400)]
fixing the path to pod2html in the release managers guide
Stevan Little [Tue, 20 Sep 2011 16:31:10 +0000 (12:31 -0400)]
Adding the acknowledgements section to perldelta
Stevan Little [Tue, 20 Sep 2011 01:24:56 +0000 (21:24 -0400)]
Update Module::CoreList for 5.15.3
Stevan Little [Tue, 20 Sep 2011 00:54:33 +0000 (20:54 -0400)]
The link to Devel::PPPort was not understood by porting/podcheck.t so we had to teach it
Stevan Little [Tue, 20 Sep 2011 00:53:40 +0000 (20:53 -0400)]
perldelta pod tweaks,.. this is not a link
Stevan Little [Tue, 20 Sep 2011 00:35:32 +0000 (20:35 -0400)]
manually updating INSTALL version "Upgrading from 5.X.Y or earlier" as specified in the RMG
Stevan Little [Mon, 19 Sep 2011 21:14:52 +0000 (17:14 -0400)]
bump version to 5.15.3 using Porting/bump-perl-version
Stevan Little [Mon, 19 Sep 2011 21:26:34 +0000 (17:26 -0400)]
More pod formatting tweaks
Stevan Little [Mon, 19 Sep 2011 21:06:01 +0000 (17:06 -0400)]
Fix some pod errors reported by podchecker
Stevan Little [Mon, 19 Sep 2011 20:45:12 +0000 (16:45 -0400)]
Updating perldelta in preparation for the 5.13.3 release.
Stevan Little [Mon, 19 Sep 2011 19:51:02 +0000 (15:51 -0400)]
Fixing the version in the comment in perl5152delta.pod
Nicholas Clark [Tue, 20 Sep 2011 13:11:46 +0000 (15:11 +0200)]
Skip 2 tests in t/op/filetest.t if t/TEST is a symlink.
t/TEST is usually a regular file, but not always. For example, if one is
building using a symlink forest (eg ./Configure -Dmksymlinks) then it will
be a symlink.
Stevan Little [Mon, 19 Sep 2011 16:57:51 +0000 (12:57 -0400)]
Update CPAN-Meta to CPAN version 2.112621
[DELTA]
2.112621 2011-09-19 12:15:16 America/New_York
[BUGFIX]
- Spell BACKEND environment variables correctly this time
[noticed by Stevan Little]
2.112620 2011-09-18 20:56:06 America/New_York
[BUGFIX]
- Protect tests against PERL_(YAML|JSON)_BACKEND settings that could
cause tests to fail. (RT #69979)
Stevan Little [Mon, 19 Sep 2011 16:30:42 +0000 (12:30 -0400)]
Adding myself to the AUTHORS list
Dave Rolsky [Fri, 16 Sep 2011 04:00:45 +0000 (23:00 -0500)]
regen generated files
Dave Rolsky [Fri, 16 Sep 2011 04:00:32 +0000 (23:00 -0500)]
Include stub files in pod.lst
Dave Rolsky [Fri, 16 Sep 2011 04:00:09 +0000 (23:00 -0500)]
Explicitly ignore the stub pod files I just added when doing the sanity check
Dave Rolsky [Fri, 16 Sep 2011 03:39:32 +0000 (22:39 -0500)]
add stub files for deleted OO-related pod files
Florian Ragwitz [Mon, 19 Sep 2011 12:10:31 +0000 (14:10 +0200)]
For RC releases there's no indexer report
Tony Cook [Mon, 19 Sep 2011 05:23:44 +0000 (15:23 +1000)]
use :raw to avoid interference from PERL_UNICODE when creating test data
986a805c added dist/IO/t/io_utf8argv.t which creates a utf-8 test file
from raw bytes. When PERL_UNICODE was set the bytes were encoded as
utf-8, so producing a double-encode file.
Create the file with :raw to avoid that.
Tony Cook [Mon, 19 Sep 2011 05:20:04 +0000 (15:20 +1000)]
clear $ENV{PERL_UNICODE} before runperl()ing a test of use open.
If PERL_UNICODE was set to a value that modified stream behaviour, the
test added in
73f1eaca would fail, because the implied -C option would
cause the behaviour the test was checking wouldn't happen.
Florian Ragwitz [Mon, 19 Sep 2011 05:13:42 +0000 (07:13 +0200)]
Fix the version of CoreList that'll ship with 5.14.2
Florian Ragwitz [Mon, 19 Sep 2011 04:34:54 +0000 (06:34 +0200)]
Update Module::CoreList for 5.14.2
Florian Ragwitz [Mon, 19 Sep 2011 04:45:11 +0000 (06:45 +0200)]
Re-generate known_pod_issues.dat
Father Chrysostomos [Mon, 19 Sep 2011 00:08:28 +0000 (17:08 -0700)]
Correct perldelta entry for -l \*foo change
Chris 'BinGOs' Williams [Sun, 18 Sep 2011 21:01:08 +0000 (22:01 +0100)]
Update CPAN-Meta to CPAN version 2.112600
[DELTA]
2.112600 2011-09-17 12:21:09 America/New_York
[DOCUMENTATION]
- Fixed spelling error in CPAN::Meta::Spec (RT #71036) [Gregor Hermann]
Father Chrysostomos [Sun, 18 Sep 2011 21:17:50 +0000 (14:17 -0700)]
[perl #95034] Make perldoc <url> use a reasonabe name
This patch makes perldoc with a URL use a somewhat reasonable name
based on the basename of the URL, instead of displaying PALLEGCSYO or
BJ1KKH1675 in the pod header (based on the tmp file name).
It treats all URLs the same (changing perldoc.pod to PERLDOC), instead
of treating .pm’s specially. Maybe this could be improved later.
Father Chrysostomos [Sun, 18 Sep 2011 19:48:05 +0000 (12:48 -0700)]
DBFile -> DB_File
Craig A. Berry [Sun, 18 Sep 2011 19:33:51 +0000 (14:33 -0500)]
Update skip count in t/op/filetest.t after
433644eed.
Chris 'BinGOs' Williams [Sun, 18 Sep 2011 19:37:22 +0000 (20:37 +0100)]
Noted recent changes to Module::CoreList and added perlpunks.de/corelist
Karl Williamson [Sun, 18 Sep 2011 19:13:21 +0000 (13:13 -0600)]
podcheck: Clean up known issues
When a link to a module is unknown, it is better to use the --add_link
option to podcheck.t and not the --regen option
Father Chrysostomos [Sun, 18 Sep 2011 13:13:34 +0000 (06:13 -0700)]
Increase $VERSIONs for Text::Abbrev and Search::Dict
Robin Barker [Sat, 10 Sep 2011 08:05:13 +0000 (09:05 +0100)]
fix NAME section in Text::Abbrev and Search::Dict
These modules currently warn when parsing ABSTRACT_FROM,
as the NAME section does not have the correct form; so
add "$package - " at the start of the NAME section line.
Leon Timmermans [Sun, 18 Sep 2011 10:22:30 +0000 (12:22 +0200)]
Only upgrade when necessary
Father Chrysostomos [Sun, 18 Sep 2011 05:42:58 +0000 (22:42 -0700)]
Deparse "${#}a"
Father Chrysostomos [Sun, 18 Sep 2011 05:39:17 +0000 (22:39 -0700)]
Deparse $#{/} correctly
Father Chrysostomos [Sun, 18 Sep 2011 03:47:26 +0000 (20:47 -0700)]
Make -l always treat non-bareword arguments as file names
Here is some suspicious code in Perl_my_lstat_flags:
if (SvROK(sv) && isGV_with_GP(SvRV(sv)) && ckWARN(WARN_IO)) {
Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %s",
GvENAME((const GV *)SvRV(sv)));
return (PL_laststatval = -1);
}
The behaviour differs depending on whether warnings are enabled.
That -1 turns into undef in pp_ftlink. So we get an undef return
value with warnings on, but a file test on a file name otherwise.
In 5.6.2, -l $foo always treated $foo as a file name.
In 5.8+, if it is a reference (ignoring magic) and the reference
points to a typeglob (ignoring magic) and io warnings are on, it warns
and returns undef.
So the only time that undef return is reached is when a warning has
been emitted, so it’s code that will likely be corrected before it
goes into production. Hence I think it unlikely that anyone could be
relying on the behaviour of -l \*foo (under warnings).
So this commit restores the 5.6 behaviour for that case.
Father Chrysostomos [Sun, 18 Sep 2011 03:16:36 +0000 (20:16 -0700)]
Make stacked -l work
Perl 5.10.0 introduced stacked filetest operators,
-x -r $foo
being equivalent to
-r $foo && -x _
That does not work with -l. It was these suspicious lines in
Perl_my_lstat_flags that drew my attention to it:
> else if (PL_laststype != OP_LSTAT
> && (PL_op->op_private & OPpFT_STACKED) && ckWARN(WARN_IO))
> Perl_croak(aTHX_ no_prev_lstat);
That croak only happens when warnings are on. Warnings are just
supposed to be warnings, unless the ‘user’ explicitly requests
fatal warnings.
$ perl -le 'print "foo", -l -e "miniperl"'
foo
$ perl -lwe 'print "foo", -l -e "miniperl"'
The stat preceding -l _ wasn't an lstat at -e line 1.
That it doesn’t die in the first example is a bug.
In fact, it’s using the return value of -e as a file name:
$ ln -s miniperl 1
$ ./miniperl -le 'print -l -e "miniperl"'
1
And, with warnings on, if the preceding stat *was* an lstat, it
falls back to the pre-stacked behaviour, just as it does when warn-
ings are off.
It’s meant to be equivalent to -e "miniperl" && -l _ (which is why the
error message above says ‘The stat preceding -l _’).
Father Chrysostomos [Sun, 18 Sep 2011 02:39:07 +0000 (19:39 -0700)]
perlglossary: fix broken link
Father Chrysostomos [Sun, 18 Sep 2011 02:32:22 +0000 (19:32 -0700)]
perlglossary: Make empty-list-as-scalar even clearer
Chas. Owens [Sun, 18 Sep 2011 02:31:09 +0000 (19:31 -0700)]
Document empty-list-as-scalar in perlglossary
Father Chrysostomos [Sun, 18 Sep 2011 02:35:41 +0000 (19:35 -0700)]
Really allow podcheck.t to be run from outside t/
4e9a627e2 was not enough.
Father Chrysostomos [Sun, 18 Sep 2011 02:25:26 +0000 (19:25 -0700)]
perldata: Mention undefined as a false val
Father Chrysostomos [Sun, 18 Sep 2011 02:12:38 +0000 (19:12 -0700)]
Allow podcheck.t to be run from outside t/ for convenience
Father Chrysostomos [Sat, 17 Sep 2011 21:28:29 +0000 (14:28 -0700)]
Update META.yml following
986a805c
Father Chrysostomos [Sat, 17 Sep 2011 20:23:07 +0000 (13:23 -0700)]
Correct punctuation in some POSIX error messages
Commit
fa22ee54 changed some of the POSIX error messages to be more
consistent, but in doing so made many of them grammatically incorrect.
It is almost always incorrect in English to join two independent
clauses with a comma.
I don’t think it’s particularly important that error messages be gram-
matical; I just don’t want them getting worse over time. Hence, I
have not touched those that were already ungrammatical.
Father Chrysostomos [Sat, 17 Sep 2011 19:46:20 +0000 (12:46 -0700)]
perlop: Clarify \octal slightly
This is to address ticket #94252.
Father Chrysostomos [Sat, 17 Sep 2011 19:09:22 +0000 (12:09 -0700)]
Make IO::Handle::getline(s) respect the open pragma
See <https://rt.cpan.org/Ticket/Display.html?id=66474>. Also, this
came up in <https://rt.perl.org/rt3/Ticket/Display.html?id=92728>.
The <> operator, when reading from the magic ARGV handle, automatic-
ally opens the next file. Layers set by the lexical open pragma are
applied, if they are in scope at the point where <> is used.
This works almost all the time, because the common convention is:
use open ":utf8";
while(<>) {
...
}
IO::Handle’s getline and getlines methods are Perl subroutines
that call <> themselves. But that happens within the scope of
IO/Handle.pm, so the caller’s I/O layer settings are ignored. That
means that these two expressions are not equivalent within in a
‘use open’ scope:
<>
*ARGV->getline
The latter will open the next file with no layers applied.
This commit solves that by putting PL_check hooks in place in
IO::Handle before compiling the getline and getlines subroutines.
Those hooks cause every state op (nextstate, or dbstate under the
debugger) to have a custom pp function that saves the previous value
of PL_curcop, calls the default pp function, and then restores
PL_curcop.
That means that getline and getlines run with the caller’s compile-
time hints. Another way to see it is that getline and getlines’s own
lexical hints are never activated.
(A state op carries all the lexical pragmata. Every statement
has one. When any op executes, it’s ‘pp’ function is called.
pp_nextstate and pp_dbstate both set PL_curcop to the op itself. Any
code that checks hints looks at PL_curcop, which contains the current
run-time hints.)
Father Chrysostomos [Sat, 17 Sep 2011 18:51:16 +0000 (11:51 -0700)]
perldelta for h2ph conditional sub fix
Lukas Mai [Sat, 17 Sep 2011 16:31:00 +0000 (18:31 +0200)]
don't redefine macrosubs in .ph
h2ph generates code of the form
unless(defined(&FOO)) {
sub FOO () {42;}
}
for a C macro like '#define FOO 42'.
The problem with that: 'sub' happens at compile time, 'unless' at runtime.
So the sub is unconditionally defined first, then the unless runs with
an empty body. This behavior was introduced in commit
3d271ce79d39df56470393916b3d33ff26db2c8b (the syntax errors there were
fixed in commit
4a8e146e38ec2045f1f817a7cb578e1b1f80f39f).
There are already two code paths there, one for indentation level > 0
(eval), the other for toplevel definitions (straight sub). This patch
unifies them to always use 'eval' / runtime definitions. This change
shortens the code and makes the conditions actually work.
It moves the check for '#define FOO FOO' further up because I don't
see why it only needs to be done if indentation == 0. I changed the
comparison to use a whitespace-agnostic regex because
'" \&$name" eq $new' looks too brittle (the redundant \ doesn't help).
Karl Williamson [Sat, 17 Sep 2011 18:43:57 +0000 (12:43 -0600)]
perlobj: Fix pod problems
introduced by
7168b2511bddd4967be30033b32ce8b1b6500f6d
Karl Williamson [Sat, 17 Sep 2011 18:16:15 +0000 (12:16 -0600)]
perldata: Only one "_" is allowed between each digit pair
Karl Williamson [Mon, 5 Sep 2011 18:39:23 +0000 (12:39 -0600)]
podcheck.t: Don't use case-sensitive file exclusion
VMS by default doesn't preserve case in its file systems, and so
excluding a file based on case-sensitive matching will fail there.
Damian Conway [Sat, 17 Sep 2011 13:39:56 +0000 (08:39 -0500)]
Lots of revisions from Damian for perlobj
A lot of this is fixing the incorrect meme of "an object is a blessed
reference", but this change also corrects a number of typos, adds clarifying
bits of text, etc.
Damian Conway [Sat, 17 Sep 2011 13:29:47 +0000 (08:29 -0500)]
Tweaks to perlootut by Damian
Mostly this consists of removing the incorrect meme that an object is a
blessed reference.
Craig A. Berry [Sat, 17 Sep 2011 12:15:15 +0000 (07:15 -0500)]
POSIX::access() doesn't do ENOTDIR on VMS.
Even though the underlying error is RMS$_DNF. Go figure.
Father Chrysostomos [Sat, 17 Sep 2011 07:27:14 +0000 (00:27 -0700)]
Fix recursion warning for ‘no warnings; goto &sub’
Commit
309aab3a made goto &foo make the lexical hints of the caller of
the sub containing the goto visible when foo is called. CORE subs
need this to function properly when ‘goneto’. But in that commit I
put the PL_curcop assignment before the recursion check, causing the
warning settings of the caller to be used, instead of those at the
goto. This commit moves the PL_curcop further down in pp_goto.
Father Chrysostomos [Sat, 17 Sep 2011 01:57:37 +0000 (18:57 -0700)]
Tests for goto &xsub and lexical hints
This new script tests that goto &xsub causes the sub to see the hints,
not of the subroutine it replaces, but of that subroutine’s caller.