From 9b5ede14707cf7b2f2080352426aed4b534e3413 Mon Sep 17 00:00:00 2001 From: lukec Date: Tue, 7 Mar 2006 23:41:30 +0000 Subject: [PATCH] Add as_text git-svn-id: http://5thplane.com/svn/perl/Zen-Koans@120 e5f7e8ef-ac07-0410-9fef-9965b2c2b5fc --- lib/Zen/Koan.pm | 5 +++++ t/koan.t | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/Zen/Koan.pm b/lib/Zen/Koan.pm index 03fe173..0d0d84c 100644 --- a/lib/Zen/Koan.pm +++ b/lib/Zen/Koan.pm @@ -65,6 +65,11 @@ $body EOT } +sub as_text { + my $self = shift; + return "\t$self->{title}\n\n$self->{body}"; +} + sub AUTOLOAD { return <new( body => <new( body => <as_html, <A koan by no other name
@@ -66,6 +68,18 @@ EOK EOK } +Koan_as_text: { + my $k = poem_koan(); + is $k->as_text, <new; isa_ok $k, 'Zen::Koan';