RexOps / RexOps/Rex

`needs` is missing from `main` namespace

Open
#1,547 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Perl
Stars
737
Forks
214
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

As a side-effect of 3c87437a4fee8ba40fbb8ffe878178b0a09eda9c via #1414, needs is no longer registered in the main namespace, which might break some of the expected behavior. Tasks that depends on another task from the Rexfile are failing with error messages similar to:

Can't locate object method "needs" via package "main" at /loader/0x55c93d31c3b8/__Rexfile__.pm line 16, <> line 1
Expected behavior

needs should be present in the main namespace to stay backwards compatible with the established behavior.

How to reproduce it
  1. create a task two that depends on another task in the Rexfile via needs main 'one';
  2. execute two with rex two
Code example
use Rex -feature => [ '1.4' ];

task 'one', sub {
  say 'hello from one';
};

task 'two', sub {
  needs main 'one';
  say 'hello from two';
};
Additional context

Discovered while investigating #1543, so the code example is also taken from there, but fixed to show only this bug.

Rex version

1.13.4

Perl version

5.36.0

Operating system running rex

Gentoo

Operating system managed by rex

local

How rex was installed?

dzil install

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rexfile example and the rex two command, then inspect commit 3c87437a4fee8ba40fbb8ffe878178b0a09eda9c and PR #1414. Done means needs main 'one'; works again and executing rex two completes without the missing-method error.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.