--- /dev/null
+package Parson;
+
+# Copyright (C) Jeremiah C. Foster 2009
+
+=head1 NAME
+
+parson.pl - parse json
+
+=head1 VERSION
+
+This document describes version 0.1
+
+=head1 PURPOSE
+
+Create something readable from a json file
+
+=head1 SYNOPSIS
+
+=cut
+
+use Moose;
+
+has 'file' => ( isa => 'Str', is => 'rw', default => '/home/jeremiah/maemian/json.txt' );
+
+__PACKAGE__->meta->make_immutable;
+
+sub parse_json {
+ use JSON;
+ use Perl6::Slurp;
+ use File::Basename;
+ my ($self, $location) = @_;
+ my @json = slurp $self->file;
+ my $text = decode_json $json[0];
+
+ while( my ($k, $v) = each %$text ) {
+ if (ref($v) eq "ARRAY") {
+ if ($k eq 'targets') {
+ # print map { "ARRAY key: $k, value: @$_\n" } @$v;
+ }
+ elsif ($k eq "fnames") {
+ my $dsc = "@$v";
+ return basename $dsc;
+ }
+ else {
+ # print "ARRAY key: $k, value: @$v.\n";
+ }
+ }
+ }
+}
+
+
+1;
use Perl6::Slurp;
use RepoUtils;
use File::Basename;
+use Parson;
+
+# find our tarball
+my $json_object = Parson->new(); # parse json file
+my $dsc = $json_object->parse_json();
+
my $tarball = $ARGV[0]; # Orignal tarball
my $repo = RepoUtils->new();
}
$package_name =~ tr/_/-/; # translate underscore into dash
$package_name =~ s/-[\d]$//; # trim package version
-$package_name =~ s/-.?maemo.$//; # trim package version
+$package_name =~ s/-.?maemo.$//; # trim maemo version
chdir("lab/"); # We're in /lab now!
$tar->extract(); # extracted tarball now in lab/
--- /dev/null
+#!/usr/bin/perl
+
+# Standard testing of the Parson package which is desinged to
+# receive a JSON stream and pull out date from it.
+
+use strict;
+use warnings;
+use lib('/home/jeremiah/maemian/');
+use Parson;
+use Test::More tests => 6;
+
+BEGIN { use_ok( 'Parson' ); }
+require_ok( 'Parson' );
+my $json_object = Parson->new();
+isa_ok($json_object, 'Parson');
+like($json_object->file, qr(\/home\/jeremiah\/maemian\/json\.txt), 'Files identical.');
+can_ok($json_object, 'parse_json');
+my $dsc = $json_object->parse_json();
+like($dsc, qr(.*\.dsc$), 'Likely a dsc file');
+print "$dsc\n";