X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FMoreCommon.pm;h=e93dd172e155d9a64834157e65bd6d7a0bf06468;hb=88e6dce2c094fa468e4397030d2f14289a265e62;hp=e09d7c85dd13a236a8b45103bf0a1ee647b3a28f;hpb=46e1506b7ccd09f451b1c33f9b42f450b96f55fd;p=kivitendo-erp.git diff --git a/SL/MoreCommon.pm b/SL/MoreCommon.pm index e09d7c85d..e93dd172e 100644 --- a/SL/MoreCommon.pm +++ b/SL/MoreCommon.pm @@ -1,15 +1,17 @@ package SL::MoreCommon; require Exporter; -@ISA = qw(Exporter); +our @ISA = qw(Exporter); -@EXPORT = qw(save_form restore_form compare_numbers any cross); -@EXPORT_OK = qw(ary_union ary_intersect ary_diff); +our @EXPORT = qw(save_form restore_form compare_numbers any cross); +our @EXPORT_OK = qw(ary_union ary_intersect ary_diff listify); use YAML; use SL::AM; +use strict; + sub save_form { $main::lxdebug->enter_sub(); @@ -159,4 +161,9 @@ 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;