Mouse::Exporter(3pm)

Mouse::Exporter3pm

Make an import() and unimport() just like mouse.pm

Usage

    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;

Version

This document describes Mouse version v2.6.2

Overview

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)"

Releases

9 releases since Debian 6.0 (Squeeze); the text changed 8 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10
  6. 11
  7. 12
  8. 13
  9. Arch

From perl-mouse 2.6.2-2 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.