issue #477: get rid of perl JSON module requirement.

issue510
David Wilson 6 years ago
parent 7d1b0e0807
commit abb0319bbb

@ -9,7 +9,7 @@
- assert: - assert:
that: that:
- out.results[0].input[0].foo - out.results[0].input.foo
- out.results[0].message == 'I am a perl script! Here is my input.' - out.results[0].message == 'I am a perl script! Here is my input.'
- when: ansible_version.full > '2.4' - when: ansible_version.full > '2.4'

@ -9,7 +9,7 @@
- assert: - assert:
that: that:
- out.results[0].input[0].foo - out.results[0].input.foo
- out.results[0].message == 'I am a want JSON perl script! Here is my input.' - out.results[0].message == 'I am a want JSON perl script! Here is my input.'
- when: ansible_version.full > '2.4' - when: ansible_version.full > '2.4'

@ -1,15 +1,10 @@
#!/usr/bin/perl #!/usr/bin/perl
binmode STDOUT, ":utf8";
use utf8;
use JSON;
my $json_args = <<'END_MESSAGE'; my $json_args = <<'END_MESSAGE';
<<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>> <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>
END_MESSAGE END_MESSAGE
print encode_json({ print '{';
message => "I am a perl script! Here is my input.", print ' "message": "I am a perl script! Here is my input.",' . "\n";
input => [decode_json($json_args)] print ' "input": ' . $json_args;
}); print '}' . "\n";

@ -1,12 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl
binmode STDOUT, ":utf8";
use utf8;
my $WANT_JSON = 1; my $WANT_JSON = 1;
use JSON;
my $json; my $json;
{ {
local $/; #Enable 'slurp' mode local $/; #Enable 'slurp' mode
@ -15,7 +10,7 @@ my $json;
close $fh; close $fh;
} }
print encode_json({ print "{\n";
message => "I am a want JSON perl script! Here is my input.", print ' "message": "I am a want JSON perl script! Here is my input.",' . "\n";
input => [decode_json($json_args)] print ' "input": ' . $json_args . "\n";
}); print "}\n";

Loading…
Cancel
Save