Browse Source

Changed to filter-like (stdin/stdout) behavior

Alois Mahdal 10 years ago
parent
commit
bad26a7836
2 changed files with 7 additions and 17 deletions
  1. 4
    12
      bin/pl2yml
  2. 3
    5
      bin/yml2pl

+ 4
- 12
bin/pl2yml View File

@@ -2,17 +2,9 @@
2 2
 
3 3
 use strict;
4 4
 use warnings;
5
-use YAML::Tiny;
5
+use YAML;
6 6
 
7
-my $file = shift @ARGV
8
-    or &usage;
7
+my $string = join "", <>;
8
+my $var = eval $string;
9 9
 
10
-do $file;
11
-
12
-my $yaml = YAML::Tiny->new;
13
-
14
-$yaml->[0] = $VAR1;
15
-
16
-print $yaml->write_string;
17
-
18
-sub usage { print "usage: pl2yml FILE\n"; }
10
+print Dump($var);

+ 3
- 5
bin/yml2pl View File

@@ -2,14 +2,12 @@
2 2
 
3 3
 use strict;
4 4
 use warnings;
5
-use YAML::Tiny;
5
+use YAML;
6 6
 use Data::Dumper;
7 7
 
8
-my $file = shift @ARGV
9
-    or &usage;
8
+my $string = join "", <>;
10 9
 
11
-my $data = YAML::Tiny->read($file)
12
-    or die "cannot read $file: " . YAML::Tiny->errstr . "\n";
10
+my $data = Load($string);
13 11
 
14 12
 print Dumper($data);
15 13