Apache-SWIT

 view release on metacpan or  search on metacpan

lib/Apache/SWIT/Maker/FileWriter.pm  view on Meta::CPAN

sub _write_file {
	my ($self, $n, $vars, $new_opts) = @_;
	my $opts = $self->_normalize_options($self->Files->{$n}, $new_opts);
	my $p = $opts->{path};
	$p = $p->($opts) if ref($p);
	my $f = $self->root_dir . "/$p";
	die "Cowardly refusing to overwrite $f"
		if (-f $f && !$opts->{overwrite});
	$vars = $self->_normalize_options($opts->{vars}, $vars)
			if $opts->{vars};
	my $t = Template->new({ OUTPUT_PATH => $self->root_dir,
				%{ $opts->{tmpl_options} || {} } })
			or die "No template";
	$t->process(\$opts->{contents}, $vars, $p)
		or die "No result for $n: " . $t->error;

	write_file($self->root_dir . "/MANIFEST", { append => 1 }
			, "\n$p\n") if $opts->{manifest};
}

sub _mangle_name_to_path {



( run in 0.368 second using v1.01-cache-2.11-cpan-4e96b696675 )