mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-26 05:58:16 +00:00
Load Encode before trying to use Encode::resolve_alias
This commit is contained in:
@@ -3953,15 +3953,24 @@ sub main {
|
||||
# Open the file and print the header to it.
|
||||
if ( $archive_file ) {
|
||||
my $need_hdr = $o->get('header') && !-f $archive_file;
|
||||
my $charset = lc $o->get('charset');
|
||||
if ( $charset ) {
|
||||
$archive_fh = IO::File->new($archive_file, ">>:$charset")
|
||||
or die "Cannot open $charset $archive_file: $OS_ERROR\n";
|
||||
}
|
||||
else {
|
||||
$archive_fh = IO::File->new($archive_file, ">>")
|
||||
or die "Cannot open $archive_file: $OS_ERROR\n";
|
||||
}
|
||||
my $charset = $o->get('charset');
|
||||
$charset = $charset
|
||||
? do {
|
||||
eval { require Encode }
|
||||
or (PTDEBUG &&
|
||||
_d("Couldn't load Encode: ", $EVAL_ERROR,
|
||||
"Going to try using the charset ",
|
||||
"passed in without checking it."));
|
||||
# No need to punish a user if they did their
|
||||
# homework and passed in an official charset,
|
||||
# rather than an alias.
|
||||
":" . defined &Encode::resolve_alias
|
||||
? Encode::resolve_alias($charset)
|
||||
: $charset;
|
||||
}
|
||||
: '';
|
||||
$archive_fh = IO::File->new($archive_file, ">>$charset")
|
||||
or die "Cannot open $charset $archive_file: $OS_ERROR\n";
|
||||
$archive_fh->autoflush(1) unless $o->get('buffer');
|
||||
if ( $need_hdr ) {
|
||||
print $archive_fh '', escape(\@sel_cols), "\n"
|
||||
|
Reference in New Issue
Block a user