Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 86 lines (70 sloc) 1.652 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
#!/usr/bin/perl

# Copyright 2002-2014, Paul Johnson (paul@pjcj.net)

# This software is free. It is licensed under the same terms as Perl itself.

# The latest version of this software should be available from my homepage:
# http://www.pjcj.net

# __COVER__ skip_test $] < 5.008 || $^O eq "cygwin"
# __COVER__ skip_reason Busted on 5.6 and cygwin

use strict;
use warnings;

my @x;

my $y = 1;
my $z = 0;
$::foo = 17;

if ($] >= 5.009) {
    $ENV{PATH} = "/bin";
    system "pwd";
    use lib "tests";
    my $file = "cond_or.pl";
    unless (my $return = do $file) {
        die "couldn't parse $file: $@" if $@;
        die "couldn't do $file: $!" unless defined $return;
        die "couldn't run $file" unless $return;
    }
}

for my $i (0 .. 10) {
    $y ||
        $x[1]++;

    $y ||
        $x[0]++ ||
        $x[1]++;

    $x[2]++
        unless $z;

    for (0 .. 2) {
        $x[3]++;
    }

    if ($z) {
        $x[4]++;
    } else {
        $x[5]++;
    }

    my $p = $y || $z;
    my $q = $z || $y;
    my $r = $i || "qqq";
    my $s = $i || [];
    my $t = $y | $z;
    my $u = $y || 0;
    my $v = $y || undef;
    my $w = $z || 0;

    $p ||= $y;
    $p ||= $z;
    $x[ 6] ||= $y;
    $x[ 7] ||= $z;
    $x[ 8] ||= 1;
    $x[ 9] ||= {};
    $x[10] ||= \"foo";
    $x[11] ||= \$y;
    $x[12] ||= \*STDIO;
    $x[13] ||= sub { 1 };
    $x[14] ||= *::foo{SCALAR};
    $x[15] ||= *STDIO{IO};
    $x[16] ||= bless {}, "XXX";
    $x[17] ||= $i == 1;
    $w ||= ref($i) eq "SCALAR";
    $x[18] ||= <<"EOD";
blah
EOD
    cond_dor(\@x) if exists &cond_dor;
    sub { $x[19] ||= 1 };
}

# print join(", ", @x), "\n";
Something went wrong with that request. Please try again.