exiftool-vendored.exe 12.82.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 (225) hide show
  1. package/README.md +6 -0
  2. package/bin/exiftool.exe +0 -0
  3. package/bin/exiftool_files/Licenses_Strawberry_Perl.zip +0 -0
  4. package/bin/exiftool_files/lib/Archive/Zip/Archive.pm +399 -65
  5. package/bin/exiftool_files/lib/Archive/Zip/DirectoryMember.pm +1 -1
  6. package/bin/exiftool_files/lib/Archive/Zip/FileMember.pm +1 -1
  7. package/bin/exiftool_files/lib/Archive/Zip/Member.pm +499 -195
  8. package/bin/exiftool_files/lib/Archive/Zip/NewFileMember.pm +1 -1
  9. package/bin/exiftool_files/lib/Archive/Zip/StringMember.pm +2 -2
  10. package/bin/exiftool_files/lib/Archive/Zip/ZipFileMember.pm +79 -20
  11. package/bin/exiftool_files/lib/Archive/Zip.pm +179 -29
  12. package/bin/exiftool_files/lib/AutoLoader.pm +453 -0
  13. package/bin/exiftool_files/lib/B/Deparse.pm +209 -137
  14. package/bin/exiftool_files/lib/B.pm +1 -1
  15. package/bin/exiftool_files/lib/Benchmark.pm +1123 -0
  16. package/bin/exiftool_files/lib/Class/Struct.pm +2 -2
  17. package/bin/exiftool_files/lib/Compress/Raw/Bzip2.pm +14 -9
  18. package/bin/exiftool_files/lib/Compress/Raw/Lzma.pm +982 -0
  19. package/bin/exiftool_files/lib/Compress/Raw/Zlib.pm +91 -86
  20. package/bin/exiftool_files/lib/Compress/Zlib.pm +105 -100
  21. package/bin/exiftool_files/lib/Config.pm +9 -9
  22. package/bin/exiftool_files/lib/Config_heavy.pl +36 -33
  23. package/bin/exiftool_files/lib/CryptX.pm +2 -82
  24. package/bin/exiftool_files/lib/Data/Dumper.pm +2 -2
  25. package/bin/exiftool_files/lib/Digest/MD5.pm +12 -9
  26. package/bin/exiftool_files/lib/Digest/Perl/MD5.pm +1 -191
  27. package/bin/exiftool_files/lib/Digest/base.pm +26 -20
  28. package/bin/exiftool_files/lib/DynaLoader.pm +7 -4
  29. package/bin/exiftool_files/lib/Encode.pm +3 -3
  30. package/bin/exiftool_files/lib/Errno.pm +13 -13
  31. package/bin/exiftool_files/lib/Exporter/Heavy.pm +2 -2
  32. package/bin/exiftool_files/lib/Exporter.pm +1 -1
  33. package/bin/exiftool_files/lib/ExtUtils/Command/MM.pm +323 -0
  34. package/bin/exiftool_files/lib/ExtUtils/Command.pm +382 -0
  35. package/bin/exiftool_files/lib/File/Find.pm +1 -1
  36. package/bin/exiftool_files/lib/File/Glob.pm +1 -8
  37. package/bin/exiftool_files/lib/File/GlobMapper.pm +2 -2
  38. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Carbon.pm +2 -40
  39. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Cocoa.pm +2 -34
  40. package/bin/exiftool_files/lib/File/HomeDir/Darwin.pm +2 -28
  41. package/bin/exiftool_files/lib/File/HomeDir/Driver.pm +2 -35
  42. package/bin/exiftool_files/lib/File/HomeDir/FreeDesktop.pm +2 -62
  43. package/bin/exiftool_files/lib/File/HomeDir/MacOS9.pm +2 -53
  44. package/bin/exiftool_files/lib/File/HomeDir/Test.pm +2 -43
  45. package/bin/exiftool_files/lib/File/HomeDir/Unix.pm +2 -53
  46. package/bin/exiftool_files/lib/File/HomeDir/Windows.pm +2 -69
  47. package/bin/exiftool_files/lib/File/HomeDir.pm +5 -416
  48. package/bin/exiftool_files/lib/File/Path.pm +3 -3
  49. package/bin/exiftool_files/lib/File/Spec/Win32.pm +2 -2
  50. package/bin/exiftool_files/lib/File/Temp.pm +70 -35
  51. package/bin/exiftool_files/lib/File/Which.pm +1 -240
  52. package/bin/exiftool_files/lib/File/stat.pm +3 -2
  53. package/bin/exiftool_files/lib/IO/Compress/Adapter/Bzip2.pm +16 -17
  54. package/bin/exiftool_files/lib/IO/Compress/Adapter/Deflate.pm +19 -20
  55. package/bin/exiftool_files/lib/IO/Compress/Base/Common.pm +5 -5
  56. package/bin/exiftool_files/lib/IO/Compress/Base.pm +35 -26
  57. package/bin/exiftool_files/lib/IO/Compress/Brotli.pm +159 -0
  58. package/bin/exiftool_files/lib/IO/Compress/Bzip2.pm +50 -25
  59. package/bin/exiftool_files/lib/IO/Compress/Gzip/Constants.pm +6 -6
  60. package/bin/exiftool_files/lib/IO/Compress/Gzip.pm +58 -32
  61. package/bin/exiftool_files/lib/IO/Compress/RawDeflate.pm +63 -38
  62. package/bin/exiftool_files/lib/IO/Compress/Zlib/Extra.pm +20 -20
  63. package/bin/exiftool_files/lib/IO/Dir.pm +1 -1
  64. package/bin/exiftool_files/lib/IO/File.pm +1 -1
  65. package/bin/exiftool_files/lib/IO/Handle.pm +1 -21
  66. package/bin/exiftool_files/lib/IO/Pipe.pm +1 -1
  67. package/bin/exiftool_files/lib/IO/Seekable.pm +1 -1
  68. package/bin/exiftool_files/lib/IO/Select.pm +16 -2
  69. package/bin/exiftool_files/lib/IO/Socket/INET.pm +14 -9
  70. package/bin/exiftool_files/lib/IO/Socket/UNIX.pm +17 -1
  71. package/bin/exiftool_files/lib/IO/Socket.pm +474 -126
  72. package/bin/exiftool_files/lib/IO/String.pm +425 -0
  73. package/bin/exiftool_files/lib/IO/Uncompress/Adapter/Inflate.pm +13 -14
  74. package/bin/exiftool_files/lib/IO/Uncompress/Base.pm +142 -132
  75. package/bin/exiftool_files/lib/IO/Uncompress/Brotli.pm +119 -0
  76. package/bin/exiftool_files/lib/IO/Uncompress/Gunzip.pm +43 -37
  77. package/bin/exiftool_files/lib/IO/Uncompress/RawInflate.pm +49 -43
  78. package/bin/exiftool_files/lib/IO.pm +2 -2
  79. package/bin/exiftool_files/lib/List/Util.pm +97 -8
  80. package/bin/exiftool_files/lib/MIME/Base64.pm +5 -5
  81. package/bin/exiftool_files/lib/MIME/Charset/_Compat.pm +106 -0
  82. package/bin/exiftool_files/lib/MIME/Charset.pm +1303 -0
  83. package/bin/exiftool_files/lib/Math/BigFloat.pm +444 -27
  84. package/bin/exiftool_files/lib/Math/BigInt/Calc.pm +296 -313
  85. package/bin/exiftool_files/lib/Math/BigInt/FastCalc.pm +1 -1
  86. package/bin/exiftool_files/lib/Math/BigInt/GMP.pm +2 -115
  87. package/bin/exiftool_files/lib/Math/BigInt/LTM.pm +2 -24
  88. package/bin/exiftool_files/lib/Math/BigInt/Lib.pm +61 -32
  89. package/bin/exiftool_files/lib/Math/BigInt.pm +292 -107
  90. package/bin/exiftool_files/lib/POSIX.pm +1 -1
  91. package/bin/exiftool_files/lib/PerlIO/scalar.pm +41 -0
  92. package/bin/exiftool_files/lib/PerlIO.pm +397 -0
  93. package/bin/exiftool_files/lib/Portable/CPAN.pm +94 -94
  94. package/bin/exiftool_files/lib/Portable/Config.pm +94 -94
  95. package/bin/exiftool_files/lib/Portable/FileSpec.pm +180 -180
  96. package/bin/exiftool_files/lib/Portable/HomeDir.pm +110 -110
  97. package/bin/exiftool_files/lib/Portable/LoadYaml.pm +430 -430
  98. package/bin/exiftool_files/lib/Portable/minicpan.pm +55 -55
  99. package/bin/exiftool_files/lib/Portable.pm +246 -320
  100. package/bin/exiftool_files/lib/Scalar/Util.pm +9 -4
  101. package/bin/exiftool_files/lib/Socket.pm +16 -12
  102. package/bin/exiftool_files/lib/Storable.pm +1444 -1441
  103. package/bin/exiftool_files/lib/TAP/Base.pm +133 -0
  104. package/bin/exiftool_files/lib/TAP/Formatter/Base.pm +467 -0
  105. package/bin/exiftool_files/lib/TAP/Formatter/Color.pm +116 -0
  106. package/bin/exiftool_files/lib/TAP/Formatter/Console/ParallelSession.pm +201 -0
  107. package/bin/exiftool_files/lib/TAP/Formatter/Console/Session.pm +205 -0
  108. package/bin/exiftool_files/lib/TAP/Formatter/Console.pm +100 -0
  109. package/bin/exiftool_files/lib/TAP/Formatter/File/Session.pm +95 -0
  110. package/bin/exiftool_files/lib/TAP/Formatter/File.pm +56 -0
  111. package/bin/exiftool_files/lib/TAP/Formatter/Session.pm +220 -0
  112. package/bin/exiftool_files/lib/TAP/Harness/Beyond.pod +426 -0
  113. package/bin/exiftool_files/lib/TAP/Harness/Env.pm +215 -0
  114. package/bin/exiftool_files/lib/TAP/Harness.pm +1054 -0
  115. package/bin/exiftool_files/lib/TAP/Object.pm +155 -0
  116. package/bin/exiftool_files/lib/TAP/Parser/Aggregator.pm +414 -0
  117. package/bin/exiftool_files/lib/TAP/Parser/Grammar.pm +584 -0
  118. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Array.pm +100 -0
  119. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Process.pm +378 -0
  120. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Stream.pm +116 -0
  121. package/bin/exiftool_files/lib/TAP/Parser/Iterator.pm +162 -0
  122. package/bin/exiftool_files/lib/TAP/Parser/IteratorFactory.pm +339 -0
  123. package/bin/exiftool_files/lib/TAP/Parser/Multiplexer.pm +194 -0
  124. package/bin/exiftool_files/lib/TAP/Parser/Result/Bailout.pm +62 -0
  125. package/bin/exiftool_files/lib/TAP/Parser/Result/Comment.pm +60 -0
  126. package/bin/exiftool_files/lib/TAP/Parser/Result/Plan.pm +119 -0
  127. package/bin/exiftool_files/lib/TAP/Parser/Result/Pragma.pm +62 -0
  128. package/bin/exiftool_files/lib/TAP/Parser/Result/Test.pm +271 -0
  129. package/bin/exiftool_files/lib/TAP/Parser/Result/Unknown.pm +48 -0
  130. package/bin/exiftool_files/lib/TAP/Parser/Result/Version.pm +62 -0
  131. package/bin/exiftool_files/lib/TAP/Parser/Result/YAML.pm +61 -0
  132. package/bin/exiftool_files/lib/TAP/Parser/Result.pm +297 -0
  133. package/bin/exiftool_files/lib/TAP/Parser/ResultFactory.pm +183 -0
  134. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Job.pm +127 -0
  135. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Spinner.pm +61 -0
  136. package/bin/exiftool_files/lib/TAP/Parser/Scheduler.pm +448 -0
  137. package/bin/exiftool_files/lib/TAP/Parser/Source.pm +381 -0
  138. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Executable.pm +184 -0
  139. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/File.pm +136 -0
  140. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Handle.pm +124 -0
  141. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Perl.pm +370 -0
  142. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/RawTAP.pm +130 -0
  143. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler.pm +191 -0
  144. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Reader.pm +332 -0
  145. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Writer.pm +254 -0
  146. package/bin/exiftool_files/lib/TAP/Parser.pm +1931 -0
  147. package/bin/exiftool_files/lib/Test/Builder/Formatter.pm +107 -0
  148. package/bin/exiftool_files/lib/Test/Builder/IO/Scalar.pm +659 -0
  149. package/bin/exiftool_files/lib/Test/Builder/Module.pm +182 -0
  150. package/bin/exiftool_files/lib/Test/Builder/Tester/Color.pm +51 -0
  151. package/bin/exiftool_files/lib/Test/Builder/Tester.pm +675 -0
  152. package/bin/exiftool_files/lib/Test/Builder/TodoDiag.pm +68 -0
  153. package/bin/exiftool_files/lib/Test/Builder.pm +2653 -0
  154. package/bin/exiftool_files/lib/Test/Harness.pm +618 -0
  155. package/bin/exiftool_files/lib/Test/More.pm +1997 -0
  156. package/bin/exiftool_files/lib/Test/Simple.pm +220 -0
  157. package/bin/exiftool_files/lib/Test/Tester/Capture.pm +241 -0
  158. package/bin/exiftool_files/lib/Test/Tester/CaptureRunner.pm +79 -0
  159. package/bin/exiftool_files/lib/Test/Tester/Delegate.pm +45 -0
  160. package/bin/exiftool_files/lib/Test/Tester.pm +695 -0
  161. package/bin/exiftool_files/lib/Test/Tutorial.pod +618 -0
  162. package/bin/exiftool_files/lib/Test/use/ok.pm +64 -0
  163. package/bin/exiftool_files/lib/Text/ParseWords.pm +303 -0
  164. package/bin/exiftool_files/lib/Tie/StdHandle.pm +2 -2
  165. package/bin/exiftool_files/lib/Time/HiRes.pm +73 -68
  166. package/bin/exiftool_files/lib/Time/Local.pm +82 -35
  167. package/bin/exiftool_files/lib/Time/Piece.pm +19 -4
  168. package/bin/exiftool_files/lib/Time/Seconds.pm +1 -1
  169. package/bin/exiftool_files/lib/UNIVERSAL.pm +203 -0
  170. package/bin/exiftool_files/lib/Unicode/GCString.pm +60 -0
  171. package/bin/exiftool_files/lib/Unicode/LineBreak/Constants.pm +68 -0
  172. package/bin/exiftool_files/lib/Unicode/LineBreak.pm +248 -0
  173. package/bin/exiftool_files/lib/Win32/API/Struct.pm +1 -177
  174. package/bin/exiftool_files/lib/Win32/API/Type.pm +1 -100
  175. package/bin/exiftool_files/lib/Win32/API.pm +1 -830
  176. package/bin/exiftool_files/lib/Win32/FindFile.pm +2 -123
  177. package/bin/exiftool_files/lib/Win32.pm +213 -89
  178. package/bin/exiftool_files/lib/Win32API/File.pm +1 -1
  179. package/bin/exiftool_files/lib/auto/B/B.xs.dll +0 -0
  180. package/bin/exiftool_files/lib/auto/Compress/Raw/Bzip2/Bzip2.xs.dll +0 -0
  181. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/Lzma.xs.dll +0 -0
  182. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/autosplit.ix +3 -0
  183. package/bin/exiftool_files/lib/auto/Compress/Raw/Zlib/Zlib.xs.dll +0 -0
  184. package/bin/exiftool_files/lib/auto/CryptX/CryptX.xs.dll +0 -0
  185. package/bin/exiftool_files/lib/auto/Cwd/Cwd.xs.dll +0 -0
  186. package/bin/exiftool_files/lib/auto/Data/Dumper/Dumper.xs.dll +0 -0
  187. package/bin/exiftool_files/lib/auto/Digest/MD5/MD5.xs.dll +0 -0
  188. package/bin/exiftool_files/lib/auto/Digest/SHA/SHA.xs.dll +0 -0
  189. package/bin/exiftool_files/lib/auto/Encode/Encode.xs.dll +0 -0
  190. package/bin/exiftool_files/lib/auto/Fcntl/Fcntl.xs.dll +0 -0
  191. package/bin/exiftool_files/lib/auto/File/Glob/Glob.xs.dll +0 -0
  192. package/bin/exiftool_files/lib/auto/IO/Compress/Brotli/Brotli.xs.dll +0 -0
  193. package/bin/exiftool_files/lib/auto/IO/IO.xs.dll +0 -0
  194. package/bin/exiftool_files/lib/auto/List/Util/Util.xs.dll +0 -0
  195. package/bin/exiftool_files/lib/auto/MIME/Base64/Base64.xs.dll +0 -0
  196. package/bin/exiftool_files/lib/auto/Math/BigInt/FastCalc/FastCalc.xs.dll +0 -0
  197. package/bin/exiftool_files/lib/auto/Math/BigInt/GMP/GMP.xs.dll +0 -0
  198. package/bin/exiftool_files/lib/auto/POSIX/POSIX.xs.dll +0 -0
  199. package/bin/exiftool_files/lib/auto/PerlIO/scalar/scalar.xs.dll +0 -0
  200. package/bin/exiftool_files/lib/auto/Socket/Socket.xs.dll +0 -0
  201. package/bin/exiftool_files/lib/auto/Storable/Storable.xs.dll +0 -0
  202. package/bin/exiftool_files/lib/auto/Time/HiRes/HiRes.xs.dll +0 -0
  203. package/bin/exiftool_files/lib/auto/Time/Piece/Piece.xs.dll +0 -0
  204. package/bin/exiftool_files/lib/auto/Unicode/LineBreak/LineBreak.xs.dll +0 -0
  205. package/bin/exiftool_files/lib/auto/Win32/API/API.xs.dll +0 -0
  206. package/bin/exiftool_files/lib/auto/Win32/FindFile/FindFile.xs.dll +0 -0
  207. package/bin/exiftool_files/lib/auto/Win32/Win32.xs.dll +0 -0
  208. package/bin/exiftool_files/lib/auto/Win32API/File/File.xs.dll +0 -0
  209. package/bin/exiftool_files/lib/auto/mro/mro.xs.dll +0 -0
  210. package/bin/exiftool_files/lib/auto/re/re.xs.dll +0 -0
  211. package/bin/exiftool_files/lib/feature.pm +49 -17
  212. package/bin/exiftool_files/lib/mro.pm +4 -20
  213. package/bin/exiftool_files/lib/overload.pm +15 -15
  214. package/bin/exiftool_files/lib/parent.pm +10 -2
  215. package/bin/exiftool_files/lib/re.pm +91 -33
  216. package/bin/exiftool_files/lib/warnings.pm +17 -6
  217. package/bin/exiftool_files/libgcc_s_seh-1.dll +0 -0
  218. package/bin/exiftool_files/liblzma-5__.dll +0 -0
  219. package/bin/exiftool_files/libstdc++-6.dll +0 -0
  220. package/bin/exiftool_files/libwinpthread-1.dll +0 -0
  221. package/bin/exiftool_files/perl.exe +0 -0
  222. package/bin/exiftool_files/perl532.dll +0 -0
  223. package/package.json +5 -3
  224. package/bin/exiftool_files/libgcc_s_dw2-1.dll +0 -0
  225. package/bin/exiftool_files/perl530.dll +0 -0
