
Test::Run::Sprintf::Named::FromAccessors - named sprintf according to the values of accessors.

my $formatter =
Test::Run::Sprintf::Named::FromAccessors->new(
{
fmt => "Hello %(name)s! Today you are %(age)d years old.",
)
);
my $person1 = Person->new(name => "Larry", age => 24);
my $msg1 = $formatter->format({args => { obj => $person1 }});
my $person2 = Person->new(name => "Rachel", age => 30);
my $msg2 = $formatter->format({args => { obj => $person2 }});

This module is a sub-class of Text::Sprintf::Named where the variables inside the sprintf fields (e.g: %(varname)s) are read from the accessors (or any other function) of the current object.

Over-riding the behavior of the equivalent one in Text::Sprintf::Named.
Formats based on the accessors of the object $object. I don't think %args is used in any way.

Written by Shlomi Fish, http://www.shlomifish.org/.

This file is licensed under the MIT X11 License:
http://www.opensource.org/licenses/mit-license.php
