| Acme-PSON documentation | Contained in the Acme-PSON distribution. |
Acme::PSON - PSON(PerlScript Object Notation) Module
use Acme::PSON qw(obj2pson pson2obj);
my $data = { x=> 'adfs' , y => 'adf' };
my $pson = obj2pson( $data );
my $obj = pson2obj( $pson );
Like JSON but use Dumper.
get pson data.
get hash_ref or array_ref.
Masahiro Funakoshi <masap@cpan.org>
Tomohiro Teranishi <tomohiro.teranishi@gmail.com>
Copyright 2008 Tomohiro Teranishi.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
| Acme-PSON documentation | Contained in the Acme-PSON distribution. |
package Acme::PSON; use strict; use warnings; our $VERSION = '0.05'; use strict; use warnings; use vars qw( @EXPORT_OK ); use Carp; use Data::Dumper; use Exporter::Lite; @EXPORT_OK = qw(obj2pson pson2obj); use Readonly; Readonly my $VARNAME => 'PSON_VALUE'; sub obj2pson { my $obj = shift; local $Data::Dumper::Indent = 0; local $Data::Dumper::Varname = $VARNAME; return Dumper($obj); } sub pson2obj { my $str = shift; no strict; &_is_dumpeddata($str) ? eval($str) : croak "No PSON Data!"; } sub _is_dumpeddata { my $str = shift; return ( $str =~ /^\$$VARNAME/ ) ? 1 : 0; } 1;