Acme-JWT

 view release on metacpan or  search on metacpan

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

617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
# Effectively turn %Refs_Seen into a stack.  This avoids picking up
# the same referenced used twice (such as [\$a, \$a]) to be considered
# circular.
local %Refs_Seen = %Refs_Seen;
 
{
    $tb->_unoverload_str( \$e1, \$e2 );
 
    # Either they're both references or both not.
    my $same_ref = !( !ref $e1 xor !ref $e2 );
    my $not_ref = ( !ref $e1 and !ref $e2 );
 
    if( defined $e1 xor defined $e2 ) {
        $ok = 0;
    }
    elsif( !defined $e1 and !defined $e2 ) {
        # Shortcut if they're both undefined.
        $ok = 1;
    }
    elsif( _dne($e1) xor _dne($e2) ) {
        $ok = 0;
    }
    elsif( $same_ref and( $e1 eq $e2 ) ) {
        $ok = 1;
    }
    elsif($not_ref) {
        push @Data_Stack, { type => '', vals => [ $e1, $e2 ] };
        $ok = 0;
    }
    else {
        if( $Refs_Seen{$e1} ) {
            return $Refs_Seen{$e1} eq $e2;
        }
        else {
            $Refs_Seen{$e1} = "$e2";
        }



( run in 0.274 second using v1.01-cache-2.11-cpan-e5176c747c2 )