From e39e1efc46c229dba9618684aac47df4ba10ace1 Mon Sep 17 00:00:00 2001
From: Robert Anderson <randerson@lbsd.net>
Date: Fri, 6 Mar 2009 05:27:16 +0000
Subject: [PATCH] * Return the raw value for rawattr() and fallback to the
 translated value if there is no raw value

---
 Radius/Packet.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Radius/Packet.pm b/Radius/Packet.pm
index 746ebb59..941568ed 100644
--- a/Radius/Packet.pm
+++ b/Radius/Packet.pm
@@ -131,7 +131,11 @@ sub rawattr
     my @attr = $self->_attributes;
     
     for (my $i = $#attr; $i >= 0; $i-- ) {
-        return $attr[$i][2] if $attr[$i][0] eq $name;
+	# Check if this is the attr we're after
+	if ($attr[$i][0] eq $name) {
+		# If it is, return the raw attribute if it exists, else return the nicer dict one
+		return defined($attr[$i][2]) ? $attr[$i][2] : $attr[$i][1];
+	}
     }
     return;
 }
-- 
GitLab