| 1 | #!/usr/bin/env perl | ||
| 2 | # | ||
| 3 | # This file is part of Convert-TBX-RNG | ||
| 4 | # | ||
| 5 | # This software is copyright (c) 2013 by Alan K. Melby. | ||
| 6 | # | ||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||
| 9 | # | ||
| 10 | use strict; | ||
| 11 | use warnings; | ||
| 12 | # PODNAME: xcs2rng.pl | ||
| 13 | #TODO: test this | ||
| 14 | our $VERSION = '0.04'; # VERSION | ||
| 15 | # ABSTRACT: Create an RNG from an XCS file | ||
| 16 | # | ||
| 17 | |||
| 18 | use Convert::TBX::RNG qw(generate_rng); | ||
| 19 | use TBX::XCS; | ||
| 20 | use TBX::XCS::JSON qw(xcs_from_json); | ||
| 21 | use File::Slurp; | ||
| 22 | |||
| 23 | my $rng; | ||
| 24 | if($ARGV[0] eq '--json'){ | ||
| 25 | my $json = read_file($ARGV[1]); | ||
| 26 | my $xcs = xcs_from_json($json); | ||
| 27 | $rng = generate_rng(xcs => $xcs); | ||
| 28 | }else{ | ||
| 29 | $rng = generate_rng(xcs_file => $ARGV[0]); | ||
| 30 | } | ||
| 31 | |||
| 32 | print $$rng; | ||
| 33 | |||
| 34 | __END__ |