Skip to content

Commit

Permalink
Update Encode to CPAN version 2.70
Browse files Browse the repository at this point in the history
  [DELTA]

$Revision: 2.70 $ $Date: 2015/02/05 10:53:00 $
! Makefile.PL
  add bin/encguess to EXE_FILES

2.69 2015/02/05 10:35:11
! bin/encguess
  Refactored so that
  * does not depend on non-core module (File::Slurp in particular)
  * PODified document
  * -s "encA encB" to -s encA,encB which is more shell-friendly
  * and more
! MANIFEST
+ bin/encguess
  Pulled: Added CLI wrapper for Encode::Guess
  dankogai/p5-encode#32
! Unicode/Unicode.pm
  Pulled: Bump $VERSION in module changed since Encode-2.60
  dankogai/p5-encode#31
  • Loading branch information
bingos committed Feb 6, 2015
1 parent 8d28fc8 commit 5965881
Show file tree
Hide file tree
Showing 16 changed files with 220 additions and 16 deletions.
2 changes: 2 additions & 0 deletions MANIFEST
Expand Up @@ -784,6 +784,7 @@ cpan/Digest/t/file.t See if Digest extensions work
cpan/Digest/t/lib/Digest/Dummy.pm See if Digest extensions work
cpan/Digest/t/security.t See if Digest extensions work
cpan/Encode/bin/enc2xs Encode module generator
cpan/Encode/bin/encguess guess character encodings of files
cpan/Encode/bin/piconv iconv by perl
cpan/Encode/bin/ucm2table Table Generator for testing
cpan/Encode/bin/ucmlint A UCM Lint utility
Expand Down Expand Up @@ -5625,6 +5626,7 @@ utils/c2ph.PL program to translate dbx stabs to perl
utils/corelist.PL Module::CoreList
utils/cpan.PL easily interact with CPAN from the command line
utils/enc2xs.PL Encode module generator
utils/encguess.PL guess character encodings of files
utils/h2ph.PL A thing to turn C .h files into perl .ph files
utils/h2xs.PL Program to make .xs files from C header files
utils/instmodsh.PL Give information about installed extensions
Expand Down
4 changes: 1 addition & 3 deletions Porting/Maintainers.pl
Expand Up @@ -392,14 +392,12 @@ package Maintainers;
},

'Encode' => {
'DISTRIBUTION' => 'DANKOGAI/Encode-2.68.tar.gz',
'DISTRIBUTION' => 'DANKOGAI/Encode-2.70.tar.gz',
'FILES' => q[cpan/Encode],
'CUSTOMIZED' => [
# Waiting to be merged upstream if it smokes ok: see CPAN RT#100347,
# in particular see khw's comments on that ticket on 21 Nov 2014.
qw( encoding.pm ),
# Waiting to be merged upstream: see pull request #31
qw( Unicode/Unicode.pm ),
],
},

