GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MooseX::Extended::Custom(3) User Contributed Perl Documentation MooseX::Extended::Custom(3)

MooseX::Extended::Custom - Build a custom Moose, just for you.

version 0.35

Define your own version of MooseX::Extended:

    package My::Moose {
        use MooseX::Extended::Custom;
        sub import {
            my ( $class, %args ) = @_;
            MooseX::Extended::Custom->create(
                excludes => [qw/ StrictConstructor c3 /],
                includes => ['multi'],
                %args    # you need this to allow customization of your customization
            );
        }
    }
    # no need for a true value

And then use it:

    package Some::Class {
        use My::Moose types => [qw/ArrayRef Num/];
        param numbers ( isa => ArrayRef[Num] );
        multi sub foo ($self)       { ... }
        multi sub foo ($self, $bar) { ... }
    }

I hate boilerplate, so let's get rid of it. Let's say you don't want namespace::autoclean or "carp", but you do want "multi". Plus, you have custom versions of "carp" and "croak":

    package Some::Class {
        use MooseX::Extended
          excludes => [qw/ autoclean carp /],
          includes => ['multi'];
        use My::Carp q(carp croak);
        ... my code here
    }

You probably get tired of typing that every time. Now you don't have to.

    package My::Moose {
        use MooseX::Extended::Custom;
        use My::Carp ();
        use Import::Into;
        sub import {
            my ( $class, %args ) = @_;
            my $target_class = caller;
            MooseX::Extended::Custom->create(
                excludes => [qw/ autoclean carp /],
                includes => ['multi'],
                %args    # you need this to allow customization of your customization
            );
            My::Carp->import::into($target_class, qw(carp croak));
        }
    }

And then when you use "My::Moose", that's all set up for you.

If you need to change this on a "per class" basis:

    use My::Moose
      excludes => ['carp'],
      types    => [qw/ArrayRef Num/];

The above changes your "excludes" and adds "types", but doesn't change your "includes".

Curtis "Ovid" Poe <curtis.poe@gmail.com>

This software is Copyright (c) 2022 by Curtis "Ovid" Poe.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
2023-06-06 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.