| 1 | # | ||||||||||
| 2 | # This file is part of Reindeer | ||||||||||
| 3 | # | ||||||||||
| 4 | # This software is Copyright (c) 2017, 2015, 2014, 2012, 2011 by Chris Weyl. | ||||||||||
| 5 | # | ||||||||||
| 6 | # This is free software, licensed under: | ||||||||||
| 7 | # | ||||||||||
| 8 | # The GNU Lesser General Public License, Version 2.1, February 1999 | ||||||||||
| 9 | # | ||||||||||
| 10 | package Reindeer::Role; | ||||||||||
| 11 | 7 | our $AUTHORITY = 'cpan:RSRCHBOY'; | |||||||||
| 12 | 7 | $Reindeer::Role::VERSION = '0.020'; | |||||||||
| 13 | # ABSTRACT: Reindeer in role form | ||||||||||
| 14 | |||||||||||
| 15 | 8 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 8 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 8 | ▶ | use Reindeer::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 8 | ▶ | use Moose::Exporter; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 8 | ▶ | use Import::Into; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 7 | my (undef, undef, $init_meta) = Moose::Exporter->build_import_methods( | |||||||||
| 23 | install => [ qw{ import unimport } ], | ||||||||||
| 24 | |||||||||||
| 25 | also => [ 'Moose::Role', Reindeer::Util::also_list() ], | ||||||||||
| 26 | trait_aliases => [ Reindeer::Util::trait_aliases() ], | ||||||||||
| 27 | as_is => [ Reindeer::Util::as_is() ], | ||||||||||
| 28 | ); | ||||||||||
| 29 | |||||||||||
| 30 | 13 | ▶ | sub init_meta { | ||||||||
|
Subroutine
init_meta: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 31 | 13 | my ($class, %options) = @_; | |||||||||
| 32 | 13 | my $for_class = $options{for_class}; | |||||||||
| 33 | |||||||||||
| 34 | 13 | ▶ | if ($] >= 5.010) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | |||||||||||
| 36 | 12 | ▶ | eval 'use feature'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 37 | 12 | feature->import(':5.10'); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | ### $for_class | ||||||||||
| 41 | 12 | Moose::Role->init_meta(for_class => $for_class); | |||||||||
| 42 | 12 | Reindeer::Util->import_type_libraries({ -into => $for_class }); | |||||||||
| 43 | 12 | Path::Class->export_to_level(1); | |||||||||
| 44 | 12 | Try::Tiny->import::into(1); | |||||||||
| 45 | 12 | MooseX::Params::Validate->import({ into => $for_class }); | |||||||||
| 46 | 12 | Moose::Util::TypeConstraints->import( | |||||||||
| 47 | { into => $for_class }, | ||||||||||
| 48 | qw{ class_type role_type duck_type }, | ||||||||||
| 49 | ); | ||||||||||
| 50 | 12 | MooseX::MarkAsMethods->import({ into => $for_class }, autoclean => 1); | |||||||||
| 51 | |||||||||||
| 52 | 12 | ▶ | goto $init_meta if defined $init_meta; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 7 | !!42; | |||||||||
| 56 | |||||||||||
| 57 | __END__ | ||||||||||