Miril

 view release on metacpan or  search on metacpan

lib/Miril/Publisher.pm  view on Meta::CPAN

					url   => $miril->util->inflate_list_url(undef, $location),
					sort  => $cfg->sort,
					id    => $list->id,
				);

				my $output = $miril->tmpl->load(
					name => $list->template,
					params => {
						list  => $list_page,
						cfg   => $cfg,
						title => $list_page->title,
						id    => $list->id,
				});
		
				my $new_filename = catfile($cfg->output_path, $location);
				_file_write($new_filename, $output);
			}
		}	
		else
		{
			my $output = $miril->tmpl->load(
				name => $list->template,
				params => {
					list => Miril::List->new( 
						posts => \@posts,
						title => $list->name,
						url   => $miril->util->inflate_list_url($list->id, $list->location),
						id    => $list->id,
						sort  => $cfg->sort,
					),
					cfg   => $cfg,
					title => $list->name,
					id    => $list->id,
				}
			);
		
			my $new_filename = catfile($cfg->output_path, $list->location);
			_file_write($new_filename, $output);
		}
	}
}

sub _file_write {
	my ($filename, $data) = @_;
	my ($volume, $directories, $file) = splitpath($filename);
	my $path = $volume . $directories;
	try {
		make_path($path);
		my $fh = IO::File->new($filename, ">") or die $!;
		$fh->print($data);
		$fh->close;
	} catch {
		Miril::Exception->throw(
			errorvar => $_,
			message  => 'Could not save information',
		);
	}
	#my $post_fh = IO::File->new($filename, "<") or die $!;
	#while (<$post_fh>)
	#{
#		warn "BOM before write!" if /\x{FEFF}/;
	#}
}

1;





( run in 0.602 second using v1.01-cache-2.11-cpan-9581c071862 )