From: Sven Schöling Date: Wed, 30 Sep 2009 10:40:42 +0000 (+0200) Subject: Funktion "listify" ergänzt. X-Git-Tag: release-2.6.1beta1~269 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=67223abfdf21b3c53bbb830f223663c65b8c187b;p=kivitendo-erp.git Funktion "listify" ergänzt. Merge aus -r9498 intern. --- diff --git a/SL/MoreCommon.pm b/SL/MoreCommon.pm index e09d7c85d..6c292bab8 100644 --- a/SL/MoreCommon.pm +++ b/SL/MoreCommon.pm @@ -4,7 +4,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT = qw(save_form restore_form compare_numbers any cross); -@EXPORT_OK = qw(ary_union ary_intersect ary_diff); +@EXPORT_OK = qw(ary_union ary_intersect ary_diff listify); use YAML; @@ -159,4 +159,10 @@ sub ary_diff { return grep { !$in_b{$_} } @$a; } +sub listify { + my @ary = scalar @_ > 1 ? @_ : ref $_[0] eq 'ARRAY' ? @{ $_[0] } : (@_); + return wantarray ? @ary : scalar @ary; +} ++ + 1;