Perl Diver 2.33
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Mouse::Exporter

Name Mouse::Exporter
Version
Located at /usr/lib/x86_64-linux-gnu/perl5/5.34
File /usr/lib/x86_64-linux-gnu/perl5/5.34/Mouse/Exporter.pm
Is Core No
Search CPAN for this module Mouse::Exporter
Documentation Mouse::Exporter
Module Details Mouse::Exporter

NAME

Mouse::Exporter - make an import() and unimport() just like Mouse.pm


VERSION

This document describes Mouse version v2.5.10


SYNOPSIS

    package MyApp::Mouse;
    use Mouse ();
    use Mouse::Exporter;
    Mouse::Exporter->setup_import_methods(
      as_is => [ 'has_rw', 'other_sugar', \&Some::Random::thing ],
      also  => 'Mouse',
    );
    sub has_rw {
        my $meta = caller->meta;
        my ( $name, %options ) = @_;
        $meta->add_attribute(
          $name,
          is => 'rw',
          %options,
        );
    }
    # then later ...
    package MyApp::User;
    use MyApp::Mouse;
    has 'name';
    has_rw 'size';
    thing;
    no MyApp::Mouse;


DESCRIPTION

This module encapsulates the exporting of sugar functions in a Mouse.pm-like manner. It does this by building custom import, unimport methods for your module, based on a spec you provide.

Note that Mouse::Exporter does not provide the with_meta option, but you can easily get the metaclass by caller->meta as SYNOPSIS shows.


METHODS

setup_import_methods( ARGS )

build_import_methods( ARGS ) -> (\&import, \&unimport)


SEE ALSO

the Moose::Exporter manpage

Perl Diver brought to you by ScriptSolutions.com © 1997- 2026