testbot: Add prototypes to the Perl utility functions.

Francois Gouget fgouget at codeweavers.com
Sun May 18 17:05:52 CDT 2014


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) = @_;
 
-- 
2.0.0.rc0




More information about the wine-patches mailing list