exiftool-vendored.exe 12.80.0 → 12.82.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/bin/exiftool.exe +0 -0
- package/bin/exiftool_files/Changes +44 -0
- package/bin/exiftool_files/Licenses_Strawberry_Perl.zip +0 -0
- package/bin/exiftool_files/README +3 -2
- package/bin/exiftool_files/exiftool.pl +36 -14
- package/bin/exiftool_files/lib/Archive/Zip/Archive.pm +399 -65
- package/bin/exiftool_files/lib/Archive/Zip/DirectoryMember.pm +1 -1
- package/bin/exiftool_files/lib/Archive/Zip/FileMember.pm +1 -1
- package/bin/exiftool_files/lib/Archive/Zip/Member.pm +499 -195
- package/bin/exiftool_files/lib/Archive/Zip/NewFileMember.pm +1 -1
- package/bin/exiftool_files/lib/Archive/Zip/StringMember.pm +2 -2
- package/bin/exiftool_files/lib/Archive/Zip/ZipFileMember.pm +79 -20
- package/bin/exiftool_files/lib/Archive/Zip.pm +179 -29
- package/bin/exiftool_files/lib/AutoLoader.pm +453 -0
- package/bin/exiftool_files/lib/B/Deparse.pm +209 -137
- package/bin/exiftool_files/lib/B.pm +1 -1
- package/bin/exiftool_files/lib/Benchmark.pm +1123 -0
- package/bin/exiftool_files/lib/Class/Struct.pm +2 -2
- package/bin/exiftool_files/lib/Compress/Raw/Bzip2.pm +14 -9
- package/bin/exiftool_files/lib/Compress/Raw/Lzma.pm +982 -0
- package/bin/exiftool_files/lib/Compress/Raw/Zlib.pm +91 -86
- package/bin/exiftool_files/lib/Compress/Zlib.pm +105 -100
- package/bin/exiftool_files/lib/Config.pm +9 -9
- package/bin/exiftool_files/lib/Config_heavy.pl +36 -33
- package/bin/exiftool_files/lib/CryptX.pm +2 -82
- package/bin/exiftool_files/lib/Data/Dumper.pm +2 -2
- package/bin/exiftool_files/lib/Digest/MD5.pm +12 -9
- package/bin/exiftool_files/lib/Digest/Perl/MD5.pm +1 -191
- package/bin/exiftool_files/lib/Digest/base.pm +26 -20
- package/bin/exiftool_files/lib/DynaLoader.pm +7 -4
- package/bin/exiftool_files/lib/Encode.pm +3 -3
- package/bin/exiftool_files/lib/Errno.pm +13 -13
- package/bin/exiftool_files/lib/Exporter/Heavy.pm +2 -2
- package/bin/exiftool_files/lib/Exporter.pm +1 -1
- package/bin/exiftool_files/lib/ExtUtils/Command/MM.pm +323 -0
- package/bin/exiftool_files/lib/ExtUtils/Command.pm +382 -0
- package/bin/exiftool_files/lib/File/Find.pm +1 -1
- package/bin/exiftool_files/lib/File/Glob.pm +1 -8
- package/bin/exiftool_files/lib/File/GlobMapper.pm +2 -2
- package/bin/exiftool_files/lib/File/HomeDir/Darwin/Carbon.pm +2 -40
- package/bin/exiftool_files/lib/File/HomeDir/Darwin/Cocoa.pm +2 -34
- package/bin/exiftool_files/lib/File/HomeDir/Darwin.pm +2 -28
- package/bin/exiftool_files/lib/File/HomeDir/Driver.pm +2 -35
- package/bin/exiftool_files/lib/File/HomeDir/FreeDesktop.pm +2 -62
- package/bin/exiftool_files/lib/File/HomeDir/MacOS9.pm +2 -53
- package/bin/exiftool_files/lib/File/HomeDir/Test.pm +2 -43
- package/bin/exiftool_files/lib/File/HomeDir/Unix.pm +2 -53
- package/bin/exiftool_files/lib/File/HomeDir/Windows.pm +2 -69
- package/bin/exiftool_files/lib/File/HomeDir.pm +5 -416
- package/bin/exiftool_files/lib/File/Path.pm +3 -3
- package/bin/exiftool_files/lib/File/Spec/Win32.pm +2 -2
- package/bin/exiftool_files/lib/File/Temp.pm +70 -35
- package/bin/exiftool_files/lib/File/Which.pm +1 -240
- package/bin/exiftool_files/lib/File/stat.pm +3 -2
- package/bin/exiftool_files/lib/IO/Compress/Adapter/Bzip2.pm +16 -17
- package/bin/exiftool_files/lib/IO/Compress/Adapter/Deflate.pm +19 -20
- package/bin/exiftool_files/lib/IO/Compress/Base/Common.pm +5 -5
- package/bin/exiftool_files/lib/IO/Compress/Base.pm +35 -26
- package/bin/exiftool_files/lib/IO/Compress/Brotli.pm +159 -0
- package/bin/exiftool_files/lib/IO/Compress/Bzip2.pm +50 -25
- package/bin/exiftool_files/lib/IO/Compress/Gzip/Constants.pm +6 -6
- package/bin/exiftool_files/lib/IO/Compress/Gzip.pm +58 -32
- package/bin/exiftool_files/lib/IO/Compress/RawDeflate.pm +63 -38
- package/bin/exiftool_files/lib/IO/Compress/Zlib/Extra.pm +20 -20
- package/bin/exiftool_files/lib/IO/Dir.pm +1 -1
- package/bin/exiftool_files/lib/IO/File.pm +1 -1
- package/bin/exiftool_files/lib/IO/Handle.pm +1 -21
- package/bin/exiftool_files/lib/IO/Pipe.pm +1 -1
- package/bin/exiftool_files/lib/IO/Seekable.pm +1 -1
- package/bin/exiftool_files/lib/IO/Select.pm +16 -2
- package/bin/exiftool_files/lib/IO/Socket/INET.pm +14 -9
- package/bin/exiftool_files/lib/IO/Socket/UNIX.pm +17 -1
- package/bin/exiftool_files/lib/IO/Socket.pm +474 -126
- package/bin/exiftool_files/lib/IO/String.pm +425 -0
- package/bin/exiftool_files/lib/IO/Uncompress/Adapter/Inflate.pm +13 -14
- package/bin/exiftool_files/lib/IO/Uncompress/Base.pm +142 -132
- package/bin/exiftool_files/lib/IO/Uncompress/Brotli.pm +119 -0
- package/bin/exiftool_files/lib/IO/Uncompress/Gunzip.pm +43 -37
- package/bin/exiftool_files/lib/IO/Uncompress/RawInflate.pm +49 -43
- package/bin/exiftool_files/lib/IO.pm +2 -2
- package/bin/exiftool_files/lib/Image/ExifTool/BuildTagLookup.pm +44 -31
- package/bin/exiftool_files/lib/Image/ExifTool/CanonVRD.pm +2 -2
- package/bin/exiftool_files/lib/Image/ExifTool/FujiFilm.pm +20 -7
- package/bin/exiftool_files/lib/Image/ExifTool/GM.pm +543 -0
- package/bin/exiftool_files/lib/Image/ExifTool/Geolocation.pm +332 -149
- package/bin/exiftool_files/lib/Image/ExifTool/Geotag.pm +9 -4
- package/bin/exiftool_files/lib/Image/ExifTool/M2TS.pm +32 -4
- package/bin/exiftool_files/lib/Image/ExifTool/MakerNotes.pm +2 -2
- package/bin/exiftool_files/lib/Image/ExifTool/Microsoft.pm +1 -1
- package/bin/exiftool_files/lib/Image/ExifTool/Nikon.pm +331 -22
- package/bin/exiftool_files/lib/Image/ExifTool/NikonCustom.pm +55 -1
- package/bin/exiftool_files/lib/Image/ExifTool/Olympus.pm +1 -0
- package/bin/exiftool_files/lib/Image/ExifTool/OpenEXR.pm +21 -3
- package/bin/exiftool_files/lib/Image/ExifTool/PNG.pm +3 -3
- package/bin/exiftool_files/lib/Image/ExifTool/QuickTime.pm +40 -24
- package/bin/exiftool_files/lib/Image/ExifTool/QuickTimeStream.pl +61 -30
- package/bin/exiftool_files/lib/Image/ExifTool/README +2 -0
- package/bin/exiftool_files/lib/Image/ExifTool/Sony.pm +1 -1
- package/bin/exiftool_files/lib/Image/ExifTool/TagLookup.pm +4815 -4775
- package/bin/exiftool_files/lib/Image/ExifTool/TagNames.pod +931 -617
- package/bin/exiftool_files/lib/Image/ExifTool/WriteQuickTime.pl +30 -8
- package/bin/exiftool_files/lib/Image/ExifTool/Writer.pl +10 -4
- package/bin/exiftool_files/lib/Image/ExifTool/XMP.pm +4 -2
- package/bin/exiftool_files/lib/Image/ExifTool.pm +77 -41
- package/bin/exiftool_files/lib/Image/ExifTool.pod +24 -11
- package/bin/exiftool_files/lib/List/Util.pm +97 -8
- package/bin/exiftool_files/lib/MIME/Base64.pm +5 -5
- package/bin/exiftool_files/lib/MIME/Charset/_Compat.pm +106 -0
- package/bin/exiftool_files/lib/MIME/Charset.pm +1303 -0
- package/bin/exiftool_files/lib/Math/BigFloat.pm +444 -27
- package/bin/exiftool_files/lib/Math/BigInt/Calc.pm +296 -313
- package/bin/exiftool_files/lib/Math/BigInt/FastCalc.pm +1 -1
- package/bin/exiftool_files/lib/Math/BigInt/GMP.pm +2 -115
- package/bin/exiftool_files/lib/Math/BigInt/LTM.pm +2 -24
- package/bin/exiftool_files/lib/Math/BigInt/Lib.pm +61 -32
- package/bin/exiftool_files/lib/Math/BigInt.pm +292 -107
- package/bin/exiftool_files/lib/POSIX.pm +1 -1
- package/bin/exiftool_files/lib/PerlIO/scalar.pm +41 -0
- package/bin/exiftool_files/lib/PerlIO.pm +397 -0
- package/bin/exiftool_files/lib/Portable/CPAN.pm +94 -94
- package/bin/exiftool_files/lib/Portable/Config.pm +94 -94
- package/bin/exiftool_files/lib/Portable/FileSpec.pm +180 -180
- package/bin/exiftool_files/lib/Portable/HomeDir.pm +110 -110
- package/bin/exiftool_files/lib/Portable/LoadYaml.pm +430 -430
- package/bin/exiftool_files/lib/Portable/minicpan.pm +55 -55
- package/bin/exiftool_files/lib/Portable.pm +246 -320
- package/bin/exiftool_files/lib/Scalar/Util.pm +9 -4
- package/bin/exiftool_files/lib/Socket.pm +16 -12
- package/bin/exiftool_files/lib/Storable.pm +1444 -1441
- package/bin/exiftool_files/lib/TAP/Base.pm +133 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Base.pm +467 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Color.pm +116 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Console/ParallelSession.pm +201 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Console/Session.pm +205 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Console.pm +100 -0
- package/bin/exiftool_files/lib/TAP/Formatter/File/Session.pm +95 -0
- package/bin/exiftool_files/lib/TAP/Formatter/File.pm +56 -0
- package/bin/exiftool_files/lib/TAP/Formatter/Session.pm +220 -0
- package/bin/exiftool_files/lib/TAP/Harness/Beyond.pod +426 -0
- package/bin/exiftool_files/lib/TAP/Harness/Env.pm +215 -0
- package/bin/exiftool_files/lib/TAP/Harness.pm +1054 -0
- package/bin/exiftool_files/lib/TAP/Object.pm +155 -0
- package/bin/exiftool_files/lib/TAP/Parser/Aggregator.pm +414 -0
- package/bin/exiftool_files/lib/TAP/Parser/Grammar.pm +584 -0
- package/bin/exiftool_files/lib/TAP/Parser/Iterator/Array.pm +100 -0
- package/bin/exiftool_files/lib/TAP/Parser/Iterator/Process.pm +378 -0
- package/bin/exiftool_files/lib/TAP/Parser/Iterator/Stream.pm +116 -0
- package/bin/exiftool_files/lib/TAP/Parser/Iterator.pm +162 -0
- package/bin/exiftool_files/lib/TAP/Parser/IteratorFactory.pm +339 -0
- package/bin/exiftool_files/lib/TAP/Parser/Multiplexer.pm +194 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Bailout.pm +62 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Comment.pm +60 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Plan.pm +119 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Pragma.pm +62 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Test.pm +271 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Unknown.pm +48 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/Version.pm +62 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result/YAML.pm +61 -0
- package/bin/exiftool_files/lib/TAP/Parser/Result.pm +297 -0
- package/bin/exiftool_files/lib/TAP/Parser/ResultFactory.pm +183 -0
- package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Job.pm +127 -0
- package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Spinner.pm +61 -0
- package/bin/exiftool_files/lib/TAP/Parser/Scheduler.pm +448 -0
- package/bin/exiftool_files/lib/TAP/Parser/Source.pm +381 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Executable.pm +184 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/File.pm +136 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Handle.pm +124 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Perl.pm +370 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/RawTAP.pm +130 -0
- package/bin/exiftool_files/lib/TAP/Parser/SourceHandler.pm +191 -0
- package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Reader.pm +332 -0
- package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Writer.pm +254 -0
- package/bin/exiftool_files/lib/TAP/Parser.pm +1931 -0
- package/bin/exiftool_files/lib/Test/Builder/Formatter.pm +107 -0
- package/bin/exiftool_files/lib/Test/Builder/IO/Scalar.pm +659 -0
- package/bin/exiftool_files/lib/Test/Builder/Module.pm +182 -0
- package/bin/exiftool_files/lib/Test/Builder/Tester/Color.pm +51 -0
- package/bin/exiftool_files/lib/Test/Builder/Tester.pm +675 -0
- package/bin/exiftool_files/lib/Test/Builder/TodoDiag.pm +68 -0
- package/bin/exiftool_files/lib/Test/Builder.pm +2653 -0
- package/bin/exiftool_files/lib/Test/Harness.pm +618 -0
- package/bin/exiftool_files/lib/Test/More.pm +1997 -0
- package/bin/exiftool_files/lib/Test/Simple.pm +220 -0
- package/bin/exiftool_files/lib/Test/Tester/Capture.pm +241 -0
- package/bin/exiftool_files/lib/Test/Tester/CaptureRunner.pm +79 -0
- package/bin/exiftool_files/lib/Test/Tester/Delegate.pm +45 -0
- package/bin/exiftool_files/lib/Test/Tester.pm +695 -0
- package/bin/exiftool_files/lib/Test/Tutorial.pod +618 -0
- package/bin/exiftool_files/lib/Test/use/ok.pm +64 -0
- package/bin/exiftool_files/lib/Text/ParseWords.pm +303 -0
- package/bin/exiftool_files/lib/Tie/StdHandle.pm +2 -2
- package/bin/exiftool_files/lib/Time/HiRes.pm +73 -68
- package/bin/exiftool_files/lib/Time/Local.pm +82 -35
- package/bin/exiftool_files/lib/Time/Piece.pm +19 -4
- package/bin/exiftool_files/lib/Time/Seconds.pm +1 -1
- package/bin/exiftool_files/lib/UNIVERSAL.pm +203 -0
- package/bin/exiftool_files/lib/Unicode/GCString.pm +60 -0
- package/bin/exiftool_files/lib/Unicode/LineBreak/Constants.pm +68 -0
- package/bin/exiftool_files/lib/Unicode/LineBreak.pm +248 -0
- package/bin/exiftool_files/lib/Win32/API/Struct.pm +1 -177
- package/bin/exiftool_files/lib/Win32/API/Type.pm +1 -100
- package/bin/exiftool_files/lib/Win32/API.pm +1 -830
- package/bin/exiftool_files/lib/Win32/FindFile.pm +2 -123
- package/bin/exiftool_files/lib/Win32.pm +213 -89
- package/bin/exiftool_files/lib/Win32API/File.pm +1 -1
- package/bin/exiftool_files/lib/auto/B/B.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Compress/Raw/Bzip2/Bzip2.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/Lzma.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/autosplit.ix +3 -0
- package/bin/exiftool_files/lib/auto/Compress/Raw/Zlib/Zlib.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/CryptX/CryptX.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Cwd/Cwd.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Data/Dumper/Dumper.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Digest/MD5/MD5.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Digest/SHA/SHA.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Encode/Encode.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Fcntl/Fcntl.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/File/Glob/Glob.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/IO/Compress/Brotli/Brotli.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/IO/IO.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/List/Util/Util.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/MIME/Base64/Base64.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Math/BigInt/FastCalc/FastCalc.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Math/BigInt/GMP/GMP.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/POSIX/POSIX.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/PerlIO/scalar/scalar.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Socket/Socket.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Storable/Storable.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Time/HiRes/HiRes.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Time/Piece/Piece.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Unicode/LineBreak/LineBreak.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Win32/API/API.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Win32/FindFile/FindFile.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Win32/Win32.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/Win32API/File/File.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/mro/mro.xs.dll +0 -0
- package/bin/exiftool_files/lib/auto/re/re.xs.dll +0 -0
- package/bin/exiftool_files/lib/feature.pm +49 -17
- package/bin/exiftool_files/lib/mro.pm +4 -20
- package/bin/exiftool_files/lib/overload.pm +15 -15
- package/bin/exiftool_files/lib/parent.pm +10 -2
- package/bin/exiftool_files/lib/re.pm +91 -33
- package/bin/exiftool_files/lib/warnings.pm +17 -6
- package/bin/exiftool_files/libgcc_s_seh-1.dll +0 -0
- package/bin/exiftool_files/liblzma-5__.dll +0 -0
- package/bin/exiftool_files/libstdc++-6.dll +0 -0
- package/bin/exiftool_files/libwinpthread-1.dll +0 -0
- package/bin/exiftool_files/perl.exe +0 -0
- package/bin/exiftool_files/perl532.dll +0 -0
- package/package.json +7 -5
- package/bin/exiftool_files/libgcc_s_dw2-1.dll +0 -0
- package/bin/exiftool_files/perl530.dll +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
package TAP::Parser::SourceHandler::Handle;
|
|
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::Handle - Stream TAP from an IO::Handle or a GLOB.
|
|
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( \*TAP_FILE );
|
|
31
|
+
$source->assemble_meta;
|
|
32
|
+
|
|
33
|
+
my $class = 'TAP::Parser::SourceHandler::Handle';
|
|
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 an IO Handle> L<TAP::Parser::SourceHandler> class. It
|
|
40
|
+
has 2 jobs:
|
|
41
|
+
|
|
42
|
+
1. Figure out if the L<TAP::Parser::Source> it's given is an L<IO::Handle> or
|
|
43
|
+
GLOB containing raw TAP output (L</can_handle>).
|
|
44
|
+
|
|
45
|
+
2. Creates an iterator for IO::Handle's & globs (L</make_iterator>).
|
|
46
|
+
|
|
47
|
+
Unless you're writing a plugin or subclassing L<TAP::Parser>, you probably
|
|
48
|
+
won't need to use this module directly.
|
|
49
|
+
|
|
50
|
+
=head1 METHODS
|
|
51
|
+
|
|
52
|
+
=head2 Class Methods
|
|
53
|
+
|
|
54
|
+
=head3 C<can_handle>
|
|
55
|
+
|
|
56
|
+
my $vote = $class->can_handle( $source );
|
|
57
|
+
|
|
58
|
+
Casts the following votes:
|
|
59
|
+
|
|
60
|
+
0.9 if $source is an IO::Handle
|
|
61
|
+
0.8 if $source is a glob
|
|
62
|
+
|
|
63
|
+
=cut
|
|
64
|
+
|
|
65
|
+
sub can_handle {
|
|
66
|
+
my ( $class, $src ) = @_;
|
|
67
|
+
my $meta = $src->meta;
|
|
68
|
+
|
|
69
|
+
return 0.9
|
|
70
|
+
if $meta->{is_object}
|
|
71
|
+
&& UNIVERSAL::isa( $src->raw, 'IO::Handle' );
|
|
72
|
+
|
|
73
|
+
return 0.8 if $meta->{is_glob};
|
|
74
|
+
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
=head3 C<make_iterator>
|
|
79
|
+
|
|
80
|
+
my $iterator = $class->make_iterator( $source );
|
|
81
|
+
|
|
82
|
+
Returns a new L<TAP::Parser::Iterator::Stream> for the source.
|
|
83
|
+
|
|
84
|
+
=cut
|
|
85
|
+
|
|
86
|
+
sub make_iterator {
|
|
87
|
+
my ( $class, $source ) = @_;
|
|
88
|
+
|
|
89
|
+
$class->_croak('$source->raw must be a glob ref or an IO::Handle')
|
|
90
|
+
unless $source->meta->{is_glob}
|
|
91
|
+
|| UNIVERSAL::isa( $source->raw, 'IO::Handle' );
|
|
92
|
+
|
|
93
|
+
return $class->iterator_class->new( $source->raw );
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
=head3 C<iterator_class>
|
|
97
|
+
|
|
98
|
+
The class of iterator to use, override if you're sub-classing. Defaults
|
|
99
|
+
to L<TAP::Parser::Iterator::Stream>.
|
|
100
|
+
|
|
101
|
+
=cut
|
|
102
|
+
|
|
103
|
+
use constant iterator_class => 'TAP::Parser::Iterator::Stream';
|
|
104
|
+
|
|
105
|
+
1;
|
|
106
|
+
|
|
107
|
+
=head1 SUBCLASSING
|
|
108
|
+
|
|
109
|
+
Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview.
|
|
110
|
+
|
|
111
|
+
=head1 SEE ALSO
|
|
112
|
+
|
|
113
|
+
L<TAP::Object>,
|
|
114
|
+
L<TAP::Parser>,
|
|
115
|
+
L<TAP::Parser::Iterator>,
|
|
116
|
+
L<TAP::Parser::Iterator::Stream>,
|
|
117
|
+
L<TAP::Parser::IteratorFactory>,
|
|
118
|
+
L<TAP::Parser::SourceHandler>,
|
|
119
|
+
L<TAP::Parser::SourceHandler::Executable>,
|
|
120
|
+
L<TAP::Parser::SourceHandler::Perl>,
|
|
121
|
+
L<TAP::Parser::SourceHandler::File>,
|
|
122
|
+
L<TAP::Parser::SourceHandler::RawTAP>
|
|
123
|
+
|
|
124
|
+
=cut
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
package TAP::Parser::SourceHandler::Perl;
|
|
2
|
+
|
|
3
|
+
use strict;
|
|
4
|
+
use warnings;
|
|
5
|
+
use Config;
|
|
6
|
+
|
|
7
|
+
use constant IS_WIN32 => ( $^O =~ /^(MS)?Win32$/ );
|
|
8
|
+
use constant IS_VMS => ( $^O eq 'VMS' );
|
|
9
|
+
|
|
10
|
+
use TAP::Parser::IteratorFactory ();
|
|
11
|
+
use TAP::Parser::Iterator::Process ();
|
|
12
|
+
use Text::ParseWords qw(shellwords);
|
|
13
|
+
|
|
14
|
+
use base 'TAP::Parser::SourceHandler::Executable';
|
|
15
|
+
|
|
16
|
+
TAP::Parser::IteratorFactory->register_handler(__PACKAGE__);
|
|
17
|
+
|
|
18
|
+
=head1 NAME
|
|
19
|
+
|
|
20
|
+
TAP::Parser::SourceHandler::Perl - Stream TAP from a Perl executable
|
|
21
|
+
|
|
22
|
+
=head1 VERSION
|
|
23
|
+
|
|
24
|
+
Version 3.42
|
|
25
|
+
|
|
26
|
+
=cut
|
|
27
|
+
|
|
28
|
+
our $VERSION = '3.42';
|
|
29
|
+
|
|
30
|
+
=head1 SYNOPSIS
|
|
31
|
+
|
|
32
|
+
use TAP::Parser::Source;
|
|
33
|
+
use TAP::Parser::SourceHandler::Perl;
|
|
34
|
+
|
|
35
|
+
my $source = TAP::Parser::Source->new->raw( \'script.pl' );
|
|
36
|
+
$source->assemble_meta;
|
|
37
|
+
|
|
38
|
+
my $class = 'TAP::Parser::SourceHandler::Perl';
|
|
39
|
+
my $vote = $class->can_handle( $source );
|
|
40
|
+
my $iter = $class->make_iterator( $source );
|
|
41
|
+
|
|
42
|
+
=head1 DESCRIPTION
|
|
43
|
+
|
|
44
|
+
This is a I<Perl> L<TAP::Parser::SourceHandler> - it has 2 jobs:
|
|
45
|
+
|
|
46
|
+
1. Figure out if the L<TAP::Parser::Source> it's given is actually a Perl
|
|
47
|
+
script (L</can_handle>).
|
|
48
|
+
|
|
49
|
+
2. Creates an iterator for Perl sources (L</make_iterator>).
|
|
50
|
+
|
|
51
|
+
Unless you're writing a plugin or subclassing L<TAP::Parser>, you probably
|
|
52
|
+
won't need to use this module directly.
|
|
53
|
+
|
|
54
|
+
=head1 METHODS
|
|
55
|
+
|
|
56
|
+
=head2 Class Methods
|
|
57
|
+
|
|
58
|
+
=head3 C<can_handle>
|
|
59
|
+
|
|
60
|
+
my $vote = $class->can_handle( $source );
|
|
61
|
+
|
|
62
|
+
Only votes if $source looks like a file. Casts the following votes:
|
|
63
|
+
|
|
64
|
+
0.9 if it has a shebang ala "#!...perl"
|
|
65
|
+
0.75 if it has any shebang
|
|
66
|
+
0.8 if it's a .t file
|
|
67
|
+
0.9 if it's a .pl file
|
|
68
|
+
0.75 if it's in a 't' directory
|
|
69
|
+
0.25 by default (backwards compat)
|
|
70
|
+
|
|
71
|
+
=cut
|
|
72
|
+
|
|
73
|
+
sub can_handle {
|
|
74
|
+
my ( $class, $source ) = @_;
|
|
75
|
+
my $meta = $source->meta;
|
|
76
|
+
|
|
77
|
+
return 0 unless $meta->{is_file};
|
|
78
|
+
my $file = $meta->{file};
|
|
79
|
+
|
|
80
|
+
if ( my $shebang = $file->{shebang} ) {
|
|
81
|
+
return 0.9 if $shebang =~ /^#!.*\bperl/;
|
|
82
|
+
|
|
83
|
+
# We favour Perl as the interpreter for any shebang to preserve
|
|
84
|
+
# previous semantics: we used to execute everything via Perl and
|
|
85
|
+
# relied on it to pass the shebang off to the appropriate
|
|
86
|
+
# interpreter.
|
|
87
|
+
return 0.3;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return 0.8 if $file->{lc_ext} eq '.t'; # vote higher than Executable
|
|
91
|
+
return 0.9 if $file->{lc_ext} eq '.pl';
|
|
92
|
+
|
|
93
|
+
return 0.75 if $file->{dir} =~ /^t\b/; # vote higher than Executable
|
|
94
|
+
|
|
95
|
+
# backwards compat, always vote:
|
|
96
|
+
return 0.25;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
=head3 C<make_iterator>
|
|
100
|
+
|
|
101
|
+
my $iterator = $class->make_iterator( $source );
|
|
102
|
+
|
|
103
|
+
Constructs & returns a new L<TAP::Parser::Iterator::Process> for the source.
|
|
104
|
+
Assumes C<$source-E<gt>raw> contains a reference to the perl script. C<croak>s
|
|
105
|
+
if the file could not be found.
|
|
106
|
+
|
|
107
|
+
The command to run is built as follows:
|
|
108
|
+
|
|
109
|
+
$perl @switches $perl_script @test_args
|
|
110
|
+
|
|
111
|
+
The perl command to use is determined by L</get_perl>. The command generated
|
|
112
|
+
is guaranteed to preserve:
|
|
113
|
+
|
|
114
|
+
PERL5LIB
|
|
115
|
+
PERL5OPT
|
|
116
|
+
Taint Mode, if set in the script's shebang
|
|
117
|
+
|
|
118
|
+
I<Note:> the command generated will I<not> respect any shebang line defined in
|
|
119
|
+
your Perl script. This is only a problem if you have compiled a custom version
|
|
120
|
+
of Perl or if you want to use a specific version of Perl for one test and a
|
|
121
|
+
different version for another, for example:
|
|
122
|
+
|
|
123
|
+
#!/path/to/a/custom_perl --some --args
|
|
124
|
+
#!/usr/local/perl-5.6/bin/perl -w
|
|
125
|
+
|
|
126
|
+
Currently you need to write a plugin to get around this.
|
|
127
|
+
|
|
128
|
+
=cut
|
|
129
|
+
|
|
130
|
+
sub _autoflush_stdhandles {
|
|
131
|
+
my ($class) = @_;
|
|
132
|
+
|
|
133
|
+
$class->_autoflush( \*STDOUT );
|
|
134
|
+
$class->_autoflush( \*STDERR );
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
sub make_iterator {
|
|
138
|
+
my ( $class, $source ) = @_;
|
|
139
|
+
my $meta = $source->meta;
|
|
140
|
+
my $perl_script = ${ $source->raw };
|
|
141
|
+
|
|
142
|
+
$class->_croak("Cannot find ($perl_script)") unless $meta->{is_file};
|
|
143
|
+
|
|
144
|
+
# TODO: does this really need to be done here?
|
|
145
|
+
$class->_autoflush_stdhandles;
|
|
146
|
+
|
|
147
|
+
my ( $libs, $switches )
|
|
148
|
+
= $class->_mangle_switches(
|
|
149
|
+
$class->_filter_libs( $class->_switches($source) ) );
|
|
150
|
+
|
|
151
|
+
$class->_run( $source, $libs, $switches );
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
sub _has_taint_switch {
|
|
156
|
+
my( $class, $switches ) = @_;
|
|
157
|
+
|
|
158
|
+
my $has_taint = grep { $_ eq "-T" || $_ eq "-t" } @{$switches};
|
|
159
|
+
return $has_taint ? 1 : 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
sub _mangle_switches {
|
|
163
|
+
my ( $class, $libs, $switches ) = @_;
|
|
164
|
+
|
|
165
|
+
# Taint mode ignores environment variables so we must retranslate
|
|
166
|
+
# PERL5LIB as -I switches and place PERL5OPT on the command line
|
|
167
|
+
# in order that it be seen.
|
|
168
|
+
if ( $class->_has_taint_switch($switches) ) {
|
|
169
|
+
my @perl5lib = defined $ENV{PERL5LIB} ? split /$Config{path_sep}/, $ENV{PERL5LIB} : ();
|
|
170
|
+
return (
|
|
171
|
+
$libs,
|
|
172
|
+
[ @{$switches},
|
|
173
|
+
$class->_libs2switches([@$libs, @perl5lib]),
|
|
174
|
+
defined $ENV{PERL5OPT} ? shellwords( $ENV{PERL5OPT} ) : ()
|
|
175
|
+
],
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return ( $libs, $switches );
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
sub _filter_libs {
|
|
183
|
+
my ( $class, @switches ) = @_;
|
|
184
|
+
|
|
185
|
+
my $path_sep = $Config{path_sep};
|
|
186
|
+
my $path_re = qr{$path_sep};
|
|
187
|
+
|
|
188
|
+
# Filter out any -I switches to be handled as libs later.
|
|
189
|
+
#
|
|
190
|
+
# Nasty kludge. It might be nicer if we got the libs separately
|
|
191
|
+
# although at least this way we find any -I switches that were
|
|
192
|
+
# supplied other then as explicit libs.
|
|
193
|
+
#
|
|
194
|
+
# We filter out any names containing colons because they will break
|
|
195
|
+
# PERL5LIB
|
|
196
|
+
my @libs;
|
|
197
|
+
my @filtered_switches;
|
|
198
|
+
for (@switches) {
|
|
199
|
+
if ( !/$path_re/ && m/ ^ ['"]? -I ['"]? (.*?) ['"]? $ /x ) {
|
|
200
|
+
push @libs, $1;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
push @filtered_switches, $_;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return \@libs, \@filtered_switches;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
sub _iterator_hooks {
|
|
211
|
+
my ( $class, $source, $libs, $switches ) = @_;
|
|
212
|
+
|
|
213
|
+
my $setup = sub {
|
|
214
|
+
if ( @{$libs} and !$class->_has_taint_switch($switches) ) {
|
|
215
|
+
$ENV{PERL5LIB} = join(
|
|
216
|
+
$Config{path_sep}, grep {defined} @{$libs},
|
|
217
|
+
$ENV{PERL5LIB}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
# VMS environment variables aren't guaranteed to reset at the end of
|
|
223
|
+
# the process, so we need to put PERL5LIB back.
|
|
224
|
+
my $previous = $ENV{PERL5LIB};
|
|
225
|
+
my $teardown = sub {
|
|
226
|
+
if ( defined $previous ) {
|
|
227
|
+
$ENV{PERL5LIB} = $previous;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
delete $ENV{PERL5LIB};
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
return ( $setup, $teardown );
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
sub _run {
|
|
238
|
+
my ( $class, $source, $libs, $switches ) = @_;
|
|
239
|
+
|
|
240
|
+
my @command = $class->_get_command_for_switches( $source, $switches )
|
|
241
|
+
or $class->_croak("No command found!");
|
|
242
|
+
|
|
243
|
+
my ( $setup, $teardown ) = $class->_iterator_hooks( $source, $libs, $switches );
|
|
244
|
+
|
|
245
|
+
return $class->_create_iterator( $source, \@command, $setup, $teardown );
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
sub _create_iterator {
|
|
249
|
+
my ( $class, $source, $command, $setup, $teardown ) = @_;
|
|
250
|
+
|
|
251
|
+
return TAP::Parser::Iterator::Process->new(
|
|
252
|
+
{ command => $command,
|
|
253
|
+
merge => $source->merge,
|
|
254
|
+
setup => $setup,
|
|
255
|
+
teardown => $teardown,
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
sub _get_command_for_switches {
|
|
261
|
+
my ( $class, $source, $switches ) = @_;
|
|
262
|
+
my $file = ${ $source->raw };
|
|
263
|
+
my @args = @{ $source->test_args || [] };
|
|
264
|
+
my $command = $class->get_perl;
|
|
265
|
+
|
|
266
|
+
# XXX don't need to quote if we treat the parts as atoms (except maybe vms)
|
|
267
|
+
#$file = qq["$file"] if ( $file =~ /\s/ ) && ( $file !~ /^".*"$/ );
|
|
268
|
+
my @command = ( $command, @{$switches}, $file, @args );
|
|
269
|
+
return @command;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
sub _libs2switches {
|
|
273
|
+
my $class = shift;
|
|
274
|
+
return map {"-I$_"} grep {$_} @{ $_[0] };
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
=head3 C<get_taint>
|
|
278
|
+
|
|
279
|
+
Decode any taint switches from a Perl shebang line.
|
|
280
|
+
|
|
281
|
+
# $taint will be 't'
|
|
282
|
+
my $taint = TAP::Parser::SourceHandler::Perl->get_taint( '#!/usr/bin/perl -t' );
|
|
283
|
+
|
|
284
|
+
# $untaint will be undefined
|
|
285
|
+
my $untaint = TAP::Parser::SourceHandler::Perl->get_taint( '#!/usr/bin/perl' );
|
|
286
|
+
|
|
287
|
+
=cut
|
|
288
|
+
|
|
289
|
+
sub get_taint {
|
|
290
|
+
my ( $class, $shebang ) = @_;
|
|
291
|
+
return
|
|
292
|
+
unless defined $shebang
|
|
293
|
+
&& $shebang =~ /^#!.*\bperl.*\s-\w*([Tt]+)/;
|
|
294
|
+
return $1;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
sub _switches {
|
|
298
|
+
my ( $class, $source ) = @_;
|
|
299
|
+
my $file = ${ $source->raw };
|
|
300
|
+
my @switches = @{ $source->switches || [] };
|
|
301
|
+
my $shebang = $source->meta->{file}->{shebang};
|
|
302
|
+
return unless defined $shebang;
|
|
303
|
+
|
|
304
|
+
my $taint = $class->get_taint($shebang);
|
|
305
|
+
push @switches, "-$taint" if defined $taint;
|
|
306
|
+
|
|
307
|
+
# Quote the argument if we're VMS, since VMS will downcase anything
|
|
308
|
+
# not quoted.
|
|
309
|
+
if (IS_VMS) {
|
|
310
|
+
for (@switches) {
|
|
311
|
+
$_ = qq["$_"];
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return @switches;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
=head3 C<get_perl>
|
|
319
|
+
|
|
320
|
+
Gets the version of Perl currently running the test suite.
|
|
321
|
+
|
|
322
|
+
=cut
|
|
323
|
+
|
|
324
|
+
sub get_perl {
|
|
325
|
+
my $class = shift;
|
|
326
|
+
return $ENV{HARNESS_PERL} if defined $ENV{HARNESS_PERL};
|
|
327
|
+
return qq["$^X"] if IS_WIN32 && ( $^X =~ /[^\w\.\/\\]/ );
|
|
328
|
+
return $^X;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
1;
|
|
332
|
+
|
|
333
|
+
__END__
|
|
334
|
+
|
|
335
|
+
=head1 SUBCLASSING
|
|
336
|
+
|
|
337
|
+
Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview.
|
|
338
|
+
|
|
339
|
+
=head2 Example
|
|
340
|
+
|
|
341
|
+
package MyPerlSourceHandler;
|
|
342
|
+
|
|
343
|
+
use strict;
|
|
344
|
+
|
|
345
|
+
use TAP::Parser::SourceHandler::Perl;
|
|
346
|
+
|
|
347
|
+
use base 'TAP::Parser::SourceHandler::Perl';
|
|
348
|
+
|
|
349
|
+
# use the version of perl from the shebang line in the test file
|
|
350
|
+
sub get_perl {
|
|
351
|
+
my $self = shift;
|
|
352
|
+
if (my $shebang = $self->shebang( $self->{file} )) {
|
|
353
|
+
$shebang =~ /^#!(.*\bperl.*?)(?:(?:\s)|(?:$))/;
|
|
354
|
+
return $1 if $1;
|
|
355
|
+
}
|
|
356
|
+
return $self->SUPER::get_perl(@_);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
=head1 SEE ALSO
|
|
360
|
+
|
|
361
|
+
L<TAP::Object>,
|
|
362
|
+
L<TAP::Parser>,
|
|
363
|
+
L<TAP::Parser::IteratorFactory>,
|
|
364
|
+
L<TAP::Parser::SourceHandler>,
|
|
365
|
+
L<TAP::Parser::SourceHandler::Executable>,
|
|
366
|
+
L<TAP::Parser::SourceHandler::File>,
|
|
367
|
+
L<TAP::Parser::SourceHandler::Handle>,
|
|
368
|
+
L<TAP::Parser::SourceHandler::RawTAP>
|
|
369
|
+
|
|
370
|
+
=cut
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
package TAP::Parser::SourceHandler::RawTAP;
|
|
2
|
+
|
|
3
|
+
use strict;
|
|
4
|
+
use warnings;
|
|
5
|
+
|
|
6
|
+
use TAP::Parser::IteratorFactory ();
|
|
7
|
+
use TAP::Parser::Iterator::Array ();
|
|
8
|
+
|
|
9
|
+
use base 'TAP::Parser::SourceHandler';
|
|
10
|
+
|
|
11
|
+
TAP::Parser::IteratorFactory->register_handler(__PACKAGE__);
|
|
12
|
+
|
|
13
|
+
=head1 NAME
|
|
14
|
+
|
|
15
|
+
TAP::Parser::SourceHandler::RawTAP - Stream output from raw TAP in a scalar/array ref.
|
|
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::RawTAP;
|
|
29
|
+
|
|
30
|
+
my $source = TAP::Parser::Source->new->raw( \"1..1\nok 1\n" );
|
|
31
|
+
$source->assemble_meta;
|
|
32
|
+
|
|
33
|
+
my $class = 'TAP::Parser::SourceHandler::RawTAP';
|
|
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 output> L<TAP::Parser::SourceHandler> - it has 2 jobs:
|
|
40
|
+
|
|
41
|
+
1. Figure out if the L<TAP::Parser::Source> it's given is raw TAP output
|
|
42
|
+
(L</can_handle>).
|
|
43
|
+
|
|
44
|
+
2. Creates an iterator for raw TAP output (L</make_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 is an array, or a scalar with newlines. Casts the
|
|
58
|
+
following votes:
|
|
59
|
+
|
|
60
|
+
0.9 if it's a scalar with '..' in it
|
|
61
|
+
0.7 if it's a scalar with 'ok' in it
|
|
62
|
+
0.3 if it's just a scalar with newlines
|
|
63
|
+
0.5 if it's an array
|
|
64
|
+
|
|
65
|
+
=cut
|
|
66
|
+
|
|
67
|
+
sub can_handle {
|
|
68
|
+
my ( $class, $src ) = @_;
|
|
69
|
+
my $meta = $src->meta;
|
|
70
|
+
|
|
71
|
+
return 0 if $meta->{file};
|
|
72
|
+
if ( $meta->{is_scalar} ) {
|
|
73
|
+
return 0 unless $meta->{has_newlines};
|
|
74
|
+
return 0.9 if ${ $src->raw } =~ /\d\.\.\d/;
|
|
75
|
+
return 0.7 if ${ $src->raw } =~ /ok/;
|
|
76
|
+
return 0.3;
|
|
77
|
+
}
|
|
78
|
+
elsif ( $meta->{is_array} ) {
|
|
79
|
+
return 0.5;
|
|
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::Array> for the source.
|
|
89
|
+
C<$source-E<gt>raw> must be an array ref, or a scalar ref.
|
|
90
|
+
|
|
91
|
+
C<croak>s on error.
|
|
92
|
+
|
|
93
|
+
=cut
|
|
94
|
+
|
|
95
|
+
sub make_iterator {
|
|
96
|
+
my ( $class, $src ) = @_;
|
|
97
|
+
my $meta = $src->meta;
|
|
98
|
+
|
|
99
|
+
my $tap_array;
|
|
100
|
+
if ( $meta->{is_scalar} ) {
|
|
101
|
+
$tap_array = [ split "\n" => ${ $src->raw } ];
|
|
102
|
+
}
|
|
103
|
+
elsif ( $meta->{is_array} ) {
|
|
104
|
+
$tap_array = $src->raw;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
$class->_croak('No raw TAP found in $source->raw')
|
|
108
|
+
unless scalar $tap_array;
|
|
109
|
+
|
|
110
|
+
return TAP::Parser::Iterator::Array->new($tap_array);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
1;
|
|
114
|
+
|
|
115
|
+
=head1 SUBCLASSING
|
|
116
|
+
|
|
117
|
+
Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview.
|
|
118
|
+
|
|
119
|
+
=head1 SEE ALSO
|
|
120
|
+
|
|
121
|
+
L<TAP::Object>,
|
|
122
|
+
L<TAP::Parser>,
|
|
123
|
+
L<TAP::Parser::IteratorFactory>,
|
|
124
|
+
L<TAP::Parser::SourceHandler>,
|
|
125
|
+
L<TAP::Parser::SourceHandler::Executable>,
|
|
126
|
+
L<TAP::Parser::SourceHandler::Perl>,
|
|
127
|
+
L<TAP::Parser::SourceHandler::File>,
|
|
128
|
+
L<TAP::Parser::SourceHandler::Handle>
|
|
129
|
+
|
|
130
|
+
=cut
|