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.
Files changed (270) hide show
  1. package/README.md +6 -0
  2. package/bin/exiftool.exe +0 -0
  3. package/bin/exiftool_files/Changes +37 -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/build_geolocation +872 -0
  7. package/bin/exiftool_files/config_files/example.config +2 -2
  8. package/bin/exiftool_files/exiftool.pl +28 -6
  9. package/bin/exiftool_files/fmt_files/gpx.fmt +2 -1
  10. package/bin/exiftool_files/fmt_files/gpx_wpt.fmt +2 -1
  11. package/bin/exiftool_files/lib/Archive/Zip/Archive.pm +399 -65
  12. package/bin/exiftool_files/lib/Archive/Zip/DirectoryMember.pm +1 -1
  13. package/bin/exiftool_files/lib/Archive/Zip/FileMember.pm +1 -1
  14. package/bin/exiftool_files/lib/Archive/Zip/Member.pm +499 -195
  15. package/bin/exiftool_files/lib/Archive/Zip/NewFileMember.pm +1 -1
  16. package/bin/exiftool_files/lib/Archive/Zip/StringMember.pm +2 -2
  17. package/bin/exiftool_files/lib/Archive/Zip/ZipFileMember.pm +79 -20
  18. package/bin/exiftool_files/lib/Archive/Zip.pm +179 -29
  19. package/bin/exiftool_files/lib/AutoLoader.pm +453 -0
  20. package/bin/exiftool_files/lib/B/Deparse.pm +209 -137
  21. package/bin/exiftool_files/lib/B.pm +1 -1
  22. package/bin/exiftool_files/lib/Benchmark.pm +1123 -0
  23. package/bin/exiftool_files/lib/Class/Struct.pm +2 -2
  24. package/bin/exiftool_files/lib/Compress/Raw/Bzip2.pm +14 -9
  25. package/bin/exiftool_files/lib/Compress/Raw/Lzma.pm +982 -0
  26. package/bin/exiftool_files/lib/Compress/Raw/Zlib.pm +91 -86
  27. package/bin/exiftool_files/lib/Compress/Zlib.pm +105 -100
  28. package/bin/exiftool_files/lib/Config.pm +9 -9
  29. package/bin/exiftool_files/lib/Config_heavy.pl +36 -33
  30. package/bin/exiftool_files/lib/CryptX.pm +2 -82
  31. package/bin/exiftool_files/lib/Data/Dumper.pm +2 -2
  32. package/bin/exiftool_files/lib/Digest/MD5.pm +12 -9
  33. package/bin/exiftool_files/lib/Digest/Perl/MD5.pm +1 -191
  34. package/bin/exiftool_files/lib/Digest/base.pm +26 -20
  35. package/bin/exiftool_files/lib/DynaLoader.pm +7 -4
  36. package/bin/exiftool_files/lib/Encode.pm +3 -3
  37. package/bin/exiftool_files/lib/Errno.pm +13 -13
  38. package/bin/exiftool_files/lib/Exporter/Heavy.pm +2 -2
  39. package/bin/exiftool_files/lib/Exporter.pm +1 -1
  40. package/bin/exiftool_files/lib/ExtUtils/Command/MM.pm +323 -0
  41. package/bin/exiftool_files/lib/ExtUtils/Command.pm +382 -0
  42. package/bin/exiftool_files/lib/File/Find.pm +1 -1
  43. package/bin/exiftool_files/lib/File/Glob.pm +1 -8
  44. package/bin/exiftool_files/lib/File/GlobMapper.pm +2 -2
  45. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Carbon.pm +2 -40
  46. package/bin/exiftool_files/lib/File/HomeDir/Darwin/Cocoa.pm +2 -34
  47. package/bin/exiftool_files/lib/File/HomeDir/Darwin.pm +2 -28
  48. package/bin/exiftool_files/lib/File/HomeDir/Driver.pm +2 -35
  49. package/bin/exiftool_files/lib/File/HomeDir/FreeDesktop.pm +2 -62
  50. package/bin/exiftool_files/lib/File/HomeDir/MacOS9.pm +2 -53
  51. package/bin/exiftool_files/lib/File/HomeDir/Test.pm +2 -43
  52. package/bin/exiftool_files/lib/File/HomeDir/Unix.pm +2 -53
  53. package/bin/exiftool_files/lib/File/HomeDir/Windows.pm +2 -69
  54. package/bin/exiftool_files/lib/File/HomeDir.pm +5 -416
  55. package/bin/exiftool_files/lib/File/Path.pm +3 -3
  56. package/bin/exiftool_files/lib/File/Spec/Win32.pm +2 -2
  57. package/bin/exiftool_files/lib/File/Temp.pm +70 -35
  58. package/bin/exiftool_files/lib/File/Which.pm +1 -240
  59. package/bin/exiftool_files/lib/File/stat.pm +3 -2
  60. package/bin/exiftool_files/lib/IO/Compress/Adapter/Bzip2.pm +16 -17
  61. package/bin/exiftool_files/lib/IO/Compress/Adapter/Deflate.pm +19 -20
  62. package/bin/exiftool_files/lib/IO/Compress/Base/Common.pm +5 -5
  63. package/bin/exiftool_files/lib/IO/Compress/Base.pm +35 -26
  64. package/bin/exiftool_files/lib/IO/Compress/Brotli.pm +159 -0
  65. package/bin/exiftool_files/lib/IO/Compress/Bzip2.pm +50 -25
  66. package/bin/exiftool_files/lib/IO/Compress/Gzip/Constants.pm +6 -6
  67. package/bin/exiftool_files/lib/IO/Compress/Gzip.pm +58 -32
  68. package/bin/exiftool_files/lib/IO/Compress/RawDeflate.pm +63 -38
  69. package/bin/exiftool_files/lib/IO/Compress/Zlib/Extra.pm +20 -20
  70. package/bin/exiftool_files/lib/IO/Dir.pm +1 -1
  71. package/bin/exiftool_files/lib/IO/File.pm +1 -1
  72. package/bin/exiftool_files/lib/IO/Handle.pm +1 -21
  73. package/bin/exiftool_files/lib/IO/Pipe.pm +1 -1
  74. package/bin/exiftool_files/lib/IO/Seekable.pm +1 -1
  75. package/bin/exiftool_files/lib/IO/Select.pm +16 -2
  76. package/bin/exiftool_files/lib/IO/Socket/INET.pm +14 -9
  77. package/bin/exiftool_files/lib/IO/Socket/UNIX.pm +17 -1
  78. package/bin/exiftool_files/lib/IO/Socket.pm +474 -126
  79. package/bin/exiftool_files/lib/IO/String.pm +425 -0
  80. package/bin/exiftool_files/lib/IO/Uncompress/Adapter/Inflate.pm +13 -14
  81. package/bin/exiftool_files/lib/IO/Uncompress/Base.pm +142 -132
  82. package/bin/exiftool_files/lib/IO/Uncompress/Brotli.pm +119 -0
  83. package/bin/exiftool_files/lib/IO/Uncompress/Gunzip.pm +43 -37
  84. package/bin/exiftool_files/lib/IO/Uncompress/RawInflate.pm +49 -43
  85. package/bin/exiftool_files/lib/IO.pm +2 -2
  86. package/bin/exiftool_files/lib/Image/ExifTool/Apple.pm +51 -7
  87. package/bin/exiftool_files/lib/Image/ExifTool/BuildTagLookup.pm +5 -2
  88. package/bin/exiftool_files/lib/Image/ExifTool/CanonVRD.pm +18 -5
  89. package/bin/exiftool_files/lib/Image/ExifTool/DJI.pm +29 -0
  90. package/bin/exiftool_files/lib/Image/ExifTool/Exif.pm +19 -2
  91. package/bin/exiftool_files/lib/Image/ExifTool/GM.pm +17 -8
  92. package/bin/exiftool_files/lib/Image/ExifTool/Geolocation.dat +0 -0
  93. package/bin/exiftool_files/lib/Image/ExifTool/Geolocation.pm +163 -101
  94. package/bin/exiftool_files/lib/Image/ExifTool/Geotag.pm +18 -10
  95. package/bin/exiftool_files/lib/Image/ExifTool/Nikon.pm +7 -6
  96. package/bin/exiftool_files/lib/Image/ExifTool/QuickTime.pm +6 -1
  97. package/bin/exiftool_files/lib/Image/ExifTool/QuickTimeStream.pl +5 -0
  98. package/bin/exiftool_files/lib/Image/ExifTool/Sony.pm +15 -6
  99. package/bin/exiftool_files/lib/Image/ExifTool/TagLookup.pm +18 -9
  100. package/bin/exiftool_files/lib/Image/ExifTool/TagNames.pod +24 -5
  101. package/bin/exiftool_files/lib/Image/ExifTool/WriteQuickTime.pl +2 -1
  102. package/bin/exiftool_files/lib/Image/ExifTool/Writer.pl +165 -132
  103. package/bin/exiftool_files/lib/Image/ExifTool/XMP2.pl +3 -0
  104. package/bin/exiftool_files/lib/Image/ExifTool.pm +45 -23
  105. package/bin/exiftool_files/lib/Image/ExifTool.pod +23 -14
  106. package/bin/exiftool_files/lib/List/Util.pm +97 -8
  107. package/bin/exiftool_files/lib/MIME/Base64.pm +5 -5
  108. package/bin/exiftool_files/lib/MIME/Charset/_Compat.pm +106 -0
  109. package/bin/exiftool_files/lib/MIME/Charset.pm +1303 -0
  110. package/bin/exiftool_files/lib/Math/BigFloat.pm +444 -27
  111. package/bin/exiftool_files/lib/Math/BigInt/Calc.pm +296 -313
  112. package/bin/exiftool_files/lib/Math/BigInt/FastCalc.pm +1 -1
  113. package/bin/exiftool_files/lib/Math/BigInt/GMP.pm +2 -115
  114. package/bin/exiftool_files/lib/Math/BigInt/LTM.pm +2 -24
  115. package/bin/exiftool_files/lib/Math/BigInt/Lib.pm +61 -32
  116. package/bin/exiftool_files/lib/Math/BigInt.pm +292 -107
  117. package/bin/exiftool_files/lib/POSIX.pm +1 -1
  118. package/bin/exiftool_files/lib/PerlIO/scalar.pm +41 -0
  119. package/bin/exiftool_files/lib/PerlIO.pm +397 -0
  120. package/bin/exiftool_files/lib/Portable/CPAN.pm +94 -94
  121. package/bin/exiftool_files/lib/Portable/Config.pm +94 -94
  122. package/bin/exiftool_files/lib/Portable/FileSpec.pm +180 -180
  123. package/bin/exiftool_files/lib/Portable/HomeDir.pm +110 -110
  124. package/bin/exiftool_files/lib/Portable/LoadYaml.pm +430 -430
  125. package/bin/exiftool_files/lib/Portable/minicpan.pm +55 -55
  126. package/bin/exiftool_files/lib/Portable.pm +246 -320
  127. package/bin/exiftool_files/lib/Scalar/Util.pm +9 -4
  128. package/bin/exiftool_files/lib/Socket.pm +16 -12
  129. package/bin/exiftool_files/lib/Storable.pm +1444 -1441
  130. package/bin/exiftool_files/lib/TAP/Base.pm +133 -0
  131. package/bin/exiftool_files/lib/TAP/Formatter/Base.pm +467 -0
  132. package/bin/exiftool_files/lib/TAP/Formatter/Color.pm +116 -0
  133. package/bin/exiftool_files/lib/TAP/Formatter/Console/ParallelSession.pm +201 -0
  134. package/bin/exiftool_files/lib/TAP/Formatter/Console/Session.pm +205 -0
  135. package/bin/exiftool_files/lib/TAP/Formatter/Console.pm +100 -0
  136. package/bin/exiftool_files/lib/TAP/Formatter/File/Session.pm +95 -0
  137. package/bin/exiftool_files/lib/TAP/Formatter/File.pm +56 -0
  138. package/bin/exiftool_files/lib/TAP/Formatter/Session.pm +220 -0
  139. package/bin/exiftool_files/lib/TAP/Harness/Beyond.pod +426 -0
  140. package/bin/exiftool_files/lib/TAP/Harness/Env.pm +215 -0
  141. package/bin/exiftool_files/lib/TAP/Harness.pm +1054 -0
  142. package/bin/exiftool_files/lib/TAP/Object.pm +155 -0
  143. package/bin/exiftool_files/lib/TAP/Parser/Aggregator.pm +414 -0
  144. package/bin/exiftool_files/lib/TAP/Parser/Grammar.pm +584 -0
  145. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Array.pm +100 -0
  146. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Process.pm +378 -0
  147. package/bin/exiftool_files/lib/TAP/Parser/Iterator/Stream.pm +116 -0
  148. package/bin/exiftool_files/lib/TAP/Parser/Iterator.pm +162 -0
  149. package/bin/exiftool_files/lib/TAP/Parser/IteratorFactory.pm +339 -0
  150. package/bin/exiftool_files/lib/TAP/Parser/Multiplexer.pm +194 -0
  151. package/bin/exiftool_files/lib/TAP/Parser/Result/Bailout.pm +62 -0
  152. package/bin/exiftool_files/lib/TAP/Parser/Result/Comment.pm +60 -0
  153. package/bin/exiftool_files/lib/TAP/Parser/Result/Plan.pm +119 -0
  154. package/bin/exiftool_files/lib/TAP/Parser/Result/Pragma.pm +62 -0
  155. package/bin/exiftool_files/lib/TAP/Parser/Result/Test.pm +271 -0
  156. package/bin/exiftool_files/lib/TAP/Parser/Result/Unknown.pm +48 -0
  157. package/bin/exiftool_files/lib/TAP/Parser/Result/Version.pm +62 -0
  158. package/bin/exiftool_files/lib/TAP/Parser/Result/YAML.pm +61 -0
  159. package/bin/exiftool_files/lib/TAP/Parser/Result.pm +297 -0
  160. package/bin/exiftool_files/lib/TAP/Parser/ResultFactory.pm +183 -0
  161. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Job.pm +127 -0
  162. package/bin/exiftool_files/lib/TAP/Parser/Scheduler/Spinner.pm +61 -0
  163. package/bin/exiftool_files/lib/TAP/Parser/Scheduler.pm +448 -0
  164. package/bin/exiftool_files/lib/TAP/Parser/Source.pm +381 -0
  165. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Executable.pm +184 -0
  166. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/File.pm +136 -0
  167. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Handle.pm +124 -0
  168. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/Perl.pm +370 -0
  169. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler/RawTAP.pm +130 -0
  170. package/bin/exiftool_files/lib/TAP/Parser/SourceHandler.pm +191 -0
  171. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Reader.pm +332 -0
  172. package/bin/exiftool_files/lib/TAP/Parser/YAMLish/Writer.pm +254 -0
  173. package/bin/exiftool_files/lib/TAP/Parser.pm +1931 -0
  174. package/bin/exiftool_files/lib/Test/Builder/Formatter.pm +107 -0
  175. package/bin/exiftool_files/lib/Test/Builder/IO/Scalar.pm +659 -0
  176. package/bin/exiftool_files/lib/Test/Builder/Module.pm +182 -0
  177. package/bin/exiftool_files/lib/Test/Builder/Tester/Color.pm +51 -0
  178. package/bin/exiftool_files/lib/Test/Builder/Tester.pm +675 -0
  179. package/bin/exiftool_files/lib/Test/Builder/TodoDiag.pm +68 -0
  180. package/bin/exiftool_files/lib/Test/Builder.pm +2653 -0
  181. package/bin/exiftool_files/lib/Test/Harness.pm +618 -0
  182. package/bin/exiftool_files/lib/Test/More.pm +1997 -0
  183. package/bin/exiftool_files/lib/Test/Simple.pm +220 -0
  184. package/bin/exiftool_files/lib/Test/Tester/Capture.pm +241 -0
  185. package/bin/exiftool_files/lib/Test/Tester/CaptureRunner.pm +79 -0
  186. package/bin/exiftool_files/lib/Test/Tester/Delegate.pm +45 -0
  187. package/bin/exiftool_files/lib/Test/Tester.pm +695 -0
  188. package/bin/exiftool_files/lib/Test/Tutorial.pod +618 -0
  189. package/bin/exiftool_files/lib/Test/use/ok.pm +64 -0
  190. package/bin/exiftool_files/lib/Text/ParseWords.pm +303 -0
  191. package/bin/exiftool_files/lib/Tie/StdHandle.pm +2 -2
  192. package/bin/exiftool_files/lib/Time/HiRes.pm +73 -68
  193. package/bin/exiftool_files/lib/Time/Local.pm +82 -35
  194. package/bin/exiftool_files/lib/Time/Piece.pm +19 -4
  195. package/bin/exiftool_files/lib/Time/Seconds.pm +1 -1
  196. package/bin/exiftool_files/lib/UNIVERSAL.pm +203 -0
  197. package/bin/exiftool_files/lib/Unicode/GCString.pm +60 -0
  198. package/bin/exiftool_files/lib/Unicode/LineBreak/Constants.pm +68 -0
  199. package/bin/exiftool_files/lib/Unicode/LineBreak.pm +248 -0
  200. package/bin/exiftool_files/lib/Win32/API/Struct.pm +1 -177
  201. package/bin/exiftool_files/lib/Win32/API/Type.pm +1 -100
  202. package/bin/exiftool_files/lib/Win32/API.pm +1 -830
  203. package/bin/exiftool_files/lib/Win32/FindFile.pm +2 -123
  204. package/bin/exiftool_files/lib/Win32.pm +213 -89
  205. package/bin/exiftool_files/lib/Win32API/File.pm +1 -1
  206. package/bin/exiftool_files/lib/auto/B/B.xs.dll +0 -0
  207. package/bin/exiftool_files/lib/auto/Compress/Raw/Bzip2/Bzip2.xs.dll +0 -0
  208. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/Lzma.xs.dll +0 -0
  209. package/bin/exiftool_files/lib/auto/Compress/Raw/Lzma/autosplit.ix +3 -0
  210. package/bin/exiftool_files/lib/auto/Compress/Raw/Zlib/Zlib.xs.dll +0 -0
  211. package/bin/exiftool_files/lib/auto/CryptX/CryptX.xs.dll +0 -0
  212. package/bin/exiftool_files/lib/auto/Cwd/Cwd.xs.dll +0 -0
  213. package/bin/exiftool_files/lib/auto/Data/Dumper/Dumper.xs.dll +0 -0
  214. package/bin/exiftool_files/lib/auto/Digest/MD5/MD5.xs.dll +0 -0
  215. package/bin/exiftool_files/lib/auto/Digest/SHA/SHA.xs.dll +0 -0
  216. package/bin/exiftool_files/lib/auto/Encode/Encode.xs.dll +0 -0
  217. package/bin/exiftool_files/lib/auto/Fcntl/Fcntl.xs.dll +0 -0
  218. package/bin/exiftool_files/lib/auto/File/Glob/Glob.xs.dll +0 -0
  219. package/bin/exiftool_files/lib/auto/IO/Compress/Brotli/Brotli.xs.dll +0 -0
  220. package/bin/exiftool_files/lib/auto/IO/IO.xs.dll +0 -0
  221. package/bin/exiftool_files/lib/auto/List/Util/Util.xs.dll +0 -0
  222. package/bin/exiftool_files/lib/auto/MIME/Base64/Base64.xs.dll +0 -0
  223. package/bin/exiftool_files/lib/auto/Math/BigInt/FastCalc/FastCalc.xs.dll +0 -0
  224. package/bin/exiftool_files/lib/auto/Math/BigInt/GMP/GMP.xs.dll +0 -0
  225. package/bin/exiftool_files/lib/auto/POSIX/POSIX.xs.dll +0 -0
  226. package/bin/exiftool_files/lib/auto/PerlIO/scalar/scalar.xs.dll +0 -0
  227. package/bin/exiftool_files/lib/auto/Socket/Socket.xs.dll +0 -0
  228. package/bin/exiftool_files/lib/auto/Storable/Storable.xs.dll +0 -0
  229. package/bin/exiftool_files/lib/auto/Time/HiRes/HiRes.xs.dll +0 -0
  230. package/bin/exiftool_files/lib/auto/Time/Piece/Piece.xs.dll +0 -0
  231. package/bin/exiftool_files/lib/auto/Unicode/LineBreak/LineBreak.xs.dll +0 -0
  232. package/bin/exiftool_files/lib/auto/Win32/API/API.xs.dll +0 -0
  233. package/bin/exiftool_files/lib/auto/Win32/FindFile/FindFile.xs.dll +0 -0
  234. package/bin/exiftool_files/lib/auto/Win32/Win32.xs.dll +0 -0
  235. package/bin/exiftool_files/lib/auto/Win32API/File/File.xs.dll +0 -0
  236. package/bin/exiftool_files/lib/auto/mro/mro.xs.dll +0 -0
  237. package/bin/exiftool_files/lib/auto/re/re.xs.dll +0 -0
  238. package/bin/exiftool_files/lib/feature.pm +49 -17
  239. package/bin/exiftool_files/lib/mro.pm +4 -20
  240. package/bin/exiftool_files/lib/overload.pm +15 -15
  241. package/bin/exiftool_files/lib/parent.pm +10 -2
  242. package/bin/exiftool_files/lib/re.pm +91 -33
  243. package/bin/exiftool_files/lib/warnings.pm +17 -6
  244. package/bin/exiftool_files/libgcc_s_seh-1.dll +0 -0
  245. package/bin/exiftool_files/liblzma-5__.dll +0 -0
  246. package/bin/exiftool_files/libstdc++-6.dll +0 -0
  247. package/bin/exiftool_files/libwinpthread-1.dll +0 -0
  248. package/bin/exiftool_files/perl.exe +0 -0
  249. package/bin/exiftool_files/perl532.dll +0 -0
  250. package/package.json +6 -4
  251. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/cs.pm +0 -978
  252. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/de.pm +0 -1975
  253. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/en_ca.pm +0 -44
  254. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/en_gb.pm +0 -124
  255. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/es.pm +0 -2921
  256. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/fi.pm +0 -1116
  257. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/fr.pm +0 -3171
  258. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/it.pm +0 -2750
  259. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/ja.pm +0 -10256
  260. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/ko.pm +0 -4499
  261. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/nl.pm +0 -1270
  262. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/pl.pm +0 -3019
  263. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/ru.pm +0 -18220
  264. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/sk.pm +0 -441
  265. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/sv.pm +0 -714
  266. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/tr.pm +0 -452
  267. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/zh_cn.pm +0 -2225
  268. package/bin/exiftool_files/lib/Image/ExifTool/GeoLang/zh_tw.pm +0 -72
  269. package/bin/exiftool_files/libgcc_s_dw2-1.dll +0 -0
  270. package/bin/exiftool_files/perl530.dll +0 -0
