An open API service indexing awesome lists of open source software.

https://github.com/rsrchboy/moosex-util

Moose::Util extensions
https://github.com/rsrchboy/moosex-util

Last synced: 3 months ago
JSON representation

Moose::Util extensions

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/RsrchBoy/moosex-util.svg?branch=master)](https://travis-ci.org/RsrchBoy/moosex-util)
[![Kwalitee status](http://cpants.cpanauthors.org/dist/MooseX-Util.png)](http://cpants.charsbar.org/dist/overview/MooseX-Util)
[![Coverage Status](https://coveralls.io/repos/RsrchBoy/moosex-util/badge.svg?branch=master)](https://coveralls.io/r/RsrchBoy/moosex-util?branch=master)

# NAME

MooseX::Util - Moose::Util extensions

# VERSION

This document describes version 0.007 of MooseX::Util - released May 20, 2017 as part of MooseX-Util.

# SYNOPSIS

use MooseX::Util qw{ ensure_all_roles with_traits };

# profit!

# DESCRIPTION

This is a utility module that handles all of the same functions that
[Moose::Util](https://metacpan.org/pod/Moose::Util) handles. In fact, most of the functions exported by this
package are simply re-exports from [Moose::Util](https://metacpan.org/pod/Moose::Util), so you're recommended to
read the documentation of that module for a comprehensive view.

However.

We've re-implemented a number of the functions our parent provides, for a
variety of reasons. Those functions are documented here.

# FUNCTIONS

## with\_traits(<classname> => (<trait1>, ... ))

Given a class and one or more traits, we construct an anonymous class that is
a subclass of the given class and consumes the traits given. This is exactly
the same as ["with\_traits" in Moose::Util](https://metacpan.org/pod/Moose::Util#with_traits), except that we use
["create\_anon\_class" in MooseX::Util::Meta::Class](https://metacpan.org/pod/MooseX::Util::Meta::Class#create_anon_class) to construct the anonymous
class, rather than ["create\_anon\_class" in Moose::Meta::Class](https://metacpan.org/pod/Moose::Meta::Class#create_anon_class) directly.

Essentially, this means that when we do:

my $anon_class_name = with_traits('Zombie::Catcher', 'SomeTrait');

For $anon\_class\_name we get:

Zombie::Catcher::__ANON__::SERIAL::1

Rather than:

Moose::Meta::Class::__ANON__::SERIAL::1

This is nice because we have an idea of where the first anonymous class came
from, whereas the second one could could be from anywhere.

## is\_private

# true if "private"
... if is_private('_some_name');

Ofttimes we need to determine if a name is considered "private" or not. By convention,
method, attribute, and other names are considered private if their first character is
an underscore.

While trivial to test for, this allows us to centralize the tests in one place.

# SEE ALSO

Please see those modules/websites for more information related to this module.

- [Moose::Util](https://metacpan.org/pod/Moose::Util)

# BUGS

Please report any bugs or feature requests on the bugtracker website
[https://github.com/RsrchBoy/moosex-util/issues](https://github.com/RsrchBoy/moosex-util/issues)

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

# AUTHOR

Chris Weyl

# COPYRIGHT AND LICENSE

This software is Copyright (c) 2017, 2015, 2014, 2012 by Chris Weyl.

This is free software, licensed under:

The GNU Lesser General Public License, Version 2.1, February 1999