in reply to Re^2: Passing a value to Mojo::Template template
in thread Passing a value to Mojo::Template template

Could I combine all of it into one variable and than pass to "$mt->render_file()"?

I'm not sure I fully understand the question... do you mean something like the following (which works too)? If not, please provide more context, preferably in the form of an SSCCE (see also How do I post a question effectively?).

my %vars = ( data => $data, test => $code, color => 'blue' ); print $mt->render_file( 'myfile.html.ep', \%vars );

Replies are listed 'Best First'.
Re^4: Passing a value to Mojo::Template template
by Anonymous Monk on Apr 14, 2021 at 17:25 UTC
    Sorry for the short code sample there, but you did answer it, thank you. The only downside of it, is that it will add more complexity to extract the data to the template file, right?
      No. Hash reference is a hash reference, regardless whether it's an anonymous one or a reference to a named hash.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      wat?
        my %hash = { key1 => q{123}, key2 => q{456}, }; my $h_ref1 = \%hash; my $h_ref2 = { key3 => q{789}, key4 => q{abc}, };