In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/7131132e2e682f1f0465c6226ed180c2061b97aa?hp=6a40a726ac1d6a8f37527d834a781fc5c38e12f0>
- Log ----------------------------------------------------------------- commit 7131132e2e682f1f0465c6226ed180c2061b97aa Author: Kent Fredric <[email protected]> Date: Thu Jan 22 23:15:51 2015 +1300 Add test for glob constants accepting method calls This specific case tripped up autobox.pm. M t/op/gv.t commit c18e654645e660922fda3838b93412351e388142 Author: Leon Timmermans <[email protected]> Date: Wed Jan 21 23:43:36 2015 +0100 [perl #123619] Only make stringy classnames shared This caused failures in autobox that expect their invocant to be something other than a string (e.g. a number). See also [cpan #100819]. M op.c ----------------------------------------------------------------------- Summary of changes: op.c | 2 +- t/op/gv.t | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/op.c b/op.c index d2ce7b9..e01e58b 100644 --- a/op.c +++ b/op.c @@ -11894,7 +11894,7 @@ Perl_ck_subr(pTHX_ OP *o) } /* make class name a shared cow string to speedup method calls */ /* constant string might be replaced with object, f.e. bigint */ - if (const_class && !SvROK(*const_class)) { + if (const_class && SvPOK(*const_class)) { STRLEN len; const char* str = SvPV(*const_class, len); if (len) { diff --git a/t/op/gv.t b/t/op/gv.t index 081d280..97d0f3f 100644 --- a/t/op/gv.t +++ b/t/op/gv.t @@ -12,7 +12,7 @@ BEGIN { use warnings; -plan( tests => 271 ); +plan( tests => 273 ); # type coercion on assignment $foo = 'foo'; @@ -1073,6 +1073,14 @@ package glob_constant_test { ::is eval { bar->() }, eval { &{+bar} }, 'glob_constant->() is not mangled at compile time'; ::is "$@", "", 'no error from eval { &{+glob_constant} }'; + use constant quux => do { + local *F; + my $f = *F; + *$f = *STDOUT{IO}; + }; + ::is eval { quux->autoflush; 420 }, 420, + 'glob_constant->method() works'; + ::is "$@", "", 'no error from eval { glob_constant->method() }'; } { -- Perl5 Master Repository
