Group
Extension

Matches 1

PerlIO-via-json ( S/SL/SLANNING/PerlIO-via-json-0.02.tar.gz, SLANNING, 2017; MetaCPAN )
PerlIO-via-json/lib/PerlIO/via/json.pm ( view source; MetaCPAN )
 PerlIO::via::json;

use 5.008001;
use strict;
use warnings;

our $VERSION = '0.02';

use XML::XML2JSON;


### PerlIO::via interface

sub PUSHED {
    bless {
        obj => XML::XML2JSON->new()
    }
 $t = <$fh>;
    (defined $t) ? $self->{obj}->xml2json($t) : undef;
}

sub WRITE {
    my ($self, $buf, $fh) = @_;
    if (print $fh $self->{obj}->json2xml($buf)) {
        return length($buf);
    }
::json - PerlIO layer to convert to and from JSON

=head1 SYNOPSIS

  use PerlIO::via::json;
  open my $fh, '<:via(json)', 'file.xml' or die "...: $!";
  my $json = <$fh>;

  open my $fh, '>:via(json)

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.