Skip to content

Sq::Exporter #19

@DavidRaab

Description

@DavidRaab
use Sq::Type; # import defaults

use Sq::Type {
    import => [qw/t_run t_valid/],   # exports single requested functions
    into   => 'Package',
    as     => {t_run => 'type_run'}, # exports single function under new name
    sig    => 1,                     # load default signature
    sig    => 'Sig::Whatever',       # loads signature file once before exporting
    prefix => 'type_',               # another prefix
};

# same
use Sq::Type qw(t_run t_valid); 
use Sq::Type {
    import => [qw/t_run t_valid/],
}

defining another signature opens up some questions. First of, a signature file should only be loaded once. What happens when multiple use Sq::Type are in your project with different signatures?

Then only the first one would be loaded.

A better approach. Don't add signatures to the original package. First load/import functions. Then add signatures to the imported functions in the target package. This way you can load/import a module with different signatures at different places. While this is a cool feature. This isn't so important at the moment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions