testbot/lib: Improve the methods argument handling.

Francois Gouget fgouget at codeweavers.com
Mon Jun 16 05:18:32 CDT 2014


This standardizes the way we handle the arguments.
Make it so one can readily see the list of arguments the method takes without having to hunt down the implementation of all its ancestors.
Because these are methods the added prototypes have no effect whatsoever as far as Perl is concerned. However they do document which arguments are optional.
---
 testbot/lib/WineTestBot/Branches.pm           | 14 ++---
 testbot/lib/WineTestBot/Jobs.pm               | 46 +++++++--------
 testbot/lib/WineTestBot/Patches.pm            | 35 +++++-------
 testbot/lib/WineTestBot/PendingPatchSets.pm   | 33 +++++------
 testbot/lib/WineTestBot/PendingPatches.pm     |  4 +-
 testbot/lib/WineTestBot/Roles.pm              |  4 +-
 testbot/lib/WineTestBot/Steps.pm              | 14 ++---
 testbot/lib/WineTestBot/StepsTasks.pm         | 13 ++---
 testbot/lib/WineTestBot/Tasks.pm              | 11 ++--
 testbot/lib/WineTestBot/UserRoles.pm          |  4 +-
 testbot/lib/WineTestBot/Users.pm              | 81 ++++++++++++---------------
 testbot/lib/WineTestBot/VMs.pm                | 56 +++++++++---------
 testbot/lib/WineTestBot/WineTestBotObjects.pm |  6 +-
 13 files changed, 146 insertions(+), 175 deletions(-)

diff --git a/testbot/lib/WineTestBot/Branches.pm b/testbot/lib/WineTestBot/Branches.pm
index f434569..1cfe70d 100644
--- a/testbot/lib/WineTestBot/Branches.pm
+++ b/testbot/lib/WineTestBot/Branches.pm
@@ -33,7 +33,7 @@ use vars qw (@ISA @EXPORT);
 require Exporter;
 @ISA = qw(WineTestBot::WineTestBotItem Exporter);
 
