bin/srx2table
raw| 1 | #!/usr/bin/env perl |
| 2 | |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | use RDF::Trine; |
| 6 | |
| 7 | my $data; |
| 8 | if (scalar(@ARGV) and -r $ARGV[0]) { |
| 9 | my $file = shift; |
| 10 | $data = do { local($/) = undef; open(my $fh, '<:encoding(UTF-8)', $file) or die $!; <$fh> }; |
| 11 | } else { |
| 12 | binmode(\*STDIN, ':encoding(UTF-8)'); |
| 13 | local($/) = undef; |
| 14 | $data = <>; |
| 15 | } |
| 16 | |
| 17 | my $iter = RDF::Trine::Iterator->from_string( $data ); |
| 18 | print $iter->as_string; |