Skip to content
Browse files

checking in JSON-Any

  • Loading branch information...
0 parents commit 11afda1509572878210a9a4ee81785712ea7d8c9 perigrin committed
5 Changes
@@ -0,0 +1,5 @@
+Revision history for JSON-Any
+
+1.00 Fri Mar 23 10:24:50 EDT 2007
+ o Initial Release
+ o Currently only supports objToJson and jsonToObj
BIN JSON-Any-1.01.tar.gz
Binary file not shown.
12 MANIFEST
@@ -0,0 +1,12 @@
+Changes
+MANIFEST
+META.yml
+Makefile.PL
+README
+lib/JSON/Any.pm
+t/00-load.t
+t/01-JSON.t
+t/02-JSON-XS.t
+t/03-JSON-DWIW.t
+t/pod-coverage.t
+t/pod.t
11 META.yml
@@ -0,0 +1,11 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: JSON-Any
+version: 1.00
+version_from: lib/JSON/Any.pm
+installdirs: site
+requires:
+ Test::More: 0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
794 Makefile
@@ -0,0 +1,794 @@
+# This Makefile is for the JSON::Any extension to perl.
+#
+# It was generated automatically by MakeMaker version
+# 6.30 (Revision: Revision: 4535 ) from the contents of
+# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
+#
+# ANY CHANGES MADE HERE WILL BE LOST!
+#
+# MakeMaker ARGV: ()
+#
+# MakeMaker Parameters:
+
+# ABSTRACT_FROM => q[lib/JSON/Any.pm]
+# AUTHOR => q[Chris Thompson <cthom@cpan.org>]
+# NAME => q[JSON::Any]
+# PL_FILES => { }
+# PREREQ_PM => { Test::More=>q[0] }
+# VERSION_FROM => q[lib/JSON/Any.pm]
+# clean => { FILES=>q[JSON-Any-*] }
+# dist => { COMPRESS=>q[gzip -9f], SUFFIX=>q[gz] }
+
+# --- MakeMaker post_initialize section:
+
+
+# --- MakeMaker const_config section:
+
+# These definitions are from config.sh (via /opt/local/lib/perl5/5.8.8/darwin-2level/Config.pm)
+
+# They may have been overridden via Makefile.PL or on the command line
+AR = ar
+CC = /usr/bin/gcc-4.0
+CCCDLFLAGS =
+CCDLFLAGS =
+DLEXT = bundle
+DLSRC = dl_dlopen.xs
+LD = env MACOSX_DEPLOYMENT_TARGET=10.3 cc
+LDDLFLAGS = -L/opt/local/lib -bundle -undefined dynamic_lookup
+LDFLAGS = -L/opt/local/lib
+LIBC = /usr/lib/libc.dylib
+LIB_EXT = .a
+OBJ_EXT = .o
+OSNAME = darwin
+OSVERS = 8.9.1
+RANLIB = ranlib
+SITELIBEXP = /opt/local/lib/perl5/site_perl/5.8.8
+SITEARCHEXP = /opt/local/lib/perl5/site_perl/5.8.8/darwin-2level
+SO = dylib
+EXE_EXT =
+FULL_AR = /usr/bin/ar
+VENDORARCHEXP = /opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level
+VENDORLIBEXP = /opt/local/lib/perl5/vendor_perl/5.8.8
+
+
+# --- MakeMaker constants section:
+AR_STATIC_ARGS = cr
+DIRFILESEP = /
+DFSEP = $(DIRFILESEP)
+NAME = JSON::Any
+NAME_SYM = JSON_Any
+VERSION = 1.01
+VERSION_MACRO = VERSION
+VERSION_SYM = 1_01
+DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
+XS_VERSION = 1.01
+XS_VERSION_MACRO = XS_VERSION
+XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
+INST_ARCHLIB = blib/arch
+INST_SCRIPT = blib/script
+INST_BIN = blib/bin
+INST_LIB = blib/lib
+INST_MAN1DIR = blib/man1
+INST_MAN3DIR = blib/man3
+MAN1EXT = 1
+MAN3EXT = 3
+INSTALLDIRS = site
+DESTDIR =
+PREFIX = $(SITEPREFIX)
+PERLPREFIX = /opt/local
+SITEPREFIX = /opt/local
+VENDORPREFIX = /opt/local
+INSTALLPRIVLIB = /opt/local/lib/perl5/5.8.8
+DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB)
+INSTALLSITELIB = /opt/local/lib/perl5/site_perl/5.8.8
+DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB)
+INSTALLVENDORLIB = /opt/local/lib/perl5/vendor_perl/5.8.8
+DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB)
+INSTALLARCHLIB = /opt/local/lib/perl5/5.8.8/darwin-2level
+DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB)
+INSTALLSITEARCH = /opt/local/lib/perl5/site_perl/5.8.8/darwin-2level
+DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH)
+INSTALLVENDORARCH = /opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level
+DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH)
+INSTALLBIN = /opt/local/bin
+DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN)
+INSTALLSITEBIN = /opt/local/bin
+DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN)
+INSTALLVENDORBIN = /opt/local/bin
+DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN)
+INSTALLSCRIPT = /opt/local/bin
+DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT)
+INSTALLMAN1DIR = /opt/local/share/man/man1
+DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR)
+INSTALLSITEMAN1DIR = /opt/local/share/man/man1
+DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR)
+INSTALLVENDORMAN1DIR = /opt/local/share/man/man1
+DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR)
+INSTALLMAN3DIR = /opt/local/share/man/man3
+DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR)
+INSTALLSITEMAN3DIR = /opt/local/share/man/man3
+DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR)
+INSTALLVENDORMAN3DIR = /opt/local/share/man/man3
+DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR)
+PERL_LIB = /opt/local/lib/perl5/5.8.8
+PERL_ARCHLIB = /opt/local/lib/perl5/5.8.8/darwin-2level
+LIBPERL_A = libperl.a
+FIRST_MAKEFILE = Makefile
+MAKEFILE_OLD = Makefile.old
+MAKE_APERL_FILE = Makefile.aperl
+PERLMAINCC = $(CC)
+PERL_INC = /opt/local/lib/perl5/5.8.8/darwin-2level/CORE
+PERL = /opt/local/bin/perl
+FULLPERL = /opt/local/bin/perl
+ABSPERL = $(PERL)
+PERLRUN = $(PERL)
+FULLPERLRUN = $(FULLPERL)
+ABSPERLRUN = $(ABSPERL)
+PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
+FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
+ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
+PERL_CORE = 0
+PERM_RW = 644
+PERM_RWX = 755
+
+MAKEMAKER = /opt/local/lib/perl5/5.8.8/ExtUtils/MakeMaker.pm
+MM_VERSION = 6.30
+MM_REVISION = Revision: 4535
+
+# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
+# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
+# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
+# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
+FULLEXT = JSON/Any
+BASEEXT = Any
+PARENT_NAME = JSON
+DLBASE = $(BASEEXT)
+VERSION_FROM = lib/JSON/Any.pm
+OBJECT =
+LDFROM = $(OBJECT)
+LINKTYPE = dynamic
+BOOTDEP =
+
+# Handy lists of source code files:
+XS_FILES =
+C_FILES =
+O_FILES =
+H_FILES =
+MAN1PODS =
+MAN3PODS = lib/JSON/Any.pm
+
+# Where is the Config information that we are using/depend on
+CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
+
+# Where to build things
+INST_LIBDIR = $(INST_LIB)/JSON
+INST_ARCHLIBDIR = $(INST_ARCHLIB)/JSON
+
+INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT)
+INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
+
+INST_STATIC =
+INST_DYNAMIC =
+INST_BOOT =
+
+# Extra linker info
+EXPORT_LIST =
+PERL_ARCHIVE =
+PERL_ARCHIVE_AFTER =
+
+
+TO_INST_PM = lib/JSON/Any.pm
+
+PM_TO_BLIB = lib/JSON/Any.pm \
+ blib/lib/JSON/Any.pm
+
+
+# --- MakeMaker platform_constants section:
+MM_Unix_VERSION = 1.50
+PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc
+
+
+# --- MakeMaker tool_autosplit section:
+# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
+AUTOSPLITFILE = $(ABSPERLRUN) -e 'use AutoSplit; autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)'
+
+
+
+# --- MakeMaker tool_xsubpp section:
+
+
+# --- MakeMaker tools_other section:
+SHELL = /bin/sh
+CHMOD = chmod
+CP = cp
+MV = mv
+NOOP = $(SHELL) -c true
+NOECHO = @
+RM_F = rm -f
+RM_RF = rm -rf
+TEST_F = test -f
+TOUCH = touch
+UMASK_NULL = umask 0
+DEV_NULL = > /dev/null 2>&1
+MKPATH = $(ABSPERLRUN) "-MExtUtils::Command" -e mkpath
+EQUALIZE_TIMESTAMP = $(ABSPERLRUN) "-MExtUtils::Command" -e eqtime
+ECHO = echo
+ECHO_N = echo -n
+UNINST = 0
+VERBINST = 0
+MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e 'install({@ARGV}, '\''$(VERBINST)'\'', 0, '\''$(UNINST)'\'');'
+DOC_INSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e perllocal_install
+UNINSTALL = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e uninstall
+WARN_IF_OLD_PACKLIST = $(ABSPERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist
+MACROSTART =
+MACROEND =
+USEMAKEFILE = -f
+FIXIN = $(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"
+
+
+# --- MakeMaker makemakerdflt section:
+makemakerdflt: all
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker dist section:
+TAR = tar
+TARFLAGS = cvf
+ZIP = zip
+ZIPFLAGS = -r
+COMPRESS = gzip -9f
+SUFFIX = gz
+SHAR = shar
+PREOP = $(NOECHO) $(NOOP)
+POSTOP = $(NOECHO) $(NOOP)
+TO_UNIX = $(NOECHO) $(NOOP)
+CI = ci -u
+RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
+DIST_CP = best
+DIST_DEFAULT = tardist
+DISTNAME = JSON-Any
+DISTVNAME = JSON-Any-1.01
+
+
+# --- MakeMaker macro section:
+
+
+# --- MakeMaker depend section:
+
+
+# --- MakeMaker cflags section:
+
+
+# --- MakeMaker const_loadlibs section:
+
+
+# --- MakeMaker const_cccmd section:
+
+
+# --- MakeMaker post_constants section:
+
+
+# --- MakeMaker pasthru section:
+
+PASTHRU = LIBPERL_A="$(LIBPERL_A)"\
+ LINKTYPE="$(LINKTYPE)"\
+ PREFIX="$(PREFIX)"
+
+
+# --- MakeMaker special_targets section:
+.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
+
+.PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir
+
+
+
+# --- MakeMaker c_o section:
+
+
+# --- MakeMaker xs_c section:
+
+
+# --- MakeMaker xs_o section:
+
+
+# --- MakeMaker top_targets section:
+all :: pure_all manifypods
+ $(NOECHO) $(NOOP)
+
+
+pure_all :: config pm_to_blib subdirs linkext
+ $(NOECHO) $(NOOP)
+
+subdirs :: $(MYEXTLIB)
+ $(NOECHO) $(NOOP)
+
+config :: $(FIRST_MAKEFILE) blibdirs
+ $(NOECHO) $(NOOP)
+
+help :
+ perldoc ExtUtils::MakeMaker
+
+
+# --- MakeMaker blibdirs section:
+blibdirs : $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists
+ $(NOECHO) $(NOOP)
+
+# Backwards compat with 6.18 through 6.25
+blibdirs.ts : blibdirs
+ $(NOECHO) $(NOOP)
+
+$(INST_LIBDIR)$(DFSEP).exists :: Makefile.PL
+ $(NOECHO) $(MKPATH) $(INST_LIBDIR)
+ $(NOECHO) $(CHMOD) 755 $(INST_LIBDIR)
+ $(NOECHO) $(TOUCH) $(INST_LIBDIR)$(DFSEP).exists
+
+$(INST_ARCHLIB)$(DFSEP).exists :: Makefile.PL
+ $(NOECHO) $(MKPATH) $(INST_ARCHLIB)
+ $(NOECHO) $(CHMOD) 755 $(INST_ARCHLIB)
+ $(NOECHO) $(TOUCH) $(INST_ARCHLIB)$(DFSEP).exists
+
+$(INST_AUTODIR)$(DFSEP).exists :: Makefile.PL
+ $(NOECHO) $(MKPATH) $(INST_AUTODIR)
+ $(NOECHO) $(CHMOD) 755 $(INST_AUTODIR)
+ $(NOECHO) $(TOUCH) $(INST_AUTODIR)$(DFSEP).exists
+
+$(INST_ARCHAUTODIR)$(DFSEP).exists :: Makefile.PL
+ $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
+ $(NOECHO) $(CHMOD) 755 $(INST_ARCHAUTODIR)
+ $(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)$(DFSEP).exists
+
+$(INST_BIN)$(DFSEP).exists :: Makefile.PL
+ $(NOECHO) $(MKPATH) $(INST_BIN)
+ $(NOECHO) $(CHMOD) 755 $(INST_BIN)
+ $(NOECHO) $(TOUCH) $(INST_BIN)$(DFSEP).exists
+
+$(INST_SCRIPT)$(DFSEP).exists :: Makefile.PL
+ $(NOECHO) $(MKPATH) $(INST_SCRIPT)
+ $(NOECHO) $(CHMOD) 755 $(INST_SCRIPT)
+ $(NOECHO) $(TOUCH) $(INST_SCRIPT)$(DFSEP).exists
+
+$(INST_MAN1DIR)$(DFSEP).exists :: Makefile.PL
+ $(NOECHO) $(MKPATH) $(INST_MAN1DIR)
+ $(NOECHO) $(CHMOD) 755 $(INST_MAN1DIR)
+ $(NOECHO) $(TOUCH) $(INST_MAN1DIR)$(DFSEP).exists
+
+$(INST_MAN3DIR)$(DFSEP).exists :: Makefile.PL
+ $(NOECHO) $(MKPATH) $(INST_MAN3DIR)
+ $(NOECHO) $(CHMOD) 755 $(INST_MAN3DIR)
+ $(NOECHO) $(TOUCH) $(INST_MAN3DIR)$(DFSEP).exists
+
+
+
+# --- MakeMaker linkext section:
+
+linkext :: $(LINKTYPE)
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker dlsyms section:
+
+
+# --- MakeMaker dynamic section:
+
+dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker dynamic_bs section:
+
+BOOTSTRAP =
+
+
+# --- MakeMaker dynamic_lib section:
+
+
+# --- MakeMaker static section:
+
+## $(INST_PM) has been moved to the all: target.
+## It remains here for awhile to allow for old usage: "make static"
+static :: $(FIRST_MAKEFILE) $(INST_STATIC)
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker static_lib section:
+
+
+# --- MakeMaker manifypods section:
+
+POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--"
+POD2MAN = $(POD2MAN_EXE)
+
+
+manifypods : pure_all \
+ lib/JSON/Any.pm \
+ lib/JSON/Any.pm
+ $(NOECHO) $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) \
+ lib/JSON/Any.pm $(INST_MAN3DIR)/JSON::Any.$(MAN3EXT)
+
+
+
+
+# --- MakeMaker processPL section:
+
+
+# --- MakeMaker installbin section:
+
+
+# --- MakeMaker subdirs section:
+
+# none
+
+# --- MakeMaker clean_subdirs section:
+clean_subdirs :
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker clean section:
+
+# Delete temporary files but do not touch installed files. We don't delete
+# the Makefile here so a later make realclean still has a makefile to use.
+
+clean :: clean_subdirs
+ - $(RM_F) \
+ *$(LIB_EXT) core \
+ core.[0-9] $(INST_ARCHAUTODIR)/extralibs.all \
+ core.[0-9][0-9] $(BASEEXT).bso \
+ pm_to_blib.ts core.[0-9][0-9][0-9][0-9] \
+ $(BASEEXT).x $(BOOTSTRAP) \
+ perl$(EXE_EXT) tmon.out \
+ *$(OBJ_EXT) pm_to_blib \
+ $(INST_ARCHAUTODIR)/extralibs.ld blibdirs.ts \
+ core.[0-9][0-9][0-9][0-9][0-9] *perl.core \
+ core.*perl.*.? $(MAKE_APERL_FILE) \
+ perl $(BASEEXT).def \
+ core.[0-9][0-9][0-9] mon.out \
+ lib$(BASEEXT).def perlmain.c \
+ perl.exe so_locations \
+ $(BASEEXT).exp
+ - $(RM_RF) \
+ JSON-Any-* blib
+ - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
+
+
+# --- MakeMaker realclean_subdirs section:
+realclean_subdirs :
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker realclean section:
+# Delete temporary files (via clean) and also delete dist files
+realclean purge :: clean realclean_subdirs
+ - $(RM_F) \
+ $(MAKEFILE_OLD) $(FIRST_MAKEFILE)
+ - $(RM_RF) \
+ $(DISTVNAME)
+
+
+# --- MakeMaker metafile section:
+metafile : create_distdir
+ $(NOECHO) $(ECHO) Generating META.yml
+ $(NOECHO) $(ECHO) '# http://module-build.sourceforge.net/META-spec.html' > META_new.yml
+ $(NOECHO) $(ECHO) '#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#' >> META_new.yml
+ $(NOECHO) $(ECHO) 'name: JSON-Any' >> META_new.yml
+ $(NOECHO) $(ECHO) 'version: 1.01' >> META_new.yml
+ $(NOECHO) $(ECHO) 'version_from: lib/JSON/Any.pm' >> META_new.yml
+ $(NOECHO) $(ECHO) 'installdirs: site' >> META_new.yml
+ $(NOECHO) $(ECHO) 'requires:' >> META_new.yml
+ $(NOECHO) $(ECHO) ' Test::More: 0' >> META_new.yml
+ $(NOECHO) $(ECHO) '' >> META_new.yml
+ $(NOECHO) $(ECHO) 'distribution_type: module' >> META_new.yml
+ $(NOECHO) $(ECHO) 'generated_by: ExtUtils::MakeMaker version 6.30' >> META_new.yml
+ -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml
+
+
+# --- MakeMaker signature section:
+signature :
+ cpansign -s
+
+
+# --- MakeMaker dist_basics section:
+distclean :: realclean distcheck
+ $(NOECHO) $(NOOP)
+
+distcheck :
+ $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
+
+skipcheck :
+ $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
+
+manifest :
+ $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
+
+veryclean : realclean
+ $(RM_F) *~ *.orig */*~ */*.orig
+
+
+
+# --- MakeMaker dist_core section:
+
+dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
+ $(NOECHO) $(ABSPERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \
+ -e ' if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';'
+
+tardist : $(DISTVNAME).tar$(SUFFIX)
+ $(NOECHO) $(NOOP)
+
+uutardist : $(DISTVNAME).tar$(SUFFIX)
+ uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu
+
+$(DISTVNAME).tar$(SUFFIX) : distdir
+ $(PREOP)
+ $(TO_UNIX)
+ $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
+ $(RM_RF) $(DISTVNAME)
+ $(COMPRESS) $(DISTVNAME).tar
+ $(POSTOP)
+
+zipdist : $(DISTVNAME).zip
+ $(NOECHO) $(NOOP)
+
+$(DISTVNAME).zip : distdir
+ $(PREOP)
+ $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
+ $(RM_RF) $(DISTVNAME)
+ $(POSTOP)
+
+shdist : distdir
+ $(PREOP)
+ $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
+ $(RM_RF) $(DISTVNAME)
+ $(POSTOP)
+
+
+# --- MakeMaker distdir section:
+create_distdir :
+ $(RM_RF) $(DISTVNAME)
+ $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
+ -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
+
+distdir : create_distdir distmeta
+ $(NOECHO) $(NOOP)
+
+
+
+# --- MakeMaker dist_test section:
+disttest : distdir
+ cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
+ cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
+ cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
+
+
+
+# --- MakeMaker dist_ci section:
+
+ci :
+ $(PERLRUN) "-MExtUtils::Manifest=maniread" \
+ -e "@all = keys %{ maniread() };" \
+ -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \
+ -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"
+
+
+# --- MakeMaker distmeta section:
+distmeta : create_distdir metafile
+ $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } ' \
+ -e ' or print "Could not add META.yml to MANIFEST: $${'\''@'\''}\n"'
+
+
+
+# --- MakeMaker distsignature section:
+distsignature : create_distdir
+ $(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) } ' \
+ -e ' or print "Could not add SIGNATURE to MANIFEST: $${'\''@'\''}\n"'
+ $(NOECHO) cd $(DISTVNAME) && $(TOUCH) SIGNATURE
+ cd $(DISTVNAME) && cpansign -s
+
+
+
+# --- MakeMaker install section:
+
+install :: all pure_install doc_install
+ $(NOECHO) $(NOOP)
+
+install_perl :: all pure_perl_install doc_perl_install
+ $(NOECHO) $(NOOP)
+
+install_site :: all pure_site_install doc_site_install
+ $(NOECHO) $(NOOP)
+
+install_vendor :: all pure_vendor_install doc_vendor_install
+ $(NOECHO) $(NOOP)
+
+pure_install :: pure_$(INSTALLDIRS)_install
+ $(NOECHO) $(NOOP)
+
+doc_install :: doc_$(INSTALLDIRS)_install
+ $(NOECHO) $(NOOP)
+
+pure__install : pure_site_install
+ $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+doc__install : doc_site_install
+ $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+pure_perl_install ::
+ $(NOECHO) $(MOD_INSTALL) \
+ read $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist \
+ write $(DESTINSTALLARCHLIB)/auto/$(FULLEXT)/.packlist \
+ $(INST_LIB) $(DESTINSTALLPRIVLIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
+ $(INST_BIN) $(DESTINSTALLBIN) \
+ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \
+ $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR)
+ $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
+ $(SITEARCHEXP)/auto/$(FULLEXT)
+
+
+pure_site_install ::
+ $(NOECHO) $(MOD_INSTALL) \
+ read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \
+ write $(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \
+ $(INST_LIB) $(DESTINSTALLSITELIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \
+ $(INST_BIN) $(DESTINSTALLSITEBIN) \
+ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \
+ $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR)
+ $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
+ $(PERL_ARCHLIB)/auto/$(FULLEXT)
+
+pure_vendor_install ::
+ $(NOECHO) $(MOD_INSTALL) \
+ read $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist \
+ write $(DESTINSTALLVENDORARCH)/auto/$(FULLEXT)/.packlist \
+ $(INST_LIB) $(DESTINSTALLVENDORLIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
+ $(INST_BIN) $(DESTINSTALLVENDORBIN) \
+ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \
+ $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
+
+doc_perl_install ::
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+ -$(NOECHO) $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLPRIVLIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+ >> $(DESTINSTALLARCHLIB)/perllocal.pod
+
+doc_site_install ::
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+ -$(NOECHO) $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLSITELIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+ >> $(DESTINSTALLARCHLIB)/perllocal.pod
+
+doc_vendor_install ::
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+ -$(NOECHO) $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLVENDORLIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+ >> $(DESTINSTALLARCHLIB)/perllocal.pod
+
+
+uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+ $(NOECHO) $(NOOP)
+
+uninstall_from_perldirs ::
+ $(NOECHO) $(UNINSTALL) $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist
+
+uninstall_from_sitedirs ::
+ $(NOECHO) $(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist
+
+uninstall_from_vendordirs ::
+ $(NOECHO) $(UNINSTALL) $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist
+
+
+# --- MakeMaker force section:
+# Phony target to force checking subdirectories.
+FORCE:
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker perldepend section:
+
+
+# --- MakeMaker makefile section:
+# We take a very conservative approach here, but it's worth it.
+# We move Makefile to Makefile.old here to avoid gnu make looping.
+$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
+ $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?"
+ $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
+ -$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
+ -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
+ - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL)
+ $(PERLRUN) Makefile.PL
+ $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
+ $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <=="
+ false
+
+
+
+# --- MakeMaker staticmake section:
+
+# --- MakeMaker makeaperl section ---
+MAP_TARGET = perl
+FULLPERL = /opt/local/bin/perl
+
+$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
+ $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@
+
+$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib
+ $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
+ $(NOECHO) $(PERLRUNINST) \
+ Makefile.PL DIR= \
+ MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
+ MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=
+
+
+# --- MakeMaker test section:
+
+TEST_VERBOSE=0
+TEST_TYPE=test_$(LINKTYPE)
+TEST_FILE = test.pl
+TEST_FILES = t/*.t
+TESTDB_SW = -d
+
+testdb :: testdb_$(LINKTYPE)
+
+test :: $(TEST_TYPE)
+
+test_dynamic :: pure_all
+ PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)
+
+testdb_dynamic :: pure_all
+ PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE)
+
+test_ : test_dynamic
+
+test_static :: test_dynamic
+testdb_static :: testdb_dynamic
+
+
+# --- MakeMaker ppd section:
+# Creates a PPD (Perl Package Description) for a binary distribution.
+ppd:
+ $(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="1,01,0,0">' > $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <TITLE>$(DISTNAME)</TITLE>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <ABSTRACT>Wrapper Class for the myriad JSON classes.</ABSTRACT>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <AUTHOR>Chris Thompson &lt;cthom@cpan.org&gt;</AUTHOR>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <IMPLEMENTATION>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <DEPENDENCY NAME="Test-More" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <OS NAME="$(OSNAME)" />' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <ARCHITECTURE NAME="darwin-2level" />' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <CODEBASE HREF="" />' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' </IMPLEMENTATION>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) '</SOFTPKG>' >> $(DISTNAME).ppd
+
+
+# --- MakeMaker pm_to_blib section:
+
+pm_to_blib : $(TO_INST_PM)
+ $(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', '\''$(PM_FILTER)'\'')' \
+ lib/JSON/Any.pm blib/lib/JSON/Any.pm
+ $(NOECHO) $(TOUCH) pm_to_blib
+
+
+# --- MakeMaker selfdocument section:
+
+
+# --- MakeMaker postamble section:
+
+
+# End.
16 Makefile.PL
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'JSON::Any',
+ AUTHOR => 'Chris Thompson <cthom@cpan.org>',
+ VERSION_FROM => 'lib/JSON/Any.pm',
+ ABSTRACT_FROM => 'lib/JSON/Any.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'JSON-Any-*' },
+);
91 README
@@ -0,0 +1,91 @@
+NAME
+ JSON::Any - Wrapper Class for the myriad JSON classes.
+
+VERSION
+ Version 1.00
+
+SYNOPSIS
+ This module will provide a coherent API to bring together the various
+ JSON modules currently on CPAN.
+
+ use JSON::Any;
+
+ my $j = JSON::Any->new;
+
+ $json = $j->objToJson({foo=>'bar', baz=>'quux'});
+
+ $obj = $j->jsonToObj($json);
+
+ or without creating an object:
+
+ $json = JSON::Any->objToJson({foo=>'bar', baz=>'quux'});
+
+ $obj = JSON::Any->jsonToObj($json);
+
+ JSON::Any currently only implements converting back and forth between
+ JSON and hashrefs. There is considerably more functionality in many of
+ the JSON modules. Ability to access these will be provided in subsequent
+ versions of JSON::Any.
+
+ On load, JSON::Any will find a valid JSON module in your @INC by looking
+ for them in this order:
+
+ JSON::XS
+ JSON
+ JSON::DWIW
+ JSON::Syck
+
+ And loading the first one it finds.
+
+ You may change the order by specifying it on the "use JSON::Any" line:
+
+ use JSON::Any qw(DWIW Syck XS JSON);
+
+ Specifying an order that is missing one of the modules will prevent that
+ module from being used:
+
+ use JSON::Any qw(DWIW XS JSON);
+
+ This will check in that order, and will never attempt to load
+ JSON::Syck.
+
+FUNCTIONS
+ "new"
+ There are currently no arguments to "new"
+
+ "handlerType"
+ Takes no arguments, returns a string indicating which JSON Module is in
+ use.
+
+ "objToJson"
+ Takes a single argument, a hashref to be converted into JSON. It returns
+ the JSON text in a scalar.
+
+ "jsonToObj"
+ Takes a single argument, a string of JSON text to be converted back into
+ a hashref.
+
+AUTHOR
+ Chris Thompson, "<cthom at cpan.org>"
+
+BUGS
+ Please report any bugs or feature requests to "bug-json-any at
+ rt.cpan.org", or through the web interface at
+ <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSON-Any>. I will be
+ notified, and then you'll automatically be notified of progress on your
+ bug as I make changes.
+
+ACKNOWLEDGEMENTS
+ This module came about after discussions on irc.perl.org about the fact
+ that there were now six separate JSON perl modules with different
+ interfaces.
+
+ In the spirit of Class::Any, I have created JSON::Any with the
+ considerable help of Chris 'Perigrin' Prather, and Matt 'mst' Trout.
+
+COPYRIGHT & LICENSE
+ Copyright 2007 Chris Thompson, all rights reserved.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
0 blib/arch/.exists
No changes.
0 blib/arch/auto/JSON/Any/.exists
No changes.
0 blib/bin/.exists
No changes.
0 blib/lib/JSON/.exists
No changes.
315 blib/lib/JSON/Any.pm
@@ -0,0 +1,315 @@
+##############################################################################
+# JSON::Any
+# v1.01
+# Copyright (c) 2007 Chris Thompson
+##############################################################################
+
+package JSON::Any;
+
+use warnings;
+use strict;
+use Carp;
+
+my ( %conf, $handler, $encoder, $decoder );
+
+BEGIN {
+ %conf = (
+ json => {
+ encoder => 'objToJson',
+ decoder => 'jsonToObj',
+ create_object => sub {
+ my ($self) = @_;
+ my @params = qw(
+ autoconv
+ skipinvalid
+ execcoderef
+ pretty
+ indent
+ delimiter
+ keysort
+ convblessed
+ selfconvert
+ singlequote
+ );
+ return $handler->new( map { $_ => $self->{$_} } @params );
+ },
+ },
+
+ json_dwiw => {
+ encoder => 'to_json',
+ decoder => 'from_json',
+ create_object => sub {
+ my ($self) = @_;
+ my @params = qw(bare_keys);
+ return $handler->new( { map { $_ => $self->{$_} } @params } );
+ },
+ },
+
+ json_xs => {
+ encoder => 'to_json',
+ decoder => 'from_json',
+ create_object => sub {
+ my ($self) = @_;
+
+ my @params = qw(
+ ascii
+ utf8
+ pretty
+ indent
+ space_before
+ space_after
+ canonical
+ allow_nonref
+ shrink
+ max_depth
+ );
+
+ my $obj = $handler->new;
+ for my $mutator (@params) {
+ next unless exists $self->{$mutator};
+ $obj = $obj->$mutator( $self->{$mutator} );
+ }
+ $encoder = 'encode';
+ $decoder = 'decode';
+ return $obj;
+ },
+ },
+ json_syck => {
+ encoder => 'Dump',
+ decoder => 'Load',
+ },
+ );
+
+ # JSON::PC claims it has the same API as JSON
+ $conf{json_pc} = $conf{json};
+}
+
+sub import {
+ my $class = shift;
+ my @order = @_;
+
+ ( $handler, $encoder, $decoder ) = ();
+
+ @order = qw(XS JSON DWIW Syck) unless @order;
+
+ foreach my $testmod (@order) {
+ $testmod = "JSON::$testmod" unless $testmod eq "JSON";
+ eval "require $testmod";
+ unless ($@) {
+ $handler = $testmod;
+ ( my $key = lc($handler) ) =~ s/::/_/g;
+ $encoder = $conf{$key}->{encoder};
+ $decoder = $conf{$key}->{decoder};
+ last;
+ }
+ }
+
+ croak "Couldn't find a JSON Package." unless $handler;
+ croak "Couldn't find a decoder method." unless $decoder;
+ croak "Couldn't find a encoder method." unless $encoder;
+}
+
+=head1 NAME
+
+JSON::Any - Wrapper Class for the myriad JSON classes.
+
+=head1 VERSION
+
+Version 1.00
+
+=cut
+
+our $VERSION = '1.00_1';
+
+=head1 SYNOPSIS
+
+This module will provide a coherent API to bring together the various JSON modules
+currently on CPAN.
+
+ use JSON::Any;
+
+ my $j = JSON::Any->new;
+
+ $json = $j->objToJson({foo=>'bar', baz=>'quux'});
+
+ $obj = $j->jsonToObj($json);
+
+or without creating an object:
+
+ $json = JSON::Any->objToJson({foo=>'bar', baz=>'quux'});
+
+ $obj = JSON::Any->jsonToObj($json);
+
+JSON::Any currently only implements converting back and forth between JSON and hashrefs.
+There is considerably more functionality in many of the JSON modules. Ability to access these
+will be provided in subsequent versions of JSON::Any.
+
+On load, JSON::Any will find a valid JSON module in your @INC by looking for them in this order:
+
+ JSON::XS
+ JSON
+ JSON::DWIW
+ JSON::Syck
+
+And loading the first one it finds.
+
+You may change the order by specifying it on the C<use JSON::Any> line:
+
+ use JSON::Any qw(DWIW Syck XS JSON);
+
+Specifying an order that is missing one of the modules will prevent that module from being used:
+
+ use JSON::Any qw(DWIW XS JSON);
+
+This will check in that order, and will never attempt to load JSON::Syck.
+
+
+
+=head1 FUNCTIONS
+
+=item C<new>
+
+Will take any of the parameters for the underlying system and pass them through.
+However (and this will be fixed in a future revision) it doesn't map between systems.
+So this is really only is helpful for those paramters that happen to have the same name.
+
+=cut
+
+sub new {
+ my $class = shift;
+ my $self = bless {@_}, $class;
+ ( my $key = lc($handler) ) =~ s/::/_/g;
+ if ( my $creator = $conf{$key}->{create_object} ) {
+ $self->{obj} = $creator->($self);
+ }
+ return $self;
+}
+
+=item C<handlerType>
+
+Takes no arguments, returns a string indicating which JSON Module is in use.
+
+=cut
+
+sub handlerType {
+ my $class = shift;
+ $handler;
+}
+
+=item C<handler>
+
+Takes no arguments, if called on an object returns the internal JSON* object we are using.
+Otherwise returns the JSON* package we are using for class methods.
+
+=cut
+
+sub handler {
+ my $self = shift;
+ if ( ref $self ) {
+ return $self->{obj};
+ }
+ return $handler;
+}
+
+=item C<objToJson>
+
+Takes a single argument, a hashref to be converted into JSON.
+It returns the JSON text in a scalar.
+
+=cut
+
+sub objToJson {
+ my $self = shift;
+ my $obj = shift;
+ if ( ref $self ) {
+ croak "No $handler Object created!" unless exists $self->{obj};
+ my $method = $self->{obj}->can($encoder);
+ croak "$handler can't execute $encoder" unless $method;
+ return $self->{obj}->$method($obj);
+ }
+ return $handler->can($encoder)->($obj);
+}
+
+=item C<to_json>
+
+=item C<Dump>
+
+=item C<encode>
+
+All aliases for objToJson
+
+=cut
+
+{
+ no strict "refs";
+ *to_json = \&objToJson;
+ *Dump = \&objToJson;
+ *encode = \&objToJson;
+}
+
+=item C<jsonToObj>
+
+Takes a single argument, a string of JSON text to be converted
+back into a hashref.
+
+=cut
+
+sub jsonToObj {
+ my $self = shift;
+ my $obj = shift;
+ if ( ref $self ) {
+ croak "No $handler Object created!" unless exists $self->{obj};
+ my $method = $self->{obj}->can($decoder);
+ croak "$handler can't execute $encoder" unless $method;
+ return $self->{obj}->$method($obj);
+ }
+ $handler->can($decoder)->($obj);
+}
+
+=item C<from_json>
+
+=item C<Load>
+
+=item C<decode>
+
+all aliases for jsonToObj
+
+=cut
+
+{
+ no strict "refs";
+ *from_json = \&jsonToObj;
+ *Load = \&jsonToObj;
+ *decode = \&jsonToObj;
+}
+
+=head1 AUTHOR
+
+Chris Thompson, C<< <cthom at cpan.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-json-any at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSON-Any>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 ACKNOWLEDGEMENTS
+
+This module came about after discussions on irc.perl.org about the fact that there were
+now six separate JSON perl modules with different interfaces.
+
+In the spirit of Class::Any, I have created JSON::Any with the considerable help of
+Chris 'perigrin' Prather, and Matt 'mst' Trout.
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2007 Chris Thompson, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1; # End of JSON::Any
0 blib/lib/auto/JSON/Any/.exists
No changes.
0 blib/man1/.exists
No changes.
0 blib/man3/.exists
No changes.
281 blib/man3/JSON::Any.3
@@ -0,0 +1,281 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. | will give a
+.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
+.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
+.\" expand to `' in nroff, nothing in troff, for use with C<>.
+.tr \(*W-|\(bv\*(Tr
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.\"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "JSON::Any 3"
+.TH JSON::Any 3 "2007-04-04" "perl v5.8.8" "User Contributed Perl Documentation"
+.SH "NAME"
+JSON::Any \- Wrapper Class for the myriad JSON classes.
+.SH "VERSION"
+.IX Header "VERSION"
+Version 1.00
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+This module will provide a coherent \s-1API\s0 to bring together the various \s-1JSON\s0 modules
+currently on \s-1CPAN\s0.
+.PP
+.Vb 1
+\& use JSON::Any;
+.Ve
+.PP
+.Vb 1
+\& my $j = JSON::Any->new;
+.Ve
+.PP
+.Vb 1
+\& $json = $j->objToJson({foo=>'bar', baz=>'quux'});
+.Ve
+.PP
+.Vb 1
+\& $obj = $j->jsonToObj($json);
+.Ve
+.PP
+or without creating an object:
+.PP
+.Vb 1
+\& $json = JSON::Any->objToJson({foo=>'bar', baz=>'quux'});
+.Ve
+.PP
+.Vb 1
+\& $obj = JSON::Any->jsonToObj($json);
+.Ve
+.PP
+JSON::Any currently only implements converting back and forth between \s-1JSON\s0 and hashrefs.
+There is considerably more functionality in many of the \s-1JSON\s0 modules. Ability to access these
+will be provided in subsequent versions of JSON::Any.
+.PP
+On load, JSON::Any will find a valid \s-1JSON\s0 module in your \f(CW@INC\fR by looking for them in this order:
+.PP
+.Vb 4
+\& JSON::XS
+\& JSON
+\& JSON::DWIW
+\& JSON::Syck
+.Ve
+.PP
+And loading the first one it finds.
+.PP
+You may change the order by specifying it on the \f(CW\*(C`use JSON::Any\*(C'\fR line:
+.PP
+.Vb 1
+\& use JSON::Any qw(DWIW Syck XS JSON);
+.Ve
+.PP
+Specifying an order that is missing one of the modules will prevent that module from being used:
+.PP
+.Vb 1
+\& use JSON::Any qw(DWIW XS JSON);
+.Ve
+.PP
+This will check in that order, and will never attempt to load JSON::Syck.
+.SH "FUNCTIONS"
+.IX Header "FUNCTIONS"
+.RE
+.ie n .IP """new"""
+.el .IP "\f(CWnew\fR"
+.IX Item "new"
+Will take any of the parameters for the underlying system and pass them through.
+However (and this will be fixed in a future revision) it doesn't map between systems.
+So this is really only is helpful for those paramters that happen to have the same name.
+.RE
+.ie n .IP """handlerType"""
+.el .IP "\f(CWhandlerType\fR"
+.IX Item "handlerType"
+Takes no arguments, returns a string indicating which \s-1JSON\s0 Module is in use.
+.RE
+.ie n .IP """handler"""
+.el .IP "\f(CWhandler\fR"
+.IX Item "handler"
+Takes no arguments, if called on an object returns the internal JSON* object we are using.
+Otherwise returns the JSON* package we are using for class methods.
+.RE
+.ie n .IP """objToJson"""
+.el .IP "\f(CWobjToJson\fR"
+.IX Item "objToJson"
+Takes a single argument, a hashref to be converted into \s-1JSON\s0.
+It returns the \s-1JSON\s0 text in a scalar.
+.RE
+.ie n .IP """to_json"""
+.el .IP "\f(CWto_json\fR"
+.IX Item "to_json"
+.RE
+.PD 0
+.ie n .IP """Dump"""
+.el .IP "\f(CWDump\fR"
+.IX Item "Dump"
+.RE
+.ie n .IP """encode"""
+.el .IP "\f(CWencode\fR"
+.IX Item "encode"
+.PD
+All aliases for objToJson
+.RE
+.ie n .IP """jsonToObj"""
+.el .IP "\f(CWjsonToObj\fR"
+.IX Item "jsonToObj"
+Takes a single argument, a string of \s-1JSON\s0 text to be converted
+back into a hashref.
+.RE
+.ie n .IP """from_json"""
+.el .IP "\f(CWfrom_json\fR"
+.IX Item "from_json"
+.RE
+.PD 0
+.ie n .IP """Load"""
+.el .IP "\f(CWLoad\fR"
+.IX Item "Load"
+.RE
+.ie n .IP """decode"""
+.el .IP "\f(CWdecode\fR"
+.IX Item "decode"
+.PD
+all aliases for jsonToObj
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Chris Thompson, \f(CW\*(C`<cthom at cpan.org>\*(C'\fR
+.SH "BUGS"
+.IX Header "BUGS"
+Please report any bugs or feature requests to
+\&\f(CW\*(C`bug\-json\-any at rt.cpan.org\*(C'\fR, or through the web interface at
+<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSON\-Any>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+.SH "ACKNOWLEDGEMENTS"
+.IX Header "ACKNOWLEDGEMENTS"
+This module came about after discussions on irc.perl.org about the fact that there were
+now six separate \s-1JSON\s0 perl modules with different interfaces.
+.PP
+In the spirit of Class::Any, I have created JSON::Any with the considerable help of
+Chris 'perigrin' Prather, and Matt 'mst' Trout.
+.SH "COPYRIGHT & LICENSE"
+.IX Header "COPYRIGHT & LICENSE"
+Copyright 2007 Chris Thompson, all rights reserved.
+.PP
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
0 blib/script/.exists
No changes.
43 env.patch
@@ -0,0 +1,43 @@
+--- /opt/local/lib/perl5/site_perl/5.8.8/JSON/Any.pm 2007-04-24 10:47:14.000000000 -0500
++++ JSON-Any/lib/JSON/Any.pm 2007-05-07 14:17:20.000000000 -0500
+@@ -1,6 +1,6 @@
+ ##############################################################################
+ # JSON::Any
+-# v1.04
++# v1.05
+ # Copyright (c) 2007 Chris Thompson
+ ##############################################################################
+
+@@ -90,6 +90,7 @@
+
+ ( $handler, $encoder, $decoder ) = ();
+
++ @order = split /\s/, $ENV{JSON_ANY_ORDER} unless @order;
+ @order = qw(XS JSON DWIW Syck) unless @order;
+
+ foreach my $testmod (@order) {
+@@ -115,11 +116,11 @@
+
+ =head1 VERSION
+
+-Version 1.04
++Version 1.05
+
+ =cut
+
+-our $VERSION = '1.04';
++our $VERSION = '1.05';
+
+ =head1 SYNOPSIS
+
+@@ -194,7 +195,9 @@
+ my $self = bless [], $class;
+ ( my $key = lc($handler) ) =~ s/::/_/g;
+ if ( my $creator = $conf{$key}->{create_object} ) {
+- $self->[0] = $creator->({@_});
++ my @config = @_;
++ push @config, map { split /=/, $_ } split /,\s*/, $ENV{JSON_ANY_CONFIG};
++ $self->[0] = $creator->({@config});
+ }
+ return $self;
+ }
BIN json_any_test.tar.gz
Binary file not shown.
364 lib/JSON/Any.pm
@@ -0,0 +1,364 @@
+##############################################################################
+# JSON::Any
+# v1.05
+# Copyright (c) 2007 Chris Thompson
+##############################################################################
+
+package JSON::Any;
+
+use warnings;
+use strict;
+use Carp;
+
+my ( %conf, $handler, $encoder, $decoder );
+
+BEGIN {
+ %conf = (
+ json => {
+ encoder => 'objToJson',
+ decoder => 'jsonToObj',
+ create_object => sub {
+ my ($self) = @_;
+ my @params = qw(
+ autoconv
+ skipinvalid
+ execcoderef
+ pretty
+ indent
+ delimiter
+ keysort
+ convblessed
+ selfconvert
+ singlequote
+ );
+ return $handler->new( map { $_ => $self->{$_} } @params );
+ },
+ },
+
+ json_dwiw => {
+ encoder => 'to_json',
+ decoder => 'from_json',
+ create_object => sub {
+ my ($self) = @_;
+ my @params = qw(bare_keys);
+ return $handler->new( { map { $_ => $self->{$_} } @params } );
+ },
+ },
+
+ json_xs => {
+ encoder => 'to_json',
+ decoder => 'from_json',
+ create_object => sub {
+ my ($self) = @_;
+
+ my @params = qw(
+ ascii
+ utf8
+ pretty
+ indent
+ space_before
+ space_after
+ canonical
+ allow_nonref
+ shrink
+ max_depth
+ );
+
+ my $obj = $handler->new;
+ for my $mutator (@params) {
+ next unless exists $self->{$mutator};
+ $obj = $obj->$mutator( $self->{$mutator} );
+ }
+ $encoder = 'encode';
+ $decoder = 'decode';
+ return $obj;
+ },
+ },
+ json_syck => {
+ encoder => 'Dump',
+ decoder => 'Load',
+ },
+ );
+
+ # JSON::PC claims it has the same API as JSON
+ $conf{json_pc} = $conf{json};
+}
+
+sub import {
+ my $class = shift;
+ my @order = @_;
+
+ ( $handler, $encoder, $decoder ) = ();
+
+ @order = split /\s/, $ENV{JSON_ANY_ORDER} unless @order;
+ @order = qw(XS JSON DWIW Syck) unless @order;
+
+ foreach my $testmod (@order) {
+ $testmod = "JSON::$testmod" unless $testmod eq "JSON";
+ eval "require $testmod";
+ unless ($@) {
+ $handler = $testmod;
+ ( my $key = lc($handler) ) =~ s/::/_/g;
+ $encoder = $conf{$key}->{encoder};
+ $decoder = $conf{$key}->{decoder};
+ last;
+ }
+ }
+
+ croak "Couldn't find a JSON Package." unless $handler;
+ croak "Couldn't find a decoder method." unless $decoder;
+ croak "Couldn't find a encoder method." unless $encoder;
+}
+
+=head1 NAME
+
+JSON::Any - Wrapper Class for the various JSON classes.
+
+=head1 VERSION
+
+Version 1.05
+
+=cut
+
+our $VERSION = '1.05';
+
+=head1 SYNOPSIS
+
+This module will provide a coherent API to bring together the various JSON
+modules currently on CPAN. This module will allow you to code to any JSON API
+and have it work regardless of which JSON module is actually installed.
+
+ use JSON::Any;
+
+ my $j = JSON::Any->new;
+
+ $json = $j->objToJson({foo=>'bar', baz=>'quux'});
+ $obj = $j->jsonToObj($json);
+
+or
+
+ $json = $j->encode({foo=>'bar', baz=>'quux'});
+ $obj = $j->decode($json);
+
+or
+
+ $json = $j->Dump({foo=>'bar', baz=>'quux'});
+ $obj = $j->Load($json);
+
+or
+
+ $json = $j->to_json({foo=>'bar', baz=>'quux'});
+ $obj = $j->from_json($json);
+
+or without creating an object:
+
+ $json = JSON::Any->objToJson({foo=>'bar', baz=>'quux'});
+ $obj = JSON::Any->jsonToObj($json);
+
+On load, JSON::Any will find a valid JSON module in your @INC by looking
+for them in this order:
+
+ JSON::XS
+ JSON
+ JSON::DWIW
+ JSON::Syck
+
+And loading the first one it finds.
+
+You may change the order by specifying it on the C<use JSON::Any> line:
+
+ use JSON::Any qw(DWIW Syck XS JSON);
+
+Specifying an order that is missing one of the modules will prevent that module from being used:
+
+ use JSON::Any qw(DWIW XS JSON);
+
+This will check in that order, and will never attempt to load JSON::Syck. This can also be set via
+the $ENV{JSON_ANY_ORDER} environment variable.
+
+=head1 FUNCTIONS
+
+=over
+
+=item C<new>
+
+Will take any of the parameters for the underlying system and pass them through.
+However these values don't map between JSON modules, so, from a portability
+standpoint this is really only helpful for those paramters that happen
+to have the same name. This will be addressed in a future release.
+
+=back
+
+=cut
+
+sub new {
+ my $class = shift;
+ my $self = bless [], $class;
+ ( my $key = lc($handler) ) =~ s/::/_/g;
+ if ( my $creator = $conf{$key}->{create_object} ) {
+ my @config = @_;
+ push @config, map { split /=/, $_ } split /,\s*/, $ENV{JSON_ANY_CONFIG};
+ $self->[0] = $creator->({@config});
+ }
+ return $self;
+}
+
+=over
+
+=item C<handlerType>
+
+Takes no arguments, returns a string indicating which JSON Module is in use.
+
+=back
+
+=cut
+
+sub handlerType {
+ my $class = shift;
+ $handler;
+}
+
+=over
+
+=item C<handler>
+
+Takes no arguments, if called on an object returns the internal JSON::*
+object in use. Otherwise returns the JSON::* package we are using for
+class methods.
+
+=back
+
+=cut
+
+sub handler {
+ my $self = shift;
+ if ( ref $self ) {
+ return $self->[0];
+ }
+ return $handler;
+}
+
+=over
+
+=item C<objToJson>
+
+Takes a single argument, a hashref to be converted into JSON.
+It returns the JSON text in a scalar.
+
+=back
+
+=cut
+
+sub objToJson {
+ my $self = shift;
+ my $obj = shift;
+ if ( ref $self ) {
+ croak "No $handler Object created!" unless exists $self->[0];
+ my $method = $self->[0]->can($encoder);
+ croak "$handler can't execute $encoder" unless $method;
+ return $self->[0]->$method($obj);
+ }
+ return $handler->can($encoder)->($obj);
+}
+
+=over
+
+=item C<to_json>
+
+=item C<Dump>
+
+=item C<encode>
+
+Aliases for objToJson, can be used interchangeably, regardless of the
+underlying JSON module.
+
+=back
+
+=cut
+
+{
+ no strict "refs";
+ *to_json = \&objToJson;
+ *Dump = \&objToJson;
+ *encode = \&objToJson;
+}
+
+=over
+
+=item C<jsonToObj>
+
+Takes a single argument, a string of JSON text to be converted
+back into a hashref.
+
+=back
+
+=cut
+
+sub jsonToObj {
+ my $self = shift;
+ my $obj = shift;
+ if ( ref $self ) {
+ croak "No $handler Object created!" unless exists $self->[0];
+ my $method = $self->[0]->can($decoder);
+ croak "$handler can't execute $encoder" unless $method;
+ return $self->[0]->$method($obj);
+ }
+ $handler->can($decoder)->($obj);
+}
+
+=over
+
+=item C<from_json>
+
+=item C<Load>
+
+=item C<decode>
+
+Aliases for jsonToObj, can be used interchangeably, regardless of the
+underlying JSON module.
+
+=back
+
+=cut
+
+{
+ no strict "refs";
+ *from_json = \&jsonToObj;
+ *Load = \&jsonToObj;
+ *decode = \&jsonToObj;
+}
+
+=head1 AUTHOR
+
+Chris Thompson, C<< <cthom at cpan.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-json-any at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSON-Any>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 ACKNOWLEDGEMENTS
+
+This module came about after discussions on irc.perl.org about the fact
+that there were now six separate JSON perl modules with different interfaces.
+
+In the spirit of Class::Any, JSON::Any was created with the considerable
+help of Chris 'perigrin' Prather, and Matt 'mst' Trout.
+
+JSON::Any 1.01 was written almost entirely by Chris Prather.
+
+San Dimas High School Football Rules!
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2007 Chris Thompson, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1; # End of JSON::Any
0 pm_to_blib
No changes.
16 t/00-load.t
@@ -0,0 +1,16 @@
+#!perl -T
+
+use Test::More tests => 7;
+
+BEGIN {
+ use_ok('JSON::Any');
+}
+
+diag("Testing JSON::Any $JSON::Any::VERSION, Perl $], $^X");
+can_ok( JSON::Any, qw(new) );
+can_ok( JSON::Any, qw(objToJson jsonToObj) );
+can_ok( JSON::Any, qw(to_json from_json ) );
+can_ok( JSON::Any, qw(Dump Load ) );
+can_ok( JSON::Any, qw(encode decode ) );
+
+is(JSON::Any->objToJson({ foo => 'bar'}), q[{"foo":"bar"}]);
37 t/01-JSON.t
@@ -0,0 +1,37 @@
+#!perl -T
+$|++;
+use strict;
+use Test::More tests => 5;
+use JSON::Any;
+
+SKIP: {
+ eval { JSON::Any->import(qw(PC JSON)) };
+ skip "Neither JSON::PC nor JSON installed: $@", 3 if $@;
+ diag("Testing JSON/JSON::PC backend");
+ my ( $js, $obj );
+
+ #1
+ ok( my $json = JSON::Any->new( autoconv => 1 ) );
+ $obj = { "id" => JSON::Number("1.02") };
+ {
+ local $JSON::AUTOCONVERT = 0;
+ my $js = $json->objToJson($obj);
+
+ #2
+ is( $js, '{"id":1.02}' );
+ }
+ $js = $json->objToJson($obj);
+
+ #3
+ is( $js, '{"id":1.02}' );
+
+ $obj = { "id" => '0xfa' };
+ $js = $json->objToJson($obj);
+
+ #4
+ is( $js, '{"id":0xfa}' );
+
+ #5
+ ok( $json = JSON::Any->new( pretty => 1 ) );
+
+}
36 t/02-JSON-XS.t
@@ -0,0 +1,36 @@
+#!perl -T
+use strict;
+use Test::More tests => 9;
+
+BEGIN {
+ use_ok('JSON::Any');
+}
+
+SKIP: {
+ eval { JSON::Any->import(qw(XS)) };
+ skip "JSON::XS not installed: $@", 1 if $@;
+ diag("Testing JSON::XS backend");
+ my ( $json, $js, $obj );
+ ok( $json = JSON::Any->new( allow_nonref => 1 ) );
+ is( $json->encode("ü"), qq["ü"] );
+ ok( $json = JSON::Any->new( allow_nonref => 1, ascii => 1, utf8 => 1 ) );
+ is( $json->encode( chr 0x8000 ), '"\u8000"' );
+ ok(
+ $json = JSON::Any->new(
+ allow_nonref => 1,
+ ascii => 1,
+ utf8 => 1,
+ pretty => 1
+ )
+ );
+ is( $json->encode( chr 0x10402 ), '"\ud801\udc02"' );
+
+ TODO: {
+ ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => 1 ) );
+
+ local $TODO = 'figure out why ü ne qq["\xc3\xbc\"]';
+ is( $json->encode("ü"), qq["\xc3\xbc\"] );
+ }
+
+}
+
20 t/03-JSON-DWIW.t
@@ -0,0 +1,20 @@
+#!perl -T
+use strict;
+use Test::More tests => 3;
+
+BEGIN {
+ use_ok('JSON::Any');
+}
+
+SKIP: {
+ eval { JSON::Any->import(qw(DWIW)) };
+ skip "JSON::DWIW not installed: $@", 1 if $@;
+ diag("Testing JSON::DWIW backend");
+ my ( $json, $js, $obj );
+
+ # encoding bare keys
+ ok( $json = JSON::Any->new( bare_keys => 1 ) );
+ $js = $json->to_json({ var1 => "val2" });
+ is( $js, '{var1:"val2"}' );
+}
+
28 t/04-ENV.t
@@ -0,0 +1,28 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More tests => 8;
+
+BEGIN {
+ $ENV{JSON_ANY_ORDER} = qw(JSON);
+}
+use JSON::Any;
+is_deeply( $ENV{JSON_ANY_ORDER}, qw(JSON) );
+is( JSON::Any->handlerType, 'JSON' );
+
+$ENV{JSON_ANY_ORDER} = qw(XS);
+eval { require JSON::XS; };
+skip "JSON::XS not installed: $@", 1 if $@;
+
+JSON::Any->import();
+is(JSON::Any->handlerType, 'JSON::XS');
+
+my ($json);
+ok( $json = JSON::Any->new() );
+eval{ $json->encode("ü"), qq["ü"] };
+ok($@, 'trapped a failure');
+undef $@;
+$ENV{JSON_ANY_CONFIG} = 'allow_nonref=1';
+ok( $json = JSON::Any->new() );
+ok($json->encode("dahut"), qq["dahut"]);
+ok($@ == undef, 'no failure');
6 t/pod-coverage.t
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
6 t/pod.t
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
44 test.log
@@ -0,0 +1,44 @@
+t/00-load.........# Testing JSON::Any 1.00, Perl 5.008008, /opt/local/bin/perl
+
+# Failed test 'JSON::Any->can(...)'
+# at t/00-load.t line 12.
+# JSON::Any->can('to_json') failed
+# JSON::Any->can('from_json') failed
+
+# Failed test 'JSON::Any->can(...)'
+# at t/00-load.t line 13.
+# JSON::Any->can('Dump') failed
+# JSON::Any->can('Load') failed
+
+# Failed test 'JSON::Any->can(...)'
+# at t/00-load.t line 14.
+# JSON::Any->can('encode') failed
+# JSON::Any->can('decode') failed
+# Looks like you planned 4 tests but ran 2 extra.
+# Looks like you failed 3 tests of 6 run.
+dubious
+ Test returned status 3 (wstat 768, 0x300)
+DIED. FAILED tests 4-6
+ Failed 3/4 tests, 25.00% okay
+t/01-JSON.........# Testing JSON/JSON::PC backend, /opt/local/bin/perl
+ok
+t/02-JSON-XS......# Testing JSON::XS backend, /opt/local/bin/perl
+Can't locate object method "encode" via package "JSON::Any" at t/02-JSON-XS.t line 15.
+# Looks like you planned 9 tests but only ran 2.
+# Looks like your test died just after 2.
+dubious
+ Test returned status 255 (wstat 65280, 0xff00)
+DIED. FAILED tests 3-9
+ Failed 7/9 tests, 22.22% okay
+t/pod-coverage....skipped
+ all skipped: Test::Pod::Coverage 1.04 required for testing POD coverage
+t/pod.............skipped
+ all skipped: Test::Pod 1.14 required for testing POD
+Failed Test Stat Wstat Total Fail List of Failed
+-------------------------------------------------------------------------------
+t/00-load.t 3 768 4 5 4-6
+t/02-JSON-XS.t 255 65280 9 14 3-9
+2 tests skipped.
+Failed 2/5 test scripts. 8/20 subtests failed.
+Files=5, Tests=20, 0 wallclock secs ( 0.13 cusr + 0.05 csys = 0.18 CPU)
+Failed 2/5 test programs. 8/20 subtests failed.

0 comments on commit 11afda1

Please sign in to comment.
Something went wrong with that request. Please try again.