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.
Files changed (253) hide show
  1. package/README.md +6 -0
  2. package/bin/exiftool.exe +0 -0
  3. package/bin/exiftool_files/Changes +44 -0
  4. package/bin/exiftool_files/Licenses_Strawberry_Perl.zip +0 -0
  5. package/bin/exiftool_files/README +3 -2
  6. package/bin/exiftool_files/exiftool.pl +36 -14
  7. package/bin/exiftool_files/lib/Archive/Zip/Archive.pm +399 -65
  8. package/bin/exiftool_files/lib/Archive/Zip/DirectoryMember.pm +1 -1
  9. package/bin/exiftool_files/lib/Archive/Zip/FileMember.pm +1 -1
  10. package/bin/exiftool_files/lib/Archive/Zip/Member.pm +499 -195
  11. package/bin/exiftool_files/lib/Archive/Zip/NewFileMember.pm +1 -1
  12. package/bin/exiftool_files/lib/Archive/Zip/StringMember.pm +2 -2
  13. package/bin/exiftool_files/lib/Archive/Zip/ZipFileMember.pm +79 -20
  14. package/bin/exiftool_files/lib/Archive/Zip.pm +179 -29
  15. package/bin/exiftool_files/lib/AutoLoader.pm +453 -0
  16. package/bin/exiftool_files/lib/B/Deparse.pm +209 -137
  17. package/bin/exiftool_files/lib/B.pm +1 -1
  18. package/bin/exiftool_files/lib/Benchmark.pm +1123 -0
  19. package/bin/exiftool_files/lib/Class/Struct.pm +2 -2
  20. package/bin/exiftool_files/lib/Compress/Raw/Bzip2.pm +14 -9
  21. package/bin/exiftool_files/lib/Compress/Raw/Lzma.pm +982 -0
  22. package/bin/exiftool_files/lib/Compress/Raw/Zlib.pm +91 -86
  23. package/bin/exiftool_files/lib/Compress/Zlib.pm +105 -100
  24. package/bin/exiftool_files/lib/Config.pm +9 -9
  25. package/bin/exiftool_files/lib/Config_heavy.pl +36 -33
  26. package/bin/exiftool_files/lib/CryptX.pm +2 -82
  27. package/bin/exiftool_files/lib/Data/Dumper.pm +2 -2
  28. package/bin/exiftool_files/lib/Digest/MD5.pm +12 -9
  29. package/bin/exiftool_files/lib/Digest/Perl/MD5.pm +1 -191
  30. package/bin/exiftool_files/lib/Digest/base.pm +26 -20
  31. package/bin/exiftool_files/lib/DynaLoader.pm +7 -4
  32. package/bin/exiftool_files/lib/Encode.pm +3 -3
  33. package/bin/exiftool_files/lib/Errno.pm +13 -13
  34. package/bin/exiftool_files/lib/Exporter/Heavy.pm +2 -2
  35. package/bin/exiftool_files/lib/Exporter.pm +1 -1
  36. package/bin/exiftool_files/lib/ExtUtils/Command/MM.pm +323 -0
  37. package/bin/exiftool_files/lib/ExtUtils/Command.pm +382 -0
  38. package/bin/exiftool_files/lib/File/Find.pm +1 -1
  39. package/bin/exiftool_files/lib/File/Glob.pm +1 -8
  40. package/bin/exiftool_files/lib/File/GlobMapper.pm +2 -2
  41. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Carbon.pm +2 -40
  42. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Cocoa.pm +2 -34
  43. package/bin/exiftool_files/lib/File/HomeDir/Darwin.pm +2 -28
  44. package/bin/exiftool_files/lib/File/HomeDir/Driver.pm +2 -35
  45. package/bin/exiftool_files/lib/File/HomeDir/FreeDesktop.pm +2 -62
  46. package/bin/exiftool_files/lib/File/HomeDir/MacOS9.pm +2 -53
  47. package/bin/exiftool_files/lib/File/HomeDir/Test.pm +2 -43
  48. package/bin/exiftool_files/lib/File/HomeDir/Unix.pm +2 -53
  49. package/bin/exiftool_files/lib/File/HomeDir/Windows.pm +2 -69
  50. package/bin/exiftool_files/lib/File/HomeDir.pm +5 -416
  51. package/bin/exiftool_files/lib/File/Path.pm +3 -3
  52. package/bin/exiftool_files/lib/File/Spec/Win32.pm +2 -2
  53. package/bin/exiftool_files/lib/File/Temp.pm +70 -35
  54. package/bin/exiftool_files/lib/File/Which.pm +1 -240
  55. package/bin/exiftool_files/lib/File/stat.pm +3 -2
  56. package/bin/exiftool_files/lib/IO/Compress/Adapter/Bzip2.pm +16 -17
  57. package/bin/exiftool_files/lib/IO/Compress/Adapter/Deflate.pm +19 -20
  58. package/bin/exiftool_files/lib/IO/Compress/Base/Common.pm +5 -5
  59. package/bin/exiftool_files/lib/IO/Compress/Base.pm +35 -26
  60. package/bin/exiftool_files/lib/IO/Compress/Brotli.pm +159 -0
  61. package/bin/exiftool_files/lib/IO/Compress/Bzip2.pm +50 -25
  62. package/bin/exiftool_files/lib/IO/Compress/Gzip/Constants.pm +6 -6
  63. package/bin/exiftool_files/lib/IO/Compress/Gzip.pm +58 -32
  64. package/bin/exiftool_files/lib/IO/Compress/RawDeflate.pm +63 -38
  65. package/bin/exiftool_files/lib/IO/Compress/Zlib/Extra.pm +20 -20
  66. package/bin/exiftool_files/lib/IO/Dir.pm +1 -1
  67. package/bin/exiftool_files/lib/IO/File.pm +1 -1
  68. package/bin/exiftool_files/lib/IO/Handle.pm +1 -21
  69. package/bin/exiftool_files/lib/IO/Pipe.pm +1 -1
  70. package/bin/exiftool_files/lib/IO/Seekable.pm +1 -1
  71. package/bin/exiftool_files/lib/IO/Select.pm +16 -2
  72. package/bin/exiftool_files/lib/IO/Socket/INET.pm +14 -9
  73. package/bin/exiftool_files/lib/IO/Socket/UNIX.pm +17 -1
  74. package/bin/exiftool_files/lib/IO/Socket.pm +474 -126
  75. package/bin/exiftool_files/lib/IO/String.pm +425 -0
  76. package/bin/exiftool_files/lib/IO/Uncompress/Adapter/Inflate.pm +13 -14
  77. package/bin/exiftool_files/lib/IO/Uncompress/Base.pm +142 -132
  78. package/bin/exiftool_files/lib/IO/Uncompress/Brotli.pm +119 -0
  79. package/bin/exiftool_files/lib/IO/Uncompress/Gunzip.pm +43 -37
  80. package/bin/exiftool_files/lib/IO/Uncompress/RawInflate.pm +49 -43
  81. package/bin/exiftool_files/lib/IO.pm +2 -2
  82. package/bin/exiftool_files/lib/Image/ExifTool/BuildTagLookup.pm +44 -31
  83. package/bin/exiftool_files/lib/Image/ExifTool/CanonVRD.pm +2 -2
  84. package/bin/exiftool_files/lib/Image/ExifTool/FujiFilm.pm +20 -7
  85. package/bin/exiftool_files/lib/Image/ExifTool/GM.pm +543 -0
  86. package/bin/exiftool_files/lib/Image/ExifTool/Geolocation.pm +332 -149
  87. package/bin/exiftool_files/lib/Image/ExifTool/Geotag.pm +9 -4
  88. package/bin/exiftool_files/lib/Image/ExifTool/M2TS.pm +32 -4
  89. package/bin/exiftool_files/lib/Image/ExifTool/MakerNotes.pm +2 -2
  90. package/bin/exiftool_files/lib/Image/ExifTool/Microsoft.pm +1 -1
  91. package/bin/exiftool_files/lib/Image/ExifTool/Nikon.pm +331 -22
  92. package/bin/exiftool_files/lib/Image/ExifTool/NikonCustom.pm +55 -1
  93. package/bin/exiftool_files/lib/Image/ExifTool/Olympus.pm +1 -0
  94. package/bin/exiftool_files/lib/Image/ExifTool/OpenEXR.pm +21 -3
  95. package/bin/exiftool_files/lib/Image/ExifTool/PNG.pm +3 -3
  96. package/bin/exiftool_files/lib/Image/ExifTool/QuickTime.pm +40 -24
  97. package/bin/exiftool_files/lib/Image/ExifTool/QuickTimeStream.pl +61 -30
  98. package/bin/exiftool_files/lib/Image/ExifTool/README +2 -0
  99. package/bin/exiftool_files/lib/Image/ExifTool/Sony.pm +1 -1
  100. package/bin/exiftool_files/lib/Image/ExifTool/TagLookup.pm +4815 -4775
  101. package/bin/exiftool_files/lib/Image/ExifTool/TagNames.pod +931 -617
  102. package/bin/exiftool_files/lib/Image/ExifTool/WriteQuickTime.pl +30 -8
  103. package/bin/exiftool_files/lib/Image/ExifTool/Writer.pl +10 -4
  104. package/bin/exiftool_files/lib/Image/ExifTool/XMP.pm +4 -2
  105. package/bin/exiftool_files/lib/Image/ExifTool.pm +77 -41
  106. package/bin/exiftool_files/lib/Image/ExifTool.pod +24 -11
  107. package/bin/exiftool_files/lib/List/Util.pm +97 -8
  108. package/bin/exiftool_files/lib/MIME/Base64.pm +5 -5
  109. package/bin/exiftool_files/lib/MIME/Charset/_Compat.pm +106 -0
  110. package/bin/exiftool_files/lib/MIME/Charset.pm +1303 -0
  111. package/bin/exiftool_files/lib/Math/BigFloat.pm +444 -27
  112. package/bin/exiftool_files/lib/Math/BigInt/Calc.pm +296 -313
  113. package/bin/exiftool_files/lib/Math/BigInt/FastCalc.pm +1 -1
  114. package/bin/exiftool_files/lib/Math/BigInt/GMP.pm +2 -115
  115. package/bin/exiftool_files/lib/Math/BigInt/LTM.pm +2 -24
  116. package/bin/exiftool_files/lib/Math/BigInt/Lib.pm +61 -32
  117. package/bin/exiftool_files/lib/Math/BigInt.pm +292 -107
  118. package/bin/exiftool_files/lib/POSIX.pm +1 -1
  119. package/bin/exiftool_files/lib/PerlIO/scalar.pm +41 -0
  120. package/bin/exiftool_files/lib/PerlIO.pm +397 -0
  121. package/bin/exiftool_files/lib/Portable/CPAN.pm +94 -94
  122. package/bin/exiftool_files/lib/Portable/Config.pm +94 -94
  123. package/bin/exiftool_files/lib/Portable/FileSpec.pm +180 -180
  124. package/bin/exiftool_files/lib/Portable/HomeDir.pm +110 -110
  125. package/bin/exiftool_files/lib/Portable/LoadYaml.pm +430 -430
  126. package/bin/exiftool_files/lib/Portable/minicpan.pm +55 -55
  127. package/bin/exiftool_files/lib/Portable.pm +246 -320
  128. package/bin/exiftool_files/lib/Scalar/Util.pm +9 -4
  129. package/bin/exiftool_files/lib/Socket.pm +16 -12
  130. package/bin/exiftool_files/lib/Storable.pm +1444 -1441
  131. package/bin/exiftool_files/lib/TAP/Base.pm +133 -0
  132. package/bin/exiftool_files/lib/TAP/Formatter/Base.pm +467 -0
  133. package/bin/exiftool_files/lib/TAP/Formatter/Color.pm +116 -0
  134. package/bin/exiftool_files/lib/TAP/Formatter/Console/ParallelSession.pm +201 -0
  135. package/bin/exiftool_files/lib/TAP/Formatter/Console/Session.pm +205 -0
  136. package/bin/exiftool_files/lib/TAP/Formatter/Console.pm +100 -0
  137. package/bin/exiftool_files/lib/TAP/Formatter/File/Session.pm +95 -0
  138. package/bin/exiftool_files/lib/TAP/Formatter/File.pm +56 -0
  139. package/bin/exiftool_files/lib/TAP/Formatter/Session.pm +220 -0
  140. package/bin/exiftool_files/lib/TAP/Harness/Beyond.pod +426 -0
  141. package/bin/exiftool_files/lib/TAP/Harness/Env.pm +215 -0
  142. package/bin/exiftool_files/lib/TAP/Harness.pm +1054 -0
  143. package/bin/exiftool_files/lib/TAP/Object.pm +155 -0
  144. package/bin/exiftool_files/lib/TAP/Parser/Aggregator.pm +414 -0
  145. package/bin/exiftool_files/lib/TAP/Parser/Grammar.pm +584 -0
  146. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Array.pm +100 -0
  147. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Process.pm +378 -0
  148. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Stream.pm +116 -0
  149. package/bin/exiftool_files/lib/TAP/Parser/Iterator.pm +162 -0
  150. package/bin/exiftool_files/lib/TAP/Parser/IteratorFactory.pm +339 -0
  151. package/bin/exiftool_files/lib/TAP/Parser/Multiplexer.pm +194 -0
  152. package/bin/exiftool_files/lib/TAP/Parser/Result/Bailout.pm +62 -0
  153. package/bin/exiftool_files/lib/TAP/Parser/Result/Comment.pm +60 -0
  154. package/bin/exiftool_files/lib/TAP/Parser/Result/Plan.pm +119 -0
  155. package/bin/exiftool_files/lib/TAP/Parser/Result/Pragma.pm +62 -0
  156. package/bin/exiftool_files/lib/TAP/Parser/Result/Test.pm +271 -0
  157. package/bin/exiftool_files/lib/TAP/Parser/Result/Unknown.pm +48 -0
  158. package/bin/exiftool_files/lib/TAP/Parser/Result/Version.pm +62 -0
  159. package/bin/exiftool_files/lib/TAP/Parser/Result/YAML.pm +61 -0
  160. package/bin/exiftool_files/lib/TAP/Parser/Result.pm +297 -0
  161. package/bin/exiftool_files/lib/TAP/Parser/ResultFactory.pm +183 -0
  162. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Job.pm +127 -0
  163. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Spinner.pm +61 -0
  164. package/bin/exiftool_files/lib/TAP/Parser/Scheduler.pm +448 -0
  165. package/bin/exiftool_files/lib/TAP/Parser/Source.pm +381 -0
  166. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Executable.pm +184 -0
  167. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/File.pm +136 -0
  168. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Handle.pm +124 -0
  169. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Perl.pm +370 -0
  170. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/RawTAP.pm +130 -0
  171. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler.pm +191 -0
  172. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Reader.pm +332 -0
  173. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Writer.pm +254 -0
  174. package/bin/exiftool_files/lib/TAP/Parser.pm +1931 -0
  175. package/bin/exiftool_files/lib/Test/Builder/Formatter.pm +107 -0
  176. package/bin/exiftool_files/lib/Test/Builder/IO/Scalar.pm +659 -0
  177. package/bin/exiftool_files/lib/Test/Builder/Module.pm +182 -0
  178. package/bin/exiftool_files/lib/Test/Builder/Tester/Color.pm +51 -0
  179. package/bin/exiftool_files/lib/Test/Builder/Tester.pm +675 -0
  180. package/bin/exiftool_files/lib/Test/Builder/TodoDiag.pm +68 -0
  181. package/bin/exiftool_files/lib/Test/Builder.pm +2653 -0
  182. package/bin/exiftool_files/lib/Test/Harness.pm +618 -0
  183. package/bin/exiftool_files/lib/Test/More.pm +1997 -0
  184. package/bin/exiftool_files/lib/Test/Simple.pm +220 -0
  185. package/bin/exiftool_files/lib/Test/Tester/Capture.pm +241 -0
  186. package/bin/exiftool_files/lib/Test/Tester/CaptureRunner.pm +79 -0
  187. package/bin/exiftool_files/lib/Test/Tester/Delegate.pm +45 -0
  188. package/bin/exiftool_files/lib/Test/Tester.pm +695 -0
  189. package/bin/exiftool_files/lib/Test/Tutorial.pod +618 -0
  190. package/bin/exiftool_files/lib/Test/use/ok.pm +64 -0
  191. package/bin/exiftool_files/lib/Text/ParseWords.pm +303 -0
  192. package/bin/exiftool_files/lib/Tie/StdHandle.pm +2 -2
  193. package/bin/exiftool_files/lib/Time/HiRes.pm +73 -68
  194. package/bin/exiftool_files/lib/Time/Local.pm +82 -35
  195. package/bin/exiftool_files/lib/Time/Piece.pm +19 -4
  196. package/bin/exiftool_files/lib/Time/Seconds.pm +1 -1
  197. package/bin/exiftool_files/lib/UNIVERSAL.pm +203 -0
  198. package/bin/exiftool_files/lib/Unicode/GCString.pm +60 -0
  199. package/bin/exiftool_files/lib/Unicode/LineBreak/Constants.pm +68 -0
  200. package/bin/exiftool_files/lib/Unicode/LineBreak.pm +248 -0
  201. package/bin/exiftool_files/lib/Win32/API/Struct.pm +1 -177
  202. package/bin/exiftool_files/lib/Win32/API/Type.pm +1 -100
  203. package/bin/exiftool_files/lib/Win32/API.pm +1 -830
  204. package/bin/exiftool_files/lib/Win32/FindFile.pm +2 -123
  205. package/bin/exiftool_files/lib/Win32.pm +213 -89
  206. package/bin/exiftool_files/lib/Win32API/File.pm +1 -1
  207. package/bin/exiftool_files/lib/auto/B/B.xs.dll +0 -0
  208. package/bin/exiftool_files/lib/auto/Compress/Raw/Bzip2/Bzip2.xs.dll +0 -0
  209. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/Lzma.xs.dll +0 -0
  210. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/autosplit.ix +3 -0
  211. package/bin/exiftool_files/lib/auto/Compress/Raw/Zlib/Zlib.xs.dll +0 -0
  212. package/bin/exiftool_files/lib/auto/CryptX/CryptX.xs.dll +0 -0
  213. package/bin/exiftool_files/lib/auto/Cwd/Cwd.xs.dll +0 -0
  214. package/bin/exiftool_files/lib/auto/Data/Dumper/Dumper.xs.dll +0 -0
  215. package/bin/exiftool_files/lib/auto/Digest/MD5/MD5.xs.dll +0 -0
  216. package/bin/exiftool_files/lib/auto/Digest/SHA/SHA.xs.dll +0 -0
  217. package/bin/exiftool_files/lib/auto/Encode/Encode.xs.dll +0 -0
  218. package/bin/exiftool_files/lib/auto/Fcntl/Fcntl.xs.dll +0 -0
  219. package/bin/exiftool_files/lib/auto/File/Glob/Glob.xs.dll +0 -0
  220. package/bin/exiftool_files/lib/auto/IO/Compress/Brotli/Brotli.xs.dll +0 -0
  221. package/bin/exiftool_files/lib/auto/IO/IO.xs.dll +0 -0
  222. package/bin/exiftool_files/lib/auto/List/Util/Util.xs.dll +0 -0
  223. package/bin/exiftool_files/lib/auto/MIME/Base64/Base64.xs.dll +0 -0
  224. package/bin/exiftool_files/lib/auto/Math/BigInt/FastCalc/FastCalc.xs.dll +0 -0
  225. package/bin/exiftool_files/lib/auto/Math/BigInt/GMP/GMP.xs.dll +0 -0
  226. package/bin/exiftool_files/lib/auto/POSIX/POSIX.xs.dll +0 -0
  227. package/bin/exiftool_files/lib/auto/PerlIO/scalar/scalar.xs.dll +0 -0
  228. package/bin/exiftool_files/lib/auto/Socket/Socket.xs.dll +0 -0
  229. package/bin/exiftool_files/lib/auto/Storable/Storable.xs.dll +0 -0
  230. package/bin/exiftool_files/lib/auto/Time/HiRes/HiRes.xs.dll +0 -0
  231. package/bin/exiftool_files/lib/auto/Time/Piece/Piece.xs.dll +0 -0
  232. package/bin/exiftool_files/lib/auto/Unicode/LineBreak/LineBreak.xs.dll +0 -0
  233. package/bin/exiftool_files/lib/auto/Win32/API/API.xs.dll +0 -0
  234. package/bin/exiftool_files/lib/auto/Win32/FindFile/FindFile.xs.dll +0 -0
  235. package/bin/exiftool_files/lib/auto/Win32/Win32.xs.dll +0 -0
  236. package/bin/exiftool_files/lib/auto/Win32API/File/File.xs.dll +0 -0
  237. package/bin/exiftool_files/lib/auto/mro/mro.xs.dll +0 -0
  238. package/bin/exiftool_files/lib/auto/re/re.xs.dll +0 -0
  239. package/bin/exiftool_files/lib/feature.pm +49 -17
  240. package/bin/exiftool_files/lib/mro.pm +4 -20
  241. package/bin/exiftool_files/lib/overload.pm +15 -15
  242. package/bin/exiftool_files/lib/parent.pm +10 -2
  243. package/bin/exiftool_files/lib/re.pm +91 -33
  244. package/bin/exiftool_files/lib/warnings.pm +17 -6
  245. package/bin/exiftool_files/libgcc_s_seh-1.dll +0 -0
  246. package/bin/exiftool_files/liblzma-5__.dll +0 -0
  247. package/bin/exiftool_files/libstdc++-6.dll +0 -0
  248. package/bin/exiftool_files/libwinpthread-1.dll +0 -0
  249. package/bin/exiftool_files/perl.exe +0 -0
  250. package/bin/exiftool_files/perl532.dll +0 -0
  251. package/package.json +7 -5
  252. package/bin/exiftool_files/libgcc_s_dw2-1.dll +0 -0
  253. package/bin/exiftool_files/perl530.dll +0 -0
