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,381 @@
1
+ package TAP::Parser::Source;
2
+
3
+ use strict;
4
+ use warnings;
5
+
6
+ use File::Basename qw( fileparse );
7
+ use base 'TAP::Object';
8
+
9
+ use constant BLK_SIZE => 512;
10
+
11
+ =head1 NAME
12
+
13
+ TAP::Parser::Source - a TAP source & meta data about it
14
+
15
+ =head1 VERSION
16
+
17
+ Version 3.42
18
+
19
+ =cut
20
+
21
+ our $VERSION = '3.42';
22
+
23
+ =head1 SYNOPSIS
24
+
25
+ use TAP::Parser::Source;
26
+ my $source = TAP::Parser::Source->new;
27
+ $source->raw( \'reference to raw TAP source' )
28
+ ->config( \%config )
29
+ ->merge( $boolean )
30
+ ->switches( \@switches )
31
+ ->test_args( \@args )
32
+ ->assemble_meta;
33
+
34
+ do { ... } if $source->meta->{is_file};
35
+ # see assemble_meta for a full list of data available
36
+
37
+ =head1 DESCRIPTION
38
+
39
+ A TAP I<source> is something that produces a stream of TAP for the parser to
40
+ consume, such as an executable file, a text file, an archive, an IO handle, a
41
+ database, etc. C<TAP::Parser::Source>s encapsulate these I<raw> sources, and
42
+ provide some useful meta data about them. They are used by
43
+ L<TAP::Parser::SourceHandler>s, which do whatever is required to produce &
44
+ capture a stream of TAP from the I<raw> source, and package it up in a
45
+ L<TAP::Parser::Iterator> for the parser to consume.
46
+
47
+ Unless you're writing a new L<TAP::Parser::SourceHandler>, a plugin or
48
+ subclassing L<TAP::Parser>, you probably won't need to use this module directly.
49
+
50
+ =head1 METHODS
51
+
52
+ =head2 Class Methods
53
+
54
+ =head3 C<new>
55
+
56
+ my $source = TAP::Parser::Source->new;
57
+
58
+ Returns a new C<TAP::Parser::Source> object.
59
+
60
+ =cut
61
+
62
+ # new() implementation supplied by TAP::Object
63
+
64
+ sub _initialize {
65
+ my ($self) = @_;
66
+ $self->meta( {} );
67
+ $self->config( {} );
68
+ return $self;
69
+ }
70
+
71
+ ##############################################################################
72
+
73
+ =head2 Instance Methods
74
+
75
+ =head3 C<raw>
76
+
77
+ my $raw = $source->raw;
78
+ $source->raw( $some_value );
79
+
80
+ Chaining getter/setter for the raw TAP source. This is a reference, as it may
81
+ contain large amounts of data (eg: raw TAP).
82
+
83
+ =head3 C<meta>
84
+
85
+ my $meta = $source->meta;
86
+ $source->meta({ %some_value });
87
+
88
+ Chaining getter/setter for meta data about the source. This defaults to an
89
+ empty hashref. See L</assemble_meta> for more info.
90
+
91
+ =head3 C<has_meta>
92
+
93
+ True if the source has meta data.
94
+
95
+ =head3 C<config>
96
+
97
+ my $config = $source->config;
98
+ $source->config({ %some_value });
99
+
100
+ Chaining getter/setter for the source's configuration, if any has been provided
101
+ by the user. How it's used is up to you. This defaults to an empty hashref.
102
+ See L</config_for> for more info.
103
+
104
+ =head3 C<merge>
105
+
106
+ my $merge = $source->merge;
107
+ $source->config( $bool );
108
+
109
+ Chaining getter/setter for the flag that dictates whether STDOUT and STDERR
110
+ should be merged (where appropriate). Defaults to undef.
111
+
112
+ =head3 C<switches>
113
+
114
+ my $switches = $source->switches;
115
+ $source->config([ @switches ]);
116
+
117
+ Chaining getter/setter for the list of command-line switches that should be
118
+ passed to the source (where appropriate). Defaults to undef.
119
+
120
+ =head3 C<test_args>
121
+
122
+ my $test_args = $source->test_args;
123
+ $source->config([ @test_args ]);
124
+
125
+ Chaining getter/setter for the list of command-line arguments that should be
126
+ passed to the source (where appropriate). Defaults to undef.
127
+
128
+ =cut
129
+
130
+ sub raw {
131
+ my $self = shift;
132
+ return $self->{raw} unless @_;
133
+ $self->{raw} = shift;
134
+ return $self;
135
+ }
136
+
137
+ sub meta {
138
+ my $self = shift;
139
+ return $self->{meta} unless @_;
140
+ $self->{meta} = shift;
141
+ return $self;
142
+ }
143
+
144
+ sub has_meta {
145
+ return scalar %{ shift->meta } ? 1 : 0;
146
+ }
147
+
148
+ sub config {
149
+ my $self = shift;
150
+ return $self->{config} unless @_;
151
+ $self->{config} = shift;
152
+ return $self;
153
+ }
154
+
155
+ sub merge {
156
+ my $self = shift;
157
+ return $self->{merge} unless @_;
158
+ $self->{merge} = shift;
159
+ return $self;
160
+ }
161
+
162
+ sub switches {
163
+ my $self = shift;
164
+ return $self->{switches} unless @_;
165
+ $self->{switches} = shift;
166
+ return $self;
167
+ }
168
+
169
+ sub test_args {
170
+ my $self = shift;
171
+ return $self->{test_args} unless @_;
172
+ $self->{test_args} = shift;
173
+ return $self;
174
+ }
175
+
176
+ =head3 C<assemble_meta>
177
+
178
+ my $meta = $source->assemble_meta;
179
+
180
+ Gathers meta data about the L</raw> source, stashes it in L</meta> and returns
181
+ it as a hashref. This is done so that the L<TAP::Parser::SourceHandler>s don't
182
+ have to repeat common checks. Currently this includes:
183
+
184
+ is_scalar => $bool,
185
+ is_hash => $bool,
186
+ is_array => $bool,
187
+
188
+ # for scalars:
189
+ length => $n
190
+ has_newlines => $bool
191
+
192
+ # only done if the scalar looks like a filename
193
+ is_file => $bool,
194
+ is_dir => $bool,
195
+ is_symlink => $bool,
196
+ file => {
197
+ # only done if the scalar looks like a filename
198
+ basename => $string, # including ext
199
+ dir => $string,
200
+ ext => $string,
201
+ lc_ext => $string,
202
+ # system checks
203
+ exists => $bool,
204
+ stat => [ ... ], # perldoc -f stat
205
+ empty => $bool,
206
+ size => $n,
207
+ text => $bool,
208
+ binary => $bool,
209
+ read => $bool,
210
+ write => $bool,
211
+ execute => $bool,
212
+ setuid => $bool,
213
+ setgid => $bool,
214
+ sticky => $bool,
215
+ is_file => $bool,
216
+ is_dir => $bool,
217
+ is_symlink => $bool,
218
+ # only done if the file's a symlink
219
+ lstat => [ ... ], # perldoc -f lstat
220
+ # only done if the file's a readable text file
221
+ shebang => $first_line,
222
+ }
223
+
224
+ # for arrays:
225
+ size => $n,
226
+
227
+ =cut
228
+
229
+ sub assemble_meta {
230
+ my ($self) = @_;
231
+
232
+ return $self->meta if $self->has_meta;
233
+
234
+ my $meta = $self->meta;
235
+ my $raw = $self->raw;
236
+
237
+ # rudimentary is object test - if it's blessed it'll
238
+ # inherit from UNIVERSAL
239
+ $meta->{is_object} = UNIVERSAL::isa( $raw, 'UNIVERSAL' ) ? 1 : 0;
240
+
241
+ if ( $meta->{is_object} ) {
242
+ $meta->{class} = ref($raw);
243
+ }
244
+ else {
245
+ my $ref = lc( ref($raw) );
246
+ $meta->{"is_$ref"} = 1;
247
+ }
248
+
249
+ if ( $meta->{is_scalar} ) {
250
+ my $source = $$raw;
251
+ $meta->{length} = length($$raw);
252
+ $meta->{has_newlines} = $$raw =~ /\n/ ? 1 : 0;
253
+
254
+ # only do file checks if it looks like a filename
255
+ if ( !$meta->{has_newlines} and $meta->{length} < 1024 ) {
256
+ my $file = {};
257
+ $file->{exists} = -e $source ? 1 : 0;
258
+ if ( $file->{exists} ) {
259
+ $meta->{file} = $file;
260
+
261
+ # avoid extra system calls (see `perldoc -f -X`)
262
+ $file->{stat} = [ stat(_) ];
263
+ $file->{empty} = -z _ ? 1 : 0;
264
+ $file->{size} = -s _;
265
+ $file->{text} = -T _ ? 1 : 0;
266
+ $file->{binary} = -B _ ? 1 : 0;
267
+ $file->{read} = -r _ ? 1 : 0;
268
+ $file->{write} = -w _ ? 1 : 0;
269
+ $file->{execute} = -x _ ? 1 : 0;
270
+ $file->{setuid} = -u _ ? 1 : 0;
271
+ $file->{setgid} = -g _ ? 1 : 0;
272
+ $file->{sticky} = -k _ ? 1 : 0;
273
+
274
+ $meta->{is_file} = $file->{is_file} = -f _ ? 1 : 0;
275
+ $meta->{is_dir} = $file->{is_dir} = -d _ ? 1 : 0;
276
+
277
+ # symlink check requires another system call
278
+ $meta->{is_symlink} = $file->{is_symlink}
279
+ = -l $source ? 1 : 0;
280
+ if ( $file->{is_symlink} ) {
281
+ $file->{lstat} = [ lstat(_) ];
282
+ }
283
+
284
+ # put together some common info about the file
285
+ ( $file->{basename}, $file->{dir}, $file->{ext} )
286
+ = map { defined $_ ? $_ : '' }
287
+ fileparse( $source, qr/\.[^.]*/ );
288
+ $file->{lc_ext} = lc( $file->{ext} );
289
+ $file->{basename} .= $file->{ext} if $file->{ext};
290
+
291
+ if ( !$file->{is_dir} && $file->{read} ) {
292
+ eval { $file->{shebang} = $self->shebang($$raw); };
293
+ if ( my $e = $@ ) {
294
+ warn $e;
295
+ }
296
+ }
297
+ }
298
+ }
299
+ }
300
+ elsif ( $meta->{is_array} ) {
301
+ $meta->{size} = $#$raw + 1;
302
+ }
303
+ elsif ( $meta->{is_hash} ) {
304
+ ; # do nothing
305
+ }
306
+
307
+ return $meta;
308
+ }
309
+
310
+ =head3 C<shebang>
311
+
312
+ Get the shebang line for a script file.
313
+
314
+ my $shebang = TAP::Parser::Source->shebang( $some_script );
315
+
316
+ May be called as a class method
317
+
318
+ =cut
319
+
320
+ {
321
+
322
+ # Global shebang cache.
323
+ my %shebang_for;
324
+
325
+ sub _read_shebang {
326
+ my ( $class, $file ) = @_;
327
+ open my $fh, '<', $file or die "Can't read $file: $!\n";
328
+
329
+ # Might be a binary file - so read a fixed number of bytes.
330
+ my $got = read $fh, my ($buf), BLK_SIZE;
331
+ defined $got or die "I/O error: $!\n";
332
+ return $1 if $buf =~ /(.*)/;
333
+ return;
334
+ }
335
+
336
+ sub shebang {
337
+ my ( $class, $file ) = @_;
338
+ $shebang_for{$file} = $class->_read_shebang($file)
339
+ unless exists $shebang_for{$file};
340
+ return $shebang_for{$file};
341
+ }
342
+ }
343
+
344
+ =head3 C<config_for>
345
+
346
+ my $config = $source->config_for( $class );
347
+
348
+ Returns L</config> for the $class given. Class names may be fully qualified
349
+ or abbreviated, eg:
350
+
351
+ # these are equivalent
352
+ $source->config_for( 'Perl' );
353
+ $source->config_for( 'TAP::Parser::SourceHandler::Perl' );
354
+
355
+ If a fully qualified $class is given, its abbreviated version is checked first.
356
+
357
+ =cut
358
+
359
+ sub config_for {
360
+ my ( $self, $class ) = @_;
361
+ my ($abbrv_class) = ( $class =~ /(?:\:\:)?(\w+)$/ );
362
+ my $config = $self->config->{$abbrv_class} || $self->config->{$class};
363
+ return $config;
364
+ }
365
+
366
+ 1;
367
+
368
+ __END__
369
+
370
+ =head1 AUTHORS
371
+
372
+ Steve Purkis.
373
+
374
+ =head1 SEE ALSO
375
+
376
+ L<TAP::Object>,
377
+ L<TAP::Parser>,
378
+ L<TAP::Parser::IteratorFactory>,
379
+ L<TAP::Parser::SourceHandler>
380
+
381
+ =cut
@@ -0,0 +1,184 @@
1
+ package TAP::Parser::SourceHandler::Executable;
2
+
3
+ use strict;
4
+ use warnings;
5
+
6
+ use TAP::Parser::IteratorFactory ();
7
+ use TAP::Parser::Iterator::Process ();
8
+
9
+ use base 'TAP::Parser::SourceHandler';
10
+
11
+ TAP::Parser::IteratorFactory->register_handler(__PACKAGE__);
12
+
13
+ =head1 NAME
14
+
15
+ TAP::Parser::SourceHandler::Executable - Stream output from an executable TAP source
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::Source;
28
+ use TAP::Parser::SourceHandler::Executable;
29
+
30
+ my $source = TAP::Parser::Source->new->raw(['/usr/bin/ruby', 'mytest.rb']);
31
+ $source->assemble_meta;
32
+
33
+ my $class = 'TAP::Parser::SourceHandler::Executable';
34
+ my $vote = $class->can_handle( $source );
35
+ my $iter = $class->make_iterator( $source );
36
+
37
+ =head1 DESCRIPTION
38
+
39
+ This is an I<executable> L<TAP::Parser::SourceHandler> - it has 2 jobs:
40
+
41
+ 1. Figure out if the L<TAP::Parser::Source> it's given is an executable
42
+ command (L</can_handle>).
43
+
44
+ 2. Creates an iterator for executable commands (L</make_iterator>).
45
+
46
+ Unless you're writing a plugin or subclassing L<TAP::Parser>, you
47
+ 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
+ my $vote = $class->can_handle( $source );
56
+
57
+ Only votes if $source looks like an executable file. Casts the
58
+ following votes:
59
+
60
+ 0.9 if it's a hash with an 'exec' key
61
+ 0.8 if it's a .bat file
62
+ 0.75 if it's got an execute bit set
63
+
64
+ =cut
65
+
66
+ sub can_handle {
67
+ my ( $class, $src ) = @_;
68
+ my $meta = $src->meta;
69
+
70
+ if ( $meta->{is_file} ) {
71
+ my $file = $meta->{file};
72
+
73
+ return 0.85 if $file->{execute} && $file->{binary};
74
+ return 0.8 if $file->{lc_ext} eq '.bat';
75
+ return 0.25 if $file->{execute};
76
+ }
77
+ elsif ( $meta->{is_hash} ) {
78
+ return 0.9 if $src->raw->{exec};
79
+ }
80
+
81
+ return 0;
82
+ }
83
+
84
+ =head3 C<make_iterator>
85
+
86
+ my $iterator = $class->make_iterator( $source );
87
+
88
+ Returns a new L<TAP::Parser::Iterator::Process> for the source.
89
+ C<$source-E<gt>raw> must be in one of the following forms:
90
+
91
+ { exec => [ @exec ] }
92
+
93
+ [ @exec ]
94
+
95
+ $file
96
+
97
+ C<croak>s on error.
98
+
99
+ =cut
100
+
101
+ sub make_iterator {
102
+ my ( $class, $source ) = @_;
103
+ my $meta = $source->meta;
104
+
105
+ my @command;
106
+ if ( $meta->{is_hash} ) {
107
+ @command = @{ $source->raw->{exec} || [] };
108
+ }
109
+ elsif ( $meta->{is_scalar} ) {
110
+ @command = ${ $source->raw };
111
+ }
112
+ elsif ( $meta->{is_array} ) {
113
+ @command = @{ $source->raw };
114
+ }
115
+
116
+ $class->_croak('No command found in $source->raw!') unless @command;
117
+
118
+ $class->_autoflush( \*STDOUT );
119
+ $class->_autoflush( \*STDERR );
120
+
121
+ push @command, @{ $source->test_args || [] };
122
+
123
+ return $class->iterator_class->new(
124
+ { command => \@command,
125
+ merge => $source->merge
126
+ }
127
+ );
128
+ }
129
+
130
+ =head3 C<iterator_class>
131
+
132
+ The class of iterator to use, override if you're sub-classing. Defaults
133
+ to L<TAP::Parser::Iterator::Process>.
134
+
135
+ =cut
136
+
137
+ use constant iterator_class => 'TAP::Parser::Iterator::Process';
138
+
139
+ # Turns on autoflush for the handle passed
140
+ sub _autoflush {
141
+ my ( $class, $flushed ) = @_;
142
+ my $old_fh = select $flushed;
143
+ $| = 1;
144
+ select $old_fh;
145
+ }
146
+
147
+ 1;
148
+
149
+ =head1 SUBCLASSING
150
+
151
+ Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview.
152
+
153
+ =head2 Example
154
+
155
+ package MyRubySourceHandler;
156
+
157
+ use strict;
158
+
159
+ use Carp qw( croak );
160
+ use TAP::Parser::SourceHandler::Executable;
161
+
162
+ use base 'TAP::Parser::SourceHandler::Executable';
163
+
164
+ # expect $handler->(['mytest.rb', 'cmdline', 'args']);
165
+ sub make_iterator {
166
+ my ($self, $source) = @_;
167
+ my @test_args = @{ $source->test_args };
168
+ my $rb_file = $test_args[0];
169
+ croak("error: Ruby file '$rb_file' not found!") unless (-f $rb_file);
170
+ return $self->SUPER::raw_source(['/usr/bin/ruby', @test_args]);
171
+ }
172
+
173
+ =head1 SEE ALSO
174
+
175
+ L<TAP::Object>,
176
+ L<TAP::Parser>,
177
+ L<TAP::Parser::IteratorFactory>,
178
+ L<TAP::Parser::SourceHandler>,
179
+ L<TAP::Parser::SourceHandler::Perl>,
180
+ L<TAP::Parser::SourceHandler::File>,
181
+ L<TAP::Parser::SourceHandler::Handle>,
182
+ L<TAP::Parser::SourceHandler::RawTAP>
183
+
184
+ =cut
@@ -0,0 +1,136 @@
1
+ package TAP::Parser::SourceHandler::File;
2
+
3
+ use strict;
4
+ use warnings;
5
+
6
+ use TAP::Parser::IteratorFactory ();
7
+ use TAP::Parser::Iterator::Stream ();
8
+
9
+ use base 'TAP::Parser::SourceHandler';
10
+
11
+ TAP::Parser::IteratorFactory->register_handler(__PACKAGE__);
12
+
13
+ =head1 NAME
14
+
15
+ TAP::Parser::SourceHandler::File - Stream TAP from a text file.
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::Source;
28
+ use TAP::Parser::SourceHandler::File;
29
+
30
+ my $source = TAP::Parser::Source->new->raw( \'file.tap' );
31
+ $source->assemble_meta;
32
+
33
+ my $class = 'TAP::Parser::SourceHandler::File';
34
+ my $vote = $class->can_handle( $source );
35
+ my $iter = $class->make_iterator( $source );
36
+
37
+ =head1 DESCRIPTION
38
+
39
+ This is a I<raw TAP stored in a file> L<TAP::Parser::SourceHandler> - it has 2 jobs:
40
+
41
+ 1. Figure out if the I<raw> source it's given is a file containing raw TAP
42
+ output. See L<TAP::Parser::IteratorFactory> for more details.
43
+
44
+ 2. Takes raw TAP from the text file given, and converts into an iterator.
45
+
46
+ Unless you're writing a plugin or subclassing L<TAP::Parser>, you probably
47
+ 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
+ my $vote = $class->can_handle( $source );
56
+
57
+ Only votes if $source looks like a regular file. Casts the following votes:
58
+
59
+ 0.9 if it's a .tap file
60
+ 0.9 if it has an extension matching any given in user config.
61
+
62
+ =cut
63
+
64
+ sub can_handle {
65
+ my ( $class, $src ) = @_;
66
+ my $meta = $src->meta;
67
+ my $config = $src->config_for($class);
68
+
69
+ return 0 unless $meta->{is_file};
70
+ my $file = $meta->{file};
71
+ return 0.9 if $file->{lc_ext} eq '.tap';
72
+
73
+ if ( my $exts = $config->{extensions} ) {
74
+ my @exts = ref $exts eq 'ARRAY' ? @$exts : $exts;
75
+ return 0.9 if grep { lc($_) eq $file->{lc_ext} } @exts;
76
+ }
77
+
78
+ return 0;
79
+ }
80
+
81
+ =head3 C<make_iterator>
82
+
83
+ my $iterator = $class->make_iterator( $source );
84
+
85
+ Returns a new L<TAP::Parser::Iterator::Stream> for the source. C<croak>s
86
+ on error.
87
+
88
+ =cut
89
+
90
+ sub make_iterator {
91
+ my ( $class, $source ) = @_;
92
+
93
+ $class->_croak('$source->raw must be a scalar ref')
94
+ unless $source->meta->{is_scalar};
95
+
96
+ my $file = ${ $source->raw };
97
+ my $fh;
98
+ open( $fh, '<', $file )
99
+ or $class->_croak("error opening TAP source file '$file': $!");
100
+ return $class->iterator_class->new($fh);
101
+ }
102
+
103
+ =head3 C<iterator_class>
104
+
105
+ The class of iterator to use, override if you're sub-classing. Defaults
106
+ to L<TAP::Parser::Iterator::Stream>.
107
+
108
+ =cut
109
+
110
+ use constant iterator_class => 'TAP::Parser::Iterator::Stream';
111
+
112
+ 1;
113
+
114
+ __END__
115
+
116
+ =head1 CONFIGURATION
117
+
118
+ {
119
+ extensions => [ @case_insensitive_exts_to_match ]
120
+ }
121
+
122
+ =head1 SUBCLASSING
123
+
124
+ Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview.
125
+
126
+ =head1 SEE ALSO
127
+
128
+ L<TAP::Object>,
129
+ L<TAP::Parser>,
130
+ L<TAP::Parser::SourceHandler>,
131
+ L<TAP::Parser::SourceHandler::Executable>,
132
+ L<TAP::Parser::SourceHandler::Perl>,
133
+ L<TAP::Parser::SourceHandler::Handle>,
134
+ L<TAP::Parser::SourceHandler::RawTAP>
135
+
136
+ =cut