#!/usr/bin/env perl use 5.010; use strict; use warnings; use JSON; my ($json_file, %json_wanted) = @ARGV; open my $json_fh, '<', $json_file or die "Can't open $json_file: $!"; my $json_text = <$json_fh>; close $json_fh; my $json_array_ref = decode_json $json_text; TEST_HASH: for my $test_hash (@$json_array_ref) { for my $wanted_key (keys %json_wanted) { my $test_value = $test_hash->{$wanted_key}; next TEST_HASH unless defined $test_value; next TEST_HASH unless "$json_wanted{$wanted_key}" eq "$test_value"; } for my $key (sort keys %$test_hash) { say $key, ': ', $test_hash->{$key}; } say '-' x 60; } #### $ pm_cpan_test_extract.pl Tk-ROSyntaxText.json tester 'was_a_real_email_address' perl '5.17.0' csspatch: unp cssperl: dev dist: Tk-ROSyntaxText distribution: Tk-ROSyntaxText distversion: Tk-ROSyntaxText-1.001 fulldate: 201205260128 guid: 0bf30766-a6d2-11e1-88ae-fe3ff4b14d39 id: 22275926 osname: linux ostext: GNU/Linux osvers: 2.6.32-5-amd64 perl: 5.17.0 platform: x86_64-linux-ld postdate: 201205 state: pass status: PASS tester: was_a_real_email_address type: 2 version: 1.001 ------------------------------------------------------------ csspatch: unp cssperl: dev dist: Tk-ROSyntaxText distribution: Tk-ROSyntaxText distversion: Tk-ROSyntaxText-1.001 fulldate: 201205220052 guid: 77d0ff9c-a3a8-11e1-8aed-c04af4b14d39 id: 22217880 osname: linux ostext: GNU/Linux osvers: 2.6.32-5-amd64 perl: 5.17.0 platform: x86_64-linux-thread-multi postdate: 201205 state: pass status: PASS tester: was_a_real_email_address type: 2 version: 1.001 ------------------------------------------------------------