logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

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

Name

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

See Also

Moose::Exporter perl v5.40.0 2024-10-20 Mouse::Exporter(3pm)

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;

Version

This document describes Mouse version v2.5.11

See Also