Description: Fixes to not fail with latest version of Perl::Critic
Origin: backport, https://fedorahosted.org/publican/changeset/1732
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=684509
Bug-Debian: http://bugs.debian.org/616696
Applied-Upstream: 3.0

--- a/lib/Publican/Builder.pm
+++ b/lib/Publican/Builder.pm
@@ -1675,7 +1675,7 @@ sub package_home {
     my $outfile;
     my $spec_name = "$tmp_dir/rpm/$name_start-web-$web_type.spec";
 
-    open( $outfile, ">:utf8", "$spec_name" )
+    open( $outfile, ">:encoding(UTF-8)", "$spec_name" )
         || croak( maketext( "Can't open spec file: [_1]", $@ ) );
     print( $outfile $stylesheet->output_string($results) );
     close($outfile);
@@ -1824,7 +1824,7 @@ sub package {
         if ( -f $po_file ) {
             my $PO;
             my $real_value;
-            open( $PO, "<:utf8", $po_file )
+            open( $PO, "<:encoding(UTF-8)", $po_file )
                 || croak( maketext( "Can't open PO file: [_1]", $po_file ) );
             foreach my $line (<$PO>) {
                 if ( $line =~ /^"Project-Id-Version:/ ) {
@@ -2039,7 +2039,7 @@ sub package {
     $spec_name = "$tmp_dir/rpm/$name_start-$lang.spec"
         if ( $desktop or $short_sighted );
 
-    open( $outfile, ">:utf8", "$spec_name" )
+    open( $outfile, ">:encoding(UTF-8)", "$spec_name" )
         || croak( maketext( "Can't open spec file: [_1]", $@ ) );
     print( $outfile $stylesheet->output_string($results) );
     close($outfile);
--- a/lib/Publican/CreateBook.pm
+++ b/lib/Publican/CreateBook.pm
@@ -372,7 +372,7 @@ sub create {
             $out_file = "$name/$lang/$name" . ".xml";
         }
         my $OUTDOC;
-        open( $OUTDOC, ">:utf8", $out_file )
+        open( $OUTDOC, ">:encoding(UTF-8)", $out_file )
             || croak(
             maketext( "Could not open [_1] for output!", $out_file, $@ ) );
 
@@ -399,7 +399,7 @@ sub create {
     my $year = DateTime->today()->year();
 
     my $OUTDOC;
-    open( $OUTDOC, ">:utf8", "$name/$lang/$name" . ".ent" )
+    open( $OUTDOC, ">:encoding(UTF-8)", "$name/$lang/$name" . ".ent" )
         || croak( maketext( "Could not open entity file. [_1]", $@ ) );
     print $OUTDOC <<EOL;
 <!ENTITY PRODUCT "$product">
@@ -410,7 +410,7 @@ EOL
 
     close($OUTDOC);
 
-    open( $OUTDOC, ">:utf8", "$name/$lang/images/icon.svg" )
+    open( $OUTDOC, ">:encoding(UTF-8)", "$name/$lang/images/icon.svg" )
         || croak( maketext( "Could not open icon file. [_1]", $@ ) );
     print( $OUTDOC $icon );
     close($OUTDOC);
--- a/lib/Publican/CreateBrand.pm
+++ b/lib/Publican/CreateBrand.pm
@@ -123,7 +123,7 @@ sub create {
 
     $out_file = "$lang/css/overrides.css";
 
-    open( $OUT, ">:utf8", $out_file )
+    open( $OUT, ">:encoding(UTF-8)", $out_file )
         || croak(
         maketext( "Could not open [_1] for output: [_2]", $out_file, $@ ) );
 
@@ -241,7 +241,7 @@ sub xml_files {
         my $text     = $xml_doc->as_XML($xml_doc);
         my $out_file = "$lang/$file" . ".xml";
         my $OUTDOC;
-        open( $OUTDOC, ">:utf8", $out_file )
+        open( $OUTDOC, ">:encoding(UTF-8)", $out_file )
             || croak(
             maketext( "Could not open file [_1] for output!", $out_file ) );
 
@@ -309,7 +309,7 @@ sub conf_files {
     my $date = DateTime->today()->strftime("%a %b %e %Y");
     $out_file = "publican-$lcbrand.spec";
 
-    open( $OUT, ">:utf8", $out_file )
+    open( $OUT, ">:encoding(UTF-8)", $out_file )
         || croak( maketext( "Could not open file [_1] for output!", $out_file ) );
 
     print $OUT <<SPEC;
@@ -360,13 +360,13 @@ SPEC
 
     close($OUT);
 
-    open( $OUT, ">:utf8", 'README' )
+    open( $OUT, ">:encoding(UTF-8)", 'README' )
         || croak( maketext( "Could not open file README for output!" ) );
 
     print($OUT "SETUP This file should be a short description of your project");
     close($OUT);
 
-    open( $OUT, ">:utf8", 'COPYING' )
+    open( $OUT, ">:encoding(UTF-8)", 'COPYING' )
         || croak( maketext( "Could not open file COPYING for output!" ) );
 
     print($OUT "SETUP This file should contain your COPYRIGHT License");
@@ -420,7 +420,7 @@ sub images {
 </svg>
 SVG
 
-        open( $OUT, ">:utf8", "$lang/images/$count.svg" )
+        open( $OUT, ">:encoding(UTF-8)", "$lang/images/$count.svg" )
             || croak(
             maketext(
                 "Can't open SVG file [_1]: [_2]", "$lang/images/$count.svg",
@@ -526,7 +526,7 @@ sub default_images {
 </svg>
 SVG
 
-    open( $OUT, ">:utf8", "$lang/images/$file.svg" )
+    open( $OUT, ">:encoding(UTF-8)", "$lang/images/$file.svg" )
         || croak(
         maketext(
             "Can't open SVG file [_1]: [_2]", "$lang/images/$file.svg", $@
--- a/lib/Publican/Translate.pm
+++ b/lib/Publican/Translate.pm
@@ -190,7 +190,7 @@ sub po2xml {
 
     my $OUTDOC;
 
-    open( $OUTDOC, ">:utf8", "$out_file" )
+    open( $OUTDOC, ">:encoding(UTF-8)", "$out_file" )
         || croak( maketext( "Could not open [_1] for output!", $out_file ) );
     print $OUTDOC Publican::Builder::dtd_string(
         { tag => $type, dtdver => $dtdver } );
@@ -686,7 +686,7 @@ sub print_msgs {
 
     my $fh;
 
-    open( $fh, ">:utf8", $pot_file )
+    open( $fh, ">:encoding(UTF-8)", $pot_file )
         or croak(
         maketext(
             "Failed to open output file [_1]. Error: [_2]",
--- a/lib/Publican/WebSite.pm
+++ b/lib/Publican/WebSite.pm
@@ -636,7 +636,7 @@ sub regen_all_toc {
     $self->{Template}->process(
         'static_toc.tmpl', $vars,
         $self->{toc_path} . "/toc.html",
-        binmode => ':utf8'
+        binmode => ':encoding(UTF-8)'
     ) or croak( $self->{Template}->error() );
 
     $self->stats();
@@ -646,7 +646,7 @@ sub regen_all_toc {
     $self->{Template}->process(
         'Sitemap.tmpl', $vars,
         $self->{toc_path} . "/Sitemap",
-        binmode => ':utf8'
+        binmode => ':encoding(UTF-8)'
     ) or croak( $self->{Template}->error() );
 
     # regenerate main index.html
@@ -662,7 +662,7 @@ sub regen_all_toc {
     $self->{Template}->process(
         'index.tmpl', $vars,
         $self->{toc_path} . "/index.html",
-        binmode => ':utf8'
+        binmode => ':encoding(UTF-8)'
     ) or croak( $self->{Template}->error() );
 
     # This file contains all the langauges.
@@ -677,7 +677,7 @@ sub regen_all_toc {
     $self->{Template}->process(
         'opds-langs.tmpl', $opds_vars,
         $self->{toc_path} . "/opds.xml",
-        binmode => ':utf8'
+        binmode => ':encoding(UTF-8)'
     ) or croak( $self->{Template}->error() );
 
     $self->xml_dump() if ( $self->{dump} );
@@ -1031,7 +1031,7 @@ SEARCH
         $self->{Template}->process(
             'opds.tmpl', $opds_vars,
             $self->{toc_path} . "/$language/opds-$product.xml",
-            binmode => ':utf8'
+            binmode => ':encoding(UTF-8)'
         ) or croak( $self->{Template}->error() );
 
         my %opds_p_url = (
@@ -1054,7 +1054,7 @@ SEARCH
     $self->{Template}->process(
         'toc.tmpl', $vars,
         $self->{toc_path} . "/$language/toc.html",
-        binmode => ':utf8'
+        binmode => ':encoding(UTF-8)'
     ) or croak( $self->{Template}->error() );
 
     # This file contains all products for this langauge.
@@ -1069,7 +1069,7 @@ SEARCH
     $self->{Template}->process(
         'opds-prods.tmpl', $opds_vars,
         $self->{toc_path} . "/$language/opds.xml",
-        binmode => ':utf8'
+        binmode => ':encoding(UTF-8)'
     ) or croak( $self->{Template}->error() );
 
     return \@products;
@@ -1169,7 +1169,7 @@ GET_COUNTS
         $self->{Template}->process(
             'stats.tmpl', $vars,
             $self->{toc_path} . "/$lang/Site_Statistics.html",
-            binmode => ':utf8'
+            binmode => ':encoding(UTF-8)'
         ) or croak( $self->{Template}->error() );
     }
 
--- a/lib/Publican/XmlClean.pm
+++ b/lib/Publican/XmlClean.pm
@@ -650,7 +650,7 @@ sub print_xml {
         $xml_doc->root()->delete();
 
         my $OUTDOC;
-        open( $OUTDOC, ">:utf8", "$out_file" )
+        open( $OUTDOC, ">:encoding(UTF-8)", "$out_file" )
             || croak(
             maketext( "Could not open [_1] for output!", $out_file ) );
 
--- a/bin/publican
+++ b/bin/publican
@@ -714,7 +714,7 @@ if ( $action eq 'bump' ) {
 
         my $OUTDOC;
 
-        open( $OUTDOC, ">:utf8", "$file" )
+        open( $OUTDOC, ">:encoding(UTF-8)", "$file" )
             || croak( maketext( "Could not open [_1] for output!", $file ) );
 
         my $ent_file = undef;