Expand Down
1 change: 1 addition & 0 deletions configure.com
Expand Up @@ -7409,6 +7409,7 @@ $ WRITE CONFIG "$ c2ph == """ + perl_setup_perl + " ''vms_prefix':[utils]c
$ WRITE CONFIG "$ corelist == """ + perl_setup_perl + " ''vms_prefix':[utils]corelist.com"""
$ WRITE CONFIG "$ cpan == """ + perl_setup_perl + " ''vms_prefix':[utils]cpan.com"""
$ WRITE CONFIG "$ enc2xs == """ + perl_setup_perl + " ''vms_prefix':[utils]enc2xs.com"""
$ WRITE CONFIG "$ encguess == """ + perl_setup_perl + " ''vms_prefix':[utils]encguess.com"""
$ WRITE CONFIG "$ find2perl == """ + perl_setup_perl + " ''vms_prefix':[utils]find2perl.com"""
$ WRITE CONFIG "$ h2ph == """ + perl_setup_perl + " ''vms_prefix':[utils]h2ph.com"""
$ WRITE CONFIG "$ h2xs == """ + perl_setup_perl + " ''vms_prefix':[utils]h2xs.com"""
Expand Down
4 changes: 2 additions & 2 deletions cpan/Encode/Encode.pm
@@ -1,10 +1,10 @@
#
# $Id: Encode.pm,v 2.68 2015/01/22 10:17:32 dankogai Exp dankogai $
# $Id: Encode.pm,v 2.70 2015/02/05 10:52:16 dankogai Exp $
#
package Encode;
use strict;
use warnings;
our $VERSION = sprintf "%d.%02d", q$Revision: 2.68 $ =~ /(\d+)/g;
our $VERSION = sprintf "%d.%02d", q$Revision: 2.70 $ =~ /(\d+)/g;
use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG};
use XSLoader ();
XSLoader::load( __PACKAGE__, $VERSION );
Expand Down
2 changes: 1 addition & 1 deletion cpan/Encode/Encode.xs
@@ -1,5 +1,5 @@
/*
$Id: Encode.xs,v 2.33 2015/01/22 10:17:32 dankogai Exp dankogai $
$Id: Encode.xs,v 2.33 2015/01/22 10:17:32 dankogai Exp $
*/

#define PERL_NO_GET_CONTEXT
Expand Down
3 changes: 2 additions & 1 deletion cpan/Encode/Makefile.PL
@@ -1,5 +1,5 @@
#
# $Id: Makefile.PL,v 2.12 2013/09/14 07:51:59 dankogai Exp $
# $Id: Makefile.PL,v 2.13 2015/02/05 10:53:00 dankogai Exp dankogai $
#
use 5.007003;
use strict;
Expand All @@ -23,6 +23,7 @@ my %tables =

