| 1 | # | ||||||||||
| 2 | # This file is part of MooseX-TrackDirty-Attributes | ||||||||||
| 3 | # | ||||||||||
| 4 | # This software is Copyright (c) 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 MooseX::TrackDirty::Attributes::Trait::Role::Application::ToInstance; | ||||||||||
| 11 | 9 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 9 | $MooseX::TrackDirty::Attributes::Trait::Role::Application::ToInstance::AUTHORITY = 'cpan:RSRCHBOY'; | |||||||||
| 13 | } | ||||||||||
| 14 | 9 | $MooseX::TrackDirty::Attributes::Trait::Role::Application::ToInstance::VERSION = '2.003'; | |||||||||
| 15 | # ABSTRACT: Application to instance helper trait | ||||||||||
| 16 | |||||||||||
| 17 | 9 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 9 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 9 | ▶ | use MooseX::TrackDirty::Attributes::Util ':all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | # debug... | ||||||||||
| 22 | #use Smart::Comments; | ||||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | after apply => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 25 | 0 | my ($self, $role, $object) = @_; | |||||||||
| 26 | |||||||||||
| 27 | 0 | my $object_meta = Class::MOP::class_of($object); | |||||||||
| 28 | |||||||||||
| 29 | ### Application to instance... | ||||||||||
| 30 | ### role: $role->name | ||||||||||
| 31 | ### target: $object_meta->name | ||||||||||
| 32 | |||||||||||
| 33 | ### applying metaroles to: $object_meta->name | ||||||||||
| 34 | 0 | Moose::Util::MetaRole::apply_metaroles( | |||||||||
| 35 | for => $object_meta, | ||||||||||
| 36 | class_metaroles => { | ||||||||||
| 37 | class => [ trait_for 'Class' ], | ||||||||||
| 38 | }, | ||||||||||
| 39 | ); | ||||||||||
| 40 | |||||||||||
| 41 | #my @roles = map { $_->name } $object_meta->calculate_all_roles_with_inheritance; | ||||||||||
| 42 | ### @roles | ||||||||||
| 43 | #my @meta_roles = map { $_->name } $object_meta->meta->calculate_all_roles_with_inheritance; | ||||||||||
| 44 | ### @meta_roles | ||||||||||
| 45 | |||||||||||
| 46 | 0 | $object->remove_accessors; | |||||||||
| 47 | 0 | ▶ | Moose::Util::apply_all_roles($object, TrackDirtyNativeTrait) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | if $object_meta->does_role('Moose::Meta::Attribute::Native::Trait'); | ||||||||||
| 49 | 0 | $object->install_accessors; | |||||||||
| 50 | |||||||||||
| 51 | 0 | return; | |||||||||
| 52 | 9 | }; | |||||||||
| 53 | |||||||||||
| 54 | 9 | !!42; | |||||||||
| 55 | |||||||||||
| 56 | __END__ | ||||||||||