diff _common.pm @ 12:d19146b30334

Tests: move write_file() into _common.pm.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 11 Sep 2008 19:55:04 +0400
parents a58a62e9d695
children
line wrap: on
line diff
--- a/_common.pm
+++ b/_common.pm
@@ -11,8 +11,8 @@ use strict;
 
 use base qw/ Exporter /;
 
-our @EXPORT = qw/ start_nginx smtp_connect smtp_send smtp_read smtp_check
-	smtp_ok log_in log_out http /;
+our @EXPORT = qw/ start_nginx write_file smtp_connect smtp_send smtp_read
+	smtp_check smtp_ok log_in log_out http /;
 
 ###############################################################################
 
@@ -63,6 +63,15 @@ END {
 	stop_nginx();
 }
 
+sub write_file {
+	my ($name, $content) = @_;
+
+	open F, '>' . $testdir . '/' . $name
+		or die "Can't create $name: $!";
+	print F $content;
+	close F;
+}
+
 ###############################################################################
 
 sub log_out {