App-CLI-Plugin-Net-SMTP

 view release on metacpan or  search on metacpan

inc/Test/Builder.pm  view on Meta::CPAN

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
# $^C was only introduced in 5.005-ish.  We do this to prevent
# use of uninitialized value warnings in older perls.
$^C ||= 0;
 
use strict;
use vars qw($VERSION);
$VERSION = '0.32';
$VERSION = eval $VERSION;    # make the alpha version come out as a number
 
# Make Test::Builder thread-safe for ithreads.
BEGIN {
    use Config;
    # Load threads::shared when threads are turned on
    if( $] >= 5.008 && $Config{useithreads} && $INC{'threads.pm'}) {
        require threads::shared;
 
        # Hack around YET ANOTHER threads::shared bug.  It would
        # occassionally forget the contents of the variable when sharing it.
        # So we first copy the data, then share, then put our copy back.
        *share = sub (\[$@%]) {
            my $type = ref $_[0];
            my $data;
 
            if( $type eq 'HASH' ) {
                %$data = %{$_[0]};
            }
            elsif( $type eq 'ARRAY' ) {
                @$data = @{$_[0]};
            }
            elsif( $type eq 'SCALAR' ) {
                $$data = ${$_[0]};
            }
            else {
                die "Unknown type: ".$type;
            }
 
            $_[0] = &threads::shared::share($_[0]);
 
            if( $type eq 'HASH' ) {
                %{$_[0]} = %$data;
            }
            elsif( $type eq 'ARRAY' ) {
                @{$_[0]} = @$data;
            }
            elsif( $type eq 'SCALAR' ) {
                ${$_[0]} = $$data;
            }
            else {
                die "Unknown type: ".$type;
            }
 
            return $_[0];
        };
    }
    # 5.8.0's threads::shared is busted when threads are off.
    # We emulate it here.
    else {
        *share = sub { return $_[0] };
        *lock  = sub { 0 };
    }
}
 
 
#line 127

inc/Test/Builder.pm  view on Meta::CPAN

1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
my $test_results = $self->{Test_Results};
if( @$test_results ) {
    # The plan?  We have no plan.
    if( $self->{No_Plan} ) {
        $self->_print("1..$self->{Curr_Test}\n") unless $self->no_header;
        $self->{Expected_Tests} = $self->{Curr_Test};
    }
 
    # Auto-extended arrays and elements which aren't explicitly
    # filled in with a shared reference will puke under 5.8.0
    # ithreads.  So we have to fill them in by hand. :(
    my $empty_result = &share({});
    for my $idx ( 0..$self->{Expected_Tests}-1 ) {
        $test_results->[$idx] = $empty_result
          unless defined $test_results->[$idx];
    }
 
    my $num_failed = grep !$_->{'ok'},
                          @{$test_results}[0..$self->{Curr_Test}-1];
 
    my $num_extra = $self->{Curr_Test} - $self->{Expected_Tests};

inc/Test/More.pm  view on Meta::CPAN

634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
    # There's faster ways to do this, but this is easiest.
    local $^W = 0;
 
    # It really doesn't matter how we sort them, as long as both arrays are
    # sorted with the same algorithm.
    #
    # Ensure that references are not accidentally treated the same as a
    # string containing the reference.
    #
    # Have to inline the sort routine due to a threading/sort bug.
    # See [rt.cpan.org 6782]
    #
    # I don't know how references would be sorted so we just don't sort
    # them.  This means eq_set doesn't really work with refs.
    return eq_array(
           [grep(ref, @$a1), sort( grep(!ref, @$a1) )],
           [grep(ref, @$a2), sort( grep(!ref, @$a2) )],
    );
}



( run in 0.254 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )