in reply to Method for reducing tedium of transferring object properties to scalars

Seems you are in search of a view. Objects should generally not deal with STDOUT; code smell. This is just a terse example to demonstrate, not to recommend any specific packages.

#!/usr/bin/env perl use strictures; use Template; package OHAI { use Moo; has [qw/ val1 val2 val3 /] => is => "ro"; }; my $tt2 = Template->new; my $hai = OHAI->new({ val1 => "I", val2 => "CAN HAZ", val3 => "C0DE" }); $tt2->process(\*DATA, { thing => $hai }); __DATA__ Values: [% thing.val1 %] [% thing.val2 %] [% thing.val3 %]?
  • Comment on Re: Method for reducing tedium of transferring object properties to scalars
  • Download Code