Module: tools Branch: master Commit: 6518eb604c1b118d523b22cc649d8b82cff06f5f URL: http://source.winehq.org/git/tools.git/?a=commit;h=6518eb604c1b118d523b22cc6...
Author: Francois Gouget fgouget@codeweavers.com Date: Mon May 19 00:05:52 2014 +0200
testbot: Add prototypes to the Perl utility functions.
The prototypes let Perl detect when the wrong number of parameters is passed to these functions. Also standardize the way we retrieve their arguments.
---
testbot/lib/WineTestBot/Utils.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm index acfabb5..1084abd 100644 --- a/testbot/lib/WineTestBot/Utils.pm +++ b/testbot/lib/WineTestBot/Utils.pm @@ -33,9 +33,9 @@ require Exporter; @EXPORT = qw(&MakeSecureURL &SecureConnection &GenerateRandomString &BuildEMailRecipient);
-sub MakeSecureURL +sub MakeSecureURL($) { - my $URL = shift; + my ($URL) = @_;
my $Protocol = "http"; if ($UseSSL || SecureConnection()) @@ -46,14 +46,14 @@ sub MakeSecureURL return $Protocol . "://" . $ENV{"HTTP_HOST"} . $URL; }
-sub SecureConnection +sub SecureConnection() { return defined($ENV{"HTTPS"}) && $ENV{"HTTPS"} eq "on"; }
-sub GenerateRandomString +sub GenerateRandomString($) { - my $Len = $_[0]; + my ($Len) = @_;
my $RandomString = ""; while (length($RandomString) < $Len) @@ -65,15 +65,15 @@ sub GenerateRandomString return substr($RandomString, 0, $Len); }
-sub DateTimeToString +sub DateTimeToString($) { - my $Time = $_[0]; + my ($Time) = @_;
# my ($Sec, $Min, $Hour, $MDay, $Mon, $Year, $WDay, $YDay, $IsDst) = localtime($Time); return strftime("%Y/%m/%d %H:%M:%S", localtime($Time)); }
-sub BuildEMailRecipient +sub BuildEMailRecipient($$) { my ($EMailAddress, $Name) = @_;