X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FPb.pm;h=de9db879d98e3cea0171240c8d906e3410e68cc4;hb=fe78f0c128c35e68e65850b02057997bad6717fe;hp=efe7d26a42d986dbde5dc51b9add82aca7b91c24;hpb=42546e6c1b709dc4c8d8e7048becc14278b6cdf0;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Pb.pm b/lib/Gruntmaster/Page/Pb.pm index efe7d26..de9db87 100644 --- a/lib/Gruntmaster/Page/Pb.pm +++ b/lib/Gruntmaster/Page/Pb.pm @@ -28,14 +28,16 @@ $templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates; $templates{$_} .= footer $_ for keys %templates; sub generate{ - my $template = $templates{$_[1]}; + my ($path, $lang) = @_; + $path =~ s,/index\.html$,,; + my $template = $templates{$lang}; my $htc = HTML::Template::Compiled->new(scalarref => \$template); - IO::File->new('>pb/meta.yml')->close unless -f 'pb/meta.yml'; - flock my $metafh = IO::File->new('new(">$path/meta.yml")->close unless -f "$path/meta.yml"; + flock my $metafh = IO::File->new("<$path/meta.yml"), LOCK_SH; my @problems = sort { $b->{name} cmp $a->{name} } map { my $meta = LoadFile $_; - my $id = (m,^pb/(.*)/meta.yml$,)[0]; - +{ id => $id, name => $meta->{name} } } ; + my $id = (m,^$path/(.*)/meta.yml$,)[0]; + +{ id => $id, name => $meta->{name} } } <$path/*/meta.yml>; $htc->param(problems => \@problems); $htc->output }