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.007
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

PERL VERSION

54       This library should run on perls released even a long time ago.  It
55       should work on any version of perl released in the last five years.
56
57       Although it may work on older versions of perl, no guarantee is made
58       that the minimum required version will not be increased.  The version
59       may be increased for any reason, and there is no promise that patches
60       will be accepted to lower the minimum required perl.
61

AUTHOR

63       Ricardo Signes <cpan@semiotic.systems>
64
66       This software is copyright (c) 2022 by Ricardo Signes.
67
68       This is free software; you can redistribute it and/or modify it under
69       the same terms as the Perl 5 programming language system itself.
70
71
72
73perl v5.38.0                      2023-07-21         Role::HasMessage::Errf(3)
Impressum