-sub InitializeNew
+sub InitializeNew($$)
 {
   my ($self, $Collection) = @_;
 
@@ -59,9 +59,9 @@ require Exporter;
 @ISA = qw(WineTestBot::WineTestBotCollection Exporter);
 @EXPORT = qw(&CreateBranches);
 
-sub GetDefaultBranch
+sub GetDefaultBranch($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   foreach my $Branch (@{$self->GetItems()})
   {
@@ -79,16 +79,16 @@ BEGIN
   );
 }
 
-sub MultipleBranchesPresent()
+sub MultipleBranchesPresent($)
 {
-  my $self = shift;
+  my ($self) = @_;
   
   return 1 < scalar(@{$self->GetKeys()});
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::Branch->new($self);
 }
diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index 60241e0..3ef7a7e 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -60,7 +60,7 @@ use vars qw(@ISA @EXPORT);
 require Exporter;
 @ISA = qw(WineTestBot::WineTestBotItem Exporter);
 
-sub _initialize
+sub _initialize($$)
 {
   my ($self, $Collection) = @_;
 
@@ -69,7 +69,7 @@ sub _initialize
   $self->{OldStatus} = undef;
 }
 
-sub InitializeNew
+sub InitializeNew($$)
 {
   my ($self, $Collection) = @_;
 
@@ -81,17 +81,13 @@ sub InitializeNew
   $self->SUPER::InitializeNew($Collection);
 }
 
-sub Status
+sub Status($;$)
 {
-  my $self = shift;
+  my ($self, $NewStatus) = @_;
 
   my $CurrentStatus = $self->SUPER::Status;
-  if (! @_)
-  {
-    return $CurrentStatus;
-  }
+  return $CurrentStatus if (!defined $NewStatus);
 
-  my $NewStatus = $_[0];
   if (! defined($CurrentStatus) || $NewStatus ne $CurrentStatus)
   {
     $self->SUPER::Status($NewStatus);
@@ -101,11 +97,11 @@ sub Status
   return $NewStatus;
 }
 
-sub OnSaved
+sub OnSaved($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
-  $self->SUPER::OnSaved(@_);
+  $self->SUPER::OnSaved();
 
   if (defined($self->{OldStatus}))
   {
@@ -131,7 +127,7 @@ dead child processes.
 
 sub UpdateStatus($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   my $Status = $self->Status;
   return $Status if ($Status ne "queued" && $Status ne "running");
@@ -186,9 +182,9 @@ sub UpdateStatus($)
   return $Status;
 }
 
-sub Cancel
+sub Cancel($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   my $Steps = $self->Steps;
   $Steps->AddFilter("Status", ["queued", "running"]);
@@ -224,9 +220,9 @@ sub Cancel
   return undef;
 }
 
-sub Restart
+sub Restart($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   if ($self->Status eq "queued" || $self->Status eq "running")
   {
@@ -267,9 +263,9 @@ sub Restart
   return undef;
 }
 
-sub GetEMailRecipient
+sub GetEMailRecipient($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   if (defined($self->Patch) && defined($self->Patch->FromEMail))
   {
@@ -284,9 +280,9 @@ sub GetEMailRecipient
   return $self->User->GetEMailRecipient();
 }
 
-sub GetDescription
+sub GetDescription($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   if (defined($self->Patch) && defined($self->Patch->FromEMail))
   {
@@ -348,9 +344,9 @@ BEGIN
   );
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::Job->new($self);
 }
@@ -710,9 +706,9 @@ sub CheckJobs()
   return undef;
 }
 
-sub FilterNotArchived
+sub FilterNotArchived($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   $self->AddFilter("Archived", [!1]);
 }
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index bb7ea3f..5e684e4 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -47,7 +47,7 @@ use vars qw(@ISA @EXPORT);
 require Exporter;
 @ISA = qw(WineTestBot::WineTestBotItem Exporter);
 
-sub InitializeNew
+sub InitializeNew($$)
 {
   my ($self, $Collection) = @_;
 
@@ -66,10 +66,9 @@ Initializes a WineTestBot::Patch object from the given message.
 =back
 =cut
 
-sub FromSubmission
+sub FromSubmission($$)
 {
-  my $self = shift;
-  my $MsgEntity = $_[0];
+  my ($self, $MsgEntity) = @_;
 
   my $Head = $MsgEntity->head;
   my @From = Mail::Address->parse($Head->get("From"));
@@ -119,10 +118,9 @@ WineTestBot::PendingPatchSet::SubmitSubset().
 =back
 =cut
 
-sub Submit
+sub Submit($$$)
 {
-  my $self = shift;
-  my ($PatchFileName, $IsSet) = @_;
+  my ($self, $PatchFileName, $IsSet) = @_;
 
   # See also OnSubmit() in web/Submit.pl
   my %Targets;
@@ -287,9 +285,9 @@ sub Submit
   return undef;
 }
 
-sub GetEMailRecipient
+sub GetEMailRecipient($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return BuildEMailRecipient($self->FromEMail, $self->FromName);
 }
@@ -329,17 +327,16 @@ BEGIN
   );
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::Patch->new($self);
 }
 
-sub IsPatch
+sub IsPatch($$)
 {
-  my $self = shift;
-  my $Body = $_[0];
+  my ($self, $Body) = @_;
 
   if (open(BODY, "<" . $Body->path))
   {
@@ -358,10 +355,9 @@ sub IsPatch
   return !1;
 }
 
-sub IsTestPatch
+sub IsTestPatch($$)
 {
-  my $self = shift;
-  my $Body = $_[0];
+  my ($self, $Body) = @_;
 
   if (open(BODY, "<" . $Body->path))
   {
@@ -395,10 +391,9 @@ others, then C<WineTestBot::Patch::Submit()> is called right away.
 =back
 =cut
 
-sub NewPatch
+sub NewPatch($$$)
 {
-  my $self = shift;
-  my ($MsgEntity, $WebPatchId) = @_;
+  my ($self, $MsgEntity, $WebPatchId) = @_;
 
   my $Patch = $self->Add();
   $Patch->WebPatchId($WebPatchId) if (defined $WebPatchId);
diff --git a/testbot/lib/WineTestBot/PendingPatchSets.pm b/testbot/lib/WineTestBot/PendingPatchSets.pm
index 4f908b5..cc93fd8 100644
--- a/testbot/lib/WineTestBot/PendingPatchSets.pm
+++ b/testbot/lib/WineTestBot/PendingPatchSets.pm
@@ -58,10 +58,9 @@ have been received.
 =back
 =cut
 
-sub CheckSubsetComplete
+sub CheckSubsetComplete($$)
 {
-  my $self = shift;
-  my $MaxPart = $_[0];
+  my ($self, $MaxPart) = @_;
 
   my $Parts = $self->Parts;
   my $MissingPart = !1;
@@ -84,9 +83,9 @@ Returns true if all the patches of the patchset have been received.
 =back
 =cut
 
-sub CheckComplete
+sub CheckComplete($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return $self->CheckSubsetComplete($self->TotalParts)
 }
@@ -102,10 +101,9 @@ calls WineTestBot::Patch::Submit() so it gets scheduled for testing.
 =back
 =cut
 
-sub SubmitSubset
+sub SubmitSubset($$$)
 {
-  my $self = shift;
-  my ($MaxPart, $FinalPatch) = @_;
+  my ($self, $MaxPart, $FinalPatch) = @_;
 
   my $CombinedFileName = "$DataDir/staging/" . GenerateRandomString(32) .
                          "_patch";
@@ -152,10 +150,9 @@ Submits the last patch in the patchset.
 =back
 =cut
 
-sub Submit
+sub Submit($$)
 {
-  my $self = shift;
-  my $FinalPatch = $_[0];
+  my ($self, $FinalPatch) = @_;
 
   return $self->SubmitSubset($self->TotalParts, $FinalPatch);
 }
@@ -193,9 +190,9 @@ BEGIN
   );
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::PendingPatchSet->new($self);
 }
@@ -212,11 +209,9 @@ makes the patchset complete, then the patchset itself is deleted.
 =back
 =cut
 
-sub NewSubmission
+sub NewSubmission($$)
 {
-  my $self = shift;
-
-  my $Patch = $_[0];
+  my ($self, $Patch) = @_;
   if (! defined($Patch->FromEMail))
   {
     $Patch->Disposition("Unable to determine series author");
@@ -311,9 +306,9 @@ to have been submitted already.
 =back
 =cut
 
-sub CheckForCompleteSet
+sub CheckForCompleteSet($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   my $ErrMessage;
   foreach my $Set (@{$self->GetItems()})
diff --git a/testbot/lib/WineTestBot/PendingPatches.pm b/testbot/lib/WineTestBot/PendingPatches.pm
index a06bee7..62dc992 100644
--- a/testbot/lib/WineTestBot/PendingPatches.pm
+++ b/testbot/lib/WineTestBot/PendingPatches.pm
@@ -65,9 +65,9 @@ BEGIN
   );
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::PendingPatch->new($self);
 }
diff --git a/testbot/lib/WineTestBot/Roles.pm b/testbot/lib/WineTestBot/Roles.pm
index bd67ab8..6835a95 100644
--- a/testbot/lib/WineTestBot/Roles.pm
+++ b/testbot/lib/WineTestBot/Roles.pm
@@ -62,9 +62,9 @@ BEGIN
   );
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::Role->new($self);
 }
diff --git a/testbot/lib/WineTestBot/Steps.pm b/testbot/lib/WineTestBot/Steps.pm
index 2a7ee35..e0ede07 100644
--- a/testbot/lib/WineTestBot/Steps.pm
+++ b/testbot/lib/WineTestBot/Steps.pm
@@ -40,10 +40,9 @@ use vars qw(@ISA @EXPORT);
 require Exporter;
 @ISA = qw(WineTestBot::WineTestBotItem Exporter);
 
-sub InitializeNew
+sub InitializeNew($$)
 {
-  my $self = shift;
-  my $Collection = $_[0];
+  my ($self, $Collection) = @_;
 
   $self->Status("queued");
   my $Keys = $Collection->GetKeys();
@@ -56,10 +55,9 @@ sub InitializeNew
   $self->SUPER::InitializeNew($Collection);
 }
 
-sub HandleStaging
+sub HandleStaging($$)
 {
-  my $self = shift;
-  my $JobKey = $_[0];
+  my ($self, $JobKey) = @_;
 
   if (! $self->InStaging)
   {
@@ -168,9 +166,9 @@ BEGIN
   );
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::Step->new($self);
 }
diff --git a/testbot/lib/WineTestBot/StepsTasks.pm b/testbot/lib/WineTestBot/StepsTasks.pm
index a5facda..cb260d2 100644
--- a/testbot/lib/WineTestBot/StepsTasks.pm
+++ b/testbot/lib/WineTestBot/StepsTasks.pm
@@ -38,9 +38,9 @@ use vars qw(@ISA @EXPORT);
 require Exporter;
 @ISA = qw(WineTestBot::WineTestBotItem Exporter);
 
-sub GetTitle
+sub GetTitle($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   my $Title = "";
   if ($self->Type eq "single")
@@ -115,10 +115,9 @@ BEGIN
    );
 }
 
-sub _initialize
+sub _initialize($$)
 {
-  my $self = shift;
-  my $Job = $_[0];
+  my ($self, $Job) = @_;
 
   $self->SUPER::_initialize($Job);
 
@@ -164,9 +163,9 @@ sub _initialize
   $self->{Loaded} = 1;
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::StepTask->new($self);
 }
diff --git a/testbot/lib/WineTestBot/Tasks.pm b/testbot/lib/WineTestBot/Tasks.pm
index 02dd220..6ba23a7 100644
--- a/testbot/lib/WineTestBot/Tasks.pm
+++ b/testbot/lib/WineTestBot/Tasks.pm
@@ -45,10 +45,9 @@ use vars qw(@ISA @EXPORT);
 require Exporter;
 @ISA = qw(WineTestBot::WineTestBotItem Exporter);
 
-sub InitializeNew
+sub InitializeNew($$)
 {
-  my $self = shift;
-  my ($Collection) = @_;
+  my ($self, $Collection) = @_;
 
   $self->Status("queued");
   my $Keys = $Collection->GetKeys();
@@ -140,7 +139,7 @@ sub Run($$)
   return $ErrMessage;
 }
 
-sub UpdateStatus
+sub UpdateStatus($$)
 {
   my ($self, $Skip) = @_;
 
@@ -220,9 +219,9 @@ BEGIN
   );
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::Task->new($self);
 }
diff --git a/testbot/lib/WineTestBot/UserRoles.pm b/testbot/lib/WineTestBot/UserRoles.pm
index a6ab378..dbbc1b0 100644
--- a/testbot/lib/WineTestBot/UserRoles.pm
+++ b/testbot/lib/WineTestBot/UserRoles.pm
@@ -58,9 +58,9 @@ BEGIN
 
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::UserRole->new($self);
 }
diff --git a/testbot/lib/WineTestBot/Users.pm b/testbot/lib/WineTestBot/Users.pm
index 047e5d7..270edf5 100644
--- a/testbot/lib/WineTestBot/Users.pm
+++ b/testbot/lib/WineTestBot/Users.pm
@@ -38,7 +38,7 @@ use vars qw (@ISA @EXPORT);
 require Exporter;
 @ISA = qw(WineTestBot::WineTestBotItem Exporter);
 
-sub InitializeNew
+sub InitializeNew($$)
 {
   my ($self, $Collection) = @_;
 
@@ -47,15 +47,14 @@ sub InitializeNew
   $self->SUPER::InitializeNew($Collection);
 }
 
-sub GeneratePasswordHash
+sub GeneratePasswordHash($$;$)
 {
-  my $self = shift;
-  my $PlaintextPassword = shift;
+  my ($self, $PlaintextPassword, $HashedPassword) = @_;
 
   my $Salt;
-  if (defined($_[0]))
+  if (defined $HashedPassword)
   {
-    $Salt = substr($_[0], 0, 9);
+    $Salt = substr($HashedPassword, 0, 9);
   }
   else
   {
@@ -71,31 +70,31 @@ sub GeneratePasswordHash
   return $Salt . sha1_hex($Salt . $PlaintextPassword);
 }
 
-sub GetEMailRecipient
+sub GetEMailRecipient($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return BuildEMailRecipient($self->EMail, $self->RealName);
 }
 
-sub Activated
+sub Activated($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   my $HashedPassword = $self->Password;
   return defined($HashedPassword) && length($HashedPassword) == 49;
 }
 
-sub WaitingForApproval
+sub WaitingForApproval($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return $self->Status eq 'active' && !$self->Activated() && !$self->ResetCode;
 }
 
-sub GenerateResetCode
+sub GenerateResetCode($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   if (! $self->ResetCode)
   {
@@ -109,9 +108,9 @@ sub GenerateResetCode
   }
 }
 
-sub AddDefaultRoles
+sub AddDefaultRoles($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   my $UserRoles = $self->Roles;
   my $DefaultRoles = CreateRoles();
@@ -128,9 +127,9 @@ sub AddDefaultRoles
   }
 }
 
-sub Approve
+sub Approve($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   $self->GenerateResetCode();
   $self->AddDefaultRoles();
@@ -159,9 +158,9 @@ EOF
   return undef;
 }
 
-sub SendResetCode
+sub SendResetCode($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   if ($self->Status ne 'active')
   {
@@ -199,10 +198,9 @@ EOF
   return undef;
 }
 
-sub ResetPassword
+sub ResetPassword($$$)
 {
-  my $self = shift;
-  my ($ResetCode, $NewPassword) = @_;
+  my ($self, $ResetCode, $NewPassword) = @_;
 
   my $CorrectResetCode = $self->ResetCode;
   if (! defined($ResetCode) || ! defined($CorrectResetCode) ||
@@ -218,10 +216,9 @@ sub ResetPassword
   return $ErrMessage;
 }
 
-sub Authenticate
+sub Authenticate($$)
 {
-  my $self = shift;
-  my $PlaintextPassword = $_[0];
+  my ($self, $PlaintextPassword) = @_;
 
   if (! $self->Activated())
   {
@@ -252,10 +249,9 @@ sub Authenticate
   return (undef, $self);
 }
 
-sub FromLDAP
+sub FromLDAP($$$)
 {
-  my $self = shift;
-  my ($LDAP, $UserName) = @_;
+  my ($self, $LDAP, $UserName) = @_;
 
   $self->Name($UserName);
   $self->Password("*");
@@ -283,10 +279,9 @@ sub FromLDAP
   return undef;
 }
 
-sub HasRole
+sub HasRole($$)
 {
-  my $self = shift;
-  my $RoleName = shift;
+  my ($self, $RoleName) = @_;
 
   return defined($self->Roles->GetItem($RoleName));
 }
@@ -327,9 +322,9 @@ BEGIN
   );
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::User->new($self);
 }
@@ -341,10 +336,9 @@ sub CreateUsers(;$)
                                    \@PropertyDescriptors, $ScopeObject);
 }
 
-sub AuthenticateLDAP
+sub AuthenticateLDAP($$$)
 {
-  my $self = shift;
-  my ($Name, $Password) = @_;
+  my ($self, $Name, $Password) = @_;
 
   my $LDAP = Net::LDAP->new($LDAPServer);
   if (! defined($LDAP))
@@ -384,10 +378,9 @@ sub AuthenticateLDAP
   return (undef, $User);
 }
 
-sub AuthenticateBuiltin
+sub AuthenticateBuiltin($$$)
 {
-  my $self = shift;
-  my ($Name, $Password) = @_;
+  my ($self, $Name, $Password) = @_;
 
   my $User = $self->GetItem($Name);
   if (! defined($User))
@@ -398,12 +391,12 @@ sub AuthenticateBuiltin
   return $User->Authenticate($Password);
 }
 
-sub Authenticate
+sub Authenticate($$$)
 {
-  my $self = shift;
+  my ($self, $Name, $Password) = @_;
 
-  return defined($LDAPServer) ? $self->AuthenticateLDAP(@_) :
-                                $self->AuthenticateBuiltin(@_);
+  return defined($LDAPServer) ? $self->AuthenticateLDAP($Name, $Password) :
+                                $self->AuthenticateBuiltin($Name, $Password);
 }
 
 sub GetBatchUser()
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index e4a5a59..7c3fd4d 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -231,7 +231,7 @@ sub _initialize($$)
   $self->{OldStatus} = undef;
 }
 
-sub InitializeNew
+sub InitializeNew($$)
 {
   my ($self, $Collection) = @_;
 
@@ -360,7 +360,7 @@ sub IsPoweredOn($)
   return $IsActive;
 }
 
-sub PowerOn
+sub PowerOn($)
 {
   my ($self) = @_;
 
@@ -466,17 +466,13 @@ sub CaptureScreenImage($)
   return (undef, $Image->{Size}, $Image->{Bytes});
 }
 
-sub Status
+sub Status($;$)
 {
-  my $self = shift;
+  my ($self, $NewStatus) = @_;
 
   my $CurrentStatus = $self->SUPER::Status;
-  if (! @_)
-  {
-    return $CurrentStatus;
-  }
+  return $CurrentStatus if (!defined $NewStatus);
 
-  my $NewStatus = $_[0];
   if ($NewStatus ne $CurrentStatus)
   {
     $self->SUPER::Status($NewStatus);
@@ -505,23 +501,23 @@ sub HasEnabledRole($)
          $Role eq "winetest";
 }
 
-sub Validate
+sub Validate($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   if ($self->Type ne "win32" && $self->Type ne "win64" &&
       ($self->Role eq "winetest" || $self->Role eq "extra"))
   {
     return ("Role", "Only win32 and win64 VMs can have a role of '" . $self->Role . "'");
   }
-  return $self->SUPER::Validate(@_);
+  return $self->SUPER::Validate();
 }
 
-sub OnSaved
+sub OnSaved($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
-  $self->SUPER::OnSaved(@_);
+  $self->SUPER::OnSaved();
 
   if (defined($self->{OldStatus}))
   {
@@ -533,9 +529,9 @@ sub OnSaved
   }
 }
 
-sub RunRevert
+sub RunRevert($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   $self->Status("reverting");
   my ($ErrProperty, $ErrMessage) = $self->Save();
@@ -594,11 +590,11 @@ require Exporter;
 @ISA = qw(WineTestBot::WineTestBotCollection Exporter);
 @EXPORT = qw(&CreateVMs);
 
-sub _initialize
+sub _initialize($)
 {
-  my $self = shift;
+  my ($self) = @_;
   $self->{Hypervisors} = WineTestBot::VM::Hypervisors->new();
-  $self->SUPER::_initialize(@_);
+  $self->SUPER::_initialize();
 }
 
 BEGIN
@@ -620,9 +616,9 @@ BEGIN
   );
 }
 
-sub CreateItem
+sub CreateItem($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   return WineTestBot::VM->new($self);
 }
@@ -634,9 +630,9 @@ sub CreateVMs(;$)
                                  \@PropertyDescriptors, $ScopeObject);
 }
 
-sub CountRevertingRunningVMs
+sub CountRevertingRunningVMs($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   my $RevertingVMs = 0;
   my $RunningVMs = 0;
@@ -657,9 +653,9 @@ sub CountRevertingRunningVMs
   return ($RevertingVMs, $RunningVMs);
 }
 
-sub CountPoweredOnNonBaseVMs
+sub CountPoweredOnNonBaseVMs($)
 {
-  my $self = shift;
+  my ($self) = @_;
 
   my $PoweredOnVMs = 0;
   foreach my $VM (@{$self->GetItems()})
@@ -674,10 +670,9 @@ sub CountPoweredOnNonBaseVMs
   return $PoweredOnVMs;
 }
 
-sub SortKeysBySortOrder
+sub SortKeysBySortOrder($$)
 {
-  my $self = shift;
-  my $Keys = $_[0];
+  my ($self, $Keys) = @_;
 
   # Sort retired and deleted VMs last
   my %RoleOrders = ("retired" => 1, "deleted" => 2);
@@ -712,8 +707,7 @@ sub FilterEnabledStatus($)
 
 sub FilterHypervisors($$)
 {
-  my $self = shift;
-  my $Hypervisors = $_[0];
+  my ($self, $Hypervisors) = @_;
 
   $self->AddFilter("VirtURI", $Hypervisors);
 }
diff --git a/testbot/lib/WineTestBot/WineTestBotObjects.pm b/testbot/lib/WineTestBot/WineTestBotObjects.pm
index 5671d9a..7e8e584 100644
--- a/testbot/lib/WineTestBot/WineTestBotObjects.pm
+++ b/testbot/lib/WineTestBot/WineTestBotObjects.pm
@@ -33,8 +33,9 @@ use vars qw (@ISA @EXPORT);
 require Exporter;
 @ISA = qw(ObjectModel::Item Exporter);
 
-sub GetBackEnd
+sub GetBackEnd($)
 {
+  #my ($self) = @_;
   return $ActiveBackEnds{'WineTestBot'};
 }
 
@@ -56,8 +57,9 @@ use vars qw (@ISA @EXPORT);
 require Exporter;
 @ISA = qw(ObjectModel::Collection Exporter);
 
-sub GetBackEnd
+sub GetBackEnd($)
 {
+  #my ($self) = @_;
   return $ActiveBackEnds{'WineTestBot'};
 }
 
-- 
2.0.0




More information about the wine-patches mailing list