Bug 8442 - labels creator fixes for plack

- remove all exit(1) and replace them with __END__ which benefits CGI
- insert correct =cut markers at end of POD (required for CGI::Compile
  under plack to correctly parse source code and exeute it)
- scope variables with our which are used inside sub for plack

Signed-off-by: Mirko Tietgen <5p4m@gmx.de>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Dobrica Pavlinusic 2012-07-19 19:12:13 +02:00 committed by Paul Poulain
parent 217fef5749
commit 664ecc9aca
3 changed files with 7 additions and 8 deletions

View file

@ -72,7 +72,6 @@ else {
my $csv = Text::CSV_XS->new();
CSV_ITEMS:
foreach my $item (@$items) {
my $label = C4::Labels::Label->new(
batch_id => $batch_id,
@ -85,11 +84,10 @@ foreach my $item (@$items) {
}
else {
warn sprintf('Text::CSV_XS->combine() returned the following error: %s', $csv->error_input);
next CSV_ITEMS;
}
}
exit(1);
__END__
=head1 NAME
@ -122,3 +120,4 @@ Fifth Floor, Boston, MA 02110-1301 USA.
Koha is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
=cut

View file

@ -58,9 +58,9 @@ print $cgi->header( -type => 'application/pdf',
-attachment => "$pdf_file.pdf",
);
my $pdf = C4::Creators::PDF->new(InitVars => 0);
our $pdf = C4::Creators::PDF->new(InitVars => 0);
my $batch = C4::Labels::Batch->retrieve(batch_id => $batch_id);
my $template = C4::Labels::Template->retrieve(template_id => $template_id, profile_id => 1);
our $template = C4::Labels::Template->retrieve(template_id => $template_id, profile_id => 1);
my $layout = C4::Labels::Layout->retrieve(layout_id => $layout_id);
sub _calc_next_label_pos {
@ -205,7 +205,7 @@ foreach my $item (@{$items}) {
$pdf->End();
exit(1);
__END__
=head1 NAME

View file

@ -74,7 +74,6 @@ my $xml_data = {'label' => []};
my $item_count = 0;
XML_ITEMS:
foreach my $item (@$items) {
push(@{$xml_data->{'label'}}, {'item_number' => $item->{'item_number'}});
my $label = C4::Labels::Label->new(
@ -98,7 +97,7 @@ my $xml_out = $xml->XMLout($xml_data);
#die "XML OUT:\n" . Dumper($xml_out);
print $xml_out;
exit(1);
__END__
=head1 NAME
@ -132,3 +131,4 @@ Fifth Floor, Boston, MA 02110-1301 USA.
Koha is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
=cut