Lines Matching full:when

22     CORE::when(3) { pass "CORE::given and CORE::when"; continue }
48 when(be_true(my $x = "bar")) {
63 when(2) { $ok = 'two'; }
64 when(3) { $ok = 'three'; }
65 when(4) { $ok = 'four'; }
75 when(2) { $ok = 'two'; }
76 when(3) { $ok = 'three'; }
77 when(4) { $ok = 'four'; }
86 when(3.1) { $ok1 = 'n'; }
87 when(3.0) { $ok1 = 'y'; continue }
88 when("3.0") { $ok2 = 'y'; }
98 when("b") { $ok = 'B'; }
99 when("c") { $ok = 'C'; }
100 when("d") { $ok = 'D'; }
109 when("b") { $ok = 'B'; }
110 when("c") { $ok = 'C'; continue }
111 when("c") { $ok = 'CC'; }
120 given (0) { when(undef) {$ok = 0} }
121 is($ok, 1, "Given(0) when(undef)");
126 given (0) { when($undef) {$ok = 0} }
127 is($ok, 1, 'Given(0) when($undef)');
132 given (0) { when($undef++) {$ok = 1} }
133 is($ok, 1, "Given(0) when($undef++)");
138 given (undef) { when(0) {$ok = 0} }
139 is($ok, 1, "Given(undef) when(0)");
145 given ($undef) { when(0) {$ok = 0} }
146 is($ok, 1, 'Given($undef) when(0)');
151 given ("") { when(undef) {$ok = 0} }
152 is($ok, 1, 'Given("") when(undef)');
157 given ("") { when($undef) {$ok = 0} }
158 is($ok, 1, 'Given("") when($undef)');
163 given (undef) { when("") {$ok = 0} }
164 is($ok, 1, 'Given(undef) when("")');
170 given ($undef) { when("") {$ok = 0} }
171 is($ok, 1, 'Given($undef) when("")');
176 given (undef) { when(undef) {$ok = 1} }
177 is($ok, 1, "Given(undef) when(undef)");
182 given (undef) { when($undef) {$ok = 1} }
183 is($ok, 1, 'Given(undef) when($undef)');
188 given ($undef) { when(undef) {$ok = 1} }
189 is($ok, 1, 'Given($undef) when(undef)');
194 given ($undef) { when($undef) {$ok = 1} }
195 is($ok, 1, 'Given($undef) when($undef)');
203 when(/lo/)
205 when(/no/)
207 when(/^(Hello,|Goodbye cruel) world[!.?]/)
209 when(/^(Hello cruel|Goodbye,) world[!.?]/)
222 when ($_ < 10) { $ok = "ten" }
223 when ($_ < 20) { $ok = "twenty" }
224 when ($_ < 30) { $ok = "thirty" }
225 when ($_ < 40) { $ok = "forty" }
237 when ($_ < 10) { $ok = "ten" }
238 when ($_ < 20) { $ok = "twenty" }
239 when ($_ < 30) { $ok = "thirty" }
240 when ($_ < 40) { $ok = "forty" }
251 when ($_ <= 10) { $ok = "ten" }
252 when ($_ <= 20) { $ok = "twenty" }
253 when ($_ <= 30) { $ok = "thirty" }
254 when ($_ <= 40) { $ok = "forty" }
266 when ($_ <= 10) { $ok = "ten" }
267 when ($_ <= 20) { $ok = "twenty" }
268 when ($_ <= 30) { $ok = "thirty" }
269 when ($_ <= 40) { $ok = "forty" }
281 when ($_ > 40) { $ok = "forty" }
282 when ($_ > 30) { $ok = "thirty" }
283 when ($_ > 20) { $ok = "twenty" }
284 when ($_ > 10) { $ok = "ten" }
295 when ($_ >= 40) { $ok = "forty" }
296 when ($_ >= 30) { $ok = "thirty" }
297 when ($_ >= 20) { $ok = "twenty" }
298 when ($_ >= 10) { $ok = "ten" }
310 when ($_ > 40) { $ok = "forty" }
311 when ($_ > 30) { $ok = "thirty" }
312 when ($_ > 20) { $ok = "twenty" }
313 when ($_ > 10) { $ok = "ten" }
325 when ($_ >= 40) { $ok = "forty" }
326 when ($_ >= 30) { $ok = "thirty" }
327 when ($_ >= 20) { $ok = "twenty" }
328 when ($_ >= 10) { $ok = "ten" }
340 when ($_ lt "10") { $ok = "ten" }
341 when ($_ lt "20") { $ok = "twenty" }
342 when ($_ lt "30") { $ok = "thirty" }
343 when ($_ lt "40") { $ok = "forty" }
354 when ($_ le "10") { $ok = "ten" }
355 when ($_ le "20") { $ok = "twenty" }
356 when ($_ le "30") { $ok = "thirty" }
357 when ($_ le "40") { $ok = "forty" }
368 when ($_ ge "40") { $ok = "forty" }
369 when ($_ ge "30") { $ok = "thirty" }
370 when ($_ ge "20") { $ok = "twenty" }
371 when ($_ ge "10") { $ok = "ten" }
382 when ($_ ge "40") { $ok = "forty" }
383 when ($_ ge "30") { $ok = "thirty" }
384 when ($_ ge "20") { $ok = "twenty" }
385 when ($_ ge "10") { $ok = "ten" }
395 when (2 + 2 == 4) { $ok = 'y'; continue }
396 when (2 + 2 == 5) { $ok = 'n' }
404 when (scalar 24) { $ok = 'n'; continue }
418 when(-d) {$ok_d = 1; continue}
419 when(!-f) {$ok_f = 1; continue}
420 when(-r) {$ok_r = 1; continue}
432 when(notfoo()) {$ok = 1}
440 when(main->notfoo()) {$ok = 1}
449 when($obj->notfoo()) {$ok = 1}
458 when( /(\d+)/ and ( 1 <= $1 and $1 <= 12 ) ) {
468 when(eof(DATA)) {
479 when(exists $foo{bar}) {
489 when(defined $ok) {
499 when((1 == 1) && "bar") {
502 when((1 == 1) && $_ eq "foo") {
513 when ($_ eq "b" .. $_ eq "c") { $n = 1 }
516 ok(($n xor $l =~ /[ad]/), 'when(E1..E2) evaluates in boolean context');
524 when ($_ eq "b" ... $_ eq "c") { $n = 1 }
527 ok(($n xor $l =~ /[ad]/), 'when(E1...E2) evaluates in boolean context');
534 when((1 == $ok) || "foo") {
544 when((1 == $ok || undef) // "foo") {
581 when(undef) {}
582 when(sub{0}->()) {}
583 when(21) {}
584 when("22") {}
585 when(23) {$ok = 1}
586 when(/24/) {$ok = 0}
592 { my $test_name = "Only one FETCH (numeric when)";
597 when(undef) {}
598 when(sub{0}->()) {}
599 when(21) {}
600 when("22") {}
601 when($v) {$ok = 1}
602 when(/24/) {$ok = 0}
608 { my $test_name = "Only one FETCH (string when)";
613 when(undef) {}
614 when(sub{0}->()) {}
615 when("21") {}
616 when("22") {}
617 when($v) {$ok = 1}
618 when(/24/) {$ok = 0}
630 when(sub{0}->()) {}
631 when("21") {}
632 when("22") {}
633 when($v) {$ok = 1}
634 when(undef) {$ok = 0}
644 when ("two") {
650 when (1) {
661 when ("two") {
667 when (1) {
684 when(\&bar) {$matched_bar = 1}
685 when(\&foo) {$matched_foo = 1}
700 when(contains_x($_))
702 when(\&contains_x)
709 when(contains_x($_))
711 when(\&contains_x)
754 when ("other arg") {$matched = 1}
767 when ("other arg") {$matched = 1}
775 my $test = "Overloaded obj in when (true)";
779 when ($obj) {$matched = 1}
791 my $test = "Overloaded obj in when (false)";
795 when ($obj) {$matched = 1}
807 # Postfix when
811 $ok = 1 when undef;
818 $ok += 1 when 7;
819 $ok += 2 when 9.1685;
820 $ok += 4 when $_ > 4;
821 $ok += 8 when $_ < 2.5;
828 $ok = 1, continue when $_ eq "apple";
830 $ok = 0 when "banana";
837 do { $ok = 1; continue } when /pea/;
839 $ok = 0 when /pie/;
850 is($x, "foo", "scope inside ... when my \$x = ...");
852 } when be_true(my $x = "bar");
853 is($x, "bar", "scope after ... when my \$x = ...");
859 my $x = 2, continue when be_true();
860 is($x, undef, "scope after my \$x = ... when ...");
864 # Tests for last and next in when clauses
871 when ("b") { last }
875 is($letter, "b", "last in when");
881 when ("b") { last LETTER1 }
885 is($letter, "b", "last LABEL in when");
890 when (/b|d/) { next }
895 is($letter, "a,c,e,", "next in when");
900 when (/b|d/) { next LETTER2 }
905 is($letter, "a,c,e,", "next LABEL in when");
907 # Test goto with given/when
913 when (0) { break; }
921 when (0) { $flag = 1; }
931 when (0) { $flag = 1; goto GIVEN3; $flag = 2; }
935 is($flag, 1, "goto inside given and when");
940 when (0) { $flag = 1; goto GIVEN4; $flag = 2; }
944 is($flag, 1, "goto inside for and when");
950 when (0) { $flag = 1; goto GIVEN5; $flag = 2; }
951 when (1) { break; }
954 is($flag, 1, "goto inside given and when to the given stmt");
974 when (0) { $lexical }
975 when (2) { 'void'; 8, 9 }
988 $lexical when 0;
989 8, 9 when 2;
1001 when (0) { 5 }
1014 when (0) { 3 .. 5 }
1015 when (2) { my $fake = 'void'; 8, 9 }
1027 3 .. 5 when 0;
1028 @things when 2;
1040 when (0) { "moo" =~ /(.)/g }
1052 continue when $_ <= 1;
1053 break when 1;
1054 next when 2;
1064 'undef' when undef;
1065 when ([ 1 .. 3 ]) { 1 .. 3 }
1066 when (4) { my $fake; do { 4, 5 } }
1102 when (@list) {
1106 when (@list[0..2]) {
1111 is("@in_list", "10 15", "when(array)");
1112 is("@in_slice", "10", "when(array slice)");
1121 when (%list) {
1125 when (@list{"a".."c"}) {
1130 is("@in_list", "a e", "when(hash)");
1131 is("@in_slice", "a", "when(hash slice)");
1163 when (0) { 0 }
1165 when (1) { my $when_lex = 1 }
1166 when (2) { our $when_glob = 2 }
1167 when (3) { local $when_loc = 3 }
1169 when (4) { $given_lex }
1170 when (5) { $given_glob }
1171 when (6) { $given_loc }
1173 when (7) { $ext_lex }
1174 when (8) { $ext_glob }
1175 when (9) { $ext_loc }
1184 when-lexical
1185 when-global
1186 when-local
1207 when (/\d/) {
1223 # Check that values returned from given/when are destroyed at the right time.
1241 when
1257 when (0) { Fmurrr->new($destroyed, 0) }
1258 when (1) { my $y = Fmurrr->new($destroyed, 1); break }
1259 when (2) { $x = Fmurrr->new($destroyed, 2); continue }
1260 when (2) { $x }
1268 is $res_id, $id, "given/when returns the right object - $desc";
1269 is $destroyed, 1, "given/when does not leak - $desc";
1278 when (/[a-z]/) {
1307 # check that 'when' handles all 'for' loop types
1314 when (1) {$i += 1 }
1315 when (2) {$i += 10 }
1316 when (3) {$i += 100 }
1319 is($i, 111, "when in for 1..3");
1323 when ('a') {$i += 1 }
1324 when ('b') {$i += 10 }
1325 when ('c') {$i += 100 }
1328 is($i, 111, "when in for a..c");
1332 when (1) {$i += 1 }
1333 when (2) {$i += 10 }
1334 when (3) {$i += 100 }
1337 is($i, 111, "when in for 1,2,3");
1342 when (1) {$i += 1 }
1343 when (2) {$i += 10 }
1344 when (3) {$i += 100 }
1347 is($i, 111, 'when in for @a');
1352 my @a = (qw(a b c), do { when(/abc/) { qw(x y) } }, qw(d e f));
1354 "list value of false when";
1355 @a = (qw(a b c), scalar do { when(/abc/) { qw(x y) } }, qw(d e f));
1357 "scalar value of false when";
1363 # than when(X) being implicitly converted to when($_ ~~ X)
1369 when (index($s, 'a') > -1) { $ok = 1; }
1375 when (rindex($s, 'a') > -1) { $ok = 1; }