};
}
+sub join : method {
+ my ($attr, $reader, $writer) = @_;
+ return sub {
+ my ($instance, $separator) = @_;
+ join $separator, @{$reader->($instance)}
+ };
+}
+
1;
__END__
=item B<elements>
+=item B<join>
+
=back
=head1 BUGS
use strict;
use warnings;
-use Test::More tests => 19;
+use Test::More tests => 21;
use Test::Exception;
BEGIN {
'grep' => 'filter_options',
'find' => 'find_option',
'elements' => 'options',
+ 'join' => 'join_options',
}
);
}
filter_options
find_option
options
+ join_options
];
is_deeply($stuff->_options, [1 .. 10], '... got options');
is_deeply([ $stuff->options ], [1 .. 10], '... got the list of options');
+is($stuff->join_options(':'), '1:2:3:4:5:6:7:8:9:10', '... joined the list of options by :');
+
## test the meta
my $options = $stuff->meta->get_attribute('_options');
'count' => 'num_options',
'empty' => 'has_options',
'elements' => 'options',
+ 'join' => 'join_options',
}, '... got the right provies mapping');
is($options->type_constraint->type_parameter, 'Int', '... got the right container type');