1Test::Run::Sprintf::NamUesde:r:FCroonmtArcicbeustTseeodsrtsP:(e:3rR)lunD:o:cSupmreinnttaft:i:oNnamed::FromAccessors(3)
2
3
4
6 Test::Run::Sprintf::Named::FromAccessors - named sprintf according to
7 the values of accessors.
8
10 my $formatter =
11 Test::Run::Sprintf::Named::FromAccessors->new(
12 {
13 fmt => "Hello %(name)s! Today you are %(age)d years old.",
14 )
15 );
16
17 my $person1 = Person->new(name => "Larry", age => 24);
18
19 my $msg1 = $formatter->format({args => { obj => $person1 }});
20
21 my $person2 = Person->new(name => "Rachel", age => 30);
22
23 my $msg2 = $formatter->format({args => { obj => $person2 }});
24
26 This module is a sub-class of Text::Sprintf::Named where the variables
27 inside the sprintf fields (e.g: "%(varname)s") are read from the
28 accessors (or any other function) of the current object.
29
31 $formatter->calc_param()
32 Over-riding the behavior of the equivalent one in Text::Sprintf::Named.
33
34 $formatter->obj_format($object, \%args)
35 Formats based on the accessors of the object $object. I don't think
36 %args is used in any way.
37
39 Written by Shlomi Fish, <http://www.shlomifish.org/>.
40
42 This file is licensed under the MIT X11 License:
43
44 http://www.opensource.org/licenses/mit-license.php
45
47 Text::Sprintf::Named , Test::Run
48
49
50
51perl v5.32.1 20T2e1s-t0:1:-R2u7n::Sprintf::Named::FromAccessors(3)