+ return if $options->{quiet};
+
+ $terminal_opts //= query_terminal_options({});
+
+ my $format = $options->{'output-format'} // 'text';
+
+ if ($result_schema && defined($result_schema->{type})) {
+ return if $result_schema->{type} eq 'null';
+ } else {
+ my $type = $guess_type->($data);
+ $result_schema = { type => $type };
+ $result_schema->{items} = { type => $guess_type->($data->[0]) } if $type eq 'array';
+ }
+
+ if ($format eq 'yaml') {
+ print encode('UTF-8', CPAN::Meta::YAML::Dump($data));
+ } elsif ($format eq 'json') {
+ # Note: we always use utf8 encoding for json format
+ print to_json($data, {utf8 => 1, allow_nonref => 1, canonical => 1 }) . "\n";
+ } elsif ($format eq 'json-pretty') {