| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package MooseX::Role::WithOverloading; # git description: v0.16-18-g8c1d6d0 | 
| 2 |  |  |  |  |  |  | # ABSTRACT: (DEPRECATED) Roles which support overloading | 
| 3 |  |  |  |  |  |  | # KEYWORDS: moose extension role operator overload overloading deprecated | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | our $VERSION = '0.17'; | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 9 |  |  | 9 |  | 2744472 | use Moose::Role (); | 
|  | 9 |  |  |  |  | 1914562 |  | 
|  | 9 |  |  |  |  | 227 |  | 
| 8 | 9 |  |  | 9 |  | 68 | use Moose::Exporter; | 
|  | 9 |  |  |  |  | 19 |  | 
|  | 9 |  |  |  |  | 43 |  | 
| 9 | 9 |  |  | 9 |  | 7711 | use aliased 'MooseX::Role::WithOverloading::Meta::Role', 'MetaRole'; | 
|  | 9 |  |  |  |  | 6501 |  | 
|  | 9 |  |  |  |  | 51 |  | 
| 10 | 9 |  |  | 9 |  | 713 | use aliased 'MooseX::Role::WithOverloading::Meta::Role::Application::ToClass'; | 
|  | 9 |  |  |  |  | 19 |  | 
|  | 9 |  |  |  |  | 51 |  | 
| 11 | 9 |  |  | 9 |  | 1179 | use aliased 'MooseX::Role::WithOverloading::Meta::Role::Application::ToRole'; | 
|  | 9 |  |  |  |  | 16 |  | 
|  | 9 |  |  |  |  | 37 |  | 
| 12 | 9 |  |  | 9 |  | 1156 | use aliased 'MooseX::Role::WithOverloading::Meta::Role::Application::ToInstance'; | 
|  | 9 |  |  |  |  | 16 |  | 
|  | 9 |  |  |  |  | 38 |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 9 |  |  | 9 |  | 1175 | use namespace::clean 0.19; | 
|  | 9 |  |  |  |  | 232 |  | 
|  | 9 |  |  |  |  | 64 |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | # this functionality is built-in, starting with Moose 2.1300 | 
| 17 |  |  |  |  |  |  | my $has_core_support = eval { Moose->VERSION('2.1300'); 1 }; | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | if ($has_core_support) | 
| 20 |  |  |  |  |  |  | { | 
| 21 |  |  |  |  |  |  | Moose::Exporter->setup_import_methods(also => 'Moose::Role'); | 
| 22 |  |  |  |  |  |  | } | 
| 23 |  |  |  |  |  |  | else | 
| 24 |  |  |  |  |  |  | { | 
| 25 |  |  |  |  |  |  | require XSLoader; | 
| 26 |  |  |  |  |  |  | XSLoader::load( | 
| 27 |  |  |  |  |  |  | __PACKAGE__, | 
| 28 |  |  |  |  |  |  | $VERSION, | 
| 29 |  |  |  |  |  |  | ); | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | Moose::Exporter->setup_import_methods( | 
| 32 |  |  |  |  |  |  | also           => 'Moose::Role', | 
| 33 |  |  |  |  |  |  | role_metaroles => { | 
| 34 |  |  |  |  |  |  | role                    => [MetaRole], | 
| 35 |  |  |  |  |  |  | application_to_class    => [ToClass], | 
| 36 |  |  |  |  |  |  | application_to_role     => [ToRole], | 
| 37 |  |  |  |  |  |  | application_to_instance => [ToInstance], | 
| 38 |  |  |  |  |  |  | }, | 
| 39 |  |  |  |  |  |  | ); | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | 1; | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | __END__ | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | =pod | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =encoding UTF-8 | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =head1 NAME | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | MooseX::Role::WithOverloading - (DEPRECATED) Roles which support overloading | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | =head1 VERSION | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | version 0.17 | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | package MyRole; | 
| 61 |  |  |  |  |  |  | use MooseX::Role::WithOverloading; | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | use overload | 
| 64 |  |  |  |  |  |  | q{""}    => 'as_string', | 
| 65 |  |  |  |  |  |  | fallback => 1; | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | has message => ( | 
| 68 |  |  |  |  |  |  | is       => 'rw', | 
| 69 |  |  |  |  |  |  | isa      => 'Str', | 
| 70 |  |  |  |  |  |  | ); | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | sub as_string { shift->message } | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | package MyClass; | 
| 75 |  |  |  |  |  |  | use Moose; | 
| 76 |  |  |  |  |  |  | use namespace::autoclean; | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | with 'MyRole'; | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | package main; | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | my $i = MyClass->new( message => 'foobar' ); | 
| 83 |  |  |  |  |  |  | print $i; # Prints 'foobar' | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | MooseX::Role::WithOverloading allows you to write a L<Moose::Role> which | 
| 88 |  |  |  |  |  |  | defines overloaded operators and allows those overload methods to be | 
| 89 |  |  |  |  |  |  | composed into the classes/roles/instances it's compiled to, where plain | 
| 90 |  |  |  |  |  |  | L<Moose::Role>s would lose the overloading. | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | Starting with L<Moose> version 2.1300, this module is no longer necessary, as | 
| 93 |  |  |  |  |  |  | the functionality is available already. In that case, | 
| 94 |  |  |  |  |  |  | C<use MooseX::Role::WithOverloading> behaves identically to C<use Moose::Role>. | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | =for stopwords metaclasses | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | =head1 DEPRECATION NOTICE | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | This module is marked as deprecated, as starting with L<Moose> version 2.1300, | 
| 101 |  |  |  |  |  |  | the functionality provided here is now built-in to Moose. You only need to use | 
| 102 |  |  |  |  |  |  | this module if you are using an older L<Moose> (but please upgrade!). | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | =head1 SUPPORT | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Role-WithOverloading> | 
| 107 |  |  |  |  |  |  | (or L<bug-MooseX-Role-WithOverloading@rt.cpan.org|mailto:bug-MooseX-Role-WithOverloading@rt.cpan.org>). | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | There is also a mailing list available for users of this distribution, at | 
| 110 |  |  |  |  |  |  | L<http://lists.perl.org/list/moose.html>. | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | There is also an irc channel available for users of this distribution, at | 
| 113 |  |  |  |  |  |  | irc://irc.perl.org/#moose. | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =head1 AUTHORS | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | =over 4 | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =item * | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | Florian Ragwitz <rafl@debian.org> | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =item * | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | Tomas Doran <bobtfish@bobtfish.net> | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =back | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =head1 CONTRIBUTORS | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =for stopwords Karen Etheridge Dave Rolsky Jesse Luehrs Tomas Doran (t0m) | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =over 4 | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =item * | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | Karen Etheridge <ether@cpan.org> | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | =item * | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | Dave Rolsky <autarch@urth.org> | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =item * | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | Jesse Luehrs <doy@tozt.net> | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | =item * | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | Tomas Doran (t0m) <t0m@state51.co.uk> | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | =back | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENCE | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | This software is copyright (c) 2009 by Florian Ragwitz. | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 158 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | =cut |