exiftool-vendored.exe 12.82.0 → 12.84.0
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 +37 -0
- package/bin/exiftool_files/Licenses_Strawberry_Perl.zip +0 -0
- package/bin/exiftool_files/README +3 -2
- package/bin/exiftool_files/build_geolocation +872 -0
- package/bin/exiftool_files/config_files/example.config +2 -2
- package/bin/exiftool_files/exiftool.pl +28 -6
- package/bin/exiftool_files/fmt_files/gpx.fmt +2 -1
- package/bin/exiftool_files/fmt_files/gpx_wpt.fmt +2 -1
- 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/Apple.pm +51 -7
- package/bin/exiftool_files/lib/Image/ExifTool/BuildTagLookup.pm +5 -2
- package/bin/exiftool_files/lib/Image/ExifTool/CanonVRD.pm +18 -5
- package/bin/exiftool_files/lib/Image/ExifTool/DJI.pm +29 -0
- package/bin/exiftool_files/lib/Image/ExifTool/Exif.pm +19 -2
- package/bin/exiftool_files/lib/Image/ExifTool/GM.pm +17 -8
- package/bin/exiftool_files/lib/Image/ExifTool/Geolocation.dat +0 -0
- package/bin/exiftool_files/lib/Image/ExifTool/Geolocation.pm +163 -101
- package/bin/exiftool_files/lib/Image/ExifTool/Geotag.pm +18 -10
- package/bin/exiftool_files/lib/Image/ExifTool/Nikon.pm +7 -6
- package/bin/exiftool_files/lib/Image/ExifTool/QuickTime.pm +6 -1
- package/bin/exiftool_files/lib/Image/ExifTool/QuickTimeStream.pl +5 -0
- package/bin/exiftool_files/lib/Image/ExifTool/Sony.pm +15 -6
- package/bin/exiftool_files/lib/Image/ExifTool/TagLookup.pm +18 -9
- package/bin/exiftool_files/lib/Image/ExifTool/TagNames.pod +24 -5
- package/bin/exiftool_files/lib/Image/ExifTool/WriteQuickTime.pl +2 -1
- package/bin/exiftool_files/lib/Image/ExifTool/Writer.pl +165 -132
- package/bin/exiftool_files/lib/Image/ExifTool/XMP2.pl +3 -0
- package/bin/exiftool_files/lib/Image/ExifTool.pm +45 -23
- package/bin/exiftool_files/lib/Image/ExifTool.pod +23 -14
- 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 +6 -4
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/cs.pm +0 -978
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/de.pm +0 -1975
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/en_ca.pm +0 -44
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/en_gb.pm +0 -124
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/es.pm +0 -2921
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/fi.pm +0 -1116
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/fr.pm +0 -3171
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/it.pm +0 -2750
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/ja.pm +0 -10256
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/ko.pm +0 -4499
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/nl.pm +0 -1270
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/pl.pm +0 -3019
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/ru.pm +0 -18220
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/sk.pm +0 -441
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/sv.pm +0 -714
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/tr.pm +0 -452
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/zh_cn.pm +0 -2225
- package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/zh_tw.pm +0 -72
- package/bin/exiftool_files/libgcc_s_dw2-1.dll +0 -0
- package/bin/exiftool_files/perl530.dll +0 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
package TAP::Parser::YAMLish::Writer;
|
|
2
|
+
|
|
3
|
+
use strict;
|
|
4
|
+
use warnings;
|
|
5
|
+
|
|
6
|
+
use base 'TAP::Object';
|
|
7
|
+
|
|
8
|
+
our $VERSION = '3.42';
|
|
9
|
+
|
|
10
|
+
my $ESCAPE_CHAR = qr{ [ \x00-\x1f \" ] }x;
|
|
11
|
+
my $ESCAPE_KEY = qr{ (?: ^\W ) | $ESCAPE_CHAR }x;
|
|
12
|
+
|
|
13
|
+
my @UNPRINTABLE = qw(
|
|
14
|
+
z x01 x02 x03 x04 x05 x06 a
|
|
15
|
+
x08 t n v f r x0e x0f
|
|
16
|
+
x10 x11 x12 x13 x14 x15 x16 x17
|
|
17
|
+
x18 x19 x1a e x1c x1d x1e x1f
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
# new() implementation supplied by TAP::Object
|
|
21
|
+
|
|
22
|
+
sub write {
|
|
23
|
+
my $self = shift;
|
|
24
|
+
|
|
25
|
+
die "Need something to write"
|
|
26
|
+
unless @_;
|
|
27
|
+
|
|
28
|
+
my $obj = shift;
|
|
29
|
+
my $out = shift || \*STDOUT;
|
|
30
|
+
|
|
31
|
+
die "Need a reference to something I can write to"
|
|
32
|
+
unless ref $out;
|
|
33
|
+
|
|
34
|
+
$self->{writer} = $self->_make_writer($out);
|
|
35
|
+
|
|
36
|
+
$self->_write_obj( '---', $obj );
|
|
37
|
+
$self->_put('...');
|
|
38
|
+
|
|
39
|
+
delete $self->{writer};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
sub _make_writer {
|
|
43
|
+
my $self = shift;
|
|
44
|
+
my $out = shift;
|
|
45
|
+
|
|
46
|
+
my $ref = ref $out;
|
|
47
|
+
|
|
48
|
+
if ( 'CODE' eq $ref ) {
|
|
49
|
+
return $out;
|
|
50
|
+
}
|
|
51
|
+
elsif ( 'ARRAY' eq $ref ) {
|
|
52
|
+
return sub { push @$out, shift };
|
|
53
|
+
}
|
|
54
|
+
elsif ( 'SCALAR' eq $ref ) {
|
|
55
|
+
return sub { $$out .= shift() . "\n" };
|
|
56
|
+
}
|
|
57
|
+
elsif ( 'GLOB' eq $ref || 'IO::Handle' eq $ref ) {
|
|
58
|
+
return sub { print $out shift(), "\n" };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
die "Can't write to $out";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
sub _put {
|
|
65
|
+
my $self = shift;
|
|
66
|
+
$self->{writer}->( join '', @_ );
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
sub _enc_scalar {
|
|
70
|
+
my $self = shift;
|
|
71
|
+
my $val = shift;
|
|
72
|
+
my $rule = shift;
|
|
73
|
+
|
|
74
|
+
return '~' unless defined $val;
|
|
75
|
+
|
|
76
|
+
if ( $val =~ /$rule/ ) {
|
|
77
|
+
$val =~ s/\\/\\\\/g;
|
|
78
|
+
$val =~ s/"/\\"/g;
|
|
79
|
+
$val =~ s/ ( [\x00-\x1f] ) / '\\' . $UNPRINTABLE[ ord($1) ] /gex;
|
|
80
|
+
return qq{"$val"};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if ( length($val) == 0 or $val =~ /\s/ ) {
|
|
84
|
+
$val =~ s/'/''/;
|
|
85
|
+
return "'$val'";
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return $val;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
sub _write_obj {
|
|
92
|
+
my $self = shift;
|
|
93
|
+
my $prefix = shift;
|
|
94
|
+
my $obj = shift;
|
|
95
|
+
my $indent = shift || 0;
|
|
96
|
+
|
|
97
|
+
if ( my $ref = ref $obj ) {
|
|
98
|
+
my $pad = ' ' x $indent;
|
|
99
|
+
if ( 'HASH' eq $ref ) {
|
|
100
|
+
if ( keys %$obj ) {
|
|
101
|
+
$self->_put($prefix);
|
|
102
|
+
for my $key ( sort keys %$obj ) {
|
|
103
|
+
my $value = $obj->{$key};
|
|
104
|
+
$self->_write_obj(
|
|
105
|
+
$pad . $self->_enc_scalar( $key, $ESCAPE_KEY ) . ':',
|
|
106
|
+
$value, $indent + 1
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
$self->_put( $prefix, ' {}' );
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
elsif ( 'ARRAY' eq $ref ) {
|
|
115
|
+
if (@$obj) {
|
|
116
|
+
$self->_put($prefix);
|
|
117
|
+
for my $value (@$obj) {
|
|
118
|
+
$self->_write_obj(
|
|
119
|
+
$pad . '-', $value,
|
|
120
|
+
$indent + 1
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
$self->_put( $prefix, ' []' );
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
die "Don't know how to encode $ref";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
$self->_put( $prefix, ' ', $self->_enc_scalar( $obj, $ESCAPE_CHAR ) );
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
1;
|
|
138
|
+
|
|
139
|
+
__END__
|
|
140
|
+
|
|
141
|
+
=pod
|
|
142
|
+
|
|
143
|
+
=head1 NAME
|
|
144
|
+
|
|
145
|
+
TAP::Parser::YAMLish::Writer - Write YAMLish data
|
|
146
|
+
|
|
147
|
+
=head1 VERSION
|
|
148
|
+
|
|
149
|
+
Version 3.42
|
|
150
|
+
|
|
151
|
+
=head1 SYNOPSIS
|
|
152
|
+
|
|
153
|
+
use TAP::Parser::YAMLish::Writer;
|
|
154
|
+
|
|
155
|
+
my $data = {
|
|
156
|
+
one => 1,
|
|
157
|
+
two => 2,
|
|
158
|
+
three => [ 1, 2, 3 ],
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
my $yw = TAP::Parser::YAMLish::Writer->new;
|
|
162
|
+
|
|
163
|
+
# Write to an array...
|
|
164
|
+
$yw->write( $data, \@some_array );
|
|
165
|
+
|
|
166
|
+
# ...an open file handle...
|
|
167
|
+
$yw->write( $data, $some_file_handle );
|
|
168
|
+
|
|
169
|
+
# ...a string ...
|
|
170
|
+
$yw->write( $data, \$some_string );
|
|
171
|
+
|
|
172
|
+
# ...or a closure
|
|
173
|
+
$yw->write( $data, sub {
|
|
174
|
+
my $line = shift;
|
|
175
|
+
print "$line\n";
|
|
176
|
+
} );
|
|
177
|
+
|
|
178
|
+
=head1 DESCRIPTION
|
|
179
|
+
|
|
180
|
+
Encodes a scalar, hash reference or array reference as YAMLish.
|
|
181
|
+
|
|
182
|
+
=head1 METHODS
|
|
183
|
+
|
|
184
|
+
=head2 Class Methods
|
|
185
|
+
|
|
186
|
+
=head3 C<new>
|
|
187
|
+
|
|
188
|
+
my $writer = TAP::Parser::YAMLish::Writer->new;
|
|
189
|
+
|
|
190
|
+
The constructor C<new> creates and returns an empty
|
|
191
|
+
C<TAP::Parser::YAMLish::Writer> object.
|
|
192
|
+
|
|
193
|
+
=head2 Instance Methods
|
|
194
|
+
|
|
195
|
+
=head3 C<write>
|
|
196
|
+
|
|
197
|
+
$writer->write($obj, $output );
|
|
198
|
+
|
|
199
|
+
Encode a scalar, hash reference or array reference as YAML.
|
|
200
|
+
|
|
201
|
+
my $writer = sub {
|
|
202
|
+
my $line = shift;
|
|
203
|
+
print SOMEFILE "$line\n";
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
my $data = {
|
|
207
|
+
one => 1,
|
|
208
|
+
two => 2,
|
|
209
|
+
three => [ 1, 2, 3 ],
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
my $yw = TAP::Parser::YAMLish::Writer->new;
|
|
213
|
+
$yw->write( $data, $writer );
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
The C< $output > argument may be:
|
|
217
|
+
|
|
218
|
+
=over
|
|
219
|
+
|
|
220
|
+
=item * a reference to a scalar to append YAML to
|
|
221
|
+
|
|
222
|
+
=item * the handle of an open file
|
|
223
|
+
|
|
224
|
+
=item * a reference to an array into which YAML will be pushed
|
|
225
|
+
|
|
226
|
+
=item * a code reference
|
|
227
|
+
|
|
228
|
+
=back
|
|
229
|
+
|
|
230
|
+
If you supply a code reference the subroutine will be called once for
|
|
231
|
+
each line of output with the line as its only argument. Passed lines
|
|
232
|
+
will have no trailing newline.
|
|
233
|
+
|
|
234
|
+
=head1 AUTHOR
|
|
235
|
+
|
|
236
|
+
Andy Armstrong, <andy@hexten.net>
|
|
237
|
+
|
|
238
|
+
=head1 SEE ALSO
|
|
239
|
+
|
|
240
|
+
L<YAML::Tiny>, L<YAML>, L<YAML::Syck>, L<Config::Tiny>, L<CSS::Tiny>,
|
|
241
|
+
L<http://use.perl.org/~Alias/journal/29427>
|
|
242
|
+
|
|
243
|
+
=head1 COPYRIGHT
|
|
244
|
+
|
|
245
|
+
Copyright 2007-2011 Andy Armstrong.
|
|
246
|
+
|
|
247
|
+
This program is free software; you can redistribute
|
|
248
|
+
it and/or modify it under the same terms as Perl itself.
|
|
249
|
+
|
|
250
|
+
The full text of the license can be found in the
|
|
251
|
+
LICENSE file included with this module.
|
|
252
|
+
|
|
253
|
+
=cut
|
|
254
|
+
|