1MooseX::Role::WithOverlUosaedrinCgo(n3t)ributed Perl DocMuomoesnetXa:t:iRoonle::WithOverloading(3)
2
3
4

NAME

6       MooseX::Role::WithOverloading - Roles which support overloading
7

SYNOPSIS

9           package MyRole;
10           use MooseX::Role::WithOverloading;
11
12           use overload
13               q{""}    => 'as_string',
14               fallback => 1;
15
16           has message => (
17               is       => 'rw',
18               isa      => 'Str',
19           );
20
21           sub as_string { shift->message }
22
23           package MyClass;
24           use Moose;
25           use namespace::autoclean;
26
27           with 'MyRole';
28
29           package main;
30
31           my $i = MyClass->new( message => 'foobar' );
32           print $i; # Prints 'foobar'
33

DESCRIPTION

35       MooseX::Role::WithOverloading allows you to write a Moose::Role which
36       defines overloaded operators and allows those operator overloadings to
37       be composed into the classes/roles/instances it's compiled to, while
38       plain Moose::Roles would lose the overloading.
39

AUTHORS

41       ·   Florian Ragwitz <rafl@debian.org>
42
43       ·   Tomas Doran <bobtfish@bobtfish.net>
44
46       This software is copyright (c) 2010 by Florian Ragwitz.
47
48       This is free software; you can redistribute it and/or modify it under
49       the same terms as the Perl 5 programming language system itself.
50
51
52
53perl v5.12.2                      2010-07-19  MooseX::Role::WithOverloading(3)
Impressum