<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Common::CommonLib;

use strict;
use warnings;

use Exporter;

our @ISA = qw(Exporter);


## static var wrapper
BEGIN {
	my $__tmp_static_len = 0;

	sub calc_cvl_struct {
		my $struct = shift or die ("Bad function call!");

		if( ref $struct eq 'HASH' ) {
			foreach my $key (keys %$struct) {
				if( ref($struct-&gt;{$key}) ) {
					calc_cvl_struct( $struct-&gt;{$key} );
				}
				else {
					$__tmp_static_len += length $struct-&gt;{$key};
				}
			}
		}
		elsif( ref $struct eq 'ARRAY' ) {
			foreach my $data (@$struct) {
				if( ref($data) ) {
					calc_cvl_struct( $data );
				}
				else {
					$__tmp_static_len += length $data;
				}
			}
		}

		return $__tmp_static_len;
	}

	sub reset_cvl {
		$__tmp_static_len = 0;
	}
	
}


our @EXPORT = qw( calc_cvl_struct reset_cvl );


1;
</pre></body></html>