1Role::HasMessage::Errf(U3s)er Contributed Perl DocumentatRioolne::HasMessage::Errf(3)
2
3
4

NAME

6       Role::HasMessage::Errf - a thing with a String::Errf-powered message
7

VERSION

9       version 0.006
10

SYNOPSIS

12       In your class...
13
14         package Errfy;
15         use Moose;
16
17         with 'Role::HasMessage::Errf';
18
19         has payload => (
20           is  => 'ro',
21           isa => 'HashRef',
22           required => 1,
23         );
24
25       Then...
26
27         my $thing = Errfy->new({
28           message => "%{error_count;error}n encountered at %{when}t",
29           payload => {
30             error_count => 2,
31             when        => time,
32           },
33         });
34
35         # prints: 2 errors encountered at 2010-10-20 19:23:42
36         print $thing->message;
37

DESCRIPTION

39       Role::HasMessage::Errf is an implementation of Role::HasMessage that
40       uses String::Errf to format "sprintf"-like message strings.  It adds a
41       "message_fmt" attribute, initialized by the "message" argument.  The
42       value should be a String::Errf format string.
43
44       When the provided "message" method is called, it will fill in the
45       format string with the hashref returned by calling the "payload"
46       method, which must be implemented by the including class.
47
48       Role::HasMessage::Errf is a parameterized role.  The "default"
49       parameter lets you set a default format string or callback.  The "lazy"
50       parameter sets whether or not the "message_fmt" attribute is lazy.
51       Setting it lazy will require that a default is provided.
52

AUTHOR

54       Ricardo Signes <rjbs@cpan.org>
55
57       This software is copyright (c) 2013 by Ricardo Signes.
58
59       This is free software; you can redistribute it and/or modify it under
60       the same terms as the Perl 5 programming language system itself.
61
62
63
64perl v5.28.1                      2013-10-16         Role::HasMessage::Errf(3)
Impressum