File Coverage

blib/lib/MooseX/TrackDirty/Attributes/Trait/Role/Application/ToInstance.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
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             {
12             $MooseX::TrackDirty::Attributes::Trait::Role::Application::ToInstance::VERSION = '1.900'; # TRIAL
13             }
14              
15             # ABSTRACT: Application to instance helper trait
16              
17 11     11   36368 use Moose::Role;
  11         18  
  11         57  
18 11     11   35506 use namespace::autoclean;
  11         13  
  11         65  
19 11     11   543 use MooseX::TrackDirty::Attributes::Util ':all';
  11         14  
  11         62  
20              
21             # debug...
22             #use Smart::Comments;
23              
24             after apply => sub {
25             my ($self, $role, $object) = @_;
26              
27             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             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             $object->remove_accessors;
47             Moose::Util::apply_all_roles($object, TrackDirtyNativeTrait)
48             if $object_meta->does_role('Moose::Meta::Attribute::Native::Trait');
49             $object->install_accessors;
50              
51             return;
52             };
53              
54             !!42;
55              
56              
57              
58             =pod
59              
60             =encoding utf-8
61              
62             =head1 NAME
63              
64             MooseX::TrackDirty::Attributes::Trait::Role::Application::ToInstance - Application to instance helper trait
65              
66             =head1 VERSION
67              
68             This document describes 1.900 of MooseX::TrackDirty::Attributes::Trait::Role::Application::ToInstance - released February 15, 2012 as part of MooseX-TrackDirty-Attributes.
69              
70             =head1 SEE ALSO
71              
72             Please see those modules/websites for more information related to this module.
73              
74             =over 4
75              
76             =item *
77              
78             L<MooseX::TrackDirty::Attributes|MooseX::TrackDirty::Attributes>
79              
80             =back
81              
82             =head1 SOURCE
83              
84             The development version is on github at L<http://github.com/RsrchBoy/moosex-trackdirty-attributes>
85             and may be cloned from L<git://github.com/RsrchBoy/moosex-trackdirty-attributes.git>
86              
87             =head1 BUGS
88              
89             Please report any bugs or feature requests on the bugtracker website
90             https://github.com/RsrchBoy/moosex-trackdirty-attributes/issues
91              
92             When submitting a bug or request, please include a test-file or a
93             patch to an existing test-file that illustrates the bug or desired
94             feature.
95              
96             =head1 AUTHOR
97              
98             Chris Weyl <cweyl@alumni.drew.edu>
99              
100             =head1 COPYRIGHT AND LICENSE
101              
102             This software is Copyright (c) 2011 by Chris Weyl.
103              
104             This is free software, licensed under:
105              
106             The GNU Lesser General Public License, Version 2.1, February 1999
107              
108             =cut
109              
110              
111             __END__
112              
113