rjbs/Sub-Exporter

More help with Sub::Exporter inheritance

Closed this issue · 1 comments

rjbs commented

imported from https://rt.cpan.org/Ticket/Display.html?id=68618

Sterling wrote:

It's casually mentioned that Sub::Exporter's import sub is inherited by sub-classes and
provides all kinds of wonderful magic automatically to those sub-classes. From experience, I
know this magic to be wonderful... so long as I don't need to export anything else.

Could the documentation either in the main module or the Cookbook be amended to explain
what happens when you do:

package Foo;
use Sub::Exporter -setup => { exports => [ qw( foo ) ] };

package Bar;
use parent 'Foo';
use Sub::Exporter -setup => { exports => ... };

Based on my experience, package Bar has now replaced the import and anything that was 
exported by Foo is all gone. Perhaps a Moose::Exporter-ish:

use Sub::Exporter -setup => { exports => ..., also => 'Foo' };

or something like it to help with this?

Cheers,
Sterling

rjbs commented

Addressed by ec65555