diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-05 20:48:49 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-05 20:48:54 -0800 |
commit | c7102404ab5c18fd683fb5264665505b169ba928 (patch) | |
tree | 482c9e8a97e186af743124f3ff6e935cfea06caf | |
parent | 480e0d3cb5dd65d869513ab5419347ef0d1c9763 (diff) | |
download | perl-c7102404ab5c18fd683fb5264665505b169ba928.tar.gz |
perlop: remove triple-dot
This has been superseded by c2f1e229, which adds it
to perlsyn.
-rw-r--r-- | lib/utf8.t | 11 | ||||
-rw-r--r-- | pod/perlop.pod | 66 | ||||
-rw-r--r-- | 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 @@ -450,6 +450,17 @@ SKIP: { } { + # 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<yada-yada operator> X<whatever operator> -X<triple-dot operator> - -The triple-dot operator, C<...>, sometimes called the "whatever operator", the -"yada-yada operator", or the "I<et cetera>" 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<Unimplemented>: - - 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<Range Operators>). 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<comma> X<operator, comma> 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); } |