From 3045b3176b0f9a2cc4574ac88a7a67c66038e972 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 25 May 2014 02:44:38 -0400 Subject: stringification --- lib/Games/SMTNocturne/Demons/Demon.pm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/Games/SMTNocturne/Demons') diff --git a/lib/Games/SMTNocturne/Demons/Demon.pm b/lib/Games/SMTNocturne/Demons/Demon.pm index 711697d..8ceff42 100644 --- a/lib/Games/SMTNocturne/Demons/Demon.pm +++ b/lib/Games/SMTNocturne/Demons/Demon.pm @@ -1,6 +1,7 @@ package Games::SMTNocturne::Demons::Demon; use strict; use warnings; +use overload '""' => 'to_string', fallback => 1; use JSON::PP; @@ -47,6 +48,11 @@ sub fusion_type { $_[0]->{fusion_type} } sub level { $_[0]->{level} } sub type { $_[0]->{type} } +sub to_string { + my $self = shift; + return '<' . $self->type . ' ' . $self->name . ' (' . $self->level . ')>' +} + 1; __DATA__ -- cgit v1.2.3-54-g00ecf