Skip to content

Commit 3fe11e0

Browse files
committed
Update Win32 to CPAN version 0.58
[DELTA] 0.58 [2022-01-17] - add Win32::HttpGetFile (thanks to Craig Berry for the implementation and Tomasz Konojacki for code review) [PR/30] - skip failing Unicode.t on Cygwin because cwd() no longer returns an ANSI (short) path there. - Fixed test 14,15 of GetFullPathName.t when package is unpacked in a top level folder (thanks to Jianhong Feng) [PR/20]
1 parent 8b9e957 commit 3fe11e0

File tree

6 files changed

+363
-8
lines changed

6 files changed

+363
-8
lines changed

Porting/Maintainers.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ package Maintainers;
13011301
},
13021302

13031303
'Win32' => {
1304-
'DISTRIBUTION' => "JDB/Win32-0.57.tar.gz",
1304+
'DISTRIBUTION' => "JDB/Win32-0.58.tar.gz",
13051305
'FILES' => q[cpan/Win32],
13061306
},
13071307

cpan/Win32/Makefile.PL

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ my %param = (
2222
$param{NO_META} = 1 if eval "$ExtUtils::MakeMaker::VERSION" >= 6.10_03;
2323

2424
if ($^O eq 'cygwin') {
25-
$param{LIBS} = ['-L/lib/w32api -lole32 -lversion -luserenv -lnetapi32']
25+
$param{LIBS} = ['-L/lib/w32api -lole32 -lversion -luserenv -lnetapi32 -lwinhttp']
2626
}
2727
else {
28-
$param{LIBS} = ['-luserenv']
28+
$param{LIBS} = ['-luserenv -lwinhttp']
2929
}
3030

3131
my $test_requires = $ExtUtils::MakeMaker::VERSION >= 6.64

cpan/Win32/Win32.pm

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package Win32;
88
require DynaLoader;
99

1010
@ISA = qw|Exporter DynaLoader|;
11-
$VERSION = '0.57';
11+
$VERSION = '0.58';
1212
$XS_VERSION = $VERSION;
1313
$VERSION = eval $VERSION;
1414

@@ -1305,11 +1305,52 @@ of hex digits with surrounding braces. For example:
13051305
13061306
{09531CF1-D0C7-4860-840C-1C8C8735E2AD}
13071307
1308+
=item Win32::HttpGetFile(URL, FILENAME [, IGNORE_CERT_ERRORS])
1309+
1310+
Uses the WinHttp library to download the file specified by the URL
1311+
parameter to the local file specified by FILENAME. The optional third
1312+
parameter, if true, indicates that certficate errors are to be ignored
1313+
for https connections; please use with caution in a safe environment,
1314+
such as when testing locally using a self-signed certificate.
1315+
1316+
Only http and https protocols are supported. Authentication is not
1317+
supported. The function is not available when building with gcc prior to
1318+
4.8.0 because the WinHttp library is not available.
1319+
1320+
In scalar context returns a boolean success or failure, and in list
1321+
context also returns, in addition to the boolean status, a second
1322+
value containing message text related to the status.
1323+
1324+
If the call fails, C<Win32::GetLastError()> will return a numeric
1325+
error code, which may be a system error, a WinHttp error, or a
1326+
user-defined error composed of 1e9 plus the HTTP status code.
1327+
1328+
Scalar context example:
1329+
1330+
print Win32::GetLastError()
1331+
unless Win32::HttpGetFile('http://example.com/somefile.tar.gz',
1332+
'.\file.tgz');
1333+
1334+
List context example:
1335+
1336+
my ($ok, $msg) = Win32::HttpGetFile('http://example.com/somefile.tar.gz',
1337+
'.\file.tgz');
1338+
if ($ok) {
1339+
print "Success!: $msg\n";
1340+
}
1341+
else {
1342+
print "Failure!: $msg\n";
1343+
my $err = Win32::GetLastError();
1344+
if ($err > 1e9) {
1345+
printf "HTTP status: %d\n", ($err - 1e9);
1346+
}
1347+
}
1348+
13081349
=item Win32::InitiateSystemShutdown
13091350
13101351
(MACHINE, MESSAGE, TIMEOUT, FORCECLOSE, REBOOT)
13111352
1312-
Shutsdown the specified MACHINE, notifying users with the
1353+
Shuts down the specified MACHINE, notifying users with the
13131354
supplied MESSAGE, within the specified TIMEOUT interval. Forces
13141355
closing of all documents without prompting the user if FORCECLOSE is
13151356
true, and reboots the machine if REBOOT is true. This function works

0 commit comments

Comments
 (0)