The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Exporter::WithBase - Like Exporter, but add '-base' to declare a child class

SYNOPSIS

    # file Mother.pm
    package Mother;
    use Exporter::WithBase;
    our @EXPORT = qw<ONE>;
    use constant ONE => 1;
    ...


    # file Child.pm
    package Child;
    # instead of: use parent 'Mother'
    use Mother -base;
    print ONE, "\n";

DESCRIPTION

Does the same things as Exporter, but also supports a -base flag. That flag can be used in the use statement of a class to push the class into @ISA.

The -base flag must be the first argument in the import list:

    use Mother qw( ONE -base ); # doesn't work
    use Mother qw( -base ONE ); # works

SEE ALSO

import::Base, parent, Mojo::Base.

AUTHOR

Olivier Mengué, <dolmen@cpan.org>.

COPYRIGHT & LICENSE

Copyright © 2012 Olivier Mengué.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.