https://github.com/rsrchboy/moosex-relatednamespace
https://github.com/rsrchboy/moosex-relatednamespace
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rsrchboy/moosex-relatednamespace
- Owner: rsrchboy
- License: other
- Created: 2015-06-29T06:56:30.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-03T23:13:50.000Z (almost 10 years ago)
- Last Synced: 2025-01-16T04:21:07.818Z (5 months ago)
- Language: Perl
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkdn
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/RsrchBoy/moosex-relatednamespace)
[](http://cpants.charsbar.org/dist/overview/MooseX-RelatedNamespace)
[](https://coveralls.io/r/RsrchBoy/moosex-relatednamespace?branch=master)# NAME
MooseX::RelatedNamespace - The great new MooseX::RelatedNamespace!
# VERSION
This document describes version 0.001 of MooseX::RelatedNamespace - released August 03, 2015 as part of MooseX-RelatedNamespace.
# SYNOPSIS
package Dalek::Enemies;
use Moose;
# this...
with 'MooseX::RelatedNamespace' => {
prefix => 'doctor',
namespace => 'TimeLords::Doctor',
};# ...is the same as:
use MooseX::AttributeShortcuts; # for these attributes, at any rate
use MooseX::Types::Moose ':all';
use MooseX::Types::Perl ':all';has doctor_namespace => (
is => 'lazy',
isa => PackageName,
builder => sub { 'TimeLords::Doctor' },
);has filter_for_doctor_namespace => (
is => 'lazy',
isa => CodeRef,
builder => sub { sub { 1 } },
);has modules_in_doctor_namespace => (
is => 'lazy',
isa => ArrayRef[PackageName],
builder => sub { ... },
);# DESCRIPTION
# ROLE PARAMETERS
Parameterized roles accept parameters that influence their construction. This role accepts the following parameters.
## prefix
A prefix for our attribute names; e.g. 'doctor\_' to make our namespace
attribute's name be 'doctor\_namespace', etc.## default\_namespace
If we should have a default namespace, specify it here.
## filter
A coderef used to filter out modules found under the namespace; it should return true for
modules to keep, false for modules to drop.# ATTRIBUTES
## namespace
The namespace we use to find packages; e.g. 'TimeLord::Doctor' to find
'TimeLord::Doctor::First', etc.## filter\_for\_namespace
A coderef used to filter out modules found under the namespace; it should return true for
modules to keep, false for modules to drop.## modules\_in\_namespace
The (filtered) list of modules in the namespace. Lazily generated.
# EXAMPLES
There's a decent example in the ["SYNOPSIS"](#synopsis), but here's a couple variations to demonstrate.
# Defaults
You can use this role without giving it any parameters, and defaults will be used. In our case,
this means that this:with 'MooseX::RelatedNamespace';
...is effectively the same as:
use MooseX::AttributeShortcuts;
use MooseX::Types::Moose ':all';
use MooseX::Types::Perl ':all';has namespace => (
is => 'ro',
isa => PackageName,
required => 1,
);has filter_for_namespace => (
is => 'lazy',
isa => 'CodeRef',
builder => sub { sub { 1 } } ,
);has modules_in_namespace => (
is => 'lazy',
isa => ArrayRef[PackageName],
builder => sub { ... find/load all modules, filtering ... },
);# BUGS
Please report any bugs or feature requests on the bugtracker website
https://github.com/RsrchBoy/moosex-relatednamespace/issuesWhen 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
## I'm a material boy in a material world
Please note **I do not expect to be gittip'ed or flattr'ed for this work**,
rather **it is simply a very pleasant surprise**. I largely create and release
works like this because I need them or I find it enjoyable; however, don't let
that stop you if you feel like it ;)[Flattr](https://flattr.com/submit/auto?user_id=RsrchBoy&url=https%3A%2F%2Fgithub.com%2FRsrchBoy%2Fmoosex-relatednamespace&title=RsrchBoy's%20CPAN%20MooseX-RelatedNamespace&tags=%22RsrchBoy's%20MooseX-RelatedNamespace%20in%20the%20CPAN%22),
[Gratipay](https://gratipay.com/RsrchBoy/), or indulge my
[Amazon Wishlist](http://bit.ly/rsrchboys-wishlist)... If and \*only\* if you so desire.# COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Chris Weyl.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999