@@ -0,0 +1,155 @@
1
+ package TAP::Object;
2
+
3
+ use strict;
4
+ use warnings;
5
+
6
+ =head1 NAME
7
+
8
+ TAP::Object - Base class that provides common functionality to all C<TAP::*> modules
9
+
10
+ =head1 VERSION
11
+
12
+ Version 3.42
13
+
14
+ =cut
15
+
16
+ our $VERSION = '3.42';
17
+
18
+ =head1 SYNOPSIS
19
+
20
+ package TAP::Whatever;
21
+
22
+ use strict;
23
+
24
+ use base 'TAP::Object';
25
+
26
+ # new() implementation by TAP::Object
27
+ sub _initialize {
28
+ my ( $self, @args) = @_;
29
+ # initialize your object
30
+ return $self;
31
+ }
32
+
33
+ # ... later ...
34
+ my $obj = TAP::Whatever->new(@args);
35
+
36
+ =head1 DESCRIPTION
37
+
38
+ C<TAP::Object> provides a default constructor and exception model for all
39
+ C<TAP::*> classes. Exceptions are raised using L<Carp>.
40
+
41
+ =head1 METHODS
42
+
43
+ =head2 Class Methods
44
+
45
+ =head3 C<new>
46
+
47
+ Create a new object. Any arguments passed to C<new> will be passed on to the
48
+ L</_initialize> method. Returns a new object.
49
+
50
+ =cut
51
+
52
+ sub new {
53
+ my $class = shift;
54
+ my $self = bless {}, $class;
55
+ return $self->_initialize(@_);
56
+ }
57
+
58
+ =head2 Instance Methods
59
+
60
+ =head3 C<_initialize>
61
+
62
+ Initializes a new object. This method is a stub by default, you should override
63
+ it as appropriate.
64
+
65
+ I<Note:> L</new> expects you to return C<$self> or raise an exception. See
66
+ L</_croak>, and L<Carp>.
67
+
68
+ =cut
69
+
70
+ sub _initialize {
71
+ return $_[0];
72
+ }
73
+
74
+ =head3 C<_croak>
75
+
76
+ Raise an exception using C<croak> from L<Carp>, eg:
77
+
78
+ $self->_croak( 'why me?', 'aaarrgh!' );
79
+
80
+ May also be called as a I<class> method.
81
+
82
+ $class->_croak( 'this works too' );
83
+
84
+ =cut
85
+
86
+ sub _croak {
87
+ my $proto = shift;
88
+ require Carp;
89
+ Carp::croak(@_);
90
+ return;
91
+ }
92
+
93
+ =head3 C<_confess>
94
+
95
+ Raise an exception using C<confess> from L<Carp>, eg:
96
+
97
+ $self->_confess( 'why me?', 'aaarrgh!' );
98
+
99
+ May also be called as a I<class> method.
100
+
101
+ $class->_confess( 'this works too' );
102
+
103
+ =cut
104
+
105
+ sub _confess {
106
+ my $proto = shift;
107
+ require Carp;
108
+ Carp::confess(@_);
109
+ return;
110
+ }
111
+
112
+ =head3 C<_construct>
113
+
114
+ Create a new instance of the specified class.
115
+
116
+ =cut
117
+
118
+ sub _construct {
119
+ my ( $self, $class, @args ) = @_;
120
+
121
+ $self->_croak("Bad module name $class")
122
+ unless $class =~ /^ \w+ (?: :: \w+ ) *$/x;
123
+
124
+ unless ( $class->can('new') ) {
125
+ local $@;
126
+ eval "require $class";
127
+ $self->_croak("Can't load $class: $@") if $@;
128
+ }
129
+
130
+ return $class->new(@args);
131
+ }
132
+
133
+ =head3 C<mk_methods>
134
+
135
+ Create simple getter/setters.
136
+
137
+ __PACKAGE__->mk_methods(@method_names);
138
+
139
+ =cut
140
+
141
+ sub mk_methods {
142
+ my ( $class, @methods ) = @_;
143
+ for my $method_name (@methods) {
144
+ my $method = "${class}::$method_name";
145
+ no strict 'refs';
146
+ *$method = sub {
147
+ my $self = shift;
148
+ $self->{$method_name} = shift if @_;
149
+ return $self->{$method_name};
150
+ };
151
+ }
152
+ }
153
+
154
+ 1;
155
+
@@ -0,0 +1,414 @@
1
+ package TAP::Parser::Aggregator;
2
+
3
+ use strict;
4
+ use warnings;
5
+ use Benchmark;
6
+
7
+ use base 'TAP::Object';
8
+
9
+ =head1 NAME
10
+
11
+ TAP::Parser::Aggregator - Aggregate TAP::Parser results
12
+
13
+ =head1 VERSION
14
+
15
+ Version 3.42
16
+
17
+ =cut
18
+
19
+ our $VERSION = '3.42';
20
+
21
+ =head1 SYNOPSIS
22
+
23
+ use TAP::Parser::Aggregator;
24
+
25
+ my $aggregate = TAP::Parser::Aggregator->new;
26
+ $aggregate->add( 't/00-load.t', $load_parser );
27
+ $aggregate->add( 't/10-lex.t', $lex_parser );
28
+
29
+ my $summary = <<'END_SUMMARY';
30
+ Passed: %s
31
+ Failed: %s
32
+ Unexpectedly succeeded: %s
33
+ END_SUMMARY
34
+ printf $summary,
35
+ scalar $aggregate->passed,
36
+ scalar $aggregate->failed,
37
+ scalar $aggregate->todo_passed;
38
+
39
+ =head1 DESCRIPTION
40
+
41
+ C<TAP::Parser::Aggregator> collects parser objects and allows
42
+ reporting/querying their aggregate results.
43
+
44
+ =head1 METHODS
45
+
46
+ =head2 Class Methods
47
+
48
+ =head3 C<new>
49
+
50
+ my $aggregate = TAP::Parser::Aggregator->new;
51
+
52
+ Returns a new C<TAP::Parser::Aggregator> object.
53
+
54
+ =cut
55
+
56
+ # new() implementation supplied by TAP::Object
57
+
58
+ my %SUMMARY_METHOD_FOR;
59
+
60
+ BEGIN { # install summary methods
61
+ %SUMMARY_METHOD_FOR = map { $_ => $_ } qw(
62
+ failed
63
+ parse_errors
64
+ passed
65
+ skipped
66
+ todo
67
+ todo_passed
68
+ total
69
+ wait
70
+ exit
71
+ );
72
+ $SUMMARY_METHOD_FOR{total} = 'tests_run';
73
+ $SUMMARY_METHOD_FOR{planned} = 'tests_planned';
74
+
75
+ for my $method ( keys %SUMMARY_METHOD_FOR ) {
76
+ next if 'total' eq $method;
77
+ no strict 'refs';
78
+ *$method = sub {
79
+ my $self = shift;
80
+ return wantarray
81
+ ? @{ $self->{"descriptions_for_$method"} }
82
+ : $self->{$method};
83
+ };
84
+ }
85
+ } # end install summary methods
86
+
87
+ sub _initialize {
88
+ my ($self) = @_;
89
+ $self->{parser_for} = {};
90
+ $self->{parse_order} = [];
91
+ for my $summary ( keys %SUMMARY_METHOD_FOR ) {
92
+ $self->{$summary} = 0;
93
+ next if 'total' eq $summary;
94
+ $self->{"descriptions_for_$summary"} = [];
95
+ }
96
+ return $self;
97
+ }
98
+
99
+ ##############################################################################
100
+
101
+ =head2 Instance Methods
102
+
103
+ =head3 C<add>
104
+
105
+ $aggregate->add( $description => $parser );
106
+
107
+ The C<$description> is usually a test file name (but only by
108
+ convention.) It is used as a unique identifier (see e.g.
109
+ L<"parsers">.) Reusing a description is a fatal error.
110
+
111
+ The C<$parser> is a L<TAP::Parser|TAP::Parser> object.
112
+
113
+ =cut
114
+
115
+ sub add {
116
+ my ( $self, $description, $parser ) = @_;
117
+ if ( exists $self->{parser_for}{$description} ) {
118
+ $self->_croak( "You already have a parser for ($description)."
119
+ . " Perhaps you have run the same test twice." );
120
+ }
121
+ push @{ $self->{parse_order} } => $description;
122
+ $self->{parser_for}{$description} = $parser;
123
+
124
+ while ( my ( $summary, $method ) = each %SUMMARY_METHOD_FOR ) {
125
+
126
+ # Slightly nasty. Instead we should maybe have 'cooked' accessors
127
+ # for results that may be masked by the parser.
128
+ next
129
+ if ( $method eq 'exit' || $method eq 'wait' )
130
+ && $parser->ignore_exit;
131
+
132
+ if ( my $count = $parser->$method() ) {
133
+ $self->{$summary} += $count;
134
+ push @{ $self->{"descriptions_for_$summary"} } => $description;
135
+ }
136
+ }
137
+
138
+ return $self;
139
+ }
140
+
141
+ ##############################################################################
142
+
143
+ =head3 C<parsers>
144
+
145
+ my $count = $aggregate->parsers;
146
+ my @parsers = $aggregate->parsers;
147
+ my @parsers = $aggregate->parsers(@descriptions);
148
+
149
+ In scalar context without arguments, this method returns the number of parsers
150
+ aggregated. In list context without arguments, returns the parsers in the
151
+ order they were added.
152
+
153
+ If C<@descriptions> is given, these correspond to the keys used in each
154
+ call to the add() method. Returns an array of the requested parsers (in
155
+ the requested order) in list context or an array reference in scalar
156
+ context.
157
+
158
+ Requesting an unknown identifier is a fatal error.
159
+
160
+ =cut
161
+
162
+ sub parsers {
163
+ my $self = shift;
164
+ return $self->_get_parsers(@_) if @_;
165
+ my $descriptions = $self->{parse_order};
166
+ my @parsers = @{ $self->{parser_for} }{@$descriptions};
167
+
168
+ # Note: Because of the way context works, we must assign the parsers to
169
+ # the @parsers array or else this method does not work as documented.
170
+ return @parsers;
171
+ }
172
+
173
+ sub _get_parsers {
174
+ my ( $self, @descriptions ) = @_;
175
+ my @parsers;
176
+ for my $description (@descriptions) {
177
+ $self->_croak("A parser for ($description) could not be found")
178
+ unless exists $self->{parser_for}{$description};
179
+ push @parsers => $self->{parser_for}{$description};
180
+ }
181
+ return wantarray ? @parsers : \@parsers;
182
+ }
183
+
184
+ =head3 C<descriptions>
185
+
186
+ Get an array of descriptions in the order in which they were added to
187
+ the aggregator.
188
+
189
+ =cut
190
+
191
+ sub descriptions { @{ shift->{parse_order} || [] } }
192
+
193
+ =head3 C<start>
194
+
195
+ Call C<start> immediately before adding any results to the aggregator.
196
+ Among other times it records the start time for the test run.
197
+
198
+ =cut
199
+
200
+ sub start {
201
+ my $self = shift;
202
+ $self->{start_time} = Benchmark->new;
203
+ }
204
+
205
+ =head3 C<stop>
206
+
207
+ Call C<stop> immediately after adding all test results to the aggregator.
208
+
209
+ =cut
210
+
211
+ sub stop {
212
+ my $self = shift;
213
+ $self->{end_time} = Benchmark->new;
214
+ }
215
+
216
+ =head3 C<elapsed>
217
+
218
+ Elapsed returns a L<Benchmark> object that represents the running time
219
+ of the aggregated tests. In order for C<elapsed> to be valid you must
220
+ call C<start> before running the tests and C<stop> immediately
221
+ afterwards.
222
+
223
+ =cut
224
+
225
+ sub elapsed {
226
+ my $self = shift;
227
+
228
+ require Carp;
229
+ Carp::croak
230
+ q{Can't call elapsed without first calling start and then stop}
231
+ unless defined $self->{start_time} && defined $self->{end_time};
232
+ return timediff( $self->{end_time}, $self->{start_time} );
233
+ }
234
+
235
+ =head3 C<elapsed_timestr>
236
+
237
+ Returns a formatted string representing the runtime returned by
238
+ C<elapsed()>. This lets the caller not worry about Benchmark.
239
+
240
+ =cut
241
+
242
+ sub elapsed_timestr {
243
+ my $self = shift;
244
+
245
+ my $elapsed = $self->elapsed;
246
+
247
+ return timestr($elapsed);
248
+ }
249
+
250
+ =head3 C<all_passed>
251
+
252
+ Return true if all the tests passed and no parse errors were detected.
253
+
254
+ =cut
255
+
256
+ sub all_passed {
257
+ my $self = shift;
258
+ return
259
+ $self->total
260
+ && $self->total == $self->passed
261
+ && !$self->has_errors;
262
+ }
263
+
264
+ =head3 C<get_status>
265
+
266
+ Get a single word describing the status of the aggregated tests.
267
+ Depending on the outcome of the tests returns 'PASS', 'FAIL' or
268
+ 'NOTESTS'. This token is understood by L<CPAN::Reporter>.
269
+
270
+ =cut
271
+
272
+ sub get_status {
273
+ my $self = shift;
274
+
275
+ my $total = $self->total;
276
+ my $passed = $self->passed;
277
+
278
+ return
279
+ ( $self->has_errors || $total != $passed ) ? 'FAIL'
280
+ : $total ? 'PASS'
281
+ : 'NOTESTS';
282
+ }
283
+
284
+ ##############################################################################
285
+
286
+ =head2 Summary methods
287
+
288
+ Each of the following methods will return the total number of corresponding
289
+ tests if called in scalar context. If called in list context, returns the
290
+ descriptions of the parsers which contain the corresponding tests (see C<add>
291
+ for an explanation of description.
292
+
293
+ =over 4
294
+
295
+ =item * failed
296
+
297
+ =item * parse_errors
298
+
299
+ =item * passed
300
+
301
+ =item * planned
302
+
303
+ =item * skipped
304
+
305
+ =item * todo
306
+
307
+ =item * todo_passed
308
+
309
+ =item * wait
310
+
311
+ =item * exit
312
+
313
+ =back
314
+
315
+ For example, to find out how many tests unexpectedly succeeded (TODO tests
316
+ which passed when they shouldn't):
317
+
318
+ my $count = $aggregate->todo_passed;
319
+ my @descriptions = $aggregate->todo_passed;
320
+
321
+ Note that C<wait> and C<exit> are the totals of the wait and exit
322
+ statuses of each of the tests. These values are totalled only to provide
323
+ a true value if any of them are non-zero.
324
+
325
+ =cut
326
+
327
+ ##############################################################################
328
+
329
+ =head3 C<total>
330
+
331
+ my $tests_run = $aggregate->total;
332
+
333
+ Returns the total number of tests run.
334
+
335
+ =cut
336
+
337
+ sub total { shift->{total} }
338
+
339
+ ##############################################################################
340
+
341
+ =head3 C<has_problems>
342
+
343
+ if ( $parser->has_problems ) {
344
+ ...
345
+ }
346
+
347
+ Identical to C<has_errors>, but also returns true if any TODO tests
348
+ unexpectedly succeeded. This is more akin to "warnings".
349
+
350
+ =cut
351
+
352
+ sub has_problems {
353
+ my $self = shift;
354
+ return $self->todo_passed
355
+ || $self->has_errors;
356
+ }
357
+
358
+ ##############################################################################
359
+
360
+ =head3 C<has_errors>
361
+
362
+ if ( $parser->has_errors ) {
363
+ ...
364
+ }
365
+
366
+ Returns true if I<any> of the parsers failed. This includes:
367
+
368
+ =over 4
369
+
370
+ =item * Failed tests
371
+
372
+ =item * Parse errors
373
+
374
+ =item * Bad exit or wait status
375
+
376
+ =back
377
+
378
+ =cut
379
+
380
+ sub has_errors {
381
+ my $self = shift;
382
+ return
383
+ $self->failed
384
+ || $self->parse_errors
385
+ || $self->exit
386
+ || $self->wait;
387
+ }
388
+
389
+ ##############################################################################
390
+
391
+ =head3 C<todo_failed>
392
+
393
+ # deprecated in favor of 'todo_passed'. This method was horribly misnamed.
394
+
395
+ This was a badly misnamed method. It indicates which TODO tests unexpectedly
396
+ succeeded. Will now issue a warning and call C<todo_passed>.
397
+
398
+ =cut
399
+
400
+ sub todo_failed {
401
+ warn
402
+ '"todo_failed" is deprecated. Please use "todo_passed". See the docs.';
403
+ goto &todo_passed;
404
+ }
405
+
406
+ =head1 See Also
407
+
408
+ L<TAP::Parser>
409
+
410
+ L<TAP::Harness>
411
+
412
+ =cut
413
+
414
+ 1;