Mouse::Exporter(3pm)

🌸 NAME 🌸

okay bestie, this is Mouse::Exporter(3pm) β€” a User Contributed Perl Documentation page β€” and it's the manual for Mouse::Exporter, whose whole gig is: make an import() and unimport() just like Mouse.pm. periodt. πŸ’…

✨ VERSION ✨

This doc is literally describing Mouse version v2.6.2, no cap.

πŸŽ€ SYNOPSIS πŸŽ€

the setup is giving exactly this, so here's the code in all its glory:

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 is literally about encapsulating the exporting of sugar functions in a Mouse.pm-like manner. It does that by building custom import and unimport methods for your module, based on a spec you provide. iconic behavior, honestly. ✨

important note, bestie: Mouse::Exporter does not provide the with_meta option. But you can easily get the metaclass by using caller->meta, exactly as SYNOPSIS shows. no stress. 🫢

πŸ› οΈ METHODS πŸ› οΈ

here are the method signatures, and yes, every detail is kept:

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

🌈 SEE ALSO 🌈

go peek at Moose::Exporter, bestie. iykyk. πŸ¦‹


okay bye ily πŸ’– β€” this page comes from perl v5.42.2, dated 2026-04-21, and it's the Mouse::Exporter(3pm) page. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from