NAME

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

SYNOPSIS

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 }});

DESCRIPTION

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.

METHODS

$formatter->calc_param()

Over-riding the behavior of the equivalent one in Text::Sprintf::Named.

$formatter->obj_format($object, \%args)

Formats based on the accessors of the object $object. I don't think %args is used in any way.

AUTHOR

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

LICENSE

This file is licensed under the MIT X11 License:

http://www.opensource.org/licenses/mit-license.php

SEE ALSO

Text::Sprintf::Named , Test::Run