diff --git a/VMX/Common.pm b/VMX/Common.pm index 6c95e37..6497315 100644 --- a/VMX/Common.pm +++ b/VMX/Common.pm @@ -26,7 +26,7 @@ our @EXPORT_OK = qw( HASHARRAY quotequote min max trim htmlspecialchars strip_tags strip_unsafe_tags file_get_contents dbi_hacks ar1el filemd5 mysql_quote updaterow_hashref insertall_hashref deleteall_hashref dumper_no_lf str2time callif urandom - normalize_url utf8on rfrom_to mysql2time mysqllocaltime resub + normalize_url utf8on rfrom_to mysql2time mysqllocaltime resub hashmrg ); our %EXPORT_TAGS = (all => [ @EXPORT_OK ]); @@ -609,5 +609,27 @@ sub resub return $value; } +# недеструктивное объединение хешрефов +sub hashmrg +{ + return undef unless @_; + my $h; + for (@_) + { + if ($_ && %$_) + { + if ($h) + { + $h = { %$h, %$_ }; + } + else + { + $h = $_; + } + } + } + return $h; +} + 1; __END__