Saturday February 28, 2004
RFC - Test::Reference
Either the Perl-QA mailing list is down, or it just doesn't like where I'm sending my mail from, because my emails just don't seem to the making the list. Well, not seeing an obvious Test:: module that would work for me to make sure
that two references referred to the same thing, I wrote my own module.
Before sending it off to CPAN, I'd like to see what you all think of it.
Also, I have a couple of questions. First, the module includes some XS,
which is unusual for Test:: modules. Do you think I should split my code
into two modules (say Devel::References::Same and Test::References) or keep
it the way it is. Second, I'm not particularly in love with the names
Test::Reference with the function "references_same". I was thinking of
Test::References::Same as a possible name for the module, but then I at a
loss of what to call the function. references_same_ok? I'd appreciate your
Test::Reference - Check to see if two references refer to the same
my $val1 = 5;
my $val2 = 5;
my $a = \$val1;
my $b = \$val1;
my $c = \$val2;
references_same($a, $b, "Will return ok");
references_same($a, $c, "Will return not ok");
This modules allows you to test to see if two references refer to the
same variable or not.
"references_same( $ref1, $ref2, $mesg)"
Checks to see that the two references are references and that they both
refer to the same underlying variable.
Extending and Embedding Perl - my main reference for learning XS
Devel::Peek - my other main reference for learing XS
Steve Peters, <steve@XXXXXXXXXXX.XXX>
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Steve Peters
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself, either Perl version 5.8.3 or, at
your option, any later version of Perl 5 you may have available.