From: gfx Date: Tue, 22 Sep 2009 05:14:09 +0000 (+0900) Subject: Add Mouse::Util::english_list() X-Git-Tag: 0.32~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2e33bb59f4812cdb48fe068c11929c4e646405ab;p=gitmo%2FMouse.git Add Mouse::Util::english_list() --- diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index eb72c43..f9f2181 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -9,6 +9,7 @@ our @EXPORT_OK = qw( find_meta does_role resolve_metaclass_alias + english_list load_class is_class_loaded @@ -261,6 +262,19 @@ sub apply_all_roles { return; } +# taken from Moose::Util 0.90 +sub english_list { + return $_[0] if @_ == 1; + + my @items = sort @_; + + return "$items[0] and $items[1]" if @items == 2; + + my $tail = pop @items; + + return join q{, }, @items, "and $tail"; +} + sub not_supported{ my($feature) = @_;