@@ -23,10 +23,12 @@ require IO::Socket::UNIX if ($^O ne 'epoc' && $^O ne 'symbian');
23
23
 
24
24
  our @ISA = qw(IO::Handle);
25
25
 
26
- our $VERSION = "1.40";
26
+ our $VERSION = "1.45";
27
27
 
28
28
  our @EXPORT_OK = qw(sockatmark);
29
29
 
30
+ our $errstr;
31
+
30
32
  sub import {
31
33
  my $pkg = shift;
32
34
  if (@_ && $_[0] eq 'sockatmark') { # not very extensible but for now, fast
@@ -82,7 +84,12 @@ sub socket {
82
84
 
83
85
  ${*$sock}{'io_socket_domain'} = $domain;
84
86
  ${*$sock}{'io_socket_type'} = $type;
85
- ${*$sock}{'io_socket_proto'} = $protocol;
87
+
88
+ # "A value of 0 for protocol will let the system select an
89
+ # appropriate protocol"
90
+ # so we need to look up what the system selected,
91
+ # not cache PF_UNSPEC.
92
+ ${*$sock}{'io_socket_proto'} = $protocol if $protocol;
86
93
 
87
94
  $sock;
88
95
  }
@@ -115,7 +122,7 @@ sub connect {
115
122
  if (defined $timeout && ($!{EINPROGRESS} || $!{EWOULDBLOCK})) {
116
123
  require IO::Select;
117
124
 
118
- my $sel = new IO::Select $sock;
125
+ my $sel = IO::Select->new( $sock );
119
126
 
120
127
  undef $!;
121
128
  my($r,$w,$e) = IO::Select::select(undef,$sel,$sel,$timeout);
@@ -127,11 +134,11 @@ sub connect {
127
134
  # set we now emulate the behavior in Linux
128
135
  # - Karthik Rajagopalan
129
136
  $err = $sock->getsockopt(SOL_SOCKET,SO_ERROR);
130
- $@ = "connect: $err";
137
+ $errstr = $@ = "connect: $err";
131
138
  }
132
139
  elsif(!@$w[0]) {
133
140
  $err = $! || (exists &Errno::ETIMEDOUT ? &Errno::ETIMEDOUT : 1);
134
- $@ = "connect: timeout";
141
+ $errstr = $@ = "connect: timeout";
135
142
  }
136
143
  elsif (!connect($sock,$addr) &&
137
144
  not ($!{EISCONN} || ($^O eq 'MSWin32' &&
@@ -142,12 +149,12 @@ sub connect {
142
149
  # Windows sets errno to WSAEINVAL (10022) (pre-5.19.4) or
143
150
  # EINVAL (22) (5.19.4 onwards).
144
151
  $err = $!;
145
- $@ = "connect: $!";
152
+ $errstr = $@ = "connect: $!";
146
153
  }
147
154
  }
148
155
  elsif ($blocking || !($!{EINPROGRESS} || $!{EWOULDBLOCK})) {
149
156
  $err = $!;
150
- $@ = "connect: $!";
157
+ $errstr = $@ = "connect: $!";
151
158
  }
152
159
  }
153
160
 
@@ -179,25 +186,25 @@ sub blocking {
179
186
  #
180
187
  # which is used to set blocking behaviour.
181
188
 
182
- # NOTE:
189
+ # NOTE:
183
190
  # This is a little confusing, the perl keyword for this is
184
191
  # 'blocking' but the OS level behaviour is 'non-blocking', probably
185
192
  # because sockets are blocking by default.
186
193
  # Therefore internally we have to reverse the semantics.
187
194
 
188
195
  my $orig= !${*$sock}{io_sock_nonblocking};
189
-
196
+
190
197
  return $orig unless @_;
191
198
 
192
199
  my $block = shift;
193
-
200
+
194
201
  if ( !$block != !$orig ) {
195
202
  ${*$sock}{io_sock_nonblocking} = $block ? 0 : 1;
196
203
  ioctl($sock, 0x8004667e, pack("L!",${*$sock}{io_sock_nonblocking}))
197
204
  or return undef;
198
205
  }
199
-
200
- return $orig;
206
+
207
+ return $orig;
201
208
  }
202
209
 
203
210
 
@@ -238,10 +245,10 @@ sub accept {
238
245
  if(defined $timeout) {
239
246
  require IO::Select;
240
247
 
241
- my $sel = new IO::Select $sock;
248
+ my $sel = IO::Select->new( $sock );
242
249
 
243
250
  unless ($sel->can_read($timeout)) {
244
- $@ = 'accept: timeout';
251
+ $errstr = $@ = 'accept: timeout';
245
252
  $! = (exists &Errno::ETIMEDOUT ? &Errno::ETIMEDOUT : 1);
246
253
  return;
247
254
  }
@@ -277,14 +284,24 @@ sub send {
277
284
  @_ >= 2 && @_ <= 4 or croak 'usage: $sock->send(BUF, [FLAGS, [TO]])';
278
285
  my $sock = $_[0];
279
286
  my $flags = $_[2] || 0;
280
- my $peer = $_[3] || $sock->peername;
287
+ my $peer;
288
+
289
+ if ($_[3]) {
290
+ # the caller explicitly requested a TO, so use it
291
+ # this is non-portable for "connected" UDP sockets
292
+ $peer = $_[3];
293
+ }
294
+ elsif (!defined getpeername($sock)) {
295
+ # we're not connected, so we require a peer from somewhere
296
+ $peer = $sock->peername;
281
297
 
282
- croak 'send: Cannot determine peer address'
283
- unless(defined $peer);
298
+ croak 'send: Cannot determine peer address'
299
+ unless(defined $peer);
300
+ }
284
301
 
285
- my $r = defined(getpeername($sock))
286
- ? send($sock, $_[1], $flags)
287
- : send($sock, $_[1], $flags, $peer);
302
+ my $r = $peer
303
+ ? send($sock, $_[1], $flags, $peer)
304
+ : send($sock, $_[1], $flags);
288
305
 
289
306
  # remember who we send to, if it was successful
290
307
  ${*$sock}{'io_socket_peername'} = $peer
@@ -386,185 +403,516 @@ IO::Socket - Object interface to socket communications
386
403
 
387
404
  =head1 SYNOPSIS
388
405
 
389
- use IO::Socket;
406
+ use strict;
407
+ use warnings;
408
+
409
+ use IO::Socket qw(AF_INET AF_UNIX);
410
+
411
+ # create a new AF_INET socket
412
+ my $sock = IO::Socket->new(Domain => AF_INET);
413
+ # which is the same as
414
+ $sock = IO::Socket::INET->new();
415
+
416
+ # create a new AF_UNIX socket
417
+ $sock = IO::Socket->new(Domain => AF_UNIX);
418
+ # which is the same as
419
+ $sock = IO::Socket::UNIX->new();
390
420
 
391
421
  =head1 DESCRIPTION
392
422
 
393
- C<IO::Socket> provides an object interface to creating and using sockets. It
394
- is built upon the L<IO::Handle> interface and inherits all the methods defined
395
- by L<IO::Handle>.
423
+ C<IO::Socket> provides an object-oriented, L<IO::Handle>-based interface to
424
+ creating and using sockets via L<Socket>, which provides a near one-to-one
425
+ interface to the C socket library.
396
426
 
397
- C<IO::Socket> only defines methods for those operations which are common to all
398
- types of socket. Operations which are specified to a socket in a particular
399
- domain have methods defined in sub classes of C<IO::Socket>
427
+ C<IO::Socket> is a base class that really only defines methods for those
428
+ operations which are common to all types of sockets. Operations which are
429
+ specific to a particular socket domain have methods defined in subclasses of
430
+ C<IO::Socket>. See L<IO::Socket::INET>, L<IO::Socket::UNIX>, and
431
+ L<IO::Socket::IP> for examples of such a subclass.
400
432
 
401
433
  C<IO::Socket> will export all functions (and constants) defined by L<Socket>.
402
434
 
403
- =head1 CONSTRUCTOR
435
+ =head1 CONSTRUCTOR ARGUMENTS
404
436
 
405
- =over 4
437
+ Given that C<IO::Socket> doesn't have attributes in the traditional sense, the
438
+ following arguments, rather than attributes, can be passed into the
439
+ constructor.
406
440
 
407
- =item new ( [ARGS] )
441
+ Constructor arguments should be passed in C<< Key => 'Value' >> pairs.
408
442
 
409
- Creates an C<IO::Socket>, which is a reference to a
410
- newly created symbol (see the C<Symbol> package). C<new>
411
- optionally takes arguments, these arguments are in key-value pairs.
412
- C<new> only looks for one key C<Domain> which tells new which domain
413
- the socket will be in. All other arguments will be passed to the
414
- configuration method of the package for that domain, See below.
443
+ The only required argument is L<IO::Socket/"Domain">.
415
444
 
416
- B<NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE>
445
+ =head2 Blocking
417
446
 
418
- As of VERSION 1.18 all IO::Socket objects have autoflush turned on
419
- by default. This was not the case with earlier releases.
447
+ my $sock = IO::Socket->new(..., Blocking => 1);
448
+ $sock = IO::Socket->new(..., Blocking => 0);
420
449
 
421
- B<NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE>
450
+ If defined but false, the socket will be set to non-blocking mode. If not
451
+ specified it defaults to C<1> (blocking mode).
422
452
 
423
- =back
453
+ =head2 Domain
424
454
 
425
- =head1 METHODS
455
+ my $sock = IO::Socket->new(Domain => IO::Socket::AF_INET);
456
+ $sock = IO::Socket->new(Domain => IO::Socket::AF_UNIX);
426
457
 
427
- See L<perlfunc> for complete descriptions of each of the following
428
- supported C<IO::Socket> methods, which are just front ends for the
429
- corresponding built-in functions:
458
+ The socket domain will define which subclass of C<IO::Socket> to use. The two
459
+ options available along with this distribution are C<AF_INET> and C<AF_UNIX>.
430
460
 
431
- socket
432
- socketpair
433
- bind
434
- listen
435
- accept
436
- send
437
- recv
438
- peername (getpeername)
439
- sockname (getsockname)
440
- shutdown
461
+ C<AF_INET> is for the internet address family of sockets and is handled via
462
+ L<IO::Socket::INET>. C<AF_INET> sockets are bound to an internet address and
463
+ port.
441
464
 
442
- Some methods take slightly different arguments to those defined in L<perlfunc>
443
- in attempt to make the interface more flexible. These are
465
+ C<AF_UNIX> is for the unix domain socket and is handled via
466
+ L<IO::Socket::UNIX>. C<AF_UNIX> sockets are bound to the file system as their
467
+ address name space.
444
468
 
445
- =over 4
469
+ This argument is B<required>. All other arguments are optional.
446
470
 
447
- =item accept([PKG])
471
+ =head2 Listen
448
472
 
449
- perform the system call C<accept> on the socket and return a new
450
- object. The new object will be created in the same class as the listen
451
- socket, unless C<PKG> is specified. This object can be used to
452
- communicate with the client that was trying to connect.
473
+ my $sock = IO::Socket->new(..., Listen => 5);
453
474
 
454
- In a scalar context the new socket is returned, or undef upon
455
- failure. In a list context a two-element array is returned containing
456
- the new socket and the peer address; the list will be empty upon
457
- failure.
475
+ Listen should be an integer value or left unset.
476
+
477
+ If provided, this argument will place the socket into listening mode. New
478
+ connections can then be accepted using the L<IO::Socket/"accept"> method. The
479
+ value given is used as the C<listen(2)> queue size.
458
480
 
459
- The timeout in the [PKG] can be specified as zero to effect a "poll",
460
- but you shouldn't do that because a new IO::Select object will be
461
- created behind the scenes just to do the single poll. This is
462
- horrendously inefficient. Use rather true select() with a zero
463
- timeout on the handle, or non-blocking IO.
481
+ If the C<Listen> argument is given, but false, the queue size will be set to
482
+ 5.
464
483
 
465
- =item socketpair(DOMAIN, TYPE, PROTOCOL)
484
+ =head2 Timeout
466
485
 
467
- Call C<socketpair> and return a list of two sockets created, or an
468
- empty list on failure.
486
+ my $sock = IO::Socket->new(..., Timeout => 5);
469
487
 
470
- =back
488
+ The timeout value, in seconds, for this socket connection. How exactly this
489
+ value is utilized is defined in the socket domain subclasses that make use of
490
+ the value.
471
491
 
472
- Additional methods that are provided are:
492
+ =head2 Type
473
493
 
474
- =over 4
494
+ my $sock = IO::Socket->new(..., Type => IO::Socket::SOCK_STREAM);
475
495
 
476
- =item atmark
496
+ The socket type that will be used. These are usually C<SOCK_STREAM>,
497
+ C<SOCK_DGRAM>, or C<SOCK_RAW>. If this argument is left undefined an attempt
498
+ will be made to infer the type from the service name.
477
499
 
478
- True if the socket is currently positioned at the urgent data mark,
479
- false otherwise.
500
+ For example, you'll usually use C<SOCK_STREAM> with a C<tcp> connection and
501
+ C<SOCK_DGRAM> with a C<udp> connection.
502
+
503
+ =head1 CONSTRUCTORS
504
+
505
+ C<IO::Socket> extends the L<IO::Handle> constructor.
506
+
507
+ =head2 new
508
+
509
+ my $sock = IO::Socket->new();
510
+
511
+ # get a new IO::Socket::INET instance
512
+ $sock = IO::Socket->new(Domain => IO::Socket::AF_INET);
513
+ # get a new IO::Socket::UNIX instance
514
+ $sock = IO::Socket->new(Domain => IO::Socket::AF_UNIX);
515
+
516
+ # Domain is the only required argument
517
+ $sock = IO::Socket->new(
518
+ Domain => IO::Socket::AF_INET, # AF_INET, AF_UNIX
519
+ Type => IO::Socket::SOCK_STREAM, # SOCK_STREAM, SOCK_DGRAM, ...
520
+ Proto => 'tcp', # 'tcp', 'udp', IPPROTO_TCP, IPPROTO_UDP
521
+ # and so on...
522
+ );
523
+
524
+ Creates an C<IO::Socket>, which is a reference to a newly created symbol (see
525
+ the L<Symbol> package). C<new> optionally takes arguments, these arguments
526
+ are defined in L<IO::Socket/"CONSTRUCTOR ARGUMENTS">.
527
+
528
+ Any of the L<IO::Socket/"CONSTRUCTOR ARGUMENTS"> may be passed to the
529
+ constructor, but if any arguments are provided, then one of them must be
530
+ the L<IO::Socket/"Domain"> argument. The L<IO::Socket/"Domain"> argument can,
531
+ by default, be either C<AF_INET> or C<AF_UNIX>. Other domains can be used if a
532
+ proper subclass for the domain family is registered. All other arguments will
533
+ be passed to the C<configuration> method of the package for that domain.
534
+
535
+ If the constructor fails it will return C<undef> and set the C<$errstr> package
536
+ variable to contain an error message.
537
+
538
+ $sock = IO::Socket->new(...)
539
+ or die "Cannot create socket - $IO::Socket::errstr\n";
540
+
541
+ For legacy reasons the error message is also set into the global C<$@>
542
+ variable, and you may still find older code which looks here instead.
543
+
544
+ $sock = IO::Socket->new(...)
545
+ or die "Cannot create socket - $@\n";
546
+
547
+ =head1 METHODS
480
548
 
481
- use IO::Socket;
549
+ C<IO::Socket> inherits all methods from L<IO::Handle> and implements the
550
+ following new ones.
482
551
 
483
- my $sock = IO::Socket::INET->new('some_server');
552
+ =head2 accept
553
+
554
+ my $client_sock = $sock->accept();
555
+ my $inet_sock = $sock->accept('IO::Socket::INET');
556
+
557
+ The accept method will perform the system call C<accept> on the socket and
558
+ return a new object. The new object will be created in the same class as the
559
+ listen socket, unless a specific package name is specified. This object can be
560
+ used to communicate with the client that was trying to connect.
561
+
562
+ This differs slightly from the C<accept> function in L<perlfunc>.
563
+
564
+ In a scalar context the new socket is returned, or C<undef> upon
565
+ failure. In a list context a two-element array is returned containing
566
+ the new socket and the peer address; the list will be empty upon failure.
567
+
568
+ =head2 atmark
569
+
570
+ my $integer = $sock->atmark();
571
+ # read in some data on a given socket
572
+ my $data;
484
573
  $sock->read($data, 1024) until $sock->atmark;
485
574
 
486
- Note: this is a reasonably new addition to the family of socket
487
- functions, so all systems may not support this yet. If it is
488
- unsupported by the system, an attempt to use this method will
489
- abort the program.
575
+ # or, export the function to use:
576
+ use IO::Socket 'sockatmark';
577
+ $sock->read($data, 1024) until sockatmark($sock);
490
578
 
491
- The atmark() functionality is also exportable as sockatmark() function:
579
+ True if the socket is currently positioned at the urgent data mark, false
580
+ otherwise. If your system doesn't yet implement C<sockatmark> this will throw
581
+ an exception.
492
582
 
493
- use IO::Socket 'sockatmark';
583
+ If your system does not support C<sockatmark>, the C<use> declaration will
584
+ fail at compile time.
494
585
 
495
- This allows for a more traditional use of sockatmark() as a procedural
496
- socket function. If your system does not support sockatmark(), the
497
- C<use> declaration will fail at compile time.
586
+ =head2 autoflush
498
587
 
499
- =item connected
588
+ # by default, autoflush will be turned on when referenced
589
+ $sock->autoflush(); # turns on autoflush
590
+ # turn off autoflush
591
+ $sock->autoflush(0);
592
+ # turn on autoflush
593
+ $sock->autoflush(1);
594
+
595
+ This attribute isn't overridden from L<IO::Handle>'s implementation. However,
596
+ since we turn it on by default, it's worth mentioning here.
597
+
598
+ =head2 bind
599
+
600
+ use Socket qw(pack_sockaddr_in);
601
+ my $port = 3000;
602
+ my $ip_address = '0.0.0.0';
603
+ my $packed_addr = pack_sockaddr_in($port, $ip_address);
604
+ $sock->bind($packed_addr);
605
+
606
+ Binds a network address to a socket, just as C<bind(2)> does. Returns true if
607
+ it succeeded, false otherwise. You should provide a packed address of the
608
+ appropriate type for the socket.
609
+
610
+ =head2 connected
611
+
612
+ my $peer_addr = $sock->connected();
613
+ if ($peer_addr) {
614
+ say "We're connected to $peer_addr";
615
+ }
500
616
 
501
617
  If the socket is in a connected state, the peer address is returned. If the
502
- socket is not in a connected state, undef is returned.
618
+ socket is not in a connected state, C<undef> is returned.
503
619
 
504
- Note that connected() considers a half-open TCP socket to be "in a connected
505
- state". Specifically, connected() does not distinguish between the
620
+ Note that this method considers a half-open TCP socket to be "in a connected
621
+ state". Specifically, it does not distinguish between the
506
622
  B<ESTABLISHED> and B<CLOSE-WAIT> TCP states; it returns the peer address,
507
- rather than undef, in either case. Thus, in general, connected() cannot
623
+ rather than C<undef>, in either case. Thus, in general, it cannot
508
624
  be used to reliably learn whether the peer has initiated a graceful shutdown
509
625
  because in most cases (see below) the local TCP state machine remains in
510
- B<CLOSE-WAIT> until the local application calls shutdown() or close();
511
- only at that point does connected() return undef.
626
+ B<CLOSE-WAIT> until the local application calls L<IO::Socket/"shutdown"> or
627
+ C<close>. Only at that point does this function return C<undef>.
512
628
 
513
629
  The "in most cases" hedge is because local TCP state machine behavior may
514
630
  depend on the peer's socket options. In particular, if the peer socket has
515
- SO_LINGER enabled with a zero timeout, then the peer's close() will generate
516
- a RST segment, upon receipt of which the local TCP transitions immediately to
517
- B<CLOSED>, and in that state, connected() I<will> return undef.
631
+ C<SO_LINGER> enabled with a zero timeout, then the peer's C<close> will
632
+ generate a C<RST> segment. Upon receipt of that segment, the local TCP
633
+ transitions immediately to B<CLOSED>, and in that state, this method I<will>
634
+ return C<undef>.
635
+
636
+ =head2 getsockopt
637
+
638
+ my $value = $sock->getsockopt(SOL_SOCKET, SO_REUSEADDR);
639
+ my $buf = $socket->getsockopt(SOL_SOCKET, SO_RCVBUF);
640
+ say "Receive buffer is $buf bytes";
641
+
642
+ Get an option associated with the socket. Levels other than C<SOL_SOCKET>
643
+ may be specified here. As a convenience, this method will unpack a byte buffer
644
+ of the correct size back into a number.
645
+
646
+ =head2 listen
647
+
648
+ $sock->listen(5);
649
+
650
+ Does the same thing that the C<listen(2)> system call does. Returns true if it
651
+ succeeded, false otherwise. Listens to a socket with a given queue size.
518
652
 
519
- =item protocol
653
+ =head2 peername
520
654
 
521
- Returns the numerical number for the protocol being used on the socket, if
522
- known. If the protocol is unknown, as with an AF_UNIX socket, zero
655
+ my $sockaddr_in = $sock->peername();
656
+
657
+ Returns the packed C<sockaddr> address of the other end of the socket
658
+ connection. It calls C<getpeername>.
659
+
660
+
661
+ =head2 protocol
662
+
663
+ my $proto = $sock->protocol();
664
+
665
+ Returns the number for the protocol being used on the socket, if
666
+ known. If the protocol is unknown, as with an C<AF_UNIX> socket, zero
523
667
  is returned.
524
668
 
525
- =item sockdomain
669
+ =head2 recv
670
+
671
+ my $buffer = "";
672
+ my $length = 1024;
673
+ my $flags = 0; # default. optional
674
+ $sock->recv($buffer, $length);
675
+ $sock->recv($buffer, $length, $flags);
526
676
 
527
- Returns the numerical number for the socket domain type. For example, for
528
- an AF_INET socket the value of &AF_INET will be returned.
677
+ Similar in functionality to L<perlfunc/recv>.
529
678
 
530
- =item sockopt(OPT [, VAL])
679
+ Receives a message on a socket. Attempts to receive C<$length> characters of
680
+ data into C<$buffer> from the specified socket. C<$buffer> will be grown or
681
+ shrunk to the length actually read. Takes the same flags as the system call of
682
+ the same name. Returns the address of the sender if socket's protocol supports
683
+ this; returns an empty string otherwise. If there's an error, returns
684
+ C<undef>. This call is actually implemented in terms of the C<recvfrom(2)>
685
+ system call.
531
686
 
532
- Unified method to both set and get options in the SOL_SOCKET level. If called
533
- with one argument then getsockopt is called, otherwise setsockopt is called.
687
+ Flags are ORed together values, such as C<MSG_BCAST>, C<MSG_OOB>,
688
+ C<MSG_TRUNC>. The default value for the flags is C<0>.
534
689
 
535
- =item getsockopt(LEVEL, OPT)
690
+ The cached value of L<IO::Socket/"peername"> is updated with the result of
691
+ C<recv>.
536
692
 
537
- Get option associated with the socket. Other levels than SOL_SOCKET
538
- may be specified here.
693
+ B<Note:> In Perl v5.30 and newer, if the socket has been marked as C<:utf8>,
694
+ C<recv> will throw an exception. The C<:encoding(...)> layer implicitly
695
+ introduces the C<:utf8> layer. See L<perlfunc/binmode>.
539
696
 
540
- =item setsockopt(LEVEL, OPT, VAL)
697
+ B<Note:> In Perl versions older than v5.30, depending on the status of the
698
+ socket, either (8-bit) bytes or characters are received. By default all
699
+ sockets operate on bytes, but for example if the socket has been changed
700
+ using L<perlfunc/binmode> to operate with the C<:encoding(UTF-8)> I/O layer
701
+ (see the L<perlfunc/open> pragma), the I/O will operate on UTF8-encoded
702
+ Unicode characters, not bytes. Similarly for the C<:encoding> layer: in
703
+ that case pretty much any characters can be read.
541
704
 
542
- Set option associated with the socket. Other levels than SOL_SOCKET
543
- may be specified here.
705
+ =head2 send
544
706
 
545
- =item socktype
707
+ my $message = "Hello, world!";
708
+ my $flags = 0; # defaults to zero
709
+ my $to = '0.0.0.0'; # optional destination
710
+ my $sent = $sock->send($message);
711
+ $sent = $sock->send($message, $flags);
712
+ $sent = $sock->send($message, $flags, $to);
546
713
 
547
- Returns the numerical number for the socket type. For example, for
548
- a SOCK_STREAM socket the value of &SOCK_STREAM will be returned.
714
+ Similar in functionality to L<perlfunc/send>.
549
715
 
550
- =item timeout([VAL])
716
+ Sends a message on a socket. Attempts to send the scalar message to the
717
+ socket. Takes the same flags as the system call of the same name. On
718
+ unconnected sockets, you must specify a destination to send to, in which case
719
+ it does a C<sendto(2)> syscall. Returns the number of characters sent, or
720
+ C<undef> on error. The C<sendmsg(2)> syscall is currently unimplemented.
721
+
722
+ The C<flags> option is optional and defaults to C<0>.
723
+
724
+ After a successful send with C<$to>, further calls to C<send> on an
725
+ unconnected socket without C<$to> will send to the same address, and C<$to>
726
+ will be used as the result of L<IO::Socket/"peername">.
727
+
728
+ B<Note:> In Perl v5.30 and newer, if the socket has been marked as C<:utf8>,
729
+ C<send> will throw an exception. The C<:encoding(...)> layer implicitly
730
+ introduces the C<:utf8> layer. See L<perlfunc/binmode>.
731
+
732
+ B<Note:> In Perl versions older than v5.30, depending on the status of the
733
+ socket, either (8-bit) bytes or characters are sent. By default all
734
+ sockets operate on bytes, but for example if the socket has been changed
735
+ using L<perlfunc/binmode> to operate with the C<:encoding(UTF-8)> I/O layer
736
+ (see the L<perlfunc/open> pragma), the I/O will operate on UTF8-encoded
737
+ Unicode characters, not bytes. Similarly for the C<:encoding> layer: in
738
+ that case pretty much any characters can be sent.
739
+
740
+ =head2 setsockopt
741
+
742
+ $sock->setsockopt(SOL_SOCKET, SO_REUSEADDR, 1);
743
+ $sock->setsockopt(SOL_SOCKET, SO_RCVBUF, 64*1024);
744
+
745
+ Set option associated with the socket. Levels other than C<SOL_SOCKET>
746
+ may be specified here. As a convenience, this method will convert a number
747
+ into a packed byte buffer.
748
+
749
+ =head2 shutdown
750
+
751
+ $sock->shutdown(SHUT_RD); # we stopped reading data
752
+ $sock->shutdown(SHUT_WR); # we stopped writing data
753
+ $sock->shutdown(SHUT_RDWR); # we stopped using this socket
754
+
755
+ Shuts down a socket connection in the manner indicated by the value passed in,
756
+ which has the same interpretation as in the syscall of the same name.
757
+
758
+ This is useful with sockets when you want to tell the other side you're done
759
+ writing but not done reading, or vice versa. It's also a more insistent form
760
+ of C<close> because it also disables the file descriptor in any
761
+ forked copies in other processes.
762
+
763
+ Returns C<1> for success; on error, returns C<undef> if the socket is
764
+ not a valid filehandle, or returns C<0> and sets C<$!> for any other failure.
765
+
766
+ =head2 sockdomain
767
+
768
+ my $domain = $sock->sockdomain();
769
+
770
+ Returns the number for the socket domain type. For example, for
771
+ an C<AF_INET> socket the value of C<&AF_INET> will be returned.
772
+
773
+ =head2 socket
774
+
775
+ my $sock = IO::Socket->new(); # no values given
776
+ # now let's actually get a socket with the socket method
777
+ # domain, type, and protocol are required
778
+ $sock = $sock->socket(AF_INET, SOCK_STREAM, 'tcp');
779
+
780
+ Opens a socket of the specified kind and returns it. Domain, type, and
781
+ protocol are specified the same as for the syscall of the same name.
782
+
783
+ =head2 socketpair
784
+
785
+ my ($r, $w) = $sock->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
786
+ ($r, $w) = IO::Socket::UNIX
787
+ ->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
788
+
789
+ Will return a list of two sockets created (read and write), or an empty list
790
+ on failure.
791
+
792
+ Differs slightly from C<socketpair> in L<perlfunc> in that the argument list
793
+ is a bit simpler.
794
+
795
+ =head2 sockname
796
+
797
+ my $packed_addr = $sock->sockname();
798
+
799
+ Returns the packed C<sockaddr> address of this end of the connection. It's the
800
+ same as C<getsockname(2)>.
801
+
802
+ =head2 sockopt
803
+
804
+ my $value = $sock->sockopt(SO_REUSEADDR);
805
+ $sock->sockopt(SO_REUSEADDR, 1);
806
+
807
+ Unified method to both set and get options in the C<SOL_SOCKET> level. If
808
+ called with one argument then L<IO::Socket/"getsockopt"> is called, otherwise
809
+ L<IO::Socket/"setsockopt"> is called.
810
+
811
+ =head2 socktype
812
+
813
+ my $type = $sock->socktype();
814
+
815
+ Returns the number for the socket type. For example, for
816
+ a C<SOCK_STREAM> socket the value of C<&SOCK_STREAM> will be returned.
817
+
818
+ =head2 timeout
819
+
820
+ my $seconds = $sock->timeout();
821
+ my $old_val = $sock->timeout(5); # set new and return old value
551
822
 
552
823
  Set or get the timeout value (in seconds) associated with this socket.
553
824
  If called without any arguments then the current setting is returned. If
554
825
  called with an argument the current setting is changed and the previous
555
826
  value returned.
556
827
 
557
- =back
828
+ This method is available to all C<IO::Socket> implementations but may or may
829
+ not be used by the individual domain subclasses.
830
+
831
+ =head1 EXAMPLES
832
+
833
+ Let's create a TCP server on C<localhost:3333>.
834
+
835
+ use strict;
836
+ use warnings;
837
+ use feature 'say';
838
+
839
+ use IO::Socket qw(AF_INET AF_UNIX SOCK_STREAM SHUT_WR);
840
+
841
+ my $server = IO::Socket->new(
842
+ Domain => AF_INET,
843
+ Type => SOCK_STREAM,
844
+ Proto => 'tcp',
845
+ LocalHost => '0.0.0.0',
846
+ LocalPort => 3333,
847
+ ReusePort => 1,
848
+ Listen => 5,
849
+ ) || die "Can't open socket: $IO::Socket::errstr";
850
+ say "Waiting on 3333";
851
+
852
+ while (1) {
853
+ # waiting for a new client connection
854
+ my $client = $server->accept();
855
+
856
+ # get information about a newly connected client
857
+ my $client_address = $client->peerhost();
858
+ my $client_port = $client->peerport();
859
+ say "Connection from $client_address:$client_port";
860
+
861
+ # read up to 1024 characters from the connected client
862
+ my $data = "";
863
+ $client->recv($data, 1024);
864
+ say "received data: $data";
865
+
866
+ # write response data to the connected client
867
+ $data = "ok";
868
+ $client->send($data);
869
+
870
+ # notify client that response has been sent
871
+ $client->shutdown(SHUT_WR);
872
+ }
873
+
874
+ $server->close();
875
+
876
+ A client for such a server could be
877
+
878
+ use strict;
879
+ use warnings;
880
+ use feature 'say';
881
+
882
+ use IO::Socket qw(AF_INET AF_UNIX SOCK_STREAM SHUT_WR);
883
+
884
+ my $client = IO::Socket->new(
885
+ Domain => AF_INET,
886
+ Type => SOCK_STREAM,
887
+ proto => 'tcp',
888
+ PeerPort => 3333,
889
+ PeerHost => '0.0.0.0',
890
+ ) || die "Can't open socket: $IO::Socket::errstr";
891
+
892
+ say "Sending Hello World!";
893
+ my $size = $client->send("Hello World!");
894
+ say "Sent data of length: $size";
895
+
896
+ $client->shutdown(SHUT_WR);
897
+
898
+ my $buffer;
899
+ $client->recv($buffer, 1024);
900
+ say "Got back $buffer";
901
+
902
+ $client->close();
903
+
558
904
 
559
905
  =head1 LIMITATIONS
560
906
 
561
- On some systems, for an IO::Socket object created with new_from_fd(),
562
- or created with accept() from such an object, the protocol(),
563
- sockdomain() and socktype() methods may return undef.
907
+ On some systems, for an IO::Socket object created with C<new_from_fd>,
908
+ or created with L<IO::Socket/"accept"> from such an object, the
909
+ L<IO::Socket/"protocol">, L<IO::Socket/"sockdomain"> and
910
+ L<IO::Socket/"socktype"> methods may return C<undef>.
564
911
 
565
912
  =head1 SEE ALSO
566
913
 
567
- L<Socket>, L<IO::Handle>, L<IO::Socket::INET>, L<IO::Socket::UNIX>
914
+ L<Socket>, L<IO::Handle>, L<IO::Socket::INET>, L<IO::Socket::UNIX>,
915
+ L<IO::Socket::IP>
568
916
 
569
917
  =head1 AUTHOR
570
918