| 1 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | package XML::Rabbit::Root; | ||||||||||
| 5 | { | ||||||||||
| 6 | 7 | $XML::Rabbit::Root::VERSION = '0.4.0'; | |||||||||
| 7 | } | ||||||||||
| 8 | 7 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | # ABSTRACT: Root class with sugar functions available | ||||||||||
| 11 | |||||||||||
| 12 | 7 | ▶ | use XML::Rabbit::Sugar (); # no magic, just load | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 7 | ▶ | use namespace::autoclean (); # no cleanup, just load | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 7 | ▶ | use Moose::Exporter; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 7 | my ($import, $unimport, $init_meta) = Moose::Exporter->build_import_methods( | |||||||||
| 17 | also => 'XML::Rabbit::Sugar', | ||||||||||
| 18 | base_class_roles => ['XML::Rabbit::RootNode'], | ||||||||||
| 19 | ); | ||||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | sub import { | ||||||||||
| 23 | 6 | ▶ | namespace::autoclean->import( -cleanee => scalar caller ); | ||||||||
|
Subroutine
import: called CC=2 SCAR=7.1
| |||||||||||
| 24 | 6 | ▶ | return unless $import; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 6 | goto &$import; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | |||||||||||
| 29 | sub unimport { | ||||||||||
| 30 | 0 | ▶ | return unless $unimport; | ||||||||
|
Subroutine
unimport: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 31 | 0 | goto &$unimport; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | #sub init_meta { | ||||||||||
| 36 | # return unless $init_meta; | ||||||||||
| 37 | # goto &$init_meta; | ||||||||||
| 38 | #} | ||||||||||
| 39 | |||||||||||
| 40 | # FIXME: https://rt.cpan.org/Ticket/Display.html?id=51561 | ||||||||||
| 41 | # Hopefully fixed by 2.06 (doy) | ||||||||||
| 42 | sub init_meta { | ||||||||||
| 43 | 6 | ▶ | my ($dummy, %opts) = @_; | ||||||||
|
Subroutine
init_meta: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 44 | 6 | Moose->init_meta(%opts); | |||||||||
| 45 | Moose::Util::MetaRole::apply_base_class_roles( | ||||||||||
| 46 | for => $opts{for_class}, | ||||||||||
| 47 | 6 | roles => ['XML::Rabbit::RootNode'] | |||||||||
| 48 | ); | ||||||||||
| 49 | 6 | return Class::MOP::class_of($opts{for_class}); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 7 | 1; | |||||||||
| 53 | |||||||||||
| 54 | __END__ | ||||||||||
| 55 | |||||||||||
| 56 | =pod | ||||||||||
| 57 | |||||||||||
| 58 | =encoding utf-8 | ||||||||||
| 59 | |||||||||||
| 60 | =head1 NAME | ||||||||||
| 61 | |||||||||||
| 62 | XML::Rabbit::Root - Root class with sugar functions available | ||||||||||
| 63 | |||||||||||
| 64 | =head1 VERSION | ||||||||||
| 65 | |||||||||||
| 66 | version 0.4.0 | ||||||||||
| 67 | |||||||||||
| 68 | =head1 FUNCTIONS | ||||||||||
| 69 | |||||||||||
| 70 | =head2 import | ||||||||||
| 71 | |||||||||||
| 72 | Automatically loads L<namespace::autoclean> into the caller's package and | ||||||||||
| 73 | dispatches to L<XML::Rabbit::Sugar/"import"> (tail call). | ||||||||||
| 74 | |||||||||||
| 75 | =head2 unimport | ||||||||||
| 76 | |||||||||||
| 77 | Dispatches to L<XML::Rabbit::Sugar/"unimport"> (tail call). | ||||||||||
| 78 | |||||||||||
| 79 | =head2 init_meta | ||||||||||
| 80 | |||||||||||
| 81 | Initializes the metaclass of the calling class and adds the role | ||||||||||
| 82 | L<XML::Rabbit::RootNode>. | ||||||||||
| 83 | |||||||||||
| 84 | =head1 AUTHOR | ||||||||||
| 85 | |||||||||||
| 86 | Robin Smidsrød <robin@smidsrod.no> | ||||||||||
| 87 | |||||||||||
| 88 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 89 | |||||||||||
| 90 | This software is copyright (c) 2013 by Robin Smidsrød. | ||||||||||
| 91 | |||||||||||
| 92 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 93 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 94 | |||||||||||
| 95 | =cut | ||||||||||