Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Perlito5 - TODO update

  • Loading branch information...
commit 25440bb9da306d99e1164ddb1cacfee922bbbca9 1 parent 2461f0a
@fglock authored
Showing with 1 addition and 89 deletions.
  1. +1 −21 TODO-perlito5
  2. +0 −68 eval-test.pl
View
22 TODO-perlito5
@@ -142,28 +142,8 @@ TODO list for Perlito5
* Javascript backend
--- verify "return" behaviour inside eval (Luciano Rocha++):
-
- $ perl -le 'sub foo { my $x = eval { return "bar" }; return "baz-$x" }; my $bar = foo(); warn ( foo() )'
- baz-bar at -e line 1.
- $ perl -le 'sub foo { my $x = eval qq{ return "bar" }; return "baz-$x" }; my $bar = foo(); warn ( foo() )'
- baz-bar at -e line 1.
-
-- "or" has SCALAR context (Abigail++):
-
- $ node perlito5.js -Isrc5/lib -e '
-
- eval {
- my $result = wantarray ? "LIST" : defined wantarray ? "SCALAR" : "VOID";
- say "Eval block: $result";
- 1;
- } or do {warn "Oops"};
-
-
- '
- Eval block: VOID # should be SCALAR
-
- See: file "eval-test.pl"
+ See: t5/01-perlito/23-eval.t
-- "~~" operator not implemented; See also "when" implementation
View
68 eval-test.pl
@@ -1,68 +0,0 @@
-# this code from Abigail++
-
-use feature 'say';
-
-eval {
- my $result = wantarray ? "LIST" : defined wantarray ? "SCALAR" : "VOID";
- say "Eval block: $result";
- 1;
-} or do {warn "Oops"};
-
-
-eval <<'--' or do {warn "Oops"};
- my $result = wantarray ? "LIST" : defined wantarray ? "SCALAR" : "VOID";
- say "Eval string: $result";
- 1;
---
-
-
-sub foo {
- my $result = wantarray ? "LIST" : defined wantarray ? "SCALAR" : "VOID";
- say "Sub: $result";
- 1;
-}
-
-foo or do {warn "Oops"};
-
-
-sub {
- my $result = wantarray ? "LIST" : defined wantarray ? "SCALAR" : "VOID";
- say "Anon: $result";
- 1;
-} -> () or do {warn "Oops"};
-
-
-
-# Now, note that if the eval is in list context, wantarray pick that up:
-
-
-sub foo {1;}
-
-foo (eval {
- my $result = wantarray ? "LIST" : defined wantarray ? "SCALAR" : "VOID";
- say "Eval: $result";
- 1;
-});
-
-
-
-# And if the eval is in void context, wantarray picks that up as well:
-
-eval {
- my $result = wantarray ? "LIST" : defined wantarray ? "SCALAR" : "VOID";
- say "Eval: $result";
- 1;
-};
-
-
-
-
-__END__
-Eval block: SCALAR
-Eval string: SCALAR
-Sub: SCALAR
-Anon: SCALAR
-
-Eval block: LIST
-
-Eval: VOID
Please sign in to comment.
Something went wrong with that request. Please try again.