diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2015-02-06 12:00:27 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2015-02-06 12:36:32 +0000 |
commit | 596588193775cac82eaf059a4aa065829599815a (patch) | |
tree | a9d1367baca83078bc31c642a40316ed12a4db90 | |
parent | 8d28fc8f69270cc75d9564b369ac6008c5b5d617 (diff) | |
download | perl-596588193775cac82eaf059a4aa065829599815a.tar.gz |
Update Encode to CPAN version 2.70
[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
https://github.com/dankogai/p5-encode/pull/32
! Unicode/Unicode.pm
Pulled: Bump $VERSION in module changed since Encode-2.60
https://github.com/dankogai/p5-encode/pull/31
-rw-r--r-- | MANIFEST | 2 | ||||
-rwxr-xr-x | Porting/Maintainers.pl | 4 | ||||
-rw-r--r-- | configure.com | 1 | ||||
-rw-r--r-- | cpan/Encode/Encode.pm | 4 | ||||
-rw-r--r-- | cpan/Encode/Encode.xs | 2 | ||||
-rw-r--r-- | cpan/Encode/Makefile.PL | 3 | ||||
-rw-r--r-- | cpan/Encode/Unicode/Unicode.pm | 2 | ||||
-rw-r--r-- | cpan/Encode/bin/encguess | 145 | ||||
-rw-r--r-- | t/porting/customized.dat | 1 | ||||
-rw-r--r-- | t/porting/known_pod_issues.dat | 4 | ||||
-rw-r--r-- | utils.lst | 1 | ||||
-rw-r--r-- | utils/Makefile.PL | 8 | ||||
-rw-r--r-- | utils/encguess.PL | 48 | ||||
-rw-r--r-- | vms/descrip_mms.template | 5 | ||||
-rw-r--r-- | win32/Makefile | 3 | ||||
-rw-r--r-- | win32/makefile.mk | 3 |
16 files changed, 220 insertions, 16 deletions
@@ -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 @@ -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 diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 5c38b84c0d..5c174df269 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -392,14 +392,12 @@ use File::Glob qw(:case); }, '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 ), ], }, diff --git a/configure.com b/configure.com index 563671348e..c70cf7b601 100644 --- a/configure.com +++ b/configure.com @@ -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""" diff --git a/cpan/Encode/Encode.pm b/cpan/Encode/Encode.pm index c34e997d04..7a9135c671 100644 --- a/cpan/Encode/Encode.pm +++ b/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 ); diff --git a/cpan/Encode/Encode.xs b/cpan/Encode/Encode.xs index 7ec8d44752..73f64a8d44 100644 --- a/cpan/Encode/Encode.xs +++ b/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 diff --git a/cpan/Encode/Makefile.PL b/cpan/Encode/Makefile.PL index 18d5915b25..8193de3f10 100644 --- a/cpan/Encode/Makefile.PL +++ b/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; @@ -23,6 +23,7 @@ my %tables = my @exe_files = qw(bin/enc2xs bin/piconv + bin/encguess ); my @more_exe_files = qw( unidump diff --git a/cpan/Encode/Unicode/Unicode.pm b/cpan/Encode/Unicode/Unicode.pm index 75da3d7dfb..6b35cb7566 100644 --- a/cpan/Encode/Unicode/Unicode.pm +++ b/cpan/Encode/Unicode/Unicode.pm @@ -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 ); diff --git a/cpan/Encode/bin/encguess b/cpan/Encode/bin/encguess new file mode 100644 index 0000000000..5d7ac80aac --- /dev/null +++ b/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 diff --git a/t/porting/customized.dat b/t/porting/customized.dat index 9b6063e373..b2b33ba3b7 100644 --- a/t/porting/customized.dat +++ b/t/porting/customized.dat @@ -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 diff --git a/t/porting/known_pod_issues.dat b/t/porting/known_pod_issues.dat index 03377f8051..268fc15a77 100644 --- a/t/porting/known_pod_issues.dat +++ b/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 @@ -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 @@ -7,6 +7,7 @@ utils/c2ph # link = utils/pstruct utils/cpan utils/corelist utils/enc2xs +utils/encguess utils/h2ph utils/h2xs utils/instmodsh diff --git a/utils/Makefile.PL b/utils/Makefile.PL index 72f7707664..27c371f82a 100644 --- a/utils/Makefile.PL +++ b/utils/Makefile.PL @@ -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) @@ -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 diff --git a/utils/encguess.PL b/utils/encguess.PL new file mode 100644 index 0000000000..81322f9c21 --- /dev/null +++ b/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; diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template index 69dcc2edc1..505ab84b57 100644 --- a/vms/descrip_mms.template +++ b/vms/descrip_mms.template @@ -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) @@ -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) diff --git a/win32/Makefile b/win32/Makefile index 8076ce6f35..bc13bd280c 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -623,6 +623,7 @@ UTILS = \ ..\utils\perlivp \ ..\utils\libnetcfg \ ..\utils\enc2xs \ + ..\utils\encguess \ ..\utils\piconv \ ..\utils\corelist \ ..\utils\cpan \ @@ -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 diff --git a/win32/makefile.mk b/win32/makefile.mk index f275a8e767..d1d0bb8caf 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -757,6 +757,7 @@ UTILS = \ ..\utils\perlivp \ ..\utils\libnetcfg \ ..\utils\enc2xs \ + ..\utils\encguess \ ..\utils\piconv \ ..\utils\corelist \ ..\utils\cpan \ @@ -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 |