my @exe_files = qw(bin/enc2xs
bin/piconv
bin/encguess
);
my @more_exe_files = qw(
unidump
Expand Down
2 changes: 1 addition & 1 deletion cpan/Encode/Unicode/Unicode.pm
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;
no warnings 'redefine';

our $VERSION = do { my @r = ( q$Revision: 2.10 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
our $VERSION = do { my @r = ( q$Revision: 2.9 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };

use XSLoader;
XSLoader::load( __PACKAGE__, $VERSION );
Expand Down
145 changes: 145 additions & 0 deletions cpan/Encode/bin/encguess
@@ -0,0 +1,145 @@
#!./perl
use 5.008001;
use strict;
use warnings;
use Encode;
use Getopt::Std;
use Carp;
use Encode::Guess;
$Getopt::Std::STANDARD_HELP_VERSION = 1;

my %opt;
getopts( "huSs:", \%opt );
my @suspect_list;
list_valid_suspects() and exit if $opt{S};
@suspect_list = split /:,/, $opt{s} if $opt{s};
HELP_MESSAGE() if $opt{h};
HELP_MESSAGE() unless @ARGV;
do_guess($_) for @ARGV;

sub read_file {
my $filename = shift;
local $/;
open my $fh, '<:raw', $filename or croak "$filename:$!";
my $content = <$fh>;
close $fh;
return $content;
}

sub do_guess {
my $filename = shift;
my $data = read_file($filename);
my $enc = guess_encoding( $data, @suspect_list );
if ( !ref($enc) && $opt{u} ) {
return 1;
}
print "$filename\t";
if ( ref($enc) ) {
print $enc->mime_name();
}
else {
print "unknown";
}
print "\n";
return 1;
}

sub list_valid_suspects {
print join( "\n", Encode->encodings(":all") );
print "\n";
return 1;
}

sub HELP_MESSAGE {
exec 'pod2usage', $0 or die "pod2usage: $!"
}
__END__
=head1 NAME
encguess - guess character encodings of files
=head1 VERSION
$Id: encguess,v 0.1 2015/02/05 10:34:19 dankogai Exp $
=head1 SYNOPSIS
encguess [switches] filename...
=head2 SWITCHES
=over 2
=item -h
show this message and exit.
=item -s
specify a list of "suspect encoding types" to test,
seperated by either C<:> or C<,>
=item -S
output a list of all acceptable encoding types that can be used with
the -s param
=item -u
suppress display of unidentified types
=back
=head2 EXAMPLES:
=over 2
=item *
Guess encoding of a file named C<test.txt>, using only the default
suspect types.
encguess test.txt
=item *
Guess the encoding type of a file named C<test.txt>, using the suspect
types C<euc-jp,shiftjis,7bit-jis>.
encguess -s euc-jp,shiftjis,7bit-jis test.txt
encguess -s euc-jp:shiftjis:7bit-jis test.txt
=item *
Guess the encoding type of several files, do not display results for
unidentified files.
encguess -us euc-jp,shiftjis,7bit-jis test*.txt
=back
=head1 DESCRIPTION
The encoding identification is done by checking one encoding type at a
time until all but the right type are eliminated. The set of encoding
types to try is defined by the -s parameter and defaults to ascii,
utf8 and UTF-16/32 with BOM. This can be overridden by passing one or
more encoding types via the -s parameter. If you need to pass in
multiple suspect encoding types, use a quoted string with the a space
separating each value.
=head1 SEE ALSO
L<Encode::Guess>, L<Encode::Detect>
=head1 LICENSE AND COPYRIGHT
Copyright 2015 Michael LaGrasta and Dan Kogai.
This program is free software; you can redistribute it and/or modify it
under the terms of the the Artistic License (2.0). You may obtain a
copy of the full license at:
L<http://www.perlfoundation.org/artistic_license_2_0>
=cut
1 change: 0 additions & 1 deletion t/porting/customized.dat
Expand Up @@ -7,7 +7,6 @@ CPAN cpan/CPAN/lib/CPAN/Index.pm 73aee30450127c5ac4dc05abc2c10a8accd4b198
CPAN cpan/CPAN/lib/CPAN/LWP/UserAgent.pm e09525b0c2377c5ac28b7fad1b6d70c57e343913
CPAN cpan/CPAN/lib/CPAN/Mirrors.pm 580e74746abaf1628d533015d5b529d82a470af4
Encode cpan/Encode/encoding.pm baa25e197ba4d5fa228dbf7b440afb5ae18ec5ed
Encode cpan/Encode/Unicode/Unicode.pm 3ba3aeffd03c89c40195a189a98f7e47a11c2a11
ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/t/pm_to_blib.t 71ebcee355691ce374fcad251b12d8b2412462b3
PerlIO::via::QuotedPrint cpan/PerlIO-via-QuotedPrint/t/QuotedPrint.t ca39f0146e89de02c746e199c45dcb3e5edad691
Pod::Parser cpan/Pod-Parser/lib/Pod/PlainText.pm f0b490545b4e52e141450d1192d0ca00bd8d7a82
Expand Down
4 changes: 3 additions & 1 deletion t/porting/known_pod_issues.dat
@@ -1,4 +1,4 @@
# This file is the data file for t/porting/podcheck.t.
# This file is the data file for porting/podcheck.t.
# There are three types of lines.
# Comment lines are white-space only or begin with a '#', like this one. Any
# changes you make to the comment lines will be lost when the file is
Expand Down Expand Up @@ -314,6 +314,8 @@ porting/expand-macro.pl Verbatim line length including indents exceeds 79 by 2
porting/release_managers_guide.pod Verbatim line length including indents exceeds 79 by 6
porting/todo.pod Verbatim line length including indents exceeds 79 by 7
utils/c2ph Verbatim line length including indents exceeds 79 by 44
utils/encguess Apparent broken link 1
utils/encguess There is no NAME 1
lib/benchmark.pm Verbatim line length including indents exceeds 79 by 2
lib/config.pod ? Should you be using L<...> instead of -1
lib/extutils/embed.pm Verbatim line length including indents exceeds 79 by 2
Expand Down
1 change: 1 addition & 0 deletions utils.lst
Expand Up @@ -7,6 +7,7 @@ utils/c2ph # link = utils/pstruct
utils/cpan
utils/corelist
utils/enc2xs
utils/encguess
utils/h2ph
utils/h2xs
utils/instmodsh
Expand Down
8 changes: 5 additions & 3 deletions utils/Makefile.PL
Expand Up @@ -35,9 +35,9 @@ print $fh <<'EOT';
# Files to be built with variable substitution after miniperl is
# available. Dependencies handled manually below (for now).
pl = c2ph.PL corelist.PL cpan.PL h2ph.PL h2xs.PL instmodsh.PL json_pp.PL perlbug.PL perldoc.PL perlivp.PL pl2pm.PL prove.PL ptar.PL ptardiff.PL ptargrep.PL shasum.PL splain.PL libnetcfg.PL piconv.PL enc2xs.PL xsubpp.PL pod2html.PL zipdetails.PL
plextract = c2ph corelist cpan h2ph h2xs instmodsh json_pp perlbug perldoc perlivp pl2pm prove ptar ptardiff ptargrep shasum splain libnetcfg piconv enc2xs xsubpp pod2html zipdetails
plextractexe = ./c2ph ./corelist ./cpan ./h2ph ./h2xs ./json_pp ./instmodsh ./perlbug ./perldoc ./perlivp ./pl2pm ./prove ./ptar ./ptardiff ./ptargrep ./shasum ./splain ./libnetcfg ./piconv ./enc2xs ./xsubpp ./pod2html ./zipdetails
pl = c2ph.PL corelist.PL cpan.PL h2ph.PL h2xs.PL instmodsh.PL json_pp.PL perlbug.PL perldoc.PL perlivp.PL pl2pm.PL prove.PL ptar.PL ptardiff.PL ptargrep.PL shasum.PL splain.PL libnetcfg.PL piconv.PL enc2xs.PL encguess.PL xsubpp.PL pod2html.PL zipdetails.PL
plextract = c2ph corelist cpan h2ph h2xs instmodsh json_pp perlbug perldoc perlivp pl2pm prove ptar ptardiff ptargrep shasum splain libnetcfg piconv enc2xs encguess xsubpp pod2html zipdetails
plextractexe = ./c2ph ./corelist ./cpan ./h2ph ./h2xs ./json_pp ./instmodsh ./perlbug ./perldoc ./perlivp ./pl2pm ./prove ./ptar ./ptardiff ./ptargrep ./shasum ./splain ./libnetcfg ./piconv ./enc2xs ./encguess ./xsubpp ./pod2html ./zipdetails
all: $(plextract)
Expand Down Expand Up @@ -84,6 +84,8 @@ piconv: piconv.PL ../config.sh
enc2xs: enc2xs.PL ../config.sh
enc2xs: encguess.PL ../config.sh
xsubpp: xsubpp.PL ../config.sh
zipdetails: zipdetails.PL ../config.sh
Expand Down
48 changes: 48 additions & 0 deletions utils/encguess.PL
@@ -0,0 +1,48 @@
#!/usr/local/bin/perl

use Config;
use File::Basename qw(&basename &dirname);
use Cwd;

# List explicitly here the variables you want Configure to
# generate. Metaconfig only looks for shell variables, so you
# have to mention them as if they were shell variables, not
# %Config entries. Thus you write
# $startperl
# to ensure Configure will look for $Config{startperl}.

# This forces PL files to create target in same directory as PL file.
# This is so that make depend always knows where to find PL derivatives.
my $origdir = cwd;
chdir dirname($0);
my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';

open OUT,">$file" or die "Can't create $file: $!";

print "Extracting $file (with variable substitutions)\n";

# In this section, perl variables will be expanded during extraction.
# You can use $Config{...} to use Configure variables.

print OUT <<"!GROK!THIS!";
$Config{startperl}
eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
if \$running_under_some_shell;
!GROK!THIS!

use File::Spec;

my $enc2xs = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "cpan", "Encode", "bin"), "encguess");

if (open(ENC2XS, $enc2xs)) {
print OUT <ENC2XS>;
close ENC2XS;
} else {
die "$0: cannot find '$enc2xs'\n";
}

close OUT or die "Can't close $file: $!";
chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
chdir $origdir;
5 changes: 4 additions & 1 deletion vms/descrip_mms.template
Expand Up @@ -285,7 +285,7 @@ utils1 = [.utils]perldoc.com [.utils]c2ph.com [.utils]h2ph.com
utils2 = [.utils]h2xs.com [.utils]libnetcfg.com [.lib]perlbug.com [.utils]json_pp.com
utils3 = [.utils]perlivp.com [.lib]splain.com [.utils]pl2pm.com [.utils]xsubpp.com [.utils]pod2html.com [.utils]instmodsh.com
utils4 = [.utils]enc2xs.com [.utils]piconv.com [.utils]cpan.com [.utils]prove.com [.utils]ptar.com [.utils]ptardiff.com [.utils]shasum.com
utils5 = [.utils]corelist.com [.utils]ptargrep.com [.utils]zipdetails.com
utils5 = [.utils]corelist.com [.utils]ptargrep.com [.utils]zipdetails.com [.utils]encguess.com

all : base extras archcorefiles preplibrary [.pod]perltoc.pod
@ QUALIFIERS := $(MMSQUALIFIERS)
Expand Down Expand Up @@ -473,6 +473,9 @@ nonxsext : $(LIBPREREQ) preplibrary $(MINIPERL_EXE) [.pod]perlfunc.pod
[.utils]enc2xs.com : [.utils]enc2xs.PL $(ARCHDIR)Config.pm
$(MINIPERL) -"I[-.lib]" $(MMS$SOURCE)

[.utils]encguess.com : [.utils]encguess.PL $(ARCHDIR)Config.pm
$(MINIPERL) -"I[-.lib]" $(MMS$SOURCE)

[.utils]h2ph.com : [.utils]h2ph.PL $(ARCHDIR)Config.pm
$(MINIPERL) -"I[-.lib]" $(MMS$SOURCE)

Expand Down
3 changes: 2 additions & 1 deletion win32/Makefile
Expand Up @@ -623,6 +623,7 @@ UTILS = \
..\utils\perlivp \
..\utils\libnetcfg \
..\utils\enc2xs \
..\utils\encguess \
..\utils\piconv \
..\utils\corelist \
..\utils\cpan \
Expand Down Expand Up @@ -1260,7 +1261,7 @@ distclean: realclean
perltru64.pod perltw.pod perluniprops.pod perlvos.pod \
perlwin32.pod
-cd ..\utils && del /f h2ph splain perlbug pl2pm c2ph pstruct h2xs \
perldoc perlivp libnetcfg enc2xs piconv cpan *.bat \
perldoc perlivp libnetcfg enc2xs encguess piconv cpan *.bat \
xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist zipdetails
-del /f ..\config.sh perlmain.c dlutils.c config.h.new \
perlmainst.c
Expand Down
3 changes: 2 additions & 1 deletion win32/makefile.mk
Expand Up @@ -757,6 +757,7 @@ UTILS = \
..\utils\perlivp \
..\utils\libnetcfg \
..\utils\enc2xs \
..\utils\encguess \
..\utils\piconv \
..\utils\corelist \
..\utils\cpan \
Expand Down Expand Up @@ -1547,7 +1548,7 @@ distclean: realclean
perltru64.pod perltw.pod perluniprops.pod perlvos.pod \
perlwin32.pod
-cd ..\utils && del /f h2ph splain perlbug pl2pm c2ph pstruct h2xs \
perldoc perlivp libnetcfg enc2xs piconv cpan *.bat \
perldoc perlivp libnetcfg enc2xs encguess piconv cpan *.bat \
xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist zipdetails
-del /f ..\config.sh perlmain.c dlutils.c config.h.new \
perlmainst.c
Expand Down

0 comments on commit 5965881

Please sign in to comment.