diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-05-25 02:44:38 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-05-25 02:44:38 -0400 |
commit | 3045b3176b0f9a2cc4574ac88a7a67c66038e972 (patch) | |
tree | 8606554032c35dd9357591f0e05a99e0dc59ed96 | |
parent | ef5e91f3d15e44c37d84b98e45da34181acd3d92 (diff) | |
download | games-smtnocturne-demons-3045b3176b0f9a2cc4574ac88a7a67c66038e972.tar.gz games-smtnocturne-demons-3045b3176b0f9a2cc4574ac88a7a67c66038e972.zip |
stringification
-rw-r--r-- | lib/Games/SMTNocturne/Demons/Demon.pm | 6 |
1 files changed, 6 insertions, 0 deletions
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__ |