Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I am curious how you ended up using XS---I figure there must be a good story about that. Did comparing them as strings not work for some reason?
    use Test::More tests => 3;
    my $a = 5;
    my $b = \$a;
    my $c = \$a;
    my $d = \$b;
    my $e = [];
    is( $b, $c, "Same scalar data" );
    isnt( $b, $d, "Not the same" );
    isnt( $c, $e, "Not the same" );

    As for names, I would go for Test::Ref, since the Perl operator is ref().

    • It does OK with scalars, but some of the other reference types, no.

      For example,

      use warnings;
      use strict;
      use Test::More tests => 2;

      my $val1 = qr/foo/;
      my $val2 = qr/foo/;

      $a = $val1;
      $b = $val1;
      $c = $val2;

      diag ref $a;
      diag ref $b;
      diag ref $c;

      is($a, $b);
      isnt($a, $c);