I'm trying to use and understand Moose better, currently I use it for simple classes but am now stuck.
I have some code that reads a json file, parses it and then returns a scalar with the decoded contents.
open FH, "< myfile.json" or die $!;
my $contents = <FH>;
my $results = decode_json($contents);
My problem is that I wish to include the defining of the $results value in the class constructor, or possibly as a class method.Unfortunately I can't work out how to do this within Moose.
Can anyone help me?