From c7102404ab5c18fd683fb5264665505b169ba928 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 5 Jan 2012 20:48:49 -0800 Subject: perlop: remove triple-dot This has been superseded by c2f1e229, which adds it to perlsyn. --- lib/utf8.t | 11 ++++++++++ pod/perlop.pod | 66 ---------------------------------------------------------- universal.c | 1 + 3 files changed, 12 insertions(+), 66 deletions(-) diff --git a/lib/utf8.t b/lib/utf8.t index e56eebf626..76ab7df261 100644 --- a/lib/utf8.t +++ b/lib/utf8.t @@ -449,6 +449,17 @@ SKIP: { 'utf8::decode respects readonliness'; } +{ + # utf8::decode should stringify refs [perl #91850]. + + package eieifg { use overload '""' => sub { "\x{c3}\x{b3}" }, + fallback => 1 } + + my $name = bless[], eieifg::; + utf8::decode($name); + is $name, "\xf3", 'utf8::decode flattens references'; +} + { my $a = "456\xb6"; utf8::upgrade($a); diff --git a/pod/perlop.pod b/pod/perlop.pod index 21040b3d00..80add657e2 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1125,72 +1125,6 @@ lvalues assigned to, and a list assignment in scalar context returns the number of elements produced by the expression on the right hand side of the assignment. -=head2 The Triple-Dot Operator -X<...> X<... operator> X X -X - -The triple-dot operator, C<...>, sometimes called the "whatever operator", the -"yada-yada operator", or the "I" operator, is a placeholder for -code. Perl parses it without error, but when you try to execute a whatever, -it throws an exception with the text C: - - sub unimplemented { ... } - - eval { unimplemented() }; - if ($@ eq "Unimplemented" ) { - say "Oh look, an exception--whatever."; - } - -You can only use the triple-dot operator to stand in for a complete statement. -These examples of the triple-dot work: - - { ... } - - sub foo { ... } - - ...; - - eval { ... }; - - sub foo { - my ($self) = shift; - ...; - } - - do { - my $variable; - ...; - say "Hurrah!"; - } while $cheering; - -The yada-yada--or whatever--cannot stand in for an expression that is -part of a larger statement since the C<...> is also the three-dot version -of the binary range operator (see L). These examples of -the whatever operator are still syntax errors: - - print ...; - - open(PASSWD, ">", "/dev/passwd") or ...; - - if ($condition && ...) { say "Hello" } - -There are some cases where Perl can't immediately tell the difference -between an expression and a statement. For instance, the syntax for a -block and an anonymous hash reference constructor look the same unless -there's something in the braces that give Perl a hint. The whatever -is a syntax error if Perl doesn't guess that the C<{ ... }> is a -block. In that case, it doesn't think the C<...> is the whatever -because it's expecting an expression instead of a statement: - - my @transformed = map { ... } @input; # syntax error - -You can use a C<;> inside your block to denote that the C<{ ... }> is -a block and not a hash reference constructor. Now the whatever works: - - my @transformed = map {; ... } @input; # ; disambiguates - - my @transformed = map { ...; } @input; # ; disambiguates - =head2 Comma Operator X X X<,> diff --git a/universal.c b/universal.c index dd8ae74372..f6da76d859 100644 --- a/universal.c +++ b/universal.c @@ -813,6 +813,7 @@ XS(XS_utf8_decode) SV * const sv = ST(0); bool RETVAL; if (SvREADONLY(sv)) sv_force_normal(sv); + SvPV_force_nolen(sv); RETVAL = sv_utf8_decode(sv); ST(0) = boolSV(RETVAL); } -- cgit v1.2.1