Skip to content

Commit

Permalink
Move needs registration into a private function
Browse files Browse the repository at this point in the history
  • Loading branch information
ferki committed Aug 27, 2020
1 parent 540bd5a commit 3c87437
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Rex/Commands.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,9 @@ sub needs {
}

# register needs in main namespace
{
_register_needs_in_main_namespace();

sub _register_needs_in_main_namespace {
my ($caller_pkg) = caller(1);

if ( !$caller_pkg ) {
Expand All @@ -1090,7 +1092,7 @@ sub needs {
my $ref_to_needs = qualify_to_ref( 'needs', 'main' );
*{$ref_to_needs} = \&needs;
}
};
}

=head2 include Module::Name
Expand Down

0 comments on commit 3c87437

Please sign in to comment.