diff Lib/IMPL/lang.pm @ 181:47dac58691ee

New templating system, small fixes
author sourcer
date Thu, 26 Jan 2012 01:15:57 +0400
parents 658a80d19d33
children 4d0e1962161c
line wrap: on
line diff
--- a/Lib/IMPL/lang.pm	Fri Dec 30 23:40:00 2011 +0300
+++ b/Lib/IMPL/lang.pm	Thu Jan 26 01:15:57 2012 +0400
@@ -38,7 +38,6 @@
 		  &property
 		  &static
 		  &property
-		  &ctor
 		  )
 	],
 	compare => [
@@ -55,6 +54,7 @@
 		  &hashDiff
 		  &hashCompare
 		  &hashParse
+		  &hashSave
 		  )
 	]
 );
@@ -118,20 +118,6 @@
 	$class->static_accessor( $name, $value );
 }
 
-sub ctor(&;$) {
-	my ( $code, %base ) = @_;
-	no strict 'refs';
-	my $class = caller;
-	
-	if ($code) {
-		*{"${class}::CTOR"} = $code;
-	}
-	
-	if (%base) {
-		%{"${class}::CTOR"} = %base;
-	}
-}
-
 sub equals {
 	if (defined $_[0]) {
 		return 0 if (not defined $_[1]);
@@ -223,7 +209,25 @@
 }
 
 sub hashSave {
+	my ($hash,$p,$d) = @_;
 	
+	return "" unless ref $hash eq 'HASH';
+	
+	$p ||= "\n";
+	$d ||= " = ";
+	
+	return
+		join(
+			$p,
+			map(
+				join(
+					$d,
+					$_,
+					$hash->{$_}
+				),
+				keys %$hash
+			)
+		);
 }
 
 1;