1MooseX::Role::WithOverlUosaedrinCgo(n3t)ributed Perl DocMuomoesnetXa:t:iRoonle::WithOverloading(3)
2
3
4
6 MooseX::Role::WithOverloading - (DEPRECATED) Roles which support
7 overloading
8
10 version 0.17
11
13 package MyRole;
14 use MooseX::Role::WithOverloading;
15
16 use overload
17 q{""} => 'as_string',
18 fallback => 1;
19
20 has message => (
21 is => 'rw',
22 isa => 'Str',
23 );
24
25 sub as_string { shift->message }
26
27 package MyClass;
28 use Moose;
29 use namespace::autoclean;
30
31 with 'MyRole';
32
33 package main;
34
35 my $i = MyClass->new( message => 'foobar' );
36 print $i; # Prints 'foobar'
37
39 MooseX::Role::WithOverloading allows you to write a Moose::Role which
40 defines overloaded operators and allows those overload methods to be
41 composed into the classes/roles/instances it's compiled to, where plain
42 Moose::Roles would lose the overloading.
43
44 Starting with Moose version 2.1300, this module is no longer necessary,
45 as the functionality is available already. In that case, "use
46 MooseX::Role::WithOverloading" behaves identically to "use
47 Moose::Role".
48
50 This module is marked as deprecated, as starting with Moose version
51 2.1300, the functionality provided here is now built-in to Moose. You
52 only need to use this module if you are using an older Moose (but
53 please upgrade!).
54
56 Bugs may be submitted through the RT bug tracker
57 <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Role-
58 WithOverloading> (or bug-MooseX-Role-WithOverloading@rt.cpan.org
59 <mailto:bug-MooseX-Role-WithOverloading@rt.cpan.org>).
60
61 There is also a mailing list available for users of this distribution,
62 at <http://lists.perl.org/list/moose.html>.
63
64 There is also an irc channel available for users of this distribution,
65 at irc://irc.perl.org/#moose.
66
68 • Florian Ragwitz <rafl@debian.org>
69
70 • Tomas Doran <bobtfish@bobtfish.net>
71
73 • Karen Etheridge <ether@cpan.org>
74
75 • Dave Rolsky <autarch@urth.org>
76
77 • Jesse Luehrs <doy@tozt.net>
78
79 • Tomas Doran (t0m) <t0m@state51.co.uk>
80
82 This software is copyright (c) 2009 by Florian Ragwitz.
83
84 This is free software; you can redistribute it and/or modify it under
85 the same terms as the Perl 5 programming language system itself.
86
87
88
89perl v5.36.0 2023-01-20 MooseX::Role::WithOverloading(3)