Skip to content

Commit 3fba804

Browse files
dpvcAlex-Jordan
authored andcommitted
address 'address' issue #872
1 parent 9fcc7d0 commit 3fba804

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/Value.pm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,12 @@ sub inContext { my $self = shift; $self->context(@_); $self }
267267

268268
#############################################################
269269

270-
#
271270
#
272271
# The address of a Value object (actually ANY perl value).
273272
# Use this to compare two objects to see of they are
274273
# the same object (avoids automatic stringification).
275274
#
276-
sub address { oct(sprintf("0x%p", shift)) }
275+
sub address { Scalar::Util::refaddr(shift) }
277276

278277
sub isBlessed { (Scalar::Util::blessed(shift) // '') ne "" }
279278
sub blessedClass { Scalar::Util::blessed(shift) }

macros/answers/answerHints.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ sub Compare {
200200
$ans->{ans_message} = $ans->{error_message} = "";
201201
$ans->{score} = 0;
202202

203-
if (sprintf("%p", $self) ne sprintf("%p", $ans->{correct_value})) {
203+
if ($self->address != $ans->{correct_value}->address) {
204204
$ans->{correct_ans} = $self->string;
205205
$ans->{correct_value} = $self;
206206
$ans->{correct_formula} = Value->Package("Formula")->new($self);
207207
}
208-
if (sprintf("%p", $other) ne sprintf("%p", $ans->{student_value})) {
208+
if ($other->address != $ans->{student_value}->address) {
209209
$ans->{student_ans} = $other->string;
210210
$ans->{student_value} = $other;
211211
$ans->{student_formula} = Value->Package("Formula")->new($other);

0 commit comments

Comments
 (0)