exiftool-vendored.exe 12.80.0 → 12.82.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/bin/exiftool.exe +0 -0
- package/bin/exiftool_files/Changes +44 -0
- package/bin/exiftool_files/Licenses_Strawberry_Perl.zip +0 -0
- package/bin/exiftool_files/README +3 -2
- package/bin/exiftool_files/exiftool.pl +36 -14
- package/bin/exiftool_files/lib/Archive/Zip/Archive.pm +399 -65
- package/bin/exiftool_files/lib/Archive/Zip/DirectoryMember.pm +1 -1
- package/bin/exiftool_files/lib/Archive/Zip/FileMember.pm +1 -1
- package/bin/exiftool_files/lib/Archive/Zip/Member.pm +499 -195
- package/bin/exiftool_files/lib/Archive/Zip/NewFileMember.pm +1 -1
- package/bin/exiftool_files/lib/Archive/Zip/StringMember.pm +2 -2
- package/bin/exiftool_files/lib/Archive/Zip/ZipFileMember.pm +79 -20
- package/bin/exiftool_files/lib/Archive/Zip.pm +179 -29
- package/bin/exiftool_files/lib/AutoLoader.pm +453 -0
- package/bin/exiftool_files/lib/B/Deparse.pm +209 -137
- package/bin/exiftool_files/lib/B.pm +1 -1
- package/bin/exiftool_files/lib/Benchmark.pm +1123 -0
- package/bin/exiftool_files/lib/Class/Struct.pm +2 -2
- package/bin/exiftool_files/lib/Compress/Raw/Bzip2.pm +14 -9
- package/bin/exiftool_files/lib/Compress/Raw/Lzma.pm +982 -0
- package/bin/exiftool_files/lib/Compress/Raw/Zlib.pm +91 -86
- package/bin/exiftool_files/lib/Compress/Zlib.pm +105 -100
- package/bin/exiftool_files/lib/Config.pm +9 -9
- package/bin/exiftool_files/lib/Config_heavy.pl +36 -33
- package/bin/exiftool_files/lib/CryptX.pm +2 -82
- package/bin/exiftool_files/lib/Data/Dumper.pm +2 -2
- package/bin/exiftool_files/lib/Digest/MD5.pm +12 -9
- package/bin/exiftool_files/lib/Digest/Perl/MD5.pm +1 -191
- package/bin/exiftool_files/lib/Digest/base.pm +26 -20
- package/bin/exiftool_files/lib/DynaLoader.pm +7 -4
- package/bin/exiftool_files/lib/Encode.pm +3 -3
- package/bin/exiftool_files/lib/Errno.pm +13 -13
- package/bin/exiftool_files/lib/Exporter/Heavy.pm +2 -2
- package/bin/exiftool_files/lib/Exporter.pm +1 -1
- package/bin/exiftool_files/lib/ExtUtils/Command/MM.pm +323 -0
- package/bin/exiftool_files/lib/ExtUtils/Command.pm +382 -0
- package/bin/exiftool_files/lib/File/Find.pm +1 -1
- package/bin/exiftool_files/lib/File/Glob.pm +1 -8
- package/bin/exiftool_files/lib/File/GlobMapper.pm +2 -2
- package/bin/exiftool_files/lib/File/HomeDir/Darwin/Carbon.pm +2 -40
- package/bin/exiftool_files/lib/File/HomeDir/Darwin/Cocoa.pm +2 -34
- package/bin/exiftool_files/lib/File/HomeDir/Darwin.pm +2 -28
- package/bin/exiftool_files/lib/File/HomeDir/Driver.pm +2 -35
- package/bin/exiftool_files/lib/File/HomeDir/FreeDesktop.pm +2 -62
- package/bin/exiftool_files/lib/File/HomeDir/MacOS9.pm +2 -53
- package/bin/exiftool_files/lib/File/HomeDir/Test.pm +2 -43
- package/bin/exiftool_files/lib/File/HomeDir/Unix.pm +2 -53
- package/bin/exiftool_files/lib/File/HomeDir/Windows.pm +2 -69
- package/bin/exiftool_files/lib/File/HomeDir.pm +5 -416
- package/bin/exiftool_files/lib/File/Path.pm +3 -3
- package/bin/exiftool_files/lib/File/Spec/Win32.pm +2 -2
- package/bin/exiftool_files/lib/File/Temp.pm +70 -35
- package/bin/exiftool_files/lib/File/Which.pm +1 -240
- package/bin/exiftool_files/lib/File/stat.pm +3 -2
- package/bin/exiftool_files/lib/IO/Compress/Adapter/Bzip2.pm +16 -17
- package/bin/exiftool_files/lib/IO/Compress/Adapter/Deflate.pm +19 -20
- package/bin/exiftool_files/lib/IO/Compress/Base/Common.pm +5 -5
- package/bin/exiftool_files/lib/IO/Compress/Base.pm +35 -26
- package/bin/exiftool_files/lib/IO/Compress/Brotli.pm +159 -0
- package/bin/exiftool_files/lib/IO/Compress/Bzip2.pm +50 -25
- package/bin/exiftool_files/lib/IO/Compress/Gzip/Constants.pm +6 -6
- package/bin/exiftool_files/lib/IO/Compress/Gzip.pm +58 -32
- package/bin/exiftool_files/lib/IO/Compress/RawDeflate.pm +63 -38
- package/bin/exiftool_files/lib/IO/Compress/Zlib/Extra.pm +20 -20
- package/bin/exiftool_files/lib/IO/Dir.pm +1 -1
- package/bin/exiftool_files/lib/IO/File.pm +1 -1
- package/bin/exiftool_files/lib/IO/Handle.pm +1 -21
- package/bin/exiftool_files/lib/IO/Pipe.pm +1 -1
- package/bin/exiftool_files/lib/IO/Seekable.pm +1 -1
- package/bin/exiftool_files/lib/IO/Select.pm +16 -2
- package/bin/exiftool_files/lib/IO/Socket/INET.pm +14 -9
- package/bin/exiftool_files/lib/IO/Socket/UNIX.pm +17 -1
- package/bin/exiftool_files/lib/IO/Socket.pm +474 -126
- package/bin/exiftool_files/lib/IO/String.pm +425 -0
- package/bin/exiftool_files/lib/IO/Uncompress/Adapter/Inflate.pm +13 -14
- package/bin/exiftool_files/lib/IO/Uncompress/Base.pm +142 -132
- package/bin/exiftool_files/lib/IO/Uncompress/Brotli.pm +119 -0
- package/bin/exiftool_files/lib/IO/Uncompress/Gunzip.pm +43 -37
- package/bin/exiftool_files/lib/IO/Uncompress/RawInflate.pm +49 -43
- package/bin/exiftool_files/lib/IO.pm +2 -2
- package/bin/exiftool_files/lib/Image/ExifTool/BuildTagLookup.pm +44 -31
- package/bin/exiftool_files/lib/Image/ExifTool/CanonVRD.pm +2 -2
- package/bin/exiftool_files/lib/Image/ExifTool/FujiFilm.pm +20 -7
- package/bin/exiftool_files/lib/Image/ExifTool/GM.pm +543 -0
- package/bin/exiftool_files/lib/Image/ExifTool/Geolocation.pm +332 -149
- package/bin/exiftool_files/lib/Image/ExifTool/Geotag.pm +9 -4
- package/bin/exiftool_files/lib/Image/ExifTool/M2TS.pm +32 -4
- package/bin/exiftool_files/lib/Image/ExifTool/MakerNotes.pm +2 -2
- package/bin/exiftool_files/lib/Image/ExifTool/Microsoft.pm +1 -1
- package/bin/exiftool_files/lib/Image/ExifTool/Nikon.pm +331 -22
- package/bin/exiftool_files/lib/Image/ExifTool/NikonCustom.pm +55 -1
- package/bin/exiftool_files/lib/Image/ExifTool/Olympus.pm +1 -0
- package/bin/exiftool_files/lib/Image/ExifTool/OpenEXR.pm +21 -3
- package/bin/exiftool_files/lib/Image/ExifTool/PNG.pm +3 -3
- package/bin/exiftool_files/lib/Image/ExifTool/QuickTime.pm +40 -24
- package/bin/exiftool_files/lib/Image/ExifTool/QuickTimeStream.pl +61 -30
- package/bin/exiftool_files/lib/Image/ExifTool/README +2 -0
- package/bin/exiftool_files/lib/Image/ExifTool/Sony.pm +1 -1
- package/bin/exiftool_files/lib/Image/ExifTool/TagLookup.pm +4815 -4775
- package/bin/exiftool_files/lib/Image/ExifTool/TagNames.pod +931 -617
- package/bin/exiftool_files/lib/Image/ExifTool/WriteQuickTime.pl +30 -8
- package/bin/exiftool_files/lib/Image/ExifTool/Writer.pl +10 -4
- package/bin/exiftool_files/lib/Image/ExifTool/XMP.pm +4 -2
- package/bin/exiftool_files/lib/Image/ExifTool.pm +77 -41
- package/bin/exiftool_files/lib/Image/ExifTool.pod +24 -11
- package/bin/exiftool_files/lib/List/Util.pm +97 -8
- package/bin/exiftool_files/lib/MIME/Base64.pm +5 -5
- package/bin/exiftool_files/lib/MIME/Charset/_Compat.pm +106 -0
- package/bin/exiftool_files/lib/MIME/Charset.pm +1303 -0
- package/bin/exiftool_files/lib/Math/BigFloat.pm +444 -27
- package/bin/exiftool_files/lib/Math/BigInt/Calc.pm +296 -313
- package/bin/exiftool_files/lib/Math/BigInt/FastCalc.pm +1 -1
- package/bin/exiftool_files/lib/Math/BigInt/GMP.pm +2 -115
- package/bin/exiftool_files/lib/Math/BigInt/LTM.pm +2 -24
- package/bin/exiftool_files/lib/Math/BigInt/Lib.pm +61 -32
- package/bin/exiftool_files/lib/Math/BigInt.pm +292 -107
- package/bin/exiftool_files/lib/POSIX.pm +1 -1
- package/bin/exiftool_files/lib/PerlIO/scalar.pm +41 -0
- package/bin/exiftool_files/lib/PerlIO.pm +397 -0
- package/bin/exiftool_files/lib/Portable/CPAN.pm +94 -94
- package/bin/exiftool_files/lib/Portable/Config.pm +94 -94
- package/bin/exiftool_files/lib/Portable/FileSpec.pm +180 -180
- package/bin/exiftool_files/lib/Portable/HomeDir.pm +110 -110
- package/bin/exiftool_files/lib/Portable/LoadYaml.pm +430 -430
- package/bin/exiftool_files/lib/Portable/minicpan.pm +55 -55
- package/bin/exiftool_files/lib/Portable.pm +246 -320
- package/bin/exiftool_files/lib/Scalar/Util.pm +9 -4
- package/bin/exiftool_files/lib/Socket.pm +16 -12
- package/bin/exiftool_files/lib/Storable.pm +1444 -1441
- package/bin/exiftool_files/lib/TAP/Base.pm +133 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Base.pm +467 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Color.pm +116 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Console/ParallelSession.pm +201 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Console/Session.pm +205 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Console.pm +100 -0
- package/bin/exiftool_files/lib/TAP/Formatter/File/Session.pm +95 -0
- package/bin/exiftool_files/lib/TAP/Formatter/File.pm +56 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Session.pm +220 -0
- package/bin/exiftool_files/lib/TAP/Harness/Beyond.pod +426 -0
- package/bin/exiftool_files/lib/TAP/Harness/Env.pm +215 -0
- package/bin/exiftool_files/lib/TAP/Harness.pm +1054 -0
- package/bin/exiftool_files/lib/TAP/Object.pm +155 -0
- package/bin/exiftool_files/lib/TAP/Parser/Aggregator.pm +414 -0
- package/bin/exiftool_files/lib/TAP/Parser/Grammar.pm +584 -0
- package/bin/exiftool_files/lib/TAP/Parser/Iterator/Array.pm +100 -0
- package/bin/exiftool_files/lib/TAP/Parser/Iterator/Process.pm +378 -0
- package/bin/exiftool_files/lib/TAP/Parser/Iterator/Stream.pm +116 -0
- package/bin/exiftool_files/lib/TAP/Parser/Iterator.pm +162 -0
- package/bin/exiftool_files/lib/TAP/Parser/IteratorFactory.pm +339 -0
- package/bin/exiftool_files/lib/TAP/Parser/Multiplexer.pm +194 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Bailout.pm +62 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Comment.pm +60 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Plan.pm +119 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Pragma.pm +62 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Test.pm +271 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Unknown.pm +48 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Version.pm +62 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/YAML.pm +61 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result.pm +297 -0
- package/bin/exiftool_files/lib/TAP/Parser/ResultFactory.pm +183 -0
- package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Job.pm +127 -0
- package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Spinner.pm +61 -0
- package/bin/exiftool_files/lib/TAP/Parser/Scheduler.pm +448 -0
- package/bin/exiftool_files/lib/TAP/Parser/Source.pm +381 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Executable.pm +184 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/File.pm +136 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Handle.pm +124 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Perl.pm +370 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/RawTAP.pm +130 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler.pm +191 -0
- package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Reader.pm +332 -0
- package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Writer.pm +254 -0
- package/bin/exiftool_files/lib/TAP/Parser.pm +1931 -0
- package/bin/exiftool_files/lib/Test/Builder/Formatter.pm +107 -0
- package/bin/exiftool_files/lib/Test/Builder/IO/Scalar.pm +659 -0
- package/bin/exiftool_files/lib/Test/Builder/Module.pm +182 -0
- package/bin/exiftool_files/lib/Test/Builder/Tester/Color.pm +51 -0
- package/bin/exiftool_files/lib/Test/Builder/Tester.pm +675 -0
- package/bin/exiftool_files/lib/Test/Builder/TodoDiag.pm +68 -0
- package/bin/exiftool_files/lib/Test/Builder.pm +2653 -0
- package/bin/exiftool_files/lib/Test/Harness.pm +618 -0
- package/bin/exiftool_files/lib/Test/More.pm +1997 -0
- package/bin/exiftool_files/lib/Test/Simple.pm +220 -0
- package/bin/exiftool_files/lib/Test/Tester/Capture.pm +241 -0
- package/bin/exiftool_files/lib/Test/Tester/CaptureRunner.pm +79 -0
- package/bin/exiftool_files/lib/Test/Tester/Delegate.pm +45 -0
- package/bin/exiftool_files/lib/Test/Tester.pm +695 -0
- package/bin/exiftool_files/lib/Test/Tutorial.pod +618 -0
- package/bin/exiftool_files/lib/Test/use/ok.pm +64 -0
- package/bin/exiftool_files/lib/Text/ParseWords.pm +303 -0
- package/bin/exiftool_files/lib/Tie/StdHandle.pm +2 -2
- package/bin/exiftool_files/lib/Time/HiRes.pm +73 -68
- package/bin/exiftool_files/lib/Time/Local.pm +82 -35
- package/bin/exiftool_files/lib/Time/Piece.pm +19 -4
- package/bin/exiftool_files/lib/Time/Seconds.pm +1 -1
- package/bin/exiftool_files/lib/UNIVERSAL.pm +203 -0
- package/bin/exiftool_files/lib/Unicode/GCString.pm +60 -0
- package/bin/exiftool_files/lib/Unicode/LineBreak/Constants.pm +68 -0
- package/bin/exiftool_files/lib/Unicode/LineBreak.pm +248 -0
- package/bin/exiftool_files/lib/Win32/API/Struct.pm +1 -177
- package/bin/exiftool_files/lib/Win32/API/Type.pm +1 -100
- package/bin/exiftool_files/lib/Win32/API.pm +1 -830
- package/bin/exiftool_files/lib/Win32/FindFile.pm +2 -123
- package/bin/exiftool_files/lib/Win32.pm +213 -89
- package/bin/exiftool_files/lib/Win32API/File.pm +1 -1
- package/bin/exiftool_files/lib/auto/B/B.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Compress/Raw/Bzip2/Bzip2.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/Lzma.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/autosplit.ix +3 -0
- package/bin/exiftool_files/lib/auto/Compress/Raw/Zlib/Zlib.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/CryptX/CryptX.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Cwd/Cwd.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Data/Dumper/Dumper.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Digest/MD5/MD5.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Digest/SHA/SHA.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Encode/Encode.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Fcntl/Fcntl.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/File/Glob/Glob.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/IO/Compress/Brotli/Brotli.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/IO/IO.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/List/Util/Util.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/MIME/Base64/Base64.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Math/BigInt/FastCalc/FastCalc.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Math/BigInt/GMP/GMP.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/POSIX/POSIX.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/PerlIO/scalar/scalar.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Socket/Socket.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Storable/Storable.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Time/HiRes/HiRes.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Time/Piece/Piece.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Unicode/LineBreak/LineBreak.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Win32/API/API.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Win32/FindFile/FindFile.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Win32/Win32.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Win32API/File/File.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/mro/mro.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/re/re.xs.dll +0 -0
- package/bin/exiftool_files/lib/feature.pm +49 -17
- package/bin/exiftool_files/lib/mro.pm +4 -20
- package/bin/exiftool_files/lib/overload.pm +15 -15
- package/bin/exiftool_files/lib/parent.pm +10 -2
- package/bin/exiftool_files/lib/re.pm +91 -33
- package/bin/exiftool_files/lib/warnings.pm +17 -6
- package/bin/exiftool_files/libgcc_s_seh-1.dll +0 -0
- package/bin/exiftool_files/liblzma-5__.dll +0 -0
- package/bin/exiftool_files/libstdc++-6.dll +0 -0
- package/bin/exiftool_files/libwinpthread-1.dll +0 -0
- package/bin/exiftool_files/perl.exe +0 -0
- package/bin/exiftool_files/perl532.dll +0 -0
- package/package.json +7 -5
- package/bin/exiftool_files/libgcc_s_dw2-1.dll +0 -0
- package/bin/exiftool_files/perl530.dll +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
package TAP::Parser::SourceHandler;
|
|
2
|
+
|
|
3
|
+
use strict;
|
|
4
|
+
use warnings;
|
|
5
|
+
|
|
6
|
+
use TAP::Parser::Iterator ();
|
|
7
|
+
use base 'TAP::Object';
|
|
8
|
+
|
|
9
|
+
=head1 NAME
|
|
10
|
+
|
|
11
|
+
TAP::Parser::SourceHandler - Base class for different TAP source handlers
|
|
12
|
+
|
|
13
|
+
=head1 VERSION
|
|
14
|
+
|
|
15
|
+
Version 3.42
|
|
16
|
+
|
|
17
|
+
=cut
|
|
18
|
+
|
|
19
|
+
our $VERSION = '3.42';
|
|
20
|
+
|
|
21
|
+
=head1 SYNOPSIS
|
|
22
|
+
|
|
23
|
+
# abstract class - don't use directly!
|
|
24
|
+
# see TAP::Parser::IteratorFactory for general usage
|
|
25
|
+
|
|
26
|
+
# must be sub-classed for use
|
|
27
|
+
package MySourceHandler;
|
|
28
|
+
use base 'TAP::Parser::SourceHandler';
|
|
29
|
+
sub can_handle { return $confidence_level }
|
|
30
|
+
sub make_iterator { return $iterator }
|
|
31
|
+
|
|
32
|
+
# see example below for more details
|
|
33
|
+
|
|
34
|
+
=head1 DESCRIPTION
|
|
35
|
+
|
|
36
|
+
This is an abstract base class for L<TAP::Parser::Source> handlers / handlers.
|
|
37
|
+
|
|
38
|
+
A C<TAP::Parser::SourceHandler> does whatever is necessary to produce & capture
|
|
39
|
+
a stream of TAP from the I<raw> source, and package it up in a
|
|
40
|
+
L<TAP::Parser::Iterator> for the parser to consume.
|
|
41
|
+
|
|
42
|
+
C<SourceHandlers> must implement the I<source detection & handling> interface
|
|
43
|
+
used by L<TAP::Parser::IteratorFactory>. At 2 methods, the interface is pretty
|
|
44
|
+
simple: L</can_handle> and L</make_source>.
|
|
45
|
+
|
|
46
|
+
Unless you're writing a new L<TAP::Parser::SourceHandler>, a plugin, or
|
|
47
|
+
subclassing L<TAP::Parser>, you probably won't need to use this module directly.
|
|
48
|
+
|
|
49
|
+
=head1 METHODS
|
|
50
|
+
|
|
51
|
+
=head2 Class Methods
|
|
52
|
+
|
|
53
|
+
=head3 C<can_handle>
|
|
54
|
+
|
|
55
|
+
I<Abstract method>.
|
|
56
|
+
|
|
57
|
+
my $vote = $class->can_handle( $source );
|
|
58
|
+
|
|
59
|
+
C<$source> is a L<TAP::Parser::Source>.
|
|
60
|
+
|
|
61
|
+
Returns a number between C<0> & C<1> reflecting how confidently the raw source
|
|
62
|
+
can be handled. For example, C<0> means the source cannot handle it, C<0.5>
|
|
63
|
+
means it may be able to, and C<1> means it definitely can. See
|
|
64
|
+
L<TAP::Parser::IteratorFactory/detect_source> for details on how this is used.
|
|
65
|
+
|
|
66
|
+
=cut
|
|
67
|
+
|
|
68
|
+
sub can_handle {
|
|
69
|
+
my ( $class, $args ) = @_;
|
|
70
|
+
$class->_croak(
|
|
71
|
+
"Abstract method 'can_handle' not implemented for $class!");
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
=head3 C<make_iterator>
|
|
76
|
+
|
|
77
|
+
I<Abstract method>.
|
|
78
|
+
|
|
79
|
+
my $iterator = $class->make_iterator( $source );
|
|
80
|
+
|
|
81
|
+
C<$source> is a L<TAP::Parser::Source>.
|
|
82
|
+
|
|
83
|
+
Returns a new L<TAP::Parser::Iterator> object for use by the L<TAP::Parser>.
|
|
84
|
+
C<croak>s on error.
|
|
85
|
+
|
|
86
|
+
=cut
|
|
87
|
+
|
|
88
|
+
sub make_iterator {
|
|
89
|
+
my ( $class, $args ) = @_;
|
|
90
|
+
$class->_croak(
|
|
91
|
+
"Abstract method 'make_iterator' not implemented for $class!");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
1;
|
|
95
|
+
|
|
96
|
+
__END__
|
|
97
|
+
|
|
98
|
+
=head1 SUBCLASSING
|
|
99
|
+
|
|
100
|
+
Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview, and any
|
|
101
|
+
of the subclasses that ship with this module as an example. What follows is
|
|
102
|
+
a quick overview.
|
|
103
|
+
|
|
104
|
+
Start by familiarizing yourself with L<TAP::Parser::Source> and
|
|
105
|
+
L<TAP::Parser::IteratorFactory>. L<TAP::Parser::SourceHandler::RawTAP> is
|
|
106
|
+
the easiest sub-class to use as an example.
|
|
107
|
+
|
|
108
|
+
It's important to point out that if you want your subclass to be automatically
|
|
109
|
+
used by L<TAP::Parser> you'll have to and make sure it gets loaded somehow.
|
|
110
|
+
If you're using L<prove> you can write an L<App::Prove> plugin. If you're
|
|
111
|
+
using L<TAP::Parser> or L<TAP::Harness> directly (e.g. through a custom script,
|
|
112
|
+
L<ExtUtils::MakeMaker>, or L<Module::Build>) you can use the C<config> option
|
|
113
|
+
which will cause L<TAP::Parser::IteratorFactory/load_sources> to load your
|
|
114
|
+
subclass).
|
|
115
|
+
|
|
116
|
+
Don't forget to register your class with
|
|
117
|
+
L<TAP::Parser::IteratorFactory/register_handler>.
|
|
118
|
+
|
|
119
|
+
=head2 Example
|
|
120
|
+
|
|
121
|
+
package MySourceHandler;
|
|
122
|
+
|
|
123
|
+
use strict;
|
|
124
|
+
|
|
125
|
+
use MySourceHandler; # see TAP::Parser::SourceHandler
|
|
126
|
+
use TAP::Parser::IteratorFactory;
|
|
127
|
+
|
|
128
|
+
use base 'TAP::Parser::SourceHandler';
|
|
129
|
+
|
|
130
|
+
TAP::Parser::IteratorFactory->register_handler( __PACKAGE__ );
|
|
131
|
+
|
|
132
|
+
sub can_handle {
|
|
133
|
+
my ( $class, $src ) = @_;
|
|
134
|
+
my $meta = $src->meta;
|
|
135
|
+
my $config = $src->config_for( $class );
|
|
136
|
+
|
|
137
|
+
if ($config->{accept_all}) {
|
|
138
|
+
return 1.0;
|
|
139
|
+
} elsif (my $file = $meta->{file}) {
|
|
140
|
+
return 0.0 unless $file->{exists};
|
|
141
|
+
return 1.0 if $file->{lc_ext} eq '.tap';
|
|
142
|
+
return 0.9 if $file->{shebang} && $file->{shebang} =~ /^#!.+tap/;
|
|
143
|
+
return 0.5 if $file->{text};
|
|
144
|
+
return 0.1 if $file->{binary};
|
|
145
|
+
} elsif ($meta->{scalar}) {
|
|
146
|
+
return 0.8 if $$raw_source_ref =~ /\d\.\.\d/;
|
|
147
|
+
return 0.6 if $meta->{has_newlines};
|
|
148
|
+
} elsif ($meta->{array}) {
|
|
149
|
+
return 0.8 if $meta->{size} < 5;
|
|
150
|
+
return 0.6 if $raw_source_ref->[0] =~ /foo/;
|
|
151
|
+
return 0.5;
|
|
152
|
+
} elsif ($meta->{hash}) {
|
|
153
|
+
return 0.6 if $raw_source_ref->{foo};
|
|
154
|
+
return 0.2;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
sub make_iterator {
|
|
161
|
+
my ($class, $source) = @_;
|
|
162
|
+
# this is where you manipulate the source and
|
|
163
|
+
# capture the stream of TAP in an iterator
|
|
164
|
+
# either pick a TAP::Parser::Iterator::* or write your own...
|
|
165
|
+
my $iterator = TAP::Parser::Iterator::Array->new([ 'foo', 'bar' ]);
|
|
166
|
+
return $iterator;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
1;
|
|
170
|
+
|
|
171
|
+
=head1 AUTHORS
|
|
172
|
+
|
|
173
|
+
TAPx Developers.
|
|
174
|
+
|
|
175
|
+
Source detection stuff added by Steve Purkis
|
|
176
|
+
|
|
177
|
+
=head1 SEE ALSO
|
|
178
|
+
|
|
179
|
+
L<TAP::Object>,
|
|
180
|
+
L<TAP::Parser>,
|
|
181
|
+
L<TAP::Parser::Source>,
|
|
182
|
+
L<TAP::Parser::Iterator>,
|
|
183
|
+
L<TAP::Parser::IteratorFactory>,
|
|
184
|
+
L<TAP::Parser::SourceHandler::Executable>,
|
|
185
|
+
L<TAP::Parser::SourceHandler::Perl>,
|
|
186
|
+
L<TAP::Parser::SourceHandler::File>,
|
|
187
|
+
L<TAP::Parser::SourceHandler::Handle>,
|
|
188
|
+
L<TAP::Parser::SourceHandler::RawTAP>
|
|
189
|
+
|
|
190
|
+
=cut
|
|
191
|
+
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
package TAP::Parser::YAMLish::Reader;
|
|
2
|
+
|
|
3
|
+
use strict;
|
|
4
|
+
use warnings;
|
|
5
|
+
|
|
6
|
+
use base 'TAP::Object';
|
|
7
|
+
|
|
8
|
+
our $VERSION = '3.42';
|
|
9
|
+
|
|
10
|
+
# TODO:
|
|
11
|
+
# Handle blessed object syntax
|
|
12
|
+
|
|
13
|
+
# Printable characters for escapes
|
|
14
|
+
my %UNESCAPES = (
|
|
15
|
+
z => "\x00", a => "\x07", t => "\x09",
|
|
16
|
+
n => "\x0a", v => "\x0b", f => "\x0c",
|
|
17
|
+
r => "\x0d", e => "\x1b", '\\' => '\\',
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
my $QQ_STRING = qr{ " (?:\\. | [^"])* " }x;
|
|
21
|
+
my $HASH_LINE = qr{ ^ ($QQ_STRING|\S+) \s* : \s* (?: (.+?) \s* )? $ }x;
|
|
22
|
+
my $IS_HASH_KEY = qr{ ^ [\w\'\"] }x;
|
|
23
|
+
my $IS_END_YAML = qr{ ^ \.\.\. \s* $ }x;
|
|
24
|
+
my $IS_QQ_STRING = qr{ ^ $QQ_STRING $ }x;
|
|
25
|
+
|
|
26
|
+
# new() implementation supplied by TAP::Object
|
|
27
|
+
|
|
28
|
+
sub read {
|
|
29
|
+
my $self = shift;
|
|
30
|
+
my $obj = shift;
|
|
31
|
+
|
|
32
|
+
die "Must have a code reference to read input from"
|
|
33
|
+
unless ref $obj eq 'CODE';
|
|
34
|
+
|
|
35
|
+
$self->{reader} = $obj;
|
|
36
|
+
$self->{capture} = [];
|
|
37
|
+
|
|
38
|
+
# Prime the reader
|
|
39
|
+
$self->_next;
|
|
40
|
+
return unless $self->{next};
|
|
41
|
+
|
|
42
|
+
my $doc = $self->_read;
|
|
43
|
+
|
|
44
|
+
# The terminator is mandatory otherwise we'd consume a line from the
|
|
45
|
+
# iterator that doesn't belong to us. If we want to remove this
|
|
46
|
+
# restriction we'll have to implement look-ahead in the iterators.
|
|
47
|
+
# Which might not be a bad idea.
|
|
48
|
+
my $dots = $self->_peek;
|
|
49
|
+
die "Missing '...' at end of YAMLish"
|
|
50
|
+
unless defined $dots
|
|
51
|
+
and $dots =~ $IS_END_YAML;
|
|
52
|
+
|
|
53
|
+
delete $self->{reader};
|
|
54
|
+
delete $self->{next};
|
|
55
|
+
|
|
56
|
+
return $doc;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
sub get_raw { join( "\n", grep defined, @{ shift->{capture} || [] } ) . "\n" }
|
|
60
|
+
|
|
61
|
+
sub _peek {
|
|
62
|
+
my $self = shift;
|
|
63
|
+
return $self->{next} unless wantarray;
|
|
64
|
+
my $line = $self->{next};
|
|
65
|
+
$line =~ /^ (\s*) (.*) $ /x;
|
|
66
|
+
return ( $2, length $1 );
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
sub _next {
|
|
70
|
+
my $self = shift;
|
|
71
|
+
die "_next called with no reader"
|
|
72
|
+
unless $self->{reader};
|
|
73
|
+
my $line = $self->{reader}->();
|
|
74
|
+
$self->{next} = $line;
|
|
75
|
+
push @{ $self->{capture} }, $line;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
sub _read {
|
|
79
|
+
my $self = shift;
|
|
80
|
+
|
|
81
|
+
my $line = $self->_peek;
|
|
82
|
+
|
|
83
|
+
# Do we have a document header?
|
|
84
|
+
if ( $line =~ /^ --- (?: \s* (.+?)? \s* )? $/x ) {
|
|
85
|
+
$self->_next;
|
|
86
|
+
|
|
87
|
+
return $self->_read_scalar($1) if defined $1; # Inline?
|
|
88
|
+
|
|
89
|
+
my ( $next, $indent ) = $self->_peek;
|
|
90
|
+
|
|
91
|
+
if ( $next =~ /^ - /x ) {
|
|
92
|
+
return $self->_read_array($indent);
|
|
93
|
+
}
|
|
94
|
+
elsif ( $next =~ $IS_HASH_KEY ) {
|
|
95
|
+
return $self->_read_hash( $next, $indent );
|
|
96
|
+
}
|
|
97
|
+
elsif ( $next =~ $IS_END_YAML ) {
|
|
98
|
+
die "Premature end of YAMLish";
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
die "Unsupported YAMLish syntax: '$next'";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
die "YAMLish document header not found";
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
# Parse a double quoted string
|
|
110
|
+
sub _read_qq {
|
|
111
|
+
my $self = shift;
|
|
112
|
+
my $str = shift;
|
|
113
|
+
|
|
114
|
+
unless ( $str =~ s/^ " (.*?) " $/$1/x ) {
|
|
115
|
+
die "Internal: not a quoted string";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
$str =~ s/\\"/"/gx;
|
|
119
|
+
$str =~ s/ \\ ( [tartan\\favez] | x([0-9a-fA-F]{2}) )
|
|
120
|
+
/ (length($1) > 1) ? pack("H2", $2) : $UNESCAPES{$1} /gex;
|
|
121
|
+
return $str;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
# Parse a scalar string to the actual scalar
|
|
125
|
+
sub _read_scalar {
|
|
126
|
+
my $self = shift;
|
|
127
|
+
my $string = shift;
|
|
128
|
+
|
|
129
|
+
return undef if $string eq '~';
|
|
130
|
+
return {} if $string eq '{}';
|
|
131
|
+
return [] if $string eq '[]';
|
|
132
|
+
|
|
133
|
+
if ( $string eq '>' || $string eq '|' ) {
|
|
134
|
+
|
|
135
|
+
my ( $line, $indent ) = $self->_peek;
|
|
136
|
+
die "Multi-line scalar content missing" unless defined $line;
|
|
137
|
+
|
|
138
|
+
my @multiline = ($line);
|
|
139
|
+
|
|
140
|
+
while (1) {
|
|
141
|
+
$self->_next;
|
|
142
|
+
my ( $next, $ind ) = $self->_peek;
|
|
143
|
+
last if $ind < $indent;
|
|
144
|
+
|
|
145
|
+
my $pad = $string eq '|' ? ( ' ' x ( $ind - $indent ) ) : '';
|
|
146
|
+
push @multiline, $pad . $next;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return join( ( $string eq '>' ? ' ' : "\n" ), @multiline ) . "\n";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if ( $string =~ /^ ' (.*) ' $/x ) {
|
|
153
|
+
( my $rv = $1 ) =~ s/''/'/g;
|
|
154
|
+
return $rv;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if ( $string =~ $IS_QQ_STRING ) {
|
|
158
|
+
return $self->_read_qq($string);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if ( $string =~ /^['"]/ ) {
|
|
162
|
+
|
|
163
|
+
# A quote with folding... we don't support that
|
|
164
|
+
die __PACKAGE__ . " does not support multi-line quoted scalars";
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
# Regular unquoted string
|
|
168
|
+
return $string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
sub _read_nested {
|
|
172
|
+
my $self = shift;
|
|
173
|
+
|
|
174
|
+
my ( $line, $indent ) = $self->_peek;
|
|
175
|
+
|
|
176
|
+
if ( $line =~ /^ -/x ) {
|
|
177
|
+
return $self->_read_array($indent);
|
|
178
|
+
}
|
|
179
|
+
elsif ( $line =~ $IS_HASH_KEY ) {
|
|
180
|
+
return $self->_read_hash( $line, $indent );
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
die "Unsupported YAMLish syntax: '$line'";
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
# Parse an array
|
|
188
|
+
sub _read_array {
|
|
189
|
+
my ( $self, $limit ) = @_;
|
|
190
|
+
|
|
191
|
+
my $ar = [];
|
|
192
|
+
|
|
193
|
+
while (1) {
|
|
194
|
+
my ( $line, $indent ) = $self->_peek;
|
|
195
|
+
last
|
|
196
|
+
if $indent < $limit
|
|
197
|
+
|| !defined $line
|
|
198
|
+
|| $line =~ $IS_END_YAML;
|
|
199
|
+
|
|
200
|
+
if ( $indent > $limit ) {
|
|
201
|
+
die "Array line over-indented";
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if ( $line =~ /^ (- \s+) \S+ \s* : (?: \s+ | $ ) /x ) {
|
|
205
|
+
$indent += length $1;
|
|
206
|
+
$line =~ s/-\s+//;
|
|
207
|
+
push @$ar, $self->_read_hash( $line, $indent );
|
|
208
|
+
}
|
|
209
|
+
elsif ( $line =~ /^ - \s* (.+?) \s* $/x ) {
|
|
210
|
+
die "Unexpected start of YAMLish" if $line =~ /^---/;
|
|
211
|
+
$self->_next;
|
|
212
|
+
push @$ar, $self->_read_scalar($1);
|
|
213
|
+
}
|
|
214
|
+
elsif ( $line =~ /^ - \s* $/x ) {
|
|
215
|
+
$self->_next;
|
|
216
|
+
push @$ar, $self->_read_nested;
|
|
217
|
+
}
|
|
218
|
+
elsif ( $line =~ $IS_HASH_KEY ) {
|
|
219
|
+
$self->_next;
|
|
220
|
+
push @$ar, $self->_read_hash( $line, $indent, );
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
die "Unsupported YAMLish syntax: '$line'";
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return $ar;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
sub _read_hash {
|
|
231
|
+
my ( $self, $line, $limit ) = @_;
|
|
232
|
+
|
|
233
|
+
my $indent;
|
|
234
|
+
my $hash = {};
|
|
235
|
+
|
|
236
|
+
while (1) {
|
|
237
|
+
die "Badly formed hash line: '$line'"
|
|
238
|
+
unless $line =~ $HASH_LINE;
|
|
239
|
+
|
|
240
|
+
my ( $key, $value ) = ( $self->_read_scalar($1), $2 );
|
|
241
|
+
$self->_next;
|
|
242
|
+
|
|
243
|
+
if ( defined $value ) {
|
|
244
|
+
$hash->{$key} = $self->_read_scalar($value);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
$hash->{$key} = $self->_read_nested;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
( $line, $indent ) = $self->_peek;
|
|
251
|
+
last
|
|
252
|
+
if $indent < $limit
|
|
253
|
+
|| !defined $line
|
|
254
|
+
|| $line =~ $IS_END_YAML;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return $hash;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
1;
|
|
261
|
+
|
|
262
|
+
__END__
|
|
263
|
+
|
|
264
|
+
=pod
|
|
265
|
+
|
|
266
|
+
=head1 NAME
|
|
267
|
+
|
|
268
|
+
TAP::Parser::YAMLish::Reader - Read YAMLish data from iterator
|
|
269
|
+
|
|
270
|
+
=head1 VERSION
|
|
271
|
+
|
|
272
|
+
Version 3.42
|
|
273
|
+
|
|
274
|
+
=head1 SYNOPSIS
|
|
275
|
+
|
|
276
|
+
=head1 DESCRIPTION
|
|
277
|
+
|
|
278
|
+
Note that parts of this code were derived from L<YAML::Tiny> with the
|
|
279
|
+
permission of Adam Kennedy.
|
|
280
|
+
|
|
281
|
+
=head1 METHODS
|
|
282
|
+
|
|
283
|
+
=head2 Class Methods
|
|
284
|
+
|
|
285
|
+
=head3 C<new>
|
|
286
|
+
|
|
287
|
+
The constructor C<new> creates and returns an empty
|
|
288
|
+
C<TAP::Parser::YAMLish::Reader> object.
|
|
289
|
+
|
|
290
|
+
my $reader = TAP::Parser::YAMLish::Reader->new;
|
|
291
|
+
|
|
292
|
+
=head2 Instance Methods
|
|
293
|
+
|
|
294
|
+
=head3 C<read>
|
|
295
|
+
|
|
296
|
+
my $got = $reader->read($iterator);
|
|
297
|
+
|
|
298
|
+
Read YAMLish from a L<TAP::Parser::Iterator> and return the data structure it
|
|
299
|
+
represents.
|
|
300
|
+
|
|
301
|
+
=head3 C<get_raw>
|
|
302
|
+
|
|
303
|
+
my $source = $reader->get_source;
|
|
304
|
+
|
|
305
|
+
Return the raw YAMLish source from the most recent C<read>.
|
|
306
|
+
|
|
307
|
+
=head1 AUTHOR
|
|
308
|
+
|
|
309
|
+
Andy Armstrong, <andy@hexten.net>
|
|
310
|
+
|
|
311
|
+
Adam Kennedy wrote L<YAML::Tiny> which provided the template and many of
|
|
312
|
+
the YAML matching regular expressions for this module.
|
|
313
|
+
|
|
314
|
+
=head1 SEE ALSO
|
|
315
|
+
|
|
316
|
+
L<YAML::Tiny>, L<YAML>, L<YAML::Syck>, L<Config::Tiny>, L<CSS::Tiny>,
|
|
317
|
+
L<http://use.perl.org/~Alias/journal/29427>
|
|
318
|
+
|
|
319
|
+
=head1 COPYRIGHT
|
|
320
|
+
|
|
321
|
+
Copyright 2007-2011 Andy Armstrong.
|
|
322
|
+
|
|
323
|
+
Portions copyright 2006-2008 Adam Kennedy.
|
|
324
|
+
|
|
325
|
+
This program is free software; you can redistribute
|
|
326
|
+
it and/or modify it under the same terms as Perl itself.
|
|
327
|
+
|
|
328
|
+
The full text of the license can be found in the
|
|
329
|
+
LICENSE file included with this module.
|
|
330
|
+
|
|
331
|
+
=cut
|
|
332
|
+
|