JSON-Any-1.32000755001750001750 012236734064 13565 5ustar00perigrinperigrin000000000000README100644001750001750 46212236734064 14510 0ustar00perigrinperigrin000000000000JSON-Any-1.32 This archive contains the distribution JSON-Any, version 1.32: Wrapper Class for the various JSON classes. This software is copyright (c) 2013 by Chris Thompson. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. LICENSE100644001750001750 4366112236734064 14705 0ustar00perigrinperigrin000000000000JSON-Any-1.32This software is copyright (c) 2013 by Chris Thompson. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2013 by Chris Thompson. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2013 by Chris Thompson. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End CHANGES100644001750001750 6301612236734064 14667 0ustar00perigrinperigrin000000000000JSON-Any-1.32================================================== Changes from 2012-11-07 00:00:00 +0000 to present. ================================================== ----------------------------------------- version 1.32 at 2013-11-07 15:56:33 +0000 ----------------------------------------- Change: e1fbae5ccddc7becce7b1bcff1a8ac99075bc136 Author: Chris Prather Date : 2013-11-07 07:52:41 +0000 Merge pull request #3 from wolfsage/t_fix_deps Include dep Test::Requires in dist.ini Change: 0880faaaf3c8194acc3a70a387d94ff69633b333 Author: Matthew Horsfall Date : 2013-11-07 10:51:02 +0000 Include dep Test::Requires in dist.ini ----------------------------------------- version 1.31 at 2013-11-06 21:46:52 +0000 ----------------------------------------- Change: 87ce2b21a27c984d71ec9b2a94847ae99d48445b Author: Chris Prather Date : 2013-11-06 21:46:52 +0000 ignore a few more directories Change: d585c4cdccb59c96d7a3ab78e1881edd7e4d4e59 Author: Chris Prather Date : 2013-11-06 21:44:04 +0000 bump minimum version requirement for JSON.pm Change: f5200618645fc09d27856b921bc9be43cf35b039 Author: Chris Prather Date : 2013-11-06 21:41:22 +0000 fix the tests to properly exclude JSON::XS A bug came up where JSON::XS and JSON.pm had incompatible revisions but installed just fine. This was a problem because JSON.pm will silently load JSON::XS in the background and caused explosions. We now try to exclude JSON::XS except in the case we're actually testing it directly. Also we've removed some of the tests for JSON::Syck as it's been deprecated. We also add in tests for Cpanel::JSON::XS which got missed when it was added as a choice. Change: 14744d6d0cce26bc867638ec5aaea9594c292efe Author: Chris Prather Date : 2013-10-31 22:45:19 +0000 add a todo note for ether (or whomever) to pick up before I get back to it Change: 360853b664817a0ed0e4b473dfbf1dbf1e56dd77 Author: Chris Prather Date : 2013-10-31 17:51:41 +0000 test without JSON::XS and add a compat note JSON::XS 3.x is incompatible with JSON.pm < 2.90 in the exact way that JSON::Any uses things in the test suite. So we set the tests to ignore JSON::XS (using Test::Without::Module) thanks to ether for suggesting it. And we add a note about the situation to the POD so that others can figure out what is going on. Change: 756c6ac460c92d425d970e113465ce1e9a6b40a9 Author: Chris Prather Date : 2013-10-31 15:29:16 +0000 test for more accpetable backends on install We have added more acceptable backends (Cpanel::JSON::XS and JSON::PP) but we didn't update the tests during installation. Change: cc51c101a1aa0d45573d25cd6bad3c9eb07006f5 Author: Chris Prather Date : 2013-10-31 14:59:45 +0000 Pull Changes from Git and prune local/ Migrating out Changes file to ChangesFromGit so I won't have to remember to update it manually. If people desperately need the old commit messages broken out by release I can go back and tag the releases based on the old changes file. Additional to prevent myself from pulling a "perigrin" as rjbs put it, I've added a directive to prune Carton stile local/ directories. Change: ed357ecabed9ede1cfffb021f5c922a4bcc5c828 Author: Chris Prather Date : 2013-10-30 06:19:58 +0000 Merge pull request #2 from ilmari/json-xs-3 Add support for JSON::XS version 3 Change: 6bd1def2e2fddfd79aff4b36e2f05519bc89366e Author: Dagfinn Ilmari Mannsåker Date : 2013-10-30 11:19:24 +0000 Add support for JSON::XS version 3 For added future robustness, skip modules we manage to load but don't know how to handle. Change: 75a29b8203bc430481b5afed2a08a78e52edc037 Author: Dagfinn Ilmari Mannsåker Date : 2013-10-30 11:15:55 +0000 Test string escaping with JSON:PP as well Change: f8fb91cf5911ea5022883a34d69f362bbf5f59a4 Author: Dagfinn Ilmari Mannsåker Date : 2013-10-30 11:15:55 +0000 Fix no_plan usage ----------------------------------------- version 1.30 at 2013-06-15 20:42:55 +0000 ----------------------------------------- Change: 9855652fcb7cfcb6c66a846d0cb6b124004239d3 Author: Chris Prather Date : 2013-06-15 16:42:55 +0000 clean up and modernize the dist for 1.30 release Change: d324166b5e6b38625bc13e5cba4116365305dad5 Author: Chris Prather Date : 2013-06-15 16:17:02 +0000 tidy up the code Change: b20a5d160371ebec9c90f36a942b79fabd44aaf2 Author: Chris Prather Date : 2013-06-15 16:16:11 +0000 add Cpanel::JSON::XS support Change: 84157525e8684ed812e7007484ad208da2630f48 Author: Chris Prather Date : 2013-06-15 16:14:59 +0000 add support for JSON::PP Change: edbbf5fac3effd77e89908c37bd569f6760fc3f4 Author: Chris Prather Date : 2011-09-17 20:29:55 +0000 have dzil manage our version numbers Change: 34965f9f6daecad7b57c4e2898cdc34a436d3674 Author: Chris Prather Date : 2011-09-17 20:19:57 +0000 rework to use a similar process as Any::Moose so that the toolchain bits work properly Change: 46df74c03caed6f8226ddf6953f476f88831b753 Author: Chris Prather Date : 2011-09-17 20:18:49 +0000 update version and changes for release Change: 90acf0e8e34b949db9d0af1a3655e833efcc7e81 Author: Chris Prather Date : 2011-06-07 19:58:30 +0000 fix for version number collision Change: c4fc946bf27599fd3c4312a93d6485df0ea4102d Author: Chris Prather Date : 2011-06-07 19:54:26 +0000 fix for RT#68690 Change: 96b6d3478be74f64d23f7886aa553cb4aa9184fa Author: Chris Prather Date : 2011-05-09 13:22:06 +0000 move podspell into xt/ Change: b3d26873cf5dd0b4930ecb7f14edea2edbeb10f6 Author: Chris Prather Date : 2011-04-08 08:45:00 +0000 update README Change: 20ad0e27335ef6ee2d9507f0fa44c8c6f6149b01 Author: Chris Prather Date : 2011-04-08 08:43:37 +0000 add changes and bump version for 1.27 release Change: b7d9ffbd322f077baeb08c71709acc33eba10687 Author: Chris Prather Date : 2011-04-08 08:43:37 +0000 add back auto_install so feature works again Change: ebc0c4545b328b0efc15c43b6b8f235d7ea5373f Author: Justin Hunter Date : 2011-03-30 23:48:26 +0000 fix typos and add a test to catch them Change: 182de415f9ffbdadf00dcb31fd668673f87170e9 Author: Chris Prather Date : 2011-03-30 05:42:49 +0000 update README Change: bc139296bba835c7fba9aa517f47150cf5940ced Author: Chris Prather Date : 2011-03-30 05:40:18 +0000 add Deprecation notice Change: a603c0f9ffc40a1a72b622b30f8deb44b5048e7a Author: Chris Prather Date : 2010-11-16 16:08:41 +0000 get set for 1.25 release Change: 847b61fb00726a42e56528fbc44be3735f2c532f Author: Todd Rinaldo Date : 2010-11-16 12:04:56 +0000 Fix for Perl 5.13 deprecation of 'for qw() {}' http://search.cpan.org/~miyagawa/perl-5.13.6/pod/perl5135delta.pod#Us e_of_qw(...)_as_parentheses Change: 1378475ca0ee3eb014c061a88348107e3cd9ac23 Author: Chris Prather Date : 2010-10-08 11:53:12 +0000 update for 0.24, fixing the build from where MI changed underneath me Change: cd4804d400b0bb1bcfb0f5ebbf1a6e2594327f7c Author: Chris Prather Date : 2010-10-07 16:21:07 +0000 update Changes and Version Change: dd4d6d2eacf04bb42507b6a3284cdd7f4e10e289 Author: Justin Hunter Date : 2010-10-07 12:58:51 +0000 add support for JSON.pm v1 Change: 9b5aa0e1d5bdb5260304988bd6f9ed6530ba74df Author: Chris Prather Date : 2009-10-12 22:33:12 +0000 README apparently updated Change: 469a038a7b6ab6872ce8cadf076b1fafbb3d047b Author: Chris Prather Date : 2009-10-12 22:28:03 +0000 clean up for 1.22 release Change: 76e404897310a8adfe5bcd1ccb33c284ca201566 Author: Tomas Doran Date : 2009-10-12 23:38:08 +0000 Tidy up to use a regex Change: b285ce5339f21648f0e46f57f56caee1b367b2c1 Author: Tomas Doran Date : 2009-10-12 23:32:25 +0000 I guess just sucking this shit up is the best bet.. And should probably be done in more places, .. Better solutions welcome Change: 9c031c26f48615a255e233ac55960d9644574b12 Author: Tomas Doran Date : 2009-10-12 23:29:50 +0000 Add .gitignore Change: 72c529809ddeb8eb2f131ea54a27deade09fb0fa Author: Tomas Doran Date : 2009-10-12 23:29:11 +0000 Updated README Change: 2532659f2af87bb204c6682b5c904dc19572af28 Author: Tomas Doran Date : 2009-10-12 23:29:00 +0000 Automagically regenerate README Change: 17ad676673fbdce58c6076bcf1170db8534c7e60 Author: Chris Prather Date : 2009-07-03 13:59:17 +0000 clean up Changes Change: 9f7455d77089701c834a0acd1858243f2022a122 Author: Chris Prather Date : 2009-07-03 13:51:54 +0000 version number bump get ready for release Change: 928d82e8b782351a73e96c67d19c18ae037131f4 Author: Chris Prather Date : 2009-07-03 13:44:46 +0000 update the skip text a little Change: c122ca0bfd837455a2d3fe55710192aeceb8c94a Author: Marc Mims Date : 2009-07-03 10:26:12 +0000 Fixed: skip tests when backend is unavailable Change: d8b3c007a5c2f12858561161a49a9dbe933d226a Author: Marc Mims Date : 2009-07-03 09:39:07 +0000 Removed require/import of utf8 since that isn't necessary or advised The utf8:: methods used by JSON::Any are available without requiring and importing utf8. See 'perldoc utf8' which advises against using/requiring utf8. That should only be done if the source code in the current scope includes unicode characters. That's no the case here. Change: f68c3882ee03473d78e7f33ab19edde2f8550cdf Author: Marc Mims Date : 2009-07-03 09:39:01 +0000 Added a workaround for handlers that don't parse bare true/false values Change: de45f0a3de6746e6094bbf519326d6aa6b8e34cc Author: Marc Mims Date : 2009-07-03 09:38:47 +0000 Updated get_true/get_false for JSON::XS The required version of XS has boolean support and provides true/false methods. Using them instead of raw scalar refs, now. Change: ed17741620addd8100e7dcf09ec6da994074aa31 Author: Marc Mims Date : 2009-07-03 09:23:55 +0000 Added tets for boolean support Change: 7bf4570ee53ed519b120b0d7b0fabce045aa0943 Author: Chris Prather Date : 2009-07-02 17:19:28 +0000 clean up packaging for release Change: 4060539a57e44109f64208b6f69e7224b0e9df8f Author: Chris Prather Date : 2009-07-02 17:05:12 +0000 add deprecation feature for JSON::Syck to close the Test::JSON bug Change: e9b163eb0b24ff65b0de83f118d0b52a1d2c111c Author: Marc Mims Date : 2009-07-01 12:13:44 +0000 Better error message when a handler can't be found This should resolve the confusion that lead to: http://rt.cpan.org/Public/Bug/Display.html?id=32957 Change: ddb8a55fde900e7b72a345030beccf3ed518678a Author: Chris Prather Date : 2009-05-04 13:23:36 +0000 drop the dep down to 5.008 Change: 83da672496a5c594a662361799657c89fe4a2654 Author: Chris Prather Date : 2009-05-04 11:29:10 +0000 update version numbers to be consistent Change: 2203ea50059989b00ae15ab63b242e337cbb47a9 Author: perigrin Date : 2009-01-15 17:17:00 +0000 make the Syck test a TODO test so we can release Change: 536a67f298a34f3d1824e10cbb4ab89841821ef6 Author: perigrin Date : 2009-01-15 17:16:55 +0000 remove JSON::PC from the tests Change: 1c89db3a017fb1543235186063c340aa062ad67f Author: marc.mims Date : 2009-01-15 01:09:31 +0000 Added string escape tests. Change: 2fd0666304c829811f0a2e612ab68844ef0dfa05 Author: perigrin Date : 2009-01-14 20:22:43 +0000 Document changes, bump version number, and update Makefile Change: 880d76f5b6bb519efffd4bc3a5c8edb945770b33 Author: perigrin Date : 2009-01-14 20:08:03 +0000 make Syck deprecated and optional Change: bfa89d0cb10677f900e2f1427459e2d9f49b5cdd Author: perigrin Date : 2008-11-13 02:15:41 +0000 missed a ref to JSON::PC and add MANIFEST.SKIP Change: 030aa49d51752959548ac7fe46427956caa7846f Author: perigrin Date : 2008-11-13 02:08:30 +0000 Remove JSON::PC and bump version number Change: 1fc51f545228af50aedf35934370c2f878807197 Author: perigrin Date : 2008-07-09 04:26:20 +0000 remove +x on Changes Change: 12e2dbc25635eabcf43661527a88b1eba9f15ee4 Author: robin.berjon@gmail.com Date : 2008-07-08 10:42:18 +0000 added skipping of some bits Change: 435e7fb7b719d0f18fc8cb90ac7bf4835e485eda Author: robin.berjon@gmail.com Date : 2008-07-05 15:04:13 +0000 Added two simple methods to get to the values that the underlying modules use for true/false Change: 644abfd97e0406c6df8440d7eca55497b781ca10 Author: robin.berjon@gmail.com Date : 2008-07-05 14:36:27 +0000 Added two simple methods to get to the values that the underlying modules use for true/false Change: 8bfd48c1afa8b4c8959b2d875be4550d1a0817eb Author: robin.berjon@gmail.com Date : 2008-07-05 14:08:02 +0000 supporting allow_blessed, turned out to be a LOT easier than expected Change: e92b780b7a90f279426a9e014478f1f8d1877c0e Author: perigrin Date : 2008-02-14 00:16:22 +0000 * JSON::Any now compatible with both versions of JSON::XS (Simon Wistow) * Document that calling 'use JSON::Any ();' is a bad idea * Make JSON.pm required unless a supported JSON package is already installed Change: 53d0a376f547c59ccfd5c84d5f6740be4a8f5bba Author: perigrin Date : 2008-01-28 16:19:56 +0000 version number bump Change: ffcda91aaea1038a40925073d9970543a4c95d94 Author: perigrin Date : 2008-01-14 19:41:35 +0000 fix erroneous test spotted by jrockway Change: a6ed3a8ecbe8c674927641b501368d461164e942 Author: perigrin Date : 2008-01-02 20:15:56 +0000 add a note about compatibility Change: f2102ff4f5bc65a57a52be077d9e6faaad56bf28 Author: perigrin Date : 2008-01-02 20:15:07 +0000 from the Changes: 1.15 2008-01-02 * Update the config params for JSON and JSON/XS configuration * Update JSON handler to always pass in the -support_by_pp option if you don't want support_by_pp then don't use JSON.pm ... Change: 4d495a6e6899fec001f826f09e6c2754e583e0e0 Author: perigrin Date : 2008-01-01 20:40:36 +0000 at mst's strong reccomendation (::grin::) test use_ok in the load test if any package is installed then use_ok to make sure JSON::Any loads okay ... this is ugly and verbose but does protect us better and was the right idea Change: e08e2f933e3d3e5723529b7b44e0d33db349bc85 Author: perigrin Date : 2008-01-01 20:12:02 +0000 fix the tests so that they'll skip if you don't have a JSON package installed (despite the reccomendations from Makefile.PL) ... I'M LOOKING AT YOU DAVID CANTRELL'S SMOKER! Change: 38803b561a25733486bb49b07dc398347af605b1 Author: perigrin Date : 2007-12-20 17:25:20 +0000 version number bump and minor makefile changes Change: 161e16bc866bc4bf7e2601834c249e8599afed97 Author: perigrin Date : 2007-12-20 17:16:25 +0000 fix for latest JSON/JSON::XS Change: b7333f2ba759346ebcadd1478b9ad7ef9820812a Author: perigrin Date : 2007-11-07 00:27:58 +0000 fix bug #30509 Change: 6f5cb8923221ef888a4365ba39b1b8097296288c Author: perigrin Date : 2007-10-22 11:41:38 +0000 fix issues with tests and setup 1.12 release so we can fix our tests Change: cca1dd58b81327c5d740d17a612a71f3724a4c50 Author: perigrin Date : 2007-10-18 16:33:28 +0000 version number bump Change: 6c3b22d101020834fb0484d590c36be84157a4d6 Author: perigrin Date : 2007-10-18 16:30:41 +0000 require 5.8.3 die if trying to set uft8 on JSON::Syck until someone tells me that it'll succeed Change: f2fa9944b4824035239bd9b4cfb3b6f9d47ceab0 Author: perigrin Date : 2007-10-17 23:34:23 +0000 fix perl -MJSON::Any=Syck -e 'JSON::Any->new->objToJson({ foo => 1 })' No JSON::Syck Object created! at -e line 1 Change: 168f21285331d37c71324758ce1df89ee6ba9d76 Author: nothingmuch@woobling.org Date : 2007-10-10 14:59:40 +0000 utf8 tests for JSON::XS Change: 98ea22eef02ee23f8ac4ec9fc984be3661e4a7f4 Author: perigrin Date : 2007-10-10 02:28:20 +0000 0.09 release Change: 07a3099c9b029afea58a034e5d10955d1456afcd Author: nothingmuch@woobling.org Date : 2007-10-09 23:40:01 +0000 Document the UTF8 change Change: e670c04c3e0229c00ebc7143c52b82bcd6dfd23f Author: nothingmuch@woobling.org Date : 2007-10-09 23:33:50 +0000 consistently emit utf8 json if utf8 is enabled. introduce $JSON::Any::UTF8 to control this behavior in non OO mode Change: 59bb09ff399b4e9daf958f0000ea5b356ff8d27b Author: nothingmuch@woobling.org Date : 2007-10-09 23:32:35 +0000 no strict 'refs' is unnecessary Change: a3fcaf474d92a198d14e7657693dac7682f3663a Author: perigrin Date : 2007-10-09 23:28:17 +0000 remove MANIFEST since we can generate it Change: 87f18c14f884aefd2f4c7743b1308ce2b9436f98 Author: perigrin Date : 2007-10-09 23:25:52 +0000 remove inc Change: 9bb4f41d9f2ace8b374fb15201efc418b146b543 Author: perigrin Date : 2007-10-05 05:02:11 +0000 change things to try to get JSON::XS to play nice with UTF8 Change: fbf2fa89a765cce630d61114f8e250c054ec0169 Author: perigrin Date : 2007-10-05 03:21:52 +0000 fix the manifest Change: 9f49c1831abf463f998d99e801f68740931e137f Author: nothingmuch@woobling.org Date : 2007-10-05 02:55:19 +0000 don't send utf8 json sources to JSON::XS Change: dacfb41d6f8fa149c852215db51f0f036b14d911 Author: nothingmuch@woobling.org Date : 2007-10-05 02:54:39 +0000 expand tabs Change: 0899906b9cf1201d746ba7bfded62ff4969a197b Author: perigrin Date : 2007-10-05 02:36:24 +0000 add more history Change: 53174153531a5d6050fc71d3ed6fc7d3b5f93c81 Author: perigrin Date : 2007-10-05 02:31:22 +0000 add in changes Change: 2ce3b515e1bbf178bbaba02033ab22fc5c40c75b Author: perigrin Date : 2007-10-05 02:26:46 +0000 cleanup the repo Change: 7a8aef45dd3bd046a24208e6876cacb5f0f7bae8 Author: nothingmuch@woobling.org Date : 2007-10-05 02:23:55 +0000 fix the exiting sub via next warning Change: cb0eb8ed30e218ef1272d6b9a0b1a80a67bc65aa Author: nothingmuch@woobling.org Date : 2007-10-05 02:23:21 +0000 fix the exiting sub via next warning Change: 5d97a50e23aae459d2e15256a1d5f67b4c1af04d Author: nothingmuch@woobling.org Date : 2007-10-05 02:12:09 +0000 also test for is_utf8() Change: d5d255b374864e21f0046fae43f66b2cd9f6a0db Author: nothingmuch@woobling.org Date : 2007-10-05 02:08:46 +0000 improve unicode test Change: b73818ce9b2757b43f86ceca73b97a71eb82361e Author: nothingmuch@woobling.org Date : 2007-10-05 01:54:40 +0000 add utf8 support for JSON::{Converter,Parser} Change: 58952c375d444ff567250d57d0c125e8fa53ba9d Author: nothingmuch@woobling.org Date : 2007-10-05 01:52:17 +0000 Add a test for unicode strings Change: e087b9c5910f9a12d4e2080027a2167afb5b93f2 Author: perigrin Date : 2007-05-17 19:38:04 +0000 Fix JSON.pm backend tests Change: d719e73893014f4270e45f0b97c2d8703274fcbb Author: perigrin Date : 2007-05-10 17:35:59 +0000 fix issues with JSON::XS being pedantic about how it's methods/functions are called Change: 3631b49f3f58f79d11a6059d888de597a481e0ed Author: perigrin Date : 2007-05-10 03:46:46 +0000 added a carp requirement version number bump Change: ccf7c0dfe2b74830893cb828a35020a4597abc13 Author: perigrin Date : 2007-05-10 03:42:19 +0000 changed Makefile.PL to Module::Install Change: dadcd944569673107b9c02d7a84e0f72cec24227 Author: perigrin Date : 2007-05-09 23:01:48 +0000 helps if I test 04-ENV.t against the code it was designed for Change: 2ecd3ba748a931566a438a338778e7b92d0d7508 Author: perigrin Date : 2007-05-09 22:27:39 +0000 skip all 04-ENV.t until I get it working Change: 3eaefa86b23f1ad1af09ead208439c49d4dc656b Author: perigrin Date : 2007-05-09 22:24:57 +0000 fixing tests Change: a3791eaec63f2d820c495276c14328fec80dfc4f Author: perigrin Date : 2007-05-09 22:13:39 +0000 change to skip_all based skippage Change: 51984d7b44d9a7e267b76afd47a44312fec27791 Author: perigrin Date : 2007-05-09 17:02:13 +0000 add example directory Change: 6883f354dbaa47d649451f234424b299ffcab5af Author: perigrin Date : 2007-05-09 17:00:26 +0000 update META.yaml Change: 5f51390798f1cbfa0f3cbabe5878b2099158e910 Author: perigrin Date : 2007-05-09 16:52:22 +0000 pod updates and version bump Change: dfea1778311fd9848398a88cdcddeaeed9d2acfd Author: perigrin Date : 2007-05-09 16:44:51 +0000 - cleaned up t/04-ENV.t to not require JSON::XS anymore - fixed split on uninitalized value error - cleaned up JSON-XS tests a bit - added 04-ENV.t to MANIFEST Change: 1e8e614af085df0f88780098316d76ddf6a64ed7 Author: perigrin Date : 2007-05-09 16:20:46 +0000 last files cleaned Change: 9fb8bb4bdd25d7f7f899a2da0aff92fb7055e349 Author: perigrin Date : 2007-05-09 16:19:57 +0000 removing blib (more cleaning) Change: ecd7f42b2fe3ba3ae6aed4fdddc1e59a89112881 Author: perigrin Date : 2007-05-09 16:18:40 +0000 cleaning the repo a bit Change: 11afda1509572878210a9a4ee81785712ea7d8c9 Author: perigrin Date : 2007-05-09 16:15:31 +0000 checking in JSON-Any ================ End of releases. ================ dist.ini100644001750001750 133512236734064 15314 0ustar00perigrinperigrin000000000000JSON-Any-1.32name = JSON-Any author = Chris Thompson author = Chris Prather author = Robin Berjon author = Marc Mims author = Tomas Doran license = Perl_5 copyright_holder = Chris Thompson [@Filter] bundle = @Classic remove = MakeMaker [@Git] [ContributorsFromGit] [ChangelogFromGit] [GithubMeta] [Git::NextVersion] [PkgVersion] [=inc::MakeMaker] ; authordep Dist::Zilla::Plugin::MakeMaker::Awesome [Meta::Dynamic::Config] [MetaJSON] [PodWeaver] [Prereqs] perl = 5.008 [Prereqs / TestRequires] Test::Without::Module = 0.17 Test::Requires = 0 [PruneFiles] match = ^nytprof.* match = ^perl5 match = ^cpan.* match = ^local META.yml100644001750001750 243612236734064 15124 0ustar00perigrinperigrin000000000000JSON-Any-1.32--- abstract: 'Wrapper Class for the various JSON classes.' author: - 'Chris Thompson ' - 'Chris Prather ' - 'Robin Berjon ' - 'Marc Mims ' - 'Tomas Doran ' build_requires: Test::Requires: 0 Test::Without::Module: 0.17 configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 1 generated_by: 'Dist::Zilla version 4.300039, CPAN::Meta::Converter version 2.132830' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: JSON-Any requires: perl: 5.008 resources: homepage: https://github.com/perigrin/json-any repository: https://github.com/perigrin/json-any.git version: 1.32 x_contributors: - 'Chris Prather ' - 'Dagfinn Ilmari Mannsåker ' - 'Justin Hunter ' - 'Matthew Horsfall ' - 'Todd Rinaldo ' - 'marc.mims ' - 'nothingmuch@woobling.org ' - 'perigrin ' - 'robin.berjon@gmail.com ' MANIFEST100644001750001750 55712236734064 14766 0ustar00perigrinperigrin000000000000JSON-Any-1.32CHANGES LICENSE MANIFEST MANIFEST.SKIP META.json META.yml Makefile.PL README dist.ini inc/MakeMaker.pm lib/JSON/Any.pm t/00-load.t t/01-JSON.t t/02-JSON-XS.t t/03-JSON-DWIW.t t/04-ENV.t t/05-JSON-Syck.t t/06-JSON-PP.t t/07-CPanel-JSON-XS.t t/10_unicode.t t/11-string-escape.t t/12-boolean.t t/release-pod-coverage.t t/release-pod-syntax.t weaver.ini xt/01-podspell.t META.json100644001750001750 401012236734064 15262 0ustar00perigrinperigrin000000000000JSON-Any-1.32{ "abstract" : "Wrapper Class for the various JSON classes.", "author" : [ "Chris Thompson ", "Chris Prather ", "Robin Berjon ", "Marc Mims ", "Tomas Doran " ], "dynamic_config" : 1, "generated_by" : "Dist::Zilla version 4.300039, CPAN::Meta::Converter version 2.132830", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "JSON-Any", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "perl" : "5.008" } }, "test" : { "requires" : { "Test::Requires" : "0", "Test::Without::Module" : "0.17" } } }, "release_status" : "stable", "resources" : { "homepage" : "https://github.com/perigrin/json-any", "repository" : { "type" : "git", "url" : "https://github.com/perigrin/json-any.git", "web" : "https://github.com/perigrin/json-any" } }, "version" : "1.32", "x_contributors" : [ "Chris Prather ", "Dagfinn Ilmari Manns\u00e5ker ", "Justin Hunter ", "Matthew Horsfall ", "Todd Rinaldo ", "marc.mims ", "nothingmuch@woobling.org ", "perigrin ", "robin.berjon@gmail.com " ] } weaver.ini100644001750001750 3312236734064 15574 0ustar00perigrinperigrin000000000000JSON-Any-1.32[@Default] [Contributors] t000755001750001750 012236734064 13751 5ustar00perigrinperigrin000000000000JSON-Any-1.3204-ENV.t100644001750001750 161212236734064 15147 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl use strict; use Test::More; eval "use JSON::Any"; if ($@) { plan skip_all => "$@"; } else { plan 'no_plan'; } SKIP: { eval { require JSON; }; skip "JSON not installed: $@", 1 if $@; $ENV{JSON_ANY_ORDER} = qw(JSON); JSON::Any->import(); skip "JSON not installed: $@", 1 if $@; is_deeply( $ENV{JSON_ANY_ORDER}, qw(JSON) ); is( JSON::Any->handlerType, 'JSON' ); } SKIP: { eval { require JSON::XS; }; skip "JSON::XS not installed: $@", 1 if $@; $ENV{JSON_ANY_ORDER} = qw(XS); JSON::Any->import(); is( JSON::Any->handlerType, 'JSON::XS' ); my ($json); ok( $json = JSON::Any->new() ); eval { $json->encode("") }; ok( $@, 'trapped a failure' ); undef $@; $ENV{JSON_ANY_CONFIG} = 'allow_nonref=1'; ok( $json = JSON::Any->new() ); ok( $json->encode("dahut"), qq["dahut"] ); is( $@, undef, 'no failure' ); } 01-JSON.t100644001750001750 357712236734064 15301 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl $|++; use strict; use Test::More; use Test::Without::Module qw(JSON::XS); eval "use JSON::Any qw(JSON)"; if ($@) { plan skip_all => "JSON.pm not installed: $@"; } else { plan tests => 19; } diag("Testing JSON.pm backend"); my ( $js, $obj ); ok(my $json_obj = JSON::Any->new()); isa_ok($json_obj, 'JSON::Any'); isa_ok($json_obj->handler, 'JSON'); $js = q|{}|; $obj = $json_obj->jsonToObj($js); $js = $json_obj->objToJson($obj); is($js,'{}'); $js = q|[]|; $obj = $json_obj->jsonToObj($js); $js = $json_obj->objToJson($obj); is($js,'[]'); $js = q|{"foo":"bar"}|; $obj = $json_obj->jsonToObj($js); is($obj->{foo},'bar'); $js = $json_obj->objToJson($obj); is($js,'{"foo":"bar"}'); $js = q|{"foo":""}|; $obj = $json_obj->jsonToObj($js); $js = $json_obj->objToJson($obj); is($js,'{"foo":""}'); $js = q|{"foo":" "}|; $obj = $json_obj->jsonToObj($js); $js = $json_obj->objToJson($obj); is($js,'{"foo":" "}'); $js = q|{}|; $obj = JSON::Any->jsonToObj($js); $js = JSON::Any->objToJson($obj); is($js,'{}'); $js = q|[]|; $obj = JSON::Any->jsonToObj($js); $js = JSON::Any->objToJson($obj); is($js,'[]'); $js = q|{"foo":"bar"}|; $obj = JSON::Any->jsonToObj($js); is($obj->{foo},'bar'); $js = JSON::Any->objToJson($obj); is($js,'{"foo":"bar"}'); $js = q|{"foo":""}|; $obj = JSON::Any->jsonToObj($js); $js = JSON::Any->objToJson($obj); is($js,'{"foo":""}'); $js = q|{"foo":" "}|; $obj = JSON::Any->jsonToObj($js); $js = JSON::Any->objToJson($obj); is($js,'{"foo":" "}'); # testing the truth warn JSON::Any->true; $obj = { foo => JSON::Any->true }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":true}'); $obj = { foo => JSON::Any->false }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":false}'); $obj = { foo => $json_obj->true }; $js = $json_obj->objToJson($obj); is($js,'{"foo":true}'); $obj = { foo => $json_obj->false }; $js = $json_obj->objToJson($obj); is($js,'{"foo":false}'); 00-load.t100644001750001750 134612236734064 15436 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl -T use Test::More; BEGIN { # Count who's installed my @order = qw(JSON::XS JSON JSON::DWIW JSON::Syck); my $count = scalar grep { eval "require $_"; not $@; } @order; unless ($count) { # need at least one plan skip_all => "Can't find a JSON package."; exit; } # if we're here we have *something* that will work plan tests => 7; 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"}] ); Makefile.PL100644001750001750 436612236734064 15631 0ustar00perigrinperigrin000000000000JSON-Any-1.32# This Makefile.PL for JSON-Any was generated by # inc::MakeMaker . # Don't edit it but the dist.ini used to construct it. use strict; use warnings; use 5.008; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "Wrapper Class for the various JSON classes.", "AUTHOR" => "Chris Thompson , Chris Prather , Robin Berjon , Marc Mims , Tomas Doran ", "BUILD_REQUIRES" => {}, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "JSON-Any", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "JSON::Any", "PREREQ_PM" => {}, "TEST_REQUIRES" => { "Test::Requires" => 0, "Test::Without::Module" => "0.17" }, "VERSION" => "1.32", "test" => { "TESTS" => "t/*.t" } ); ; sub has_json () { our @order = qw(CPANEL XS PP JSON DWIW); foreach my $testmod (@order) { $testmod = "JSON::$testmod" unless $testmod eq "JSON"; $testmod = "Cpanel::JSON::XS" if $testmod eq "JSON::CPANEL"; eval "require $testmod"; return 1 unless $@; } return 0; } if (has_json) { # we have some kind of supported JSON module, we're good } else { # we need to have a version of JSON, go with JSON.pm as a sane default $WriteMakefileArgs{PREREQ_PM}{JSON} = '2.90'; } unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { my $tr = delete $WriteMakefileArgs{TEST_REQUIRES}; my $br = $WriteMakefileArgs{BUILD_REQUIRES}; for my $mod ( keys %$tr ) { if ( exists $br->{$mod} ) { $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod}; } else { $br->{$mod} = $tr->{$mod}; } } } unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; for my $mod ( keys %$br ) { if ( exists $pp->{$mod} ) { $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; } else { $pp->{$mod} = $br->{$mod}; } } } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); MANIFEST.SKIP100644001750001750 33512236734064 15525 0ustar00perigrinperigrin000000000000JSON-Any-1.32^\.git ^_build ^Build$ ^blib ~$ \.bak$ CVS \.svn \.DS_Store cover_db \..*\.sw.?$ ^Makefile$ ^pm_to_blib$ ^MakeMaker-\d ^blibdirs$ \.old$ ^#.*#$ ^\.# ^TODO$ ^PLANS$ ^doc/ ^benchmarks ^\._.*$ ^t\/600_todo_tests\/$ \.shipit 12-boolean.t100644001750001750 237212236734064 16141 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl $!++; use strict; use Data::Dumper; use Test::More; eval "use JSON::Any"; if ($@) { plan skip_all => "$@"; exit; } $Data::Dumper::Indent = 0; $Data::Dumper::Terse = 1; # JSON::Syck doesn't support bools my @backends = qw(XS JSON DWIW); # make sure we test the JSON::PP backend instead of XS, twice $ENV{PERL_JSON_BACKEND} = 0; plan tests => @backends * 2 * 4; test ($_) for @backends; { package Boolean; sub true { 1 } sub false { '' } } sub test { my ($backend) = @_; SKIP: { my $j = eval { JSON::Any->import($backend); JSON::Any->new; }; note("$backend: " . $@), skip("Backend $backend failed to load", 8) if $@; $j and $j->handler or next; note "handler is " . ( ref( $j->handler ) || $j->handlerType ); for my $bool ( qw/true false/ ) { my $data = eval { JSON::Any->jsonToObj($bool) }; ok ( !$@, "inflated '$bool'" ); ok ( eval { $data xor !Boolean->$bool }, "$bool evaluates to $bool" ); $data = eval { JSON::Any->$bool }; ok ( !$@, "JSON::Any->$bool returned a value" ); ok ( eval { $data xor !Boolean->$bool }, "JSON::Any->$bool evaluates to $bool" ); } }; } 10_unicode.t100644001750001750 377212236734064 16235 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl $|++; use strict; use utf8; use Test::More; use Test::Requires 'JSON::Any'; $ENV{JSON_ANY_CONFIG} = "utf8=1"; sub run_tests_for { my $backend = shift; note "testing backend $backend"; my $j = eval { JSON::Any->import($backend); JSON::Any->new; }; note "$backend: " . $@ and next if $@; $j and $j->handler or return; note "handler is " . ( ref( $j->handler ) || $j->handlerType ); foreach my $text (qw(foo שלום)) { my $struct = [$text]; my $frozen = $j->encode($struct); my $thawed = $j->decode($frozen); ok( utf8::is_utf8($frozen) || !scalar( $frozen !~ /[\w\d[:punct:]]/ ), "json output is utf8" ); is_deeply( $thawed, $struct, "deeply" ); is( $thawed->[0], $text, "text is the same" ) || eval { require Devel::StringInfo; my $d = Devel::StringInfo->new; $d->dump_info( $text, name => "expected" ); $d->dump_info( $thawed->[0], name => "got" ); $d->dump_info($frozen); }; ok( utf8::is_utf8( $thawed->[0] ) || !scalar( $text !~ /[a-z]/ ), "text is utf8 if it needs to be" ); if ( utf8::valid($frozen) ) { utf8::decode($frozen); my $thawed = $j->decode($frozen); is_deeply( $thawed, $struct, "deeply" ); is( $thawed->[0], $text, "text is the same" ) || eval { require Devel::StringInfo; my $d = Devel::StringInfo->new; $d->dump_info( $text, name => "expected" ); $d->dump_info( $thawed->[0], name => "got" ); $d->dump_info($frozen); }; ok( utf8::is_utf8( $thawed->[0] ) || !scalar( $text !~ /[a-z]/ ), "text is utf8 if it needs to be" ); } } } { run_tests_for 'XS'; } { require Test::Without::Module; Test::Without::Module->import('JSON::XS'); run_tests_for $_ for (qw(PP JSON CPANEL DWIW)); } done_testing; 06-JSON-PP.t100644001750001750 350412236734064 15611 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl $|++; use strict; use Test::More; eval "use JSON::Any qw(PP)"; if ($@) { plan skip_all => "JSON::PP not installed: $@"; } else { plan tests => 19; } diag("Testing JSON::PP backend"); my ( $js, $obj ); ok(my $json_obj = JSON::Any->new()); isa_ok($json_obj, 'JSON::Any'); isa_ok($json_obj->handler, 'JSON::PP'); $js = q|{}|; $obj = $json_obj->jsonToObj($js); $js = $json_obj->objToJson($obj); is($js,'{}'); $js = q|[]|; $obj = $json_obj->jsonToObj($js); $js = $json_obj->objToJson($obj); is($js,'[]'); $js = q|{"foo":"bar"}|; $obj = $json_obj->jsonToObj($js); is($obj->{foo},'bar'); $js = $json_obj->objToJson($obj); is($js,'{"foo":"bar"}'); $js = q|{"foo":""}|; $obj = $json_obj->jsonToObj($js); $js = $json_obj->objToJson($obj); is($js,'{"foo":""}'); $js = q|{"foo":" "}|; $obj = $json_obj->jsonToObj($js); $js = $json_obj->objToJson($obj); is($js,'{"foo":" "}'); $js = q|{}|; $obj = JSON::Any->jsonToObj($js); $js = JSON::Any->objToJson($obj); is($js,'{}'); $js = q|[]|; $obj = JSON::Any->jsonToObj($js); $js = JSON::Any->objToJson($obj); is($js,'[]'); $js = q|{"foo":"bar"}|; $obj = JSON::Any->jsonToObj($js); is($obj->{foo},'bar'); $js = JSON::Any->objToJson($obj); is($js,'{"foo":"bar"}'); $js = q|{"foo":""}|; $obj = JSON::Any->jsonToObj($js); $js = JSON::Any->objToJson($obj); is($js,'{"foo":""}'); $js = q|{"foo":" "}|; $obj = JSON::Any->jsonToObj($js); $js = JSON::Any->objToJson($obj); is($js,'{"foo":" "}'); # testing the truth $obj = { foo => JSON::Any->true }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":true}'); $obj = { foo => JSON::Any->false }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":false}'); $obj = { foo => $json_obj->true }; $js = $json_obj->objToJson($obj); is($js,'{"foo":true}'); $obj = { foo => $json_obj->false }; $js = $json_obj->objToJson($obj); is($js,'{"foo":false}'); 02-JSON-XS.t100644001750001750 335312236734064 15622 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl use utf8; use strict; use Test::More; eval "use JSON::Any qw(XS)"; if ($@) { plan skip_all => "JSON::XS not installed: $@"; } else { plan tests => 24; } skip "JSON::XS not installed: $@", 1 if $@; diag("Testing JSON::XS backend"); is( JSON::Any->encode({foo=>'bar'}), qq[{"foo":"bar"}] ); my ( $json, $js, $obj ); ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => 1 ) ); is( $json->encode("ü"), qq["ü"] ); foreach my $bytes ( 0, 1 ) { foreach my $utf8_support ( 0, 1 ) { my $str = "ü"; utf8::encode($str) if $bytes; ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => $utf8_support ) ); if ( $utf8_support ) { # only then do we make assumptions about the output json is( $json->encode($str), qq["$str"] ); } is( $json->decode($json->encode($str)), $str, "round tripping" ); } } 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 ) ); like( $json->encode( chr 0x10402 ), qr/"\\ud801\\udc02"\n?/ ); ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => 1 ) ); is( $json->encode("ü"), qq["\xc3\xbc\"] ); is( JSON::Any->encode({foo=>'bar'}), qq[{"foo":"bar"}] ); # testing the truth $obj = { foo => JSON::Any->true }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":true}'); $obj = { foo => JSON::Any->false }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":false}'); $obj = { foo => $json->true }; $js = $json->objToJson($obj); is($js,'{"foo":true}'); $obj = { foo => $json->false }; $js = $json->objToJson($obj); is($js,'{"foo":false}'); JSON000755001750001750 012236734064 15025 5ustar00perigrinperigrin000000000000JSON-Any-1.32/libAny.pm100755001750001750 4542712236734064 16311 0ustar00perigrinperigrin000000000000JSON-Any-1.32/lib/JSONpackage JSON::Any; { $JSON::Any::VERSION = '1.32'; } { $JSON::Any::VERSION = '1.32'; } use warnings; use strict; use Carp qw(croak carp); # ABSTRACT: Wrapper Class for the various JSON classes. our $UTF8; my ( %conf, $handler, $encoder, $decoder ); use constant HANDLER => 0; use constant ENCODER => 1; use constant DECODER => 2; use constant UTF8 => 3; BEGIN { %conf = ( json_1 => { encoder => 'objToJson', decoder => 'jsonToObj', get_true => sub { return JSON::True(); }, get_false => sub { return JSON::False(); }, create_object => sub { require JSON; my ( $self, $conf ) = @_; my @params = qw( autoconv skipinvalid execcoderef pretty indent delimiter keysort convblessed selfconvert singlequote quoteapos unmapping barekey ); my $obj = $handler->new( utf8 => $conf->{utf8} ); ## constructor only for my $mutator (@params) { next unless exists $conf->{$mutator}; $obj = $obj->$mutator( $conf->{$mutator} ); } $self->[ENCODER] = 'objToJson'; $self->[DECODER] = 'jsonToObj'; $self->[HANDLER] = $obj; }, }, json_2 => { encoder => 'encode_json', decoder => 'decode_json', get_true => sub { return JSON::true(); }, get_false => sub { return JSON::false(); }, create_object => sub { JSON->import( '-support_by_pp', '-no_export' ); my ( $self, $conf ) = @_; my @params = qw( ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref allow_blessed convert_blessed filter_json_object shrink max_depth max_size loose allow_bignum allow_barekey allow_singlequote escape_slash indent_length sort_by ); local $conf->{utf8} = !$conf->{utf8}; # it means the opposite my $obj = $handler->new; for my $mutator (@params) { next unless exists $conf->{$mutator}; $obj = $obj->$mutator( $conf->{$mutator} ); } $self->[ENCODER] = 'encode'; $self->[DECODER] = 'decode'; $self->[HANDLER] = $obj; }, }, json_dwiw => { encoder => 'to_json', decoder => 'from_json', get_true => sub { return JSON::DWIW->true; }, get_false => sub { return JSON::DWIW->false; }, create_object => sub { my ( $self, $conf ) = @_; my @params = qw(bare_keys); croak "JSON::DWIW does not support utf8" if $conf->{utf8}; $self->[ENCODER] = 'to_json'; $self->[DECODER] = 'from_json'; $self->[HANDLER] = $handler->new( { map { $_ => $conf->{$_} } @params } ); }, }, json_xs_1 => { encoder => 'to_json', decoder => 'from_json', get_true => sub { return \1; }, get_false => sub { return \0; }, create_object => sub { my ( $self, $conf ) = @_; 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 $conf->{$mutator}; $obj = $obj->$mutator( $conf->{$mutator} ); } $self->[ENCODER] = 'encode'; $self->[DECODER] = 'decode'; $self->[HANDLER] = $obj; }, }, json_xs_2 => { encoder => 'encode_json', decoder => 'decode_json', get_true => sub { return JSON::XS::true(); }, get_false => sub { return JSON::XS::false(); }, create_object => sub { my ( $self, $conf ) = @_; my @params = qw( ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref allow_blessed convert_blessed filter_json_object shrink max_depth max_size ); local $conf->{utf8} = !$conf->{utf8}; # it means the opposite my $obj = $handler->new; for my $mutator (@params) { next unless exists $conf->{$mutator}; $obj = $obj->$mutator( $conf->{$mutator} ); } $self->[ENCODER] = 'encode'; $self->[DECODER] = 'decode'; $self->[HANDLER] = $obj; }, }, json_syck => { encoder => 'Dump', decoder => 'Load', get_true => sub { croak "JSON::Syck does not support special boolean values"; }, get_false => sub { croak "JSON::Syck does not support special boolean values"; }, create_object => sub { my ( $self, $conf ) = @_; croak "JSON::Syck does not support utf8" if $conf->{utf8}; $self->[ENCODER] = sub { Dump(@_) }; $self->[DECODER] = sub { Load(@_) }; $self->[HANDLER] = 'JSON::Syck'; } }, ); # JSON::PP has the same API as JSON.pm v2 $conf{json_pp} = { %{ $conf{json_2} } }; $conf{json_pp}{get_true} = sub { return JSON::PP::true(); }; $conf{json_pp}{get_false} = sub { return JSON::PP::false(); }; # Cpanel::JSON::XS is a fork of JSON::XS (currently) $conf{cpanel_json_xs} = { %{ $conf{json_xs_2} } }; $conf{cpanel_json_xs}{get_true} = sub { return Cpanel::JSON::XS::true(); }; $conf{cpanel_json_xs}{get_false} = sub { return Cpanel::JSON::XS::false(); }; # JSON::XS 3 is almost the same as JSON::XS 2 $conf{json_xs_3} = { %{ $conf{json_xs_2} } }; $conf{json_xs_3}{get_true} = sub { return Types::Serialiser::true(); }; $conf{json_xs_3}{get_false} = sub { return Types::Serialiser::false(); }; } sub _make_key { my $handler = shift; ( my $key = lc($handler) ) =~ s/::/_/g; if ( 'json_xs' eq $key || 'json' eq $key ) { no strict 'refs'; $key .= "_" . ( split /\./, ${"$handler\::VERSION"} )[0]; } return $key; } my @default = qw(CPANEL XS PP JSON DWIW); my @deprecated = qw(Syck); sub _module_name { my ($testmod) = @_; return 'Cpanel::JSON::XS' if $testmod eq 'CPANEL'; return 'JSON' if $testmod eq 'JSON'; return "JSON::$testmod"; } sub _try_loading { my @order = @_; ( $handler, $encoder, $decoder ) = (); foreach my $mod (@order) { my $testmod = _module_name($mod); eval "require $testmod"; unless ($@) { $handler = $testmod; my $key = _make_key($handler); next unless exists $conf{$key}; $encoder = $conf{$key}->{encoder}; $decoder = $conf{$key}->{decoder}; last; } } return ( $handler, $encoder, $decoder ); } sub import { my $class = shift; my @order = @_; ( $handler, $encoder, $decoder ) = (); @order = split /\s/, $ENV{JSON_ANY_ORDER} if !@order and $ENV{JSON_ANY_ORDER}; if (@order) { ( $handler, $encoder, $decoder ) = _try_loading(@order); if ( $handler && grep { "JSON::$_" eq $handler } @deprecated ) { my $last = pop @default; carp "Found deprecated package $handler. Please upgrade to ", join ', ' => @default, "or $last"; } } else { ( $handler, $encoder, $decoder ) = _try_loading(@default); unless ($handler) { ( $handler, $encoder, $decoder ) = _try_loading(@deprecated); if ($handler) { my $last = pop @default; carp "Found deprecated package $handler. Please upgrade to ", join ', ' => @default, "or $last"; } } } unless ($handler) { my $last = pop @default; croak "Couldn't find a JSON package. Need ", join ', ' => @default, "or $last"; } croak "Couldn't find a decoder method." unless $decoder; croak "Couldn't find a encoder method." unless $encoder; } sub new { my $class = shift; my $self = bless [], $class; my $key = _make_key($handler); if ( my $creator = $conf{$key}->{create_object} ) { my @config = @_; if ( $ENV{JSON_ANY_CONFIG} ) { push @config, map { split /=/, $_ } split /,\s*/, $ENV{JSON_ANY_CONFIG}; } $creator->( $self, my $conf = {@config} ); $self->[UTF8] = $conf->{utf8}; } return $self; } sub handlerType { my $class = shift; $handler; } sub handler { my $self = shift; if ( ref $self ) { return $self->[HANDLER]; } return $handler; } sub true { my $key = _make_key($handler); return $conf{$key}->{get_true}->(); } sub false { my $key = _make_key($handler); return $conf{$key}->{get_false}->(); } sub objToJson { my $self = shift; my $obj = shift; croak 'must provide object to convert' unless defined $obj; my $json; if ( ref $self ) { my $method; unless ( ref $self->[ENCODER] ) { croak "No $handler Object created!" unless exists $self->[HANDLER]; $method = $self->[HANDLER]->can( $self->[ENCODER] ); croak "$handler can't execute $self->[ENCODER]" unless $method; } else { $method = $self->[ENCODER]; } $json = $self->[HANDLER]->$method($obj); } else { $json = $handler->can($encoder)->($obj); } utf8::decode($json) if ( ref $self ? $self->[UTF8] : $UTF8 ) and !utf8::is_utf8($json) and utf8::valid($json); return $json; } *to_json = \&objToJson; *Dump = \&objToJson; *encode = \&objToJson; sub jsonToObj { my $self = shift; my $obj = shift; croak 'must provide json to convert' unless defined $obj; # some handlers can't parse single booleans (I'm looking at you DWIW) if ( $obj =~ /^(true|false)$/ ) { return $self->$1; } if ( ref $self ) { my $method; unless ( ref $self->[DECODER] ) { croak "No $handler Object created!" unless exists $self->[HANDLER]; $method = $self->[HANDLER]->can( $self->[DECODER] ); croak "$handler can't execute $self->[DECODER]" unless $method; } else { $method = $self->[DECODER]; } return $self->[HANDLER]->$method($obj); } $handler->can($decoder)->($obj); } *from_json = \&jsonToObj; *Load = \&jsonToObj; *decode = \&jsonToObj; 1; __END__ =pod =head1 NAME JSON::Any - Wrapper Class for the various JSON classes. =head1 VERSION version 1.32 =head1 SYNOPSIS This module tries to 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: Cpanel::JSON::XS JSON::XS JSON::PP JSON JSON::DWIW And loading the first one it finds. You may change the order by specifying it on the C line: use JSON::Any qw(DWIW XS CPANEL JSON PP); Specifying an order that is missing modules will prevent those module from being used: use JSON::Any qw(CPANEL PP); # same as JSON::MaybeXS This will check in that order, and will never attempt to load JSON::XS, JSON.pm, or JSON::DWIW. This can also be set via the $ENV{JSON_ANY_ORDER} environment variable. JSON::Syck has been deprecated by it's author, but in the attempt to still stay relevant as a "Compat Layer" JSON::Any still supports it. This support however has been made optional starting with JSON::Any 1.19. In deference to a bug request starting with JSON 1.20 JSON::Syck and other deprecated modules will still be installed, but only as a last resort and will now include a warning. use JSON::Any qw(Syck XS JSON); or $ENV{JSON_ANY_ORDER} = 'Syck XS JSON'; WARNING: If you call JSON::Any with an empty list use JSON::Any (); It will skip the JSON package detection routines and will die loudly that it couldn't find a package. =head1 NAME JSON::Any =head1 VERSION version 1.32 =head1 WARNING JSON::XS 3.0 or higher has a conflict with any version of JSON.pm less than 2.90 when you use JSON.pm's C<-support_by_pp> option, which JSON::Any enables by default. This situation should only come up with JSON::Any if you have JSON.pm 2.61 or lower and JSON::XS 3.0 or higher installed and you for JSON::Any to use JSON.pm via C or the C environment variable. If you run into an issue where you're getting recursive inheritance errors in a Types::Serialiser package, please try upgrading JSON.pm to 2.90 or higher. =head1 DEPRECATION The original need for JSON::Any has been solved (quite some time ago actually). If you're producing new code it is recommended to use JSON.pm which will optionally use JSON::XS for speed purposes. JSON::Any will continue to be maintained for compatibility with existing code, and frankly because the maintainer prefers the JSON::Any API. =head1 METHODS =over =item C 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 parameters that happen to have the same name. This will be addressed in a future release. The one parameter that is universally supported (to the extent that is supported by the underlying JSON modules) is C. When this parameter is enabled all resulting JSON will be marked as unicode, and all unicode strings in the input data structure will be preserved as such. Also note that the C parameter is recognised by all the modules that throw exceptions when a blessed reference is given them meaning that setting it to true works for all modules. Of course, that means that you cannot set it to false intentionally in order to always get such exceptions. The actual output will vary, for example L will encode and decode unicode chars (the resulting JSON is not unicode) whereas L will emit unicode JSON. =back =over =item C Takes no arguments, returns a string indicating which JSON Module is in use. =back =over =item C 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 =over =item C Takes no arguments, returns the special value that the internal JSON object uses to map to a JSON C boolean. =back =over =item C Takes no arguments, returns the special value that the internal JSON object uses to map to a JSON C boolean. =back =over =item C Takes a single argument, a hashref to be converted into JSON. It returns the JSON text in a scalar. =back =over =item C =item C =item C Aliases for objToJson, can be used interchangeably, regardless of the underlying JSON module. =back =over =item C Takes a single argument, a string of JSON text to be converted back into a hashref. =back =over =item C =item C =item C Aliases for jsonToObj, can be used interchangeably, regardless of the underlying JSON module. =back =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 Matt 'mst' Trout. Simon Wistow graciously supplied a patch for backwards compat with JSON::XS versions previous to 2.01 San Dimas High School Football Rules! =head1 AUTHORS =over 4 =item * Chris Thompson =item * Chris Prather =item * Robin Berjon =item * Marc Mims =item * Tomas Doran =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Chris Thompson. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 CONTRIBUTORS =over 4 =item * Chris Prather =item * Dagfinn Ilmari Mannsker =item * Justin Hunter =item * Matthew Horsfall =item * Todd Rinaldo =item * marc.mims =item * nothingmuch@woobling.org =item * perigrin =item * robin.berjon@gmail.com =back =cut 03-JSON-DWIW.t100644001750001750 135612236734064 16044 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl use strict; use Test::More; eval "use JSON::Any qw(DWIW)"; if ($@) { plan skip_all => "JSON::DWIW not installed: $@"; } else { plan tests => 6; } 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"}' ); # testing the truth $obj = { foo => JSON::Any->true }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":true}'); $obj = { foo => JSON::Any->false }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":false}'); $obj = { foo => $json->true }; $js = $json->objToJson($obj); is($js,'{foo:true}'); $obj = { foo => $json->false }; $js = $json->objToJson($obj); is($js,'{foo:false}'); 05-JSON-Syck.t100644001750001750 40712236734064 16161 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl use strict; use Test::More; eval "use JSON::Any qw(Syck)"; if ($@) { plan skip_all => "JSON::Syck not installed: $@"; } else { plan tests => 2; } ok( JSON::Any->new->objToJson( { foo => 1 } ) ); ok( JSON::Any->new->jsonToObj('{ "foo" : 1 }') ); inc000755001750001750 012236734064 14257 5ustar00perigrinperigrin000000000000JSON-Any-1.32MakeMaker.pm100644001750001750 160312236734064 16612 0ustar00perigrinperigrin000000000000JSON-Any-1.32/incpackage inc::MakeMaker; use Moose; extends 'Dist::Zilla::Plugin::MakeMaker::Awesome'; use namespace::autoclean; override _build_WriteMakefile_dump => sub { my ($self) = @_; my $str = super; $str .= ";\n\n"; $str .= <<'END_NONSENSE'; sub has_json () { our @order = qw(CPANEL XS PP JSON DWIW); foreach my $testmod (@order) { $testmod = "JSON::$testmod" unless $testmod eq "JSON"; $testmod = "Cpanel::JSON::XS" if $testmod eq "JSON::CPANEL"; eval "require $testmod"; return 1 unless $@; } return 0; } if (has_json) { # we have some kind of supported JSON module, we're good } else { # we need to have a version of JSON, go with JSON.pm as a sane default $WriteMakefileArgs{PREREQ_PM}{JSON} = '2.90'; } END_NONSENSE return $str; }; 1; xt000755001750001750 012236734064 14141 5ustar00perigrinperigrin000000000000JSON-Any-1.3201-podspell.t100644001750001750 56112236734064 16510 0ustar00perigrinperigrin000000000000JSON-Any-1.32/xtuse Test::More; eval q{ use Test::Spelling }; plan skip_all => 'Test::Spelling is not installed.' if $@; add_stopwords(map { split /[\s\:\-]+/ } ); $ENV{LANG} = 'C'; set_spell_cmd("aspell -l en list") if `which aspell`; all_pod_files_spelling_ok('lib'); __DATA__ API Berjon CPAN Compat Dimas Doran JSON Mims Prather Wistow compat jsonToObj mst objToJson unicode 11-string-escape.t100644001750001750 334512236734064 17266 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl $!++; use strict; use Data::Dumper; use Test::More; use Storable; use Test::Requires qw(JSON::Any); $Data::Dumper::Indent = 0; $Data::Dumper::Terse = 1; my @round_trip = ( '"\""', '"\b"', '"\f"', '"\n"', '"\r"', '"\t"', '"\u0001"', ); # Seems most handlers decode the escaped slash (solidus), but don't # encode it escaped. TODO: What does the spec *really* say? # For now, just test decoding. Improper decoding breaks things. my %one_way = ( '"\/"' => '/', # escaped solidus ); { test('XS'); } { require Test::Without::Module; Test::Without::Module->import('JSON::XS'); test ($_) for qw(PP JSON CPANEL DWIW); } sub test { my ($backend) = @_; my $j = eval { JSON::Any->import($backend); JSON::Any->new; }; note "$backend: " . $@ and next if $@; $j and $j->handler or next; note "handler is " . ( ref( $j->handler ) || $j->handlerType ); plan 'no_plan' unless $ENV{JSON_ANY_RAN_TESTS}; $ENV{JSON_ANY_RAN_TESTS} = 1; for my $test_orig ( @round_trip ) { my $test = "[$test_orig]"; # make it an array my $data = eval { JSON::Any->jsonToObj($test) }; my $json = JSON::Any->objToJson($data); # don't bother white spaces for ($test, $json) { s/([,:]) /$1/eg; } my $desc = "roundtrip $test -> " . Dumper($data) . " -> $json"; utf8::encode($desc); is $json, $test, $desc; } while ( my ($encoded, $expected) = each %one_way ) { my $test = "[$encoded]"; my $data = eval { JSON::Any->jsonToObj($test) }; my $desc = "oneway $test -> " . Dumper($data); utf8::encode($desc); is $data->[0], $expected, $desc; } } 07-CPanel-JSON-XS.t100644001750001750 341012236734064 16761 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl use utf8; use strict; use Test::More; eval "use JSON::Any qw(CPANEL)"; if ($@) { plan skip_all => "Cpanel::JSON::XS not installed: $@"; } else { plan tests => 24; } skip "Cpanel::JSON::XS not installed: $@", 1 if $@; diag("Testing Cpanel::JSON::XS backend"); is( JSON::Any->encode({foo=>'bar'}), qq[{"foo":"bar"}] ); my ( $json, $js, $obj ); ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => 1 ) ); is( $json->encode("ü"), qq["ü"] ); foreach my $bytes ( 0, 1 ) { foreach my $utf8_support ( 0, 1 ) { my $str = "ü"; utf8::encode($str) if $bytes; ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => $utf8_support ) ); if ( $utf8_support ) { # only then do we make assumptions about the output json is( $json->encode($str), qq["$str"] ); } is( $json->decode($json->encode($str)), $str, "round tripping" ); } } 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 ) ); like( $json->encode( chr 0x10402 ), qr/"\\ud801\\udc02"\n?/ ); ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => 1 ) ); is( $json->encode("ü"), qq["\xc3\xbc\"] ); is( JSON::Any->encode({foo=>'bar'}), qq[{"foo":"bar"}] ); # testing the truth $obj = { foo => JSON::Any->true }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":true}'); $obj = { foo => JSON::Any->false }; $js = JSON::Any->objToJson($obj); is($js,'{"foo":false}'); $obj = { foo => $json->true }; $js = $json->objToJson($obj); is($js,'{"foo":true}'); $obj = { foo => $json->false }; $js = $json->objToJson($obj); is($js,'{"foo":false}'); release-pod-syntax.t100644001750001750 45012236734064 20001 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); release-pod-coverage.t100644001750001750 76512236734064 20257 0ustar00perigrinperigrin000000000000JSON-Any-1.32/t#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });