The main WineTestBot modules, those that implement access to the database, are prone to having circular dependencies. This is for instance the case between Jobs and Patches. Failure to handle these can force the use of fully qualified function names in hard to predict cases. So to avoid these issues, systematically declare the exports in a BEGIN block so they happen early enough.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/Branches.pm | 7 +++++-- testbot/lib/WineTestBot/Jobs.pm | 7 +++++-- testbot/lib/WineTestBot/Patches.pm | 7 +++++-- testbot/lib/WineTestBot/PendingPatchSets.pm | 7 +++++-- testbot/lib/WineTestBot/PendingPatches.pm | 7 +++++-- testbot/lib/WineTestBot/RecordGroups.pm | 7 +++++-- testbot/lib/WineTestBot/Records.pm | 7 +++++-- testbot/lib/WineTestBot/Roles.pm | 7 +++++-- testbot/lib/WineTestBot/Steps.pm | 7 +++++-- testbot/lib/WineTestBot/StepsTasks.pm | 7 +++++-- testbot/lib/WineTestBot/Tasks.pm | 7 +++++-- testbot/lib/WineTestBot/UserRoles.pm | 7 +++++-- testbot/lib/WineTestBot/Users.pm | 7 +++++-- testbot/lib/WineTestBot/VMs.pm | 7 +++++-- 14 files changed, 70 insertions(+), 28 deletions(-)
diff --git a/testbot/lib/WineTestBot/Branches.pm b/testbot/lib/WineTestBot/Branches.pm index a18fafcbd..96cf26e82 100644 --- a/testbot/lib/WineTestBot/Branches.pm +++ b/testbot/lib/WineTestBot/Branches.pm @@ -51,8 +51,11 @@ WineTestBot::Branches - A collection of WineTestBot::Branch objects
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateBranches); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateBranches); +}
use ObjectModel::BasicPropertyDescriptor;
diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm index 0f80193f6..edfe91660 100644 --- a/testbot/lib/WineTestBot/Jobs.pm +++ b/testbot/lib/WineTestBot/Jobs.pm @@ -396,8 +396,11 @@ those that are yet to be run.
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateJobs ScheduleJobs CheckJobs); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateJobs ScheduleJobs CheckJobs); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::EnumPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm index e4b9b0089..5431d9f68 100644 --- a/testbot/lib/WineTestBot/Patches.pm +++ b/testbot/lib/WineTestBot/Patches.pm @@ -366,8 +366,11 @@ WineTestBot::Patches - A collection of WineTestBot::Patch objects
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreatePatches); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreatePatches); +}
use ObjectModel::BasicPropertyDescriptor; use WineTestBot::Config; diff --git a/testbot/lib/WineTestBot/PendingPatchSets.pm b/testbot/lib/WineTestBot/PendingPatchSets.pm index 88dc73677..26a564216 100644 --- a/testbot/lib/WineTestBot/PendingPatchSets.pm +++ b/testbot/lib/WineTestBot/PendingPatchSets.pm @@ -153,8 +153,11 @@ WineTestBot::PendingPatchSets - A collection of WineTestBot::PendingPatchSet obj
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreatePendingPatchSets); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreatePendingPatchSets); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::DetailrefPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/PendingPatches.pm b/testbot/lib/WineTestBot/PendingPatches.pm index 4de599dac..414ebd0ad 100644 --- a/testbot/lib/WineTestBot/PendingPatches.pm +++ b/testbot/lib/WineTestBot/PendingPatches.pm @@ -45,8 +45,11 @@ WineTestBot::PendingPatches - A collection of WineTestBot::PendingPatch objects
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreatePendingPatches); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreatePendingPatches); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::ItemrefPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/RecordGroups.pm b/testbot/lib/WineTestBot/RecordGroups.pm index 9f0f52036..27cedfe32 100644 --- a/testbot/lib/WineTestBot/RecordGroups.pm +++ b/testbot/lib/WineTestBot/RecordGroups.pm @@ -54,8 +54,11 @@ WineTestBot::RecordGroups - A collection of WineTestBot::RecordGroup objects
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateRecordGroups CompareRecordGroups SaveRecord); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateRecordGroups CompareRecordGroups SaveRecord); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::DetailrefPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/Records.pm b/testbot/lib/WineTestBot/Records.pm index 990ae421e..a3302af96 100644 --- a/testbot/lib/WineTestBot/Records.pm +++ b/testbot/lib/WineTestBot/Records.pm @@ -62,8 +62,11 @@ WineTestBot::Records - A collection of WineTestBot::Record objects
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateRecords); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateRecords); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::EnumPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/Roles.pm b/testbot/lib/WineTestBot/Roles.pm index 45f370f1d..c37de63a9 100644 --- a/testbot/lib/WineTestBot/Roles.pm +++ b/testbot/lib/WineTestBot/Roles.pm @@ -43,8 +43,11 @@ WineTestBot::Roles - A collection of WineTestBot::Role objects
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateRoles); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateRoles); +}
use ObjectModel::BasicPropertyDescriptor;
diff --git a/testbot/lib/WineTestBot/Steps.pm b/testbot/lib/WineTestBot/Steps.pm index 237347347..635092d1a 100644 --- a/testbot/lib/WineTestBot/Steps.pm +++ b/testbot/lib/WineTestBot/Steps.pm @@ -184,8 +184,11 @@ WineTestBot::Steps - A collection of Job Steps
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateSteps); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateSteps); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::EnumPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/StepsTasks.pm b/testbot/lib/WineTestBot/StepsTasks.pm index 9dec8060a..232efe520 100644 --- a/testbot/lib/WineTestBot/StepsTasks.pm +++ b/testbot/lib/WineTestBot/StepsTasks.pm @@ -98,8 +98,11 @@ a specific database table.
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateStepsTasks); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateStepsTasks); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::ItemrefPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/Tasks.pm b/testbot/lib/WineTestBot/Tasks.pm index 4473df217..0cb2e7b02 100644 --- a/testbot/lib/WineTestBot/Tasks.pm +++ b/testbot/lib/WineTestBot/Tasks.pm @@ -202,8 +202,11 @@ WineTestBot::Tasks - A collection of WineTestBot::Task objects
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateTasks); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateTasks); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::EnumPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/UserRoles.pm b/testbot/lib/WineTestBot/UserRoles.pm index 585537ae8..e01cd9d28 100644 --- a/testbot/lib/WineTestBot/UserRoles.pm +++ b/testbot/lib/WineTestBot/UserRoles.pm @@ -39,8 +39,11 @@ WineTestBot::UserRoles - A collection of WineTestBot::UserRole objects
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateUserRoles); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateUserRoles); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::ItemrefPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/Users.pm b/testbot/lib/WineTestBot/Users.pm index 4752006ab..f7ebd93da 100644 --- a/testbot/lib/WineTestBot/Users.pm +++ b/testbot/lib/WineTestBot/Users.pm @@ -296,8 +296,11 @@ WineTestBot::Users - A collection of WineTestBot::User objects
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateUsers GetBatchUser Authenticate); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateUsers GetBatchUser Authenticate); +}
use Net::LDAP; use ObjectModel::BasicPropertyDescriptor; diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm index b6305e83e..c3a4a30cf 100644 --- a/testbot/lib/WineTestBot/VMs.pm +++ b/testbot/lib/WineTestBot/VMs.pm @@ -637,8 +637,11 @@ role or status.
use Exporter 'import'; use WineTestBot::WineTestBotObjects; -our @ISA = qw(WineTestBot::WineTestBotCollection); -our @EXPORT = qw(CreateVMs); +BEGIN +{ + our @ISA = qw(WineTestBot::WineTestBotCollection); + our @EXPORT = qw(CreateVMs); +}
use ObjectModel::BasicPropertyDescriptor; use ObjectModel::EnumPropertyDescriptor;