From 7446bb2b9d24fa6b702fbb62d73084a32ade6f75 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Sat, 31 Jan 2015 02:13:12 +0000 Subject: Class-Tiny-1.001 --- t/lib/Charlie.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 t/lib/Charlie.pm (limited to 't/lib/Charlie.pm') diff --git a/t/lib/Charlie.pm b/t/lib/Charlie.pm new file mode 100644 index 0000000..7d312bd --- /dev/null +++ b/t/lib/Charlie.pm @@ -0,0 +1,28 @@ +use 5.006; +use strict; +use warnings; + +package Charlie; + +use subs qw/bar baz/; + +use Class::Tiny qw/foo bar/, { baz => 23 }; + +sub bar { + my $self = shift; + if (@_) { + $self->{bar} = [@_]; + } + return $self->{bar}; +} + +sub baz { + my $self = shift; + if (@_) { + $self->{baz} = shift; + } + return $self->{baz} ||= + Class::Tiny->get_all_attribute_defaults_for( ref $self )->{baz}; +} + +1; -- cgit v1.2.1