in reply to Passing on "use"s

Is there a way to include those other things in my own module, so I can just use mygenericmodule and get the rest of them along with it?

Yep: see Import::Into.

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Passing on "use"s
by Chuma (Scribe) on Oct 29, 2023 at 16:30 UTC

    Looks nice! So, uh...

    use Import::Into; sub import{ feature->import::into(scalar caller,'say'); }

    That doesn't seem to do anything either. What am I missing?

      GenericModule.pm:

      package GenericModule; use Import::Into; feature->import::into(1, 'say'); 1;

      111155275.pl:

      use GenericModule; say 'hello,world';

      Script run:

      $ perl -I. 111155275.pl hello,world

      Hope this helps!


      The way forward always starts with a minimal test.

        Huh! So I don't need sub import, or caller? Just a 1? Well I have no idea what's going on, but it does work, so that's all fine by me. Thanks!