@@ -0,0 +1,378 @@
1
+ package TAP::Parser::Iterator::Process;
2
+
3
+ use strict;
4
+ use warnings;
5
+
6
+ use Config;
7
+ use IO::Handle;
8
+
9
+ use base 'TAP::Parser::Iterator';
10
+
11
+ my $IS_WIN32 = ( $^O =~ /^(MS)?Win32$/ );
12
+
13
+ =head1 NAME
14
+
15
+ TAP::Parser::Iterator::Process - Iterator for process-based TAP sources
16
+
17
+ =head1 VERSION
18
+
19
+ Version 3.42
20
+
21
+ =cut
22
+
23
+ our $VERSION = '3.42';
24
+
25
+ =head1 SYNOPSIS
26
+
27
+ use TAP::Parser::Iterator::Process;
28
+ my %args = (
29
+ command => ['python', 'setup.py', 'test'],
30
+ merge => 1,
31
+ setup => sub { ... },
32
+ teardown => sub { ... },
33
+ );
34
+ my $it = TAP::Parser::Iterator::Process->new(\%args);
35
+ my $line = $it->next;
36
+
37
+ =head1 DESCRIPTION
38
+
39
+ This is a simple iterator wrapper for executing external processes, used by
40
+ L<TAP::Parser>. Unless you're writing a plugin or subclassing, you probably
41
+ won't need to use this module directly.
42
+
43
+ =head1 METHODS
44
+
45
+ =head2 Class Methods
46
+
47
+ =head3 C<new>
48
+
49
+ Create an iterator. Expects one argument containing a hashref of the form:
50
+
51
+ command => \@command_to_execute
52
+ merge => $attempt_merge_stderr_and_stdout?
53
+ setup => $callback_to_setup_command
54
+ teardown => $callback_to_teardown_command
55
+
56
+ Tries to uses L<IPC::Open3> & L<IO::Select> to communicate with the spawned
57
+ process if they are available. Falls back onto C<open()>.
58
+
59
+ =head2 Instance Methods
60
+
61
+ =head3 C<next>
62
+
63
+ Iterate through the process output, of course.
64
+
65
+ =head3 C<next_raw>
66
+
67
+ Iterate raw input without applying any fixes for quirky input syntax.
68
+
69
+ =head3 C<wait>
70
+
71
+ Get the wait status for this iterator's process.
72
+
73
+ =head3 C<exit>
74
+
75
+ Get the exit status for this iterator's process.
76
+
77
+ =cut
78
+
79
+ {
80
+
81
+ no warnings 'uninitialized';
82
+ # get around a catch22 in the test suite that causes failures on Win32:
83
+ local $SIG{__DIE__} = undef;
84
+ eval { require POSIX; &POSIX::WEXITSTATUS(0) };
85
+ if ($@) {
86
+ *_wait2exit = sub { $_[1] >> 8 };
87
+ }
88
+ else {
89
+ *_wait2exit = sub { POSIX::WEXITSTATUS( $_[1] ) }
90
+ }
91
+ }
92
+
93
+ sub _use_open3 {
94
+ my $self = shift;
95
+ return unless $Config{d_fork} || $IS_WIN32;
96
+ for my $module (qw( IPC::Open3 IO::Select )) {
97
+ eval "use $module";
98
+ return if $@;
99
+ }
100
+ return 1;
101
+ }
102
+
103
+ {
104
+ my $got_unicode;
105
+
106
+ sub _get_unicode {
107
+ return $got_unicode if defined $got_unicode;
108
+ eval 'use Encode qw(decode_utf8);';
109
+ $got_unicode = $@ ? 0 : 1;
110
+
111
+ }
112
+ }
113
+
114
+ # new() implementation supplied by TAP::Object
115
+
116
+ sub _initialize {
117
+ my ( $self, $args ) = @_;
118
+
119
+ my @command = @{ delete $args->{command} || [] }
120
+ or die "Must supply a command to execute";
121
+
122
+ $self->{command} = [@command];
123
+
124
+ # Private. Used to frig with chunk size during testing.
125
+ my $chunk_size = delete $args->{_chunk_size} || 65536;
126
+
127
+ my $merge = delete $args->{merge};
128
+ my ( $pid, $err, $sel );
129
+
130
+ if ( my $setup = delete $args->{setup} ) {
131
+ $setup->(@command);
132
+ }
133
+
134
+ my $out = IO::Handle->new;
135
+
136
+ if ( $self->_use_open3 ) {
137
+
138
+ # HOTPATCH {{{
139
+ my $xclose = \&IPC::Open3::xclose;
140
+ no warnings;
141
+ local *IPC::Open3::xclose = sub {
142
+ my $fh = shift;
143
+ no strict 'refs';
144
+ return if ( fileno($fh) == fileno(STDIN) );
145
+ $xclose->($fh);
146
+ };
147
+
148
+ # }}}
149
+
150
+ if ($IS_WIN32) {
151
+ $err = $merge ? '' : '>&STDERR';
152
+ eval {
153
+ $pid = open3(
154
+ '<&STDIN', $out, $merge ? '' : $err,
155
+ @command
156
+ );
157
+ };
158
+ die "Could not execute (@command): $@" if $@;
159
+ if ( $] >= 5.006 ) {
160
+ binmode($out, ":crlf");
161
+ }
162
+ }
163
+ else {
164
+ $err = $merge ? '' : IO::Handle->new;
165
+ eval { $pid = open3( '<&STDIN', $out, $err, @command ); };
166
+ die "Could not execute (@command): $@" if $@;
167
+ $sel = $merge ? undef : IO::Select->new( $out, $err );
168
+ }
169
+ }
170
+ else {
171
+ $err = '';
172
+ my $command
173
+ = join( ' ', map { $_ =~ /\s/ ? qq{"$_"} : $_ } @command );
174
+ open( $out, "$command|" )
175
+ or die "Could not execute ($command): $!";
176
+ }
177
+
178
+ $self->{out} = $out;
179
+ $self->{err} = $err;
180
+ $self->{sel} = $sel;
181
+ $self->{pid} = $pid;
182
+ $self->{exit} = undef;
183
+ $self->{chunk_size} = $chunk_size;
184
+
185
+ if ( my $teardown = delete $args->{teardown} ) {
186
+ $self->{teardown} = sub {
187
+ $teardown->(@command);
188
+ };
189
+ }
190
+
191
+ return $self;
192
+ }
193
+
194
+ =head3 C<handle_unicode>
195
+
196
+ Upgrade the input stream to handle UTF8.
197
+
198
+ =cut
199
+
200
+ sub handle_unicode {
201
+ my $self = shift;
202
+
203
+ if ( $self->{sel} ) {
204
+ if ( _get_unicode() ) {
205
+
206
+ # Make sure our iterator has been constructed and...
207
+ my $next = $self->{_next} ||= $self->_next;
208
+
209
+ # ...wrap it to do UTF8 casting
210
+ $self->{_next} = sub {
211
+ my $line = $next->();
212
+ return decode_utf8($line) if defined $line;
213
+ return;
214
+ };
215
+ }
216
+ }
217
+ else {
218
+ if ( $] >= 5.008 ) {
219
+ eval 'binmode($self->{out}, ":utf8")';
220
+ }
221
+ }
222
+
223
+ }
224
+
225
+ ##############################################################################
226
+
227
+ sub wait { shift->{wait} }
228
+ sub exit { shift->{exit} }
229
+
230
+ sub _next {
231
+ my $self = shift;
232
+
233
+ if ( my $out = $self->{out} ) {
234
+ if ( my $sel = $self->{sel} ) {
235
+ my $err = $self->{err};
236
+ my @buf = ();
237
+ my $partial = ''; # Partial line
238
+ my $chunk_size = $self->{chunk_size};
239
+ return sub {
240
+ return shift @buf if @buf;
241
+
242
+ READ:
243
+ while ( my @ready = $sel->can_read ) {
244
+ for my $fh (@ready) {
245
+ my $got = sysread $fh, my ($chunk), $chunk_size;
246
+
247
+ if ( $got == 0 ) {
248
+ $sel->remove($fh);
249
+ }
250
+ elsif ( $fh == $err ) {
251
+ print STDERR $chunk; # echo STDERR
252
+ }
253
+ else {
254
+ $chunk = $partial . $chunk;
255
+ $partial = '';
256
+
257
+ # Make sure we have a complete line
258
+ unless ( substr( $chunk, -1, 1 ) eq "\n" ) {
259
+ my $nl = rindex $chunk, "\n";
260
+ if ( $nl == -1 ) {
261
+ $partial = $chunk;
262
+ redo READ;
263
+ }
264
+ else {
265
+ $partial = substr( $chunk, $nl + 1 );
266
+ $chunk = substr( $chunk, 0, $nl );
267
+ }
268
+ }
269
+
270
+ push @buf, split /\n/, $chunk;
271
+ return shift @buf if @buf;
272
+ }
273
+ }
274
+ }
275
+
276
+ # Return partial last line
277
+ if ( length $partial ) {
278
+ my $last = $partial;
279
+ $partial = '';
280
+ return $last;
281
+ }
282
+
283
+ $self->_finish;
284
+ return;
285
+ };
286
+ }
287
+ else {
288
+ return sub {
289
+ if ( defined( my $line = <$out> ) ) {
290
+ chomp $line;
291
+ return $line;
292
+ }
293
+ $self->_finish;
294
+ return;
295
+ };
296
+ }
297
+ }
298
+ else {
299
+ return sub {
300
+ $self->_finish;
301
+ return;
302
+ };
303
+ }
304
+ }
305
+
306
+ sub next_raw {
307
+ my $self = shift;
308
+ return ( $self->{_next} ||= $self->_next )->();
309
+ }
310
+
311
+ sub _finish {
312
+ my $self = shift;
313
+
314
+ my $status = $?;
315
+
316
+ # Avoid circular refs
317
+ $self->{_next} = sub {return}
318
+ if $] >= 5.006;
319
+
320
+ # If we have a subprocess we need to wait for it to terminate
321
+ if ( defined $self->{pid} ) {
322
+ if ( $self->{pid} == waitpid( $self->{pid}, 0 ) ) {
323
+ $status = $?;
324
+ }
325
+ }
326
+
327
+ ( delete $self->{out} )->close if $self->{out};
328
+
329
+ # If we have an IO::Select we also have an error handle to close.
330
+ if ( $self->{sel} ) {
331
+ ( delete $self->{err} )->close;
332
+ delete $self->{sel};
333
+ }
334
+ else {
335
+ $status = $?;
336
+ }
337
+
338
+ # Sometimes we get -1 on Windows. Presumably that means status not
339
+ # available.
340
+ $status = 0 if $IS_WIN32 && $status == -1;
341
+
342
+ $self->{wait} = $status;
343
+ $self->{exit} = $self->_wait2exit($status);
344
+
345
+ if ( my $teardown = $self->{teardown} ) {
346
+ $teardown->();
347
+ }
348
+
349
+ return $self;
350
+ }
351
+
352
+ =head3 C<get_select_handles>
353
+
354
+ Return a list of filehandles that may be used upstream in a select()
355
+ call to signal that this Iterator is ready. Iterators that are not
356
+ handle based should return an empty list.
357
+
358
+ =cut
359
+
360
+ sub get_select_handles {
361
+ my $self = shift;
362
+ return grep $_, ( $self->{out}, $self->{err} );
363
+ }
364
+
365
+ 1;
366
+
367
+ =head1 ATTRIBUTION
368
+
369
+ Originally ripped off from L<Test::Harness>.
370
+
371
+ =head1 SEE ALSO
372
+
373
+ L<TAP::Object>,
374
+ L<TAP::Parser>,
375
+ L<TAP::Parser::Iterator>,
376
+
377
+ =cut
378
+
@@ -0,0 +1,116 @@
1
+ package TAP::Parser::Iterator::Stream;
2
+
3
+ use strict;
4
+ use warnings;
5
+
6
+ use base 'TAP::Parser::Iterator';
7
+
8
+ =head1 NAME
9
+
10
+ TAP::Parser::Iterator::Stream - Iterator for filehandle-based TAP sources
11
+
12
+ =head1 VERSION
13
+
14
+ Version 3.42
15
+
16
+ =cut
17
+
18
+ our $VERSION = '3.42';
19
+
20
+ =head1 SYNOPSIS
21
+
22
+ use TAP::Parser::Iterator::Stream;
23
+ open( TEST, 'test.tap' );
24
+ my $it = TAP::Parser::Iterator::Stream->new(\*TEST);
25
+ my $line = $it->next;
26
+
27
+ =head1 DESCRIPTION
28
+
29
+ This is a simple iterator wrapper for reading from filehandles, used by
30
+ L<TAP::Parser>. Unless you're writing a plugin or subclassing, you probably
31
+ won't need to use this module directly.
32
+
33
+ =head1 METHODS
34
+
35
+ =head2 Class Methods
36
+
37
+ =head3 C<new>
38
+
39
+ Create an iterator. Expects one argument containing a filehandle.
40
+
41
+ =cut
42
+
43
+ # new() implementation supplied by TAP::Object
44
+
45
+ sub _initialize {
46
+ my ( $self, $thing ) = @_;
47
+ $self->{fh} = $thing;
48
+ return $self;
49
+ }
50
+
51
+ =head2 Instance Methods
52
+
53
+ =head3 C<next>
54
+
55
+ Iterate through it, of course.
56
+
57
+ =head3 C<next_raw>
58
+
59
+ Iterate raw input without applying any fixes for quirky input syntax.
60
+
61
+ =head3 C<wait>
62
+
63
+ Get the wait status for this iterator. Always returns zero.
64
+
65
+ =head3 C<exit>
66
+
67
+ Get the exit status for this iterator. Always returns zero.
68
+
69
+ =cut
70
+
71
+ sub wait { shift->exit }
72
+ sub exit { shift->{fh} ? () : 0 }
73
+
74
+ sub next_raw {
75
+ my $self = shift;
76
+ my $fh = $self->{fh};
77
+
78
+ if ( defined( my $line = <$fh> ) ) {
79
+ chomp $line;
80
+ return $line;
81
+ }
82
+ else {
83
+ $self->_finish;
84
+ return;
85
+ }
86
+ }
87
+
88
+ sub _finish {
89
+ my $self = shift;
90
+ close delete $self->{fh};
91
+ }
92
+
93
+ sub get_select_handles {
94
+ my $self = shift;
95
+
96
+ # return our handle in case it's a socket or pipe (select()-able)
97
+ return ( $self->{fh}, )
98
+ if (-S $self->{fh} || -p $self->{fh});
99
+
100
+ return;
101
+ }
102
+
103
+ 1;
104
+
105
+ =head1 ATTRIBUTION
106
+
107
+ Originally ripped off from L<Test::Harness>.
108
+
109
+ =head1 SEE ALSO
110
+
111
+ L<TAP::Object>,
112
+ L<TAP::Parser>,
113
+ L<TAP::Parser::Iterator>,
114
+
115
+ =cut
116
+
@@ -0,0 +1,162 @@
1
+ package TAP::Parser::Iterator;
2
+
3
+ use strict;
4
+ use warnings;
5
+
6
+ use base 'TAP::Object';
7
+
8
+ =head1 NAME
9
+
10
+ TAP::Parser::Iterator - Base class for TAP source iterators
11
+
12
+ =head1 VERSION
13
+
14
+ Version 3.42
15
+
16
+ =cut
17
+
18
+ our $VERSION = '3.42';
19
+
20
+ =head1 SYNOPSIS
21
+
22
+ # to subclass:
23
+ use TAP::Parser::Iterator ();
24
+ use base 'TAP::Parser::Iterator';
25
+ sub _initialize {
26
+ # see TAP::Object...
27
+ }
28
+
29
+ sub next_raw { ... }
30
+ sub wait { ... }
31
+ sub exit { ... }
32
+
33
+ =head1 DESCRIPTION
34
+
35
+ This is a simple iterator base class that defines L<TAP::Parser>'s iterator
36
+ API. Iterators are typically created from L<TAP::Parser::SourceHandler>s.
37
+
38
+ =head1 METHODS
39
+
40
+ =head2 Class Methods
41
+
42
+ =head3 C<new>
43
+
44
+ Create an iterator. Provided by L<TAP::Object>.
45
+
46
+ =head2 Instance Methods
47
+
48
+ =head3 C<next>
49
+
50
+ while ( my $item = $iter->next ) { ... }
51
+
52
+ Iterate through it, of course.
53
+
54
+ =head3 C<next_raw>
55
+
56
+ B<Note:> this method is abstract and should be overridden.
57
+
58
+ while ( my $item = $iter->next_raw ) { ... }
59
+
60
+ Iterate raw input without applying any fixes for quirky input syntax.
61
+
62
+ =cut
63
+
64
+ sub next {
65
+ my $self = shift;
66
+ my $line = $self->next_raw;
67
+
68
+ # vms nit: When encountering 'not ok', vms often has the 'not' on a line
69
+ # by itself:
70
+ # not
71
+ # ok 1 - 'I hate VMS'
72
+ if ( defined($line) and $line =~ /^\s*not\s*$/ ) {
73
+ $line .= ( $self->next_raw || '' );
74
+ }
75
+
76
+ return $line;
77
+ }
78
+
79
+ sub next_raw {
80
+ require Carp;
81
+ my $msg = Carp::longmess('abstract method called directly!');
82
+ $_[0]->_croak($msg);
83
+ }
84
+
85
+ =head3 C<handle_unicode>
86
+
87
+ If necessary switch the input stream to handle unicode. This only has
88
+ any effect for I/O handle based streams.
89
+
90
+ The default implementation does nothing.
91
+
92
+ =cut
93
+
94
+ sub handle_unicode { }
95
+
96
+ =head3 C<get_select_handles>
97
+
98
+ Return a list of filehandles that may be used upstream in a select()
99
+ call to signal that this Iterator is ready. Iterators that are not
100
+ handle-based should return an empty list.
101
+
102
+ The default implementation does nothing.
103
+
104
+ =cut
105
+
106
+ sub get_select_handles {
107
+ return;
108
+ }
109
+
110
+ =head3 C<wait>
111
+
112
+ B<Note:> this method is abstract and should be overridden.
113
+
114
+ my $wait_status = $iter->wait;
115
+
116
+ Return the C<wait> status for this iterator.
117
+
118
+ =head3 C<exit>
119
+
120
+ B<Note:> this method is abstract and should be overridden.
121
+
122
+ my $wait_status = $iter->exit;
123
+
124
+ Return the C<exit> status for this iterator.
125
+
126
+ =cut
127
+
128
+ sub wait {
129
+ require Carp;
130
+ my $msg = Carp::longmess('abstract method called directly!');
131
+ $_[0]->_croak($msg);
132
+ }
133
+
134
+ sub exit {
135
+ require Carp;
136
+ my $msg = Carp::longmess('abstract method called directly!');
137
+ $_[0]->_croak($msg);
138
+ }
139
+
140
+ 1;
141
+
142
+ =head1 SUBCLASSING
143
+
144
+ Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview.
145
+
146
+ You must override the abstract methods as noted above.
147
+
148
+ =head2 Example
149
+
150
+ L<TAP::Parser::Iterator::Array> is probably the easiest example to follow.
151
+ There's not much point repeating it here.
152
+
153
+ =head1 SEE ALSO
154
+
155
+ L<TAP::Object>,
156
+ L<TAP::Parser>,
157
+ L<TAP::Parser::Iterator::Array>,
158
+ L<TAP::Parser::Iterator::Stream>,
159
+ L<TAP::Parser::Iterator::Process>,
160
+
161
+ =cut
162
+