#webliberty::Script.pm (2006/02/18)
#Copyright(C) 2002-2006 Knight, All rights reserved.

package webliberty::Script;

use strict;

### コンストラクタ
sub new {
	my $class = shift;

	my $self = {
	};
	bless $self, $class;

	return $self;
}

### データ作成
sub create_jscript {
	my $self = shift;
	my %args = @_;

	my $file     = $args{'file'};
	my $contents = $args{'contents'};

	$contents =~ s/'/\\'/g;

	my $script;
	foreach (split(/\n/, $contents)) {
		$script .= "document.write('$_');\n";
	}

	open(FH, ">$file") or return(0, "Write Error : $file");
	print FH $script;
	close(FH);

	return 1;
}

1;
