@@ -0,0 +1,87 @@
+## HOW TO CONTRIBUTE
+
+Thank you for considering contributing to this distribution. This file
+contains instructions that will help you work with the source code.
+
+The distribution is managed with Dist::Zilla. This means than many of the
+usual files you might expect are not in the repository, but are generated at
+release time, as is much of the documentation. Some generated files are
+kept in the repository as a convenience (e.g. Makefile.PL or cpanfile).
+
+Generally, **you do not need Dist::Zilla to contribute patches**. You do need
+Dist::Zilla to create a tarball. See below for guidance.
+
+### Getting dependencies
+
+If you have App::cpanminus 1.6 or later installed, you can use `cpanm` to
+satisfy dependencies like this:
+
+ $ cpanm --installdeps .
+
+Otherwise, look for either a `Makefile.PL` or `cpanfile` file for
+a list of dependencies to satisfy.
+
+### Running tests
+
+You can run tests directly using the `prove` tool:
+
+ $ prove -l
+ $ prove -lv t/some_test_file.t
+
+For most of my distributions, `prove` is entirely sufficient for you to test any
+patches you have. I use `prove` for 99% of my testing during development.
+
+### Code style and tidying
+
+Please try to match any existing coding style. If there is a `.perltidyrc`
+file, please install Perl::Tidy and use perltidy before submitting patches.
+
+If there is a `tidyall.ini` file, you can also install Code::TidyAll and run
+`tidyall` on a file or `tidyall -a` to tidy all files.
+
+### Patching documentation
+
+Much of the documentation Pod is generated at release time. Some is
+generated boilerplate; other documentation is built from pseudo-POD
+directives in the source like C<=method> or C<=func>.
+
+If you would like to submit a documentation edit, please limit yourself to
+the documentation you see.
+
+If you see typos or documentation issues in the generated docs, please
+email or open a bug ticket instead of patching.
+
+### Installing and using Dist::Zilla
+
+Dist::Zilla is a very powerful authoring tool, optimized for maintaining a
+large number of distributions with a high degree of automation, but it has a
+large dependency chain, a bit of a learning curve and requires a number of
+author-specific plugins.
+
+To install it from CPAN, I recommend one of the following approaches for
+the quickest installation:
+
+ # using CPAN.pm, but bypassing non-functional pod tests
+ $ cpan TAP::Harness::Restricted
+ $ PERL_MM_USE_DEFAULT=1 HARNESS_CLASS=TAP::Harness::Restricted cpan Dist::Zilla
+
+ # using cpanm, bypassing *all* tests
+ $ cpanm -n Dist::Zilla
+
+In either case, it's probably going to take about 10 minutes. Go for a walk,
+go get a cup of your favorite beverage, take a bathroom break, or whatever.
+When you get back, Dist::Zilla should be ready for you.
+
+Then you need to install any plugins specific to this distribution:
+
+ $ cpan `dzil authordeps`
+ $ dzil authordeps | cpanm
+
+Once installed, here are some dzil commands you might try:
+
+ $ dzil build
+ $ dzil test
+ $ dzil xtest
+
+You can learn more about Dist::Zilla at http://dzil.org/
+
@@ -1,5 +1,22 @@
Revision history for BSON
+0.12 2015-04-06 16:11:59-04:00 America/New_York
+
+ [BUG FIXES]
+
+ - added decoding support for BSON type 0x06 (Javascript "undefined");
+ treated like type 0x0A (null value) and decoded as Perl undef
+
+ [OPTIMIZATION]
+
+ - Inlined most functions for 10-20% performance increase measured
+ on a sample of Twitter tweets.
+
+ [META]
+
+ - Switched repository to Dist::Zilla structure using @DAGOLDEN plugin
+ bundle and associated file layout
+
0.11 2011-12-14
use Math::Int64 to address the 32-bit only Perl support
@@ -0,0 +1,207 @@
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
+
+This is free software, licensed under:
+
+ The Apache License, Version 2.0, January 2004
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
@@ -1,8 +1,14 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.034.
+CONTRIBUTING.mkdn
Changes
+LICENSE
MANIFEST
+META.json
+META.yml
Makefile.PL
README
-META.yml
+cpanfile
+dist.ini
lib/BSON.pm
lib/BSON/Binary.pm
lib/BSON/Bool.pm
@@ -10,10 +16,12 @@ lib/BSON/Code.pm
lib/BSON/MaxKey.pm
lib/BSON/MinKey.pm
lib/BSON/ObjectId.pm
+lib/BSON/String.pm
lib/BSON/Time.pm
lib/BSON/Timestamp.pm
-lib/BSON/String.pm
-t/00-load.t
+perlcritic.rc
+t/00-report-prereqs.dd
+t/00-report-prereqs.t
t/01-bool.t
t/02-oid.t
t/03-time.t
@@ -25,5 +33,12 @@ t/08-string.t
t/10-bson.t
t/11-random.t
t/12-exception.t
-t/20-spelling.t
-t/25-manifest.t
+xt/author/00-compile.t
+xt/author/critic.t
+xt/author/pod-spell.t
+xt/release/distmeta.t
+xt/release/minimum-version.t
+xt/release/pod-coverage.t
+xt/release/pod-syntax.t
+xt/release/portability.t
+xt/release/test-version.t
@@ -0,0 +1,147 @@
+{
+ "abstract" : "Pure Perl implementation of MongoDB's BSON serialization",
+ "author" : [
+ "minimalist <minimalist@lavabit.com>",
+ "David Golden <david@mongodb.com>"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 5.034, CPAN::Meta::Converter version 2.150001",
+ "license" : [
+ "apache_2_0"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : 2
+ },
+ "name" : "BSON",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "xt",
+ "examples",
+ "corpus"
+ ],
+ "package" : [
+ "DB"
+ ]
+ },
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "6.17",
+ "perl" : "5.008001"
+ }
+ },
+ "develop" : {
+ "requires" : {
+ "Dist::Zilla" : "5",
+ "Dist::Zilla::Plugin::Meta::Contributors" : "0",
+ "Dist::Zilla::PluginBundle::DAGOLDEN" : "0.072",
+ "File::Spec" : "0",
+ "File::Temp" : "0",
+ "IO::Handle" : "0",
+ "IPC::Open3" : "0",
+ "Pod::Coverage::TrustPod" : "0",
+ "Test::CPAN::Meta" : "0",
+ "Test::More" : "0",
+ "Test::Pod" : "1.41",
+ "Test::Pod::Coverage" : "1.08",
+ "Test::Spelling" : "0.12",
+ "Test::Version" : "1"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Carp" : "0",
+ "Digest::MD5" : "0",
+ "Exporter" : "0",
+ "Math::Int64" : "0",
+ "Sys::Hostname" : "0",
+ "Tie::IxHash" : "0",
+ "base" : "0",
+ "constant" : "0",
+ "overload" : "0",
+ "perl" : "5.008001",
+ "strict" : "0",
+ "warnings" : "0"
+ }
+ },
+ "test" : {
+ "recommends" : {
+ "CPAN::Meta" : "2.120900"
+ },
+ "requires" : {
+ "DateTime" : "0",
+ "ExtUtils::MakeMaker" : "0",
+ "File::Spec" : "0",
+ "Test::Deep" : "0",
+ "Test::More" : "0",
+ "if" : "0",
+ "perl" : "5.008001"
+ }
+ }
+ },
+ "provides" : {
+ "BSON" : {
+ "file" : "lib/BSON.pm",
+ "version" : "0.12"
+ },
+ "BSON::Binary" : {
+ "file" : "lib/BSON/Binary.pm",
+ "version" : "0.12"
+ },
+ "BSON::Bool" : {
+ "file" : "lib/BSON/Bool.pm",
+ "version" : "0.12"
+ },
+ "BSON::Code" : {
+ "file" : "lib/BSON/Code.pm",
+ "version" : "0.12"
+ },
+ "BSON::MaxKey" : {
+ "file" : "lib/BSON/MaxKey.pm",
+ "version" : "0.12"
+ },
+ "BSON::MinKey" : {
+ "file" : "lib/BSON/MinKey.pm",
+ "version" : "0.12"
+ },
+ "BSON::ObjectId" : {
+ "file" : "lib/BSON/ObjectId.pm",
+ "version" : "0.12"
+ },
+ "BSON::String" : {
+ "file" : "lib/BSON/String.pm",
+ "version" : "0.12"
+ },
+ "BSON::Time" : {
+ "file" : "lib/BSON/Time.pm",
+ "version" : "0.12"
+ },
+ "BSON::Timestamp" : {
+ "file" : "lib/BSON/Timestamp.pm",
+ "version" : "0.12"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "web" : "https://jira.mongodb.org/browse/PERL"
+ },
+ "homepage" : "https://github.com/mongodb/mongo-perl-bson",
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/mongodb/mongo-perl-bson.git",
+ "web" : "https://github.com/mongodb/mongo-perl-bson"
+ }
+ },
+ "version" : "0.12",
+ "x_authority" : "cpan:MONGODB",
+ "x_contributors" : [
+ "Eric Daniels <eric.daniels@mongodb.com>",
+ "Pat Gunn <pgunn@mongodb.com>",
+ "Yury Zavarin <yury.zavarin@gmail.com>",
+ "Oleg Kostyuk <cub@cpan.org>"
+ ]
+}
+
@@ -2,28 +2,85 @@
abstract: "Pure Perl implementation of MongoDB's BSON serialization"
author:
- 'minimalist <minimalist@lavabit.com>'
+ - 'David Golden <david@mongodb.com>'
build_requires:
- DateTime: 0
+ DateTime: '0'
+ ExtUtils::MakeMaker: '0'
+ File::Spec: '0'
+ Test::Deep: '0'
+ Test::More: '0'
+ if: '0'
+ perl: '5.008001'
configure_requires:
- ExtUtils::MakeMaker: 0
+ ExtUtils::MakeMaker: '6.17'
+ perl: '5.008001'
dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 6.57_05, CPAN::Meta::Converter version 2.110930001'
-license: perl
+generated_by: 'Dist::Zilla version 5.034, CPAN::Meta::Converter version 2.150001'
+license: apache
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: BSON
no_index:
directory:
- t
- - inc
+ - xt
+ - examples
+ - corpus
+ package:
+ - DB
+provides:
+ BSON:
+ file: lib/BSON.pm
+ version: '0.12'
+ BSON::Binary:
+ file: lib/BSON/Binary.pm
+ version: '0.12'
+ BSON::Bool:
+ file: lib/BSON/Bool.pm
+ version: '0.12'
+ BSON::Code:
+ file: lib/BSON/Code.pm
+ version: '0.12'
+ BSON::MaxKey:
+ file: lib/BSON/MaxKey.pm
+ version: '0.12'
+ BSON::MinKey:
+ file: lib/BSON/MinKey.pm
+ version: '0.12'
+ BSON::ObjectId:
+ file: lib/BSON/ObjectId.pm
+ version: '0.12'
+ BSON::String:
+ file: lib/BSON/String.pm
+ version: '0.12'
+ BSON::Time:
+ file: lib/BSON/Time.pm
+ version: '0.12'
+ BSON::Timestamp:
+ file: lib/BSON/Timestamp.pm
+ version: '0.12'
requires:
- Carp: 0
- Test::More: 0.94
- Test::Deep: 0
- Tie::IxHash: 0
- perl: 5.008
+ Carp: '0'
+ Digest::MD5: '0'
+ Exporter: '0'
+ Math::Int64: '0'
+ Sys::Hostname: '0'
+ Tie::IxHash: '0'
+ base: '0'
+ constant: '0'
+ overload: '0'
+ perl: '5.008001'
+ strict: '0'
+ warnings: '0'
resources:
- bugtracker: https://github.com/naturalist/Perl-BSON/issues
- repository: git://github.com/naturalist/Perl-BSON.git
-version: 0.11
+ bugtracker: https://jira.mongodb.org/browse/PERL
+ homepage: https://github.com/mongodb/mongo-perl-bson
+ repository: https://github.com/mongodb/mongo-perl-bson.git
+version: '0.12'
+x_authority: cpan:MONGODB
+x_contributors:
+ - 'Eric Daniels <eric.daniels@mongodb.com>'
+ - 'Pat Gunn <pgunn@mongodb.com>'
+ - 'Yury Zavarin <yury.zavarin@gmail.com>'
+ - 'Oleg Kostyuk <cub@cpan.org>'
@@ -1,27 +1,78 @@
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.034.
use strict;
use warnings;
-use ExtUtils::MakeMaker;
-
-WriteMakefile(
- NAME => 'BSON',
- AUTHOR => q{minimalist <minimalist@lavabit.com>},
- VERSION_FROM => 'lib/BSON.pm',
- ABSTRACT_FROM => 'lib/BSON.pm',
- ($ExtUtils::MakeMaker::VERSION >= 6.3002
- ? ('LICENSE'=> 'perl')
- : ()),
- PL_FILES => {},
- PREREQ_PM => {
- 'Math::Int64' => 0,
- 'Tie::IxHash' => 0,
- 'Test::More' => 0.94,
- 'Test::Deep' => 0,
- 'Carp' => 0
- },
- BUILD_REQUIRES => {
- 'DateTime' => 0
- },
- MIN_PERL_VERSION => '5.008',
- dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
- clean => { FILES => 'BSON-*' },
+
+use 5.008001;
+
+use ExtUtils::MakeMaker 6.17;
+
+my %WriteMakefileArgs = (
+ "ABSTRACT" => "Pure Perl implementation of MongoDB's BSON serialization",
+ "AUTHOR" => "minimalist <minimalist\@lavabit.com>, David Golden <david\@mongodb.com>",
+ "CONFIGURE_REQUIRES" => {
+ "ExtUtils::MakeMaker" => "6.17"
+ },
+ "DISTNAME" => "BSON",
+ "EXE_FILES" => [],
+ "LICENSE" => "apache",
+ "MIN_PERL_VERSION" => "5.008001",
+ "NAME" => "BSON",
+ "PREREQ_PM" => {
+ "Carp" => 0,
+ "Digest::MD5" => 0,
+ "Exporter" => 0,
+ "Math::Int64" => 0,
+ "Sys::Hostname" => 0,
+ "Tie::IxHash" => 0,
+ "base" => 0,
+ "constant" => 0,
+ "overload" => 0,
+ "strict" => 0,
+ "warnings" => 0
+ },
+ "TEST_REQUIRES" => {
+ "DateTime" => 0,
+ "ExtUtils::MakeMaker" => 0,
+ "File::Spec" => 0,
+ "Test::Deep" => 0,
+ "Test::More" => 0,
+ "if" => 0
+ },
+ "VERSION" => "0.12",
+ "test" => {
+ "TESTS" => "t/*.t"
+ }
+);
+
+
+my %FallbackPrereqs = (
+ "Carp" => 0,
+ "DateTime" => 0,
+ "Digest::MD5" => 0,
+ "Exporter" => 0,
+ "ExtUtils::MakeMaker" => "6.17",
+ "File::Spec" => 0,
+ "Math::Int64" => 0,
+ "Sys::Hostname" => 0,
+ "Test::Deep" => 0,
+ "Test::More" => 0,
+ "Tie::IxHash" => 0,
+ "base" => 0,
+ "constant" => 0,
+ "if" => 0,
+ "overload" => 0,
+ "strict" => 0,
+ "warnings" => 0
);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+ delete $WriteMakefileArgs{TEST_REQUIRES};
+ delete $WriteMakefileArgs{BUILD_REQUIRES};
+ $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
@@ -2,7 +2,7 @@ NAME
BSON - Pure Perl implementation of MongoDB's BSON serialization
VERSION
- Version 0.11
+ version 0.12
SYNOPSIS
use BSON qw/encode decode/;
@@ -67,28 +67,52 @@ CAVEATS
anywhere in a string. If you expect your strings to contain \0
characters, use BSON::Binary instead.
+HISTORY AND ROADMAP
+ This module was originally written by minimalist. In 2014, he graciously
+ transferred ongoing maintenance to MongoDB, Inc.
+
+ Going forward, work will focus on restoration of a pure-Perl dependency
+ chain, harmonization with MongoDB driver BSON classes and some API
+ enhancements so this can provide a pure-Perl alternative serializer for
+ the MongoDB driver.
+
SEE ALSO
BSON::String, BSON::Time, BSON::ObjectId, BSON::Code, BSON::Binary,
BSON::Bool, BSON::MinKey, BSON::MaxKey, BSON::Timestamp, Tie::IxHash,
MongoDB
-AUTHOR
- minimalist, "<minimalist at lavabit.com>"
+SUPPORT
+ Bugs / Feature Requests
+ Please report any bugs or feature requests through the issue tracker at
+ <https://jira.mongodb.org/browse/PERL>. You will be notified
+ automatically of any progress on your issue.
+
+ Source Code
+ This is open source software. The code repository is available for
+ public review and contribution under the terms of the license.
+
+ <https://github.com/mongodb/mongo-perl-bson>
+
+ git clone https://github.com/mongodb/mongo-perl-bson.git
+
+AUTHORS
+ * minimalist <minimalist@lavabit.com>
+
+ * David Golden <david@mongodb.com>
CONTRIBUTORS
- Oleg Kostyuk "<cub@cpan.org>"
+ * Eric Daniels <eric.daniels@mongodb.com>
+
+ * Pat Gunn <pgunn@mongodb.com>
+
+ * Yury Zavarin <yury.zavarin@gmail.com>
-BUGS
- Bug reports and patches are welcome. Reports which include a failing
- Test::More style test are helpful and will receive priority.
+ * Oleg Kostyuk <cub@cpan.org>
-DEVELOPMENT
- The source code of this module is available on GitHub:
- <https://github.com/naturalist/Perl-BSON>
+COPYRIGHT AND LICENSE
+ This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-LICENSE AND COPYRIGHT
- Copyright 2011 minimalist.
+ This is free software, licensed under:
- This program is free software; you can redistribute it and/or modify it
- under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
@@ -0,0 +1,48 @@
+requires "Carp" => "0";
+requires "Digest::MD5" => "0";
+requires "Exporter" => "0";
+requires "Math::Int64" => "0";
+requires "Sys::Hostname" => "0";
+requires "Tie::IxHash" => "0";
+requires "base" => "0";
+requires "constant" => "0";
+requires "overload" => "0";
+requires "perl" => "5.008001";
+requires "strict" => "0";
+requires "warnings" => "0";
+
+on 'test' => sub {
+ requires "DateTime" => "0";
+ requires "ExtUtils::MakeMaker" => "0";
+ requires "File::Spec" => "0";
+ requires "Test::Deep" => "0";
+ requires "Test::More" => "0";
+ requires "if" => "0";
+ requires "perl" => "5.008001";
+};
+
+on 'test' => sub {
+ recommends "CPAN::Meta" => "2.120900";
+};
+
+on 'configure' => sub {
+ requires "ExtUtils::MakeMaker" => "6.17";
+ requires "perl" => "5.008001";
+};
+
+on 'develop' => sub {
+ requires "Dist::Zilla" => "5";
+ requires "Dist::Zilla::Plugin::Meta::Contributors" => "0";
+ requires "Dist::Zilla::PluginBundle::DAGOLDEN" => "0.072";
+ requires "File::Spec" => "0";
+ requires "File::Temp" => "0";
+ requires "IO::Handle" => "0";
+ requires "IPC::Open3" => "0";
+ requires "Pod::Coverage::TrustPod" => "0";
+ requires "Test::CPAN::Meta" => "0";
+ requires "Test::More" => "0";
+ requires "Test::Pod" => "1.41";
+ requires "Test::Pod::Coverage" => "1.08";
+ requires "Test::Spelling" => "0.12";
+ requires "Test::Version" => "1";
+};
@@ -0,0 +1,17 @@
+name = BSON
+author = minimalist <minimalist@lavabit.com>
+author = David Golden <david@mongodb.com>
+license = Apache_2_0
+copyright_holder = minimalist and MongoDB, Inc.
+
+[@DAGOLDEN]
+:version = 0.072
+authority = cpan:MONGODB
+github_issues = 0
+Bugtracker.web = https://jira.mongodb.org/browse/PERL
+UploadToCPAN.pause_cfg_file = .pause-mongodb
+stopwords = ixhash
+stopwords = sharding
+
+[Meta::Contributors]
+contributor = Oleg Kostyuk <cub@cpan.org>
@@ -1,12 +0,0 @@
-blib*
-Makefile
-Makefile.old
-Build
-Build.bat
-_build*
-pm_to_blib*
-*.tar.gz
-.lwpcookies
-cover_db
-pod2htm*.tmp
-BSON-*
@@ -1,8 +1,12 @@
-package BSON::Binary;
-
+use 5.008001;
use strict;
use warnings;
+package BSON::Binary;
+# ABSTRACT: Binary data for BSON
+
+our $VERSION = '0.12';
+
use overload '""' => \&to_s;
our $TYPE_SIMPLE = 0x00;
@@ -42,10 +46,18 @@ sub to_s {
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON::Binary - Binary data for BSON
+=head1 VERSION
+
+version 0.12
+
=head1 SYNOPSIS
use BSON;
@@ -56,6 +68,8 @@ BSON::Binary - Binary data for BSON
This module is needed for L<BSON> and it manages BSON's binary element.
+=for Pod::Coverage to_s
+
=head1 METHODS
=head2 new
@@ -88,20 +102,26 @@ Returns the type of the binary data per the BSON specification.
L<BSON>
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
-minimalist, C<< <minimalist at lavabit.com> >>
+David Golden <david@mongodb.com>
-=head1 BUGS
+=back
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -1,8 +1,12 @@
-package BSON::Bool;
-
+use 5.008001;
use strict;
use warnings;
+package BSON::Bool;
+# ABSTRACT: Boolean data for BSON
+
+our $VERSION = '0.12';
+
use overload
bool => \&value,
'==' => \&op_eq,
@@ -33,10 +37,18 @@ sub op_eq {
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON::Bool - Boolean data for BSON
+=head1 VERSION
+
+version 0.12
+
=head1 SYNOPSIS
use BSON;
@@ -51,6 +63,8 @@ BSON::Bool - Boolean data for BSON
This module is needed for L<BSON> and it manages BSON's boolean element.
+=for Pod::Coverage op_eq
+
=head1 METHODS
=head2 new
@@ -86,20 +100,26 @@ be used as a boolean variable itself.
L<BSON>
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
-minimalist, C<< <minimalist at lavabit.com> >>
+David Golden <david@mongodb.com>
-=head1 BUGS
+=back
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -1,8 +1,12 @@
-package BSON::Code;
-
+use 5.008001;
use strict;
use warnings;
+package BSON::Code;
+# ABSTRACT: JavaScript code data for BSON
+
+our $VERSION = '0.12';
+
sub new {
my ( $class, $code, $scope ) = @_;
bless { code => $code, scope => $scope }, $class;
@@ -24,10 +28,18 @@ sub length {
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON::Code - JavaScript code data for BSON
+=head1 VERSION
+
+version 0.12
+
=head1 SYNOPSIS
use BSON;
@@ -72,20 +84,26 @@ Returns the length of the JavaScript code.
L<BSON>
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
-minimalist, C<< <minimalist at lavabit.com> >>
+David Golden <david@mongodb.com>
-=head1 BUGS
+=back
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -1,8 +1,12 @@
-package BSON::MaxKey;
-
+use 5.008001;
use strict;
use warnings;
+package BSON::MaxKey;
+# ABSTRACT: MaxKey data for BSON
+
+our $VERSION = '0.12';
+
sub new {
bless {}, $_[0];
}
@@ -11,10 +15,18 @@ sub new {
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON::MaxKey - MaxKey data for BSON
+=head1 VERSION
+
+version 0.12
+
=head1 SYNOPSIS
use BSON;
@@ -35,20 +47,26 @@ Object constructor, takes no parameters.
L<BSON>
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
-minimalist, C<< <minimalist at lavabit.com> >>
+David Golden <david@mongodb.com>
-=head1 BUGS
+=back
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -1,8 +1,12 @@
-package BSON::MinKey;
-
+use 5.008001;
use strict;
use warnings;
+package BSON::MinKey;
+# ABSTRACT: MinKey data for BSON
+
+our $VERSION = '0.12';
+
sub new {
bless {}, $_[0];
}
@@ -11,10 +15,18 @@ sub new {
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON::MinKey - MinKey data for BSON
+=head1 VERSION
+
+version 0.12
+
=head1 SYNOPSIS
use BSON;
@@ -35,20 +47,26 @@ Object constructor, takes no parameters.
L<BSON>
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
-minimalist, C<< <minimalist at lavabit.com> >>
+David Golden <david@mongodb.com>
-=head1 BUGS
+=back
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -1,7 +1,12 @@
-package BSON::ObjectId;
-
+use 5.008001;
use strict;
use warnings;
+
+package BSON::ObjectId;
+# ABSTRACT: ObjectId data element for BSON
+
+our $VERSION = '0.12';
+
use Carp;
use Sys::Hostname;
use Digest::MD5 'md5';
@@ -72,10 +77,18 @@ sub _from_s {
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON::ObjectId - ObjectId data element for BSON
+=head1 VERSION
+
+version 0.12
+
=head1 SYNOPSIS
use BSON;
@@ -88,6 +101,8 @@ BSON::ObjectId - ObjectId data element for BSON
This module is needed for L<BSON> and it manages BSON's ObjectId element.
+=for Pod::Coverage op_eq to_s
+
=head1 METHODS
=head2 new
@@ -130,20 +145,26 @@ This module is thread safe.
L<BSON>
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
-minimalist, C<< <minimalist at lavabit.com> >>
+David Golden <david@mongodb.com>
-=head1 BUGS
+=back
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -1,8 +1,12 @@
-package BSON::String;
-
+use 5.008001;
use strict;
use warnings;
+package BSON::String;
+# ABSTRACT: String data for BSON
+
+our $VERSION = '0.12';
+
use overload '""' => \&value;
sub new {
@@ -18,10 +22,18 @@ sub value {
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON::String - String data for BSON
+=head1 VERSION
+
+version 0.12
+
=head1 SYNOPSIS
use BSON 'encode';
@@ -32,7 +44,6 @@ BSON::String - String data for BSON
my $bson = encode( { a => $str1, b => $str2, c => $str3 } );
-
=head1 DESCRIPTION
Since Perl does not distinguish between numbers and strings, this module
@@ -67,20 +78,26 @@ comparison on a BSON::String instance.
L<BSON>
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
-minimalist, C<< <minimalist at lavabit.com> >>
+David Golden <david@mongodb.com>
-=head1 BUGS
+=back
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -1,7 +1,12 @@
-package BSON::Time;
-
+use 5.008001;
use strict;
use warnings;
+
+package BSON::Time;
+# ABSTRACT: Date and time data for BSON
+
+our $VERSION = '0.12';
+
use Carp;
use overload
@@ -38,10 +43,18 @@ sub op_eq {
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON::Time - Date and time data for BSON
+=head1 VERSION
+
+version 0.12
+
=head1 SYNOPSIS
use BSON;
@@ -52,6 +65,8 @@ BSON::Time - Date and time data for BSON
This module is needed for L<BSON> and it manages BSON's date element.
+=for Pod::Coverage op_eq
+
=head1 METHODS
=head2 new
@@ -75,20 +90,26 @@ Returns the stored time in seconds since the Epoch.
L<BSON>
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
-minimalist, C<< <minimalist at lavabit.com> >>
+David Golden <david@mongodb.com>
-=head1 BUGS
+=back
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -1,8 +1,12 @@
-package BSON::Timestamp;
-
+use 5.008001;
use strict;
use warnings;
+package BSON::Timestamp;
+# ABSTRACT: Timestamp data for BSON
+
+our $VERSION = '0.12';
+
sub new {
my ( $class, $seconds, $increment ) = @_;
bless {
@@ -27,10 +31,18 @@ sub seconds {
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON::Timestamp - Timestamp data for BSON
+=head1 VERSION
+
+version 0.12
+
=head1 SYNOPSIS
use BSON;
@@ -62,20 +74,26 @@ Returns the value of C<increment>
L<BSON>
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
-minimalist, C<< <minimalist at lavabit.com> >>
+David Golden <david@mongodb.com>
-=head1 BUGS
+=back
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -1,13 +1,14 @@
-package BSON;
-
-use 5.008;
+use 5.008001;
use strict;
use warnings;
+package BSON;
+# ABSTRACT: Pure Perl implementation of MongoDB's BSON serialization
+
use base 'Exporter';
our @EXPORT_OK = qw/encode decode/;
-our $VERSION = 0.11;
+our $VERSION = '0.12';
use Carp;
use Tie::IxHash;
@@ -37,41 +38,24 @@ my $int_re = qr/^(?:(?:[+-]?)(?:[0123456789]+))$/;
my $doub_re = qr/^(?:(?i)(?:[+-]?)(?:(?=[0123456789]|[.])(?:[0123456789]*)(?:(?:[.])(?:[0123456789]{0,}))?)(?:(?:[E])(?:(?:[+-]?)(?:[0123456789]+))|))$/;
#>>>
-sub e_name {
- pack 'CZ*', @_;
-}
-
-sub string {
- pack 'V/Z*', shift;
-}
-
-sub pack_q {
- return int64_to_native(shift);
-}
-
-sub unpack_qastar {
- my ($bson, $l1, $l2) = @_;
- ($l1, $l2, $bson) = unpack('L2a*',$bson);
- return (native_to_int64(pack('L2',$l1, $l2)), $bson);
-}
-
-sub s_arr {
- my ( $key, $value ) = @_;
- my $i = 0;
- tie( my %h, 'Tie::IxHash' );
- %h = map { $i++ => $_ } @$value;
- e_name( 0x04, $key ) . encode( \%h );
-}
-
-sub s_int {
- my ( $key, $value ) = @_;
- if ( $value > $max_int_64 || $value < $min_int_64 ) {
- croak("MongoDB can only handle 8-byte integers");
- }
- return $value > $max_int_32 || $value < $min_int_32
- ? e_name( 0x12, $key ) . pack_q( $value )
- : e_name( 0x10, $key ) . pack( 'l', $value );
-}
+use constant {
+
+ BSON_TYPE_NAME => "CZ*",
+ BSON_DOUBLE => "d",
+ BSON_STRING => "V/Z*",
+ BSON_BOOLEAN => "C",
+ BSON_REGEX => "Z*a*",
+ BSON_JSCODE => "",
+ BSON_INT32 => "l",
+ BSON_INT64 => "LL",
+ BSON_TIMESTAMP => "LL",
+ BSON_CODE_W_SCOPE => "l",
+ BSON_REMAINING => 'a*',
+ BSON_SKIP_4_BYTES => 'x4',
+ BSON_OBJECTID => 'a12',
+ BSON_BINARY_TYPE => 'C',
+ BSON_CSTRING => 'Z*',
+};
sub _split_re {
my $value = shift;
@@ -82,142 +66,139 @@ sub _split_re {
return ( $re, $opt );
}
-sub s_re {
- my ( $key, $value ) = @_;
- my ( $re, $opt ) = _split_re( $value );
- my @o = sort grep /^(i|m|x|l|s|u)$/, split( //, $opt );
- e_name( 0x0B, $key ) . pack( 'Z*', $re ) . pack( 'a*', @o ) . "\0";
-}
-
-sub s_dt {
- my ( $key, $value ) = @_;
- e_name( 0x09, $key ) . pack_q( $value->epoch * int64(1000) );
-}
-
-sub s_code {
- my ( $key, $value ) = @_;
- if ( ref $value->scope eq 'HASH' ) {
- my $scope = encode( $value->scope );
- my $code = string( $value->code );
- my $len = 4 + length($scope) + length($code);
- return e_name( 0x0F, $key ) . pack( 'L', $len ) . $code . $scope;
- }
- else {
- return e_name( 0x0D, $key ) . string( $value->code );
- }
-}
+sub encode {
+ my $doc = shift;
-sub s_hash {
- my $doc = shift;
my $bson = '';
while ( my ( $key, $value ) = each %$doc ) {
# Null
if ( !defined $value ) {
- $bson .= e_name( 0x0A, $key );
+ $bson .= pack( BSON_TYPE_NAME, 0x0A, $key );
}
# Array
elsif ( ref $value eq 'ARRAY' ) {
- $bson .= s_arr( $key, $value );
+ my $i = 0;
+ tie( my %h, 'Tie::IxHash' );
+ %h = map { $i++ => $_ } @$value;
+ $bson .= pack( BSON_TYPE_NAME, 0x04, $key ) . encode( \%h );
}
# Document
elsif ( ref $value eq 'HASH' ) {
- $bson .= e_name( 0x03, $key ) . encode($value);
+ $bson .= pack( BSON_TYPE_NAME, 0x03, $key ) . encode($value);
}
# Regex
elsif ( ref $value eq 'Regexp' ) {
- $bson .= s_re( $key, $value );
+ my ( $re, $opt ) = _split_re($value);
+ $bson .= pack( BSON_TYPE_NAME.BSON_REGEX, 0x0B, $key, $re, sort grep /^(i|m|x|l|s|u)$/, split( //, $opt ) ) . "\0";
}
# ObjectId
elsif ( ref $value eq 'BSON::ObjectId' ) {
- $bson .= e_name( 0x07, $key ) . $value->value;
+ $bson .= pack( BSON_TYPE_NAME.BSON_OBJECTID, 0x07, $key, $value->value );
}
# Datetime
elsif ( ref $value eq 'BSON::Time' ) {
- $bson .= e_name( 0x09, $key ) . pack_q( $value->value );
+ $bson .= pack( BSON_TYPE_NAME, 0x09, $key ) . int64_to_native( $value->value );
}
# Timestamp
elsif ( ref $value eq 'BSON::Timestamp' ) {
- $bson .=
- e_name( 0x11, $key )
- . pack( 'LL', $value->increment, $value->seconds );
+ $bson .= pack( BSON_TYPE_NAME.BSON_TIMESTAMP, 0x11, $key, $value->increment, $value->seconds );
}
# MinKey
elsif ( ref $value eq 'BSON::MinKey' ) {
- $bson .= e_name( 0xFF, $key );
+ $bson .= pack( BSON_TYPE_NAME, 0xFF, $key );
}
# MaxKey
elsif ( ref $value eq 'BSON::MaxKey' ) {
- $bson .= e_name( 0x7F, $key );
+ $bson .= pack( BSON_TYPE_NAME, 0x7F, $key );
}
# Binary
elsif ( ref $value eq 'BSON::Binary' ) {
- $bson .= e_name( 0x05, $key ) . $value;
+ $bson .= pack( BSON_TYPE_NAME, 0x05, $key ) . $value;
}
# Code
elsif ( ref $value eq 'BSON::Code' ) {
- $bson .= s_code( $key, $value );
+ if ( ref $value->scope eq 'HASH' ) {
+ my $scope = encode( $value->scope );
+ my $code = pack( BSON_STRING, $value->code );
+ $bson .=
+ pack( BSON_TYPE_NAME.BSON_CODE_W_SCOPE, 0x0F, $key, (4 + length($scope) + length($code)) ) . $code . $scope;
+ }
+ else {
+ $bson .= pack( BSON_TYPE_NAME.BSON_STRING, 0x0D, $key, $value->code );
+ }
}
# Boolean
elsif ( ref $value eq 'BSON::Bool' ) {
- $bson .= e_name( 0x08, $key ) . ( $value ? "\1" : "\0" );
+ $bson .= pack( BSON_TYPE_NAME.BSON_BOOLEAN, 0x08, $key, ( $value ? 1 : 0 ) );
}
# String (explicit)
elsif ( ref $value eq 'BSON::String' ) {
- $bson .= e_name( 0x02, $key ) . string($value);
+ $bson .= pack( BSON_TYPE_NAME.BSON_STRING, 0x02, $key, $value );
}
# Int (32 and 64)
elsif ( ref $value eq 'Math::Int64' || $value =~ $int_re ) {
- $bson .= s_int( $key, $value );
+ if ( $value > $max_int_64 || $value < $min_int_64 ) {
+ croak("MongoDB can only handle 8-byte integers");
+ }
+ $bson .= $value > $max_int_32 || $value < $min_int_32 ? pack( BSON_TYPE_NAME.BSON_REMAINING, 0x12, $key, int64_to_native( $value ))
+ : pack( BSON_TYPE_NAME.BSON_INT32, 0x10, $key, $value );
}
# Double
elsif ( $value =~ $doub_re ) {
- $bson .= e_name( 0x01, $key ) . pack( 'd', $value );
+ $bson .= pack( BSON_TYPE_NAME.BSON_DOUBLE, 0x01, $key, $value );
}
# String
else {
- $bson .= e_name( 0x02, $key ) . string($value);
+ $bson .= pack( BSON_TYPE_NAME.BSON_STRING, 0x02, $key, $value );
}
}
- return $bson;
+
+ return pack( BSON_INT32, length($bson) + 5 ) . $bson . "\0";
}
-sub d_hash {
- my ($bson, %opt) = @_;
+sub decode {
+ my $bson = shift;
+ my $len = unpack( BSON_INT32, $bson );
+ if ( length($bson) != $len ) {
+ croak("Incorrect length of the bson string");
+ }
+ my %opt = @_;
+ $bson = substr( $bson, 4, -1 );
my %hash = ();
tie( %hash, 'Tie::IxHash' ) if $opt{ixhash};
while ($bson) {
my $value;
- ( my $type, my $key, $bson ) = unpack( 'CZ*a*', $bson );
+ ( my $type, my $key, $bson ) = unpack( BSON_TYPE_NAME.BSON_REMAINING, $bson );
# Double
if ( $type == 0x01 ) {
- ( $value, $bson ) = unpack( 'da*', $bson );
+ ( $value, $bson ) = unpack( BSON_DOUBLE.BSON_REMAINING, $bson );
}
# String and Symbol
elsif ( $type == 0x02 || $type == 0x0E ) {
- ( my $len, $value, $bson ) = unpack( 'LZ*a*', $bson );
+ ( $value, $bson ) = unpack( BSON_SKIP_4_BYTES.BSON_CSTRING.BSON_REMAINING, $bson );
}
# Document and Array
elsif ( $type == 0x03 || $type == 0x04 ) {
- my $len = unpack( 'L', $bson );
+ my $len = unpack( BSON_INT32, $bson );
$value = decode( substr( $bson, 0, $len ), %opt );
if ( $type == 0x04 ) {
my @a =
@@ -229,27 +210,34 @@ sub d_hash {
# Binary
elsif ( $type == 0x05 ) {
- my $len = unpack( 'L', $bson ) + 5;
- my @a = unpack( 'LCa*', substr( $bson, 0, $len ) );
- $value = BSON::Binary->new( $a[2], $a[1] );
+ my $len = unpack( BSON_INT32, $bson ) + 5;
+ my @a = unpack( BSON_SKIP_4_BYTES.BSON_BINARY_TYPE.BSON_REMAINING, substr( $bson, 0, $len ) );
+ $value = BSON::Binary->new( $a[1], $a[0] );
$bson = substr( $bson, $len, length($bson) - $len );
}
+ # Undef
+ elsif ( $type == 0x06 ) {
+ $value = undef;
+ }
+
# ObjectId
elsif ( $type == 0x07 ) {
- ( my $oid, $bson ) = unpack( 'a12a*', $bson );
+ ( my $oid, $bson ) = unpack( BSON_OBJECTID.BSON_REMAINING, $bson );
$value = BSON::ObjectId->new($oid);
}
# Boolean
elsif ( $type == 0x08 ) {
- ( my $bool, $bson ) = unpack( 'Ca*', $bson );
+ ( my $bool, $bson ) = unpack( BSON_BOOLEAN.BSON_REMAINING, $bson );
$value = BSON::Bool->new($bool);
}
# Datetime
elsif ( $type == 0x09 ) {
- ( my $dt, $bson ) = unpack_qastar( $bson );
+ my ($l1, $l2) = @_;
+ ($l1, $l2, $bson) = unpack(BSON_INT64.BSON_REMAINING,$bson);
+ my $dt = native_to_int64(pack(BSON_INT64,$l1, $l2));
$value = BSON::Time->new( int( $dt / 1000 ) );
}
@@ -260,38 +248,40 @@ sub d_hash {
# Regex
elsif ( $type == 0x0B ) {
- ( my $re, my $op, $bson ) = unpack( 'Z*Z*a*', $bson );
- $value = eval "qr/$re/$op";
+ ( my $re, my $op, $bson ) = unpack( BSON_CSTRING.BSON_CSTRING.BSON_REMAINING, $bson );
+ $value = eval "qr/$re/$op"; ## no critic
}
# Code
elsif ( $type == 0x0D ) {
- ( my $len, my $code, $bson ) = unpack( 'LZ*a*', $bson );
+ ( my $len, my $code, $bson ) = unpack( BSON_INT32.BSON_CSTRING.BSON_REMAINING, $bson );
$value = BSON::Code->new($code);
}
# Code with scope
elsif ( $type == 0x0F ) {
- my $len = unpack( 'L', $bson );
- my @a = unpack( 'L2Z*a*', substr( $bson, 0, $len ) );
- $value = BSON::Code->new( $a[2], decode( $a[3], %opt ) );
+ my $len = unpack( BSON_INT32, $bson );
+ my @a = unpack( BSON_SKIP_4_BYTES.BSON_SKIP_4_BYTES.BSON_CSTRING.BSON_REMAINING, substr( $bson, 0, $len ) );
+ $value = BSON::Code->new( $a[0], decode( $a[1], %opt ) );
$bson = substr( $bson, $len, length($bson) - $len );
}
# Int32
elsif ( $type == 0x10 ) {
- ( $value, $bson ) = unpack( 'la*', $bson );
+ ( $value, $bson ) = unpack( BSON_INT32.BSON_REMAINING, $bson );
}
# Timestamp
elsif ( $type == 0x11 ) {
- ( my $sec, my $inc, $bson ) = unpack( 'LLa*', $bson );
+ ( my $sec, my $inc, $bson ) = unpack( BSON_INT64.BSON_REMAINING, $bson );
$value = BSON::Timestamp->new( $inc, $sec );
}
# Int64
elsif ( $type == 0x12 ) {
- ( $value, $bson ) = unpack_qastar( $bson );
+ my ($l1, $l2) = @_;
+ ($l1, $l2, $bson) = unpack(BSON_INT64.BSON_REMAINING,$bson);
+ $value = native_to_int64(pack(BSON_INT64,$l1, $l2));
}
# MinKey
@@ -314,32 +304,21 @@ sub d_hash {
return \%hash;
}
-sub encode {
- my $doc = shift;
- my $r = s_hash($doc);
- return pack( 'L', length($r) + 5 ) . $r . "\0";
-}
-
-sub decode {
- my $bson = shift;
- my $len = unpack( 'L', $bson );
- if ( length($bson) != $len ) {
- croak("Incorrect length of the bson string");
- }
- return d_hash( substr( $bson, 4, -1 ), @_ );
-}
-
1;
__END__
+=pod
+
+=encoding UTF-8
+
=head1 NAME
BSON - Pure Perl implementation of MongoDB's BSON serialization
=head1 VERSION
-Version 0.11
+version 0.12
=head1 SYNOPSIS
@@ -417,35 +396,85 @@ BSON uses zero terminated strings and Perl allows the \0 character to be anywher
in a string. If you expect your strings to contain \0 characters, use L<BSON::Binary>
instead.
+=head1 HISTORY AND ROADMAP
+
+This module was originally written by minimalist. In 2014, he graciously
+transferred ongoing maintenance to MongoDB, Inc.
+
+Going forward, work will focus on restoration of a pure-Perl dependency chain,
+harmonization with L<MongoDB driver|MongoDB> BSON classes and some API
+enhancements so this can provide a pure-Perl alternative serializer for the
+MongoDB driver.
+
=head1 SEE ALSO
L<BSON::String>, L<BSON::Time>, L<BSON::ObjectId>, L<BSON::Code>,
L<BSON::Binary>, L<BSON::Bool>, L<BSON::MinKey>, L<BSON::MaxKey>,
L<BSON::Timestamp>, L<Tie::IxHash>, L<MongoDB>
-=head1 AUTHOR
+=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
+
+=head1 SUPPORT
+
+=head2 Bugs / Feature Requests
+
+Please report any bugs or feature requests through the issue tracker
+at L<https://jira.mongodb.org/browse/PERL>.
+You will be notified automatically of any progress on your issue.
+
+=head2 Source Code
-minimalist, C<< <minimalist at lavabit.com> >>
+This is open source software. The code repository is available for
+public review and contribution under the terms of the license.
+
+L<https://github.com/mongodb/mongo-perl-bson>
+
+ git clone https://github.com/mongodb/mongo-perl-bson.git
+
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+minimalist <minimalist@lavabit.com>
+
+=item *
+
+David Golden <david@mongodb.com>
+
+=back
=head1 CONTRIBUTORS
-Oleg Kostyuk C<< <cub@cpan.org> >>
+=for stopwords Eric Daniels Pat Gunn Yury Zavarin Oleg Kostyuk
+
+=over 4
+
+=item *
+
+Eric Daniels <eric.daniels@mongodb.com>
+
+=item *
-=head1 BUGS
+Pat Gunn <pgunn@mongodb.com>
-Bug reports and patches are welcome. Reports which include a failing
-Test::More style test are helpful and will receive priority.
+=item *
-=head1 DEVELOPMENT
+Yury Zavarin <yury.zavarin@gmail.com>
+
+=item *
+
+Oleg Kostyuk <cub@cpan.org>
+
+=back
-The source code of this module is available on GitHub:
-L<https://github.com/naturalist/Perl-BSON>
+=head1 COPYRIGHT AND LICENSE
-=head1 LICENSE AND COPYRIGHT
+This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
-Copyright 2011 minimalist.
+This is free software, licensed under:
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
+ The Apache License, Version 2.0, January 2004
=cut
@@ -0,0 +1,26 @@
+severity = 5
+verbose = 8
+
+[Variables::ProhibitPunctuationVars]
+allow = $@ $!
+
+[TestingAndDebugging::ProhibitNoStrict]
+allow = refs
+
+[Variables::ProhibitEvilVariables]
+variables = $DB::single
+
+# Turn these off
+[-BuiltinFunctions::ProhibitStringyEval]
+[-ControlStructures::ProhibitPostfixControls]
+[-ControlStructures::ProhibitUnlessBlocks]
+[-Documentation::RequirePodSections]
+[-InputOutput::ProhibitInteractiveTest]
+[-References::ProhibitDoubleSigils]
+[-RegularExpressions::RequireExtendedFormatting]
+[-InputOutput::ProhibitTwoArgOpen]
+[-Modules::ProhibitEvilModules]
+
+# Turn this on
+[Lax::ProhibitStringyEval::ExceptForRequire]
+
@@ -1,10 +0,0 @@
-#!perl
-
-use Test::More tests => 1;
-
-diag("Using Perl $]");
-
-BEGIN {
- use_ok( 'BSON' ) || print "Bail out!\n";
-}
-
@@ -0,0 +1,58 @@
+do { my $x = {
+ 'configure' => {
+ 'requires' => {
+ 'ExtUtils::MakeMaker' => '6.17',
+ 'perl' => '5.008001'
+ }
+ },
+ 'develop' => {
+ 'requires' => {
+ 'Dist::Zilla' => '5',
+ 'Dist::Zilla::Plugin::Meta::Contributors' => '0',
+ 'Dist::Zilla::PluginBundle::DAGOLDEN' => '0.072',
+ 'File::Spec' => '0',
+ 'File::Temp' => '0',
+ 'IO::Handle' => '0',
+ 'IPC::Open3' => '0',
+ 'Pod::Coverage::TrustPod' => '0',
+ 'Test::CPAN::Meta' => '0',
+ 'Test::More' => '0',
+ 'Test::Pod' => '1.41',
+ 'Test::Pod::Coverage' => '1.08',
+ 'Test::Spelling' => '0.12',
+ 'Test::Version' => '1'
+ }
+ },
+ 'runtime' => {
+ 'requires' => {
+ 'Carp' => '0',
+ 'Digest::MD5' => '0',
+ 'Exporter' => '0',
+ 'Math::Int64' => '0',
+ 'Sys::Hostname' => '0',
+ 'Tie::IxHash' => '0',
+ 'base' => '0',
+ 'constant' => '0',
+ 'overload' => '0',
+ 'perl' => '5.008001',
+ 'strict' => '0',
+ 'warnings' => '0'
+ }
+ },
+ 'test' => {
+ 'recommends' => {
+ 'CPAN::Meta' => '2.120900'
+ },
+ 'requires' => {
+ 'DateTime' => '0',
+ 'ExtUtils::MakeMaker' => '0',
+ 'File::Spec' => '0',
+ 'Test::Deep' => '0',
+ 'Test::More' => '0',
+ 'if' => '0',
+ 'perl' => '5.008001'
+ }
+ }
+ };
+ $x;
+ }
\ No newline at end of file
@@ -0,0 +1,183 @@
+#!perl
+
+use strict;
+use warnings;
+
+# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.021
+
+use Test::More tests => 1;
+
+use ExtUtils::MakeMaker;
+use File::Spec;
+
+# from $version::LAX
+my $lax_version_re =
+ qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )?
+ |
+ (?:\.[0-9]+) (?:_[0-9]+)?
+ ) | (?:
+ v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )?
+ |
+ (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)?
+ )
+ )/x;
+
+# hide optional CPAN::Meta modules from prereq scanner
+# and check if they are available
+my $cpan_meta = "CPAN::Meta";
+my $cpan_meta_pre = "CPAN::Meta::Prereqs";
+my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic
+
+# Verify requirements?
+my $DO_VERIFY_PREREQS = 1;
+
+sub _max {
+ my $max = shift;
+ $max = ( $_ > $max ) ? $_ : $max for @_;
+ return $max;
+}
+
+sub _merge_prereqs {
+ my ($collector, $prereqs) = @_;
+
+ # CPAN::Meta::Prereqs object
+ if (ref $collector eq $cpan_meta_pre) {
+ return $collector->with_merged_prereqs(
+ CPAN::Meta::Prereqs->new( $prereqs )
+ );
+ }
+
+ # Raw hashrefs
+ for my $phase ( keys %$prereqs ) {
+ for my $type ( keys %{ $prereqs->{$phase} } ) {
+ for my $module ( keys %{ $prereqs->{$phase}{$type} } ) {
+ $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module};
+ }
+ }
+ }
+
+ return $collector;
+}
+
+my @include = qw(
+
+);
+
+my @exclude = qw(
+
+);
+
+# Add static prereqs to the included modules list
+my $static_prereqs = do 't/00-report-prereqs.dd';
+
+# Merge all prereqs (either with ::Prereqs or a hashref)
+my $full_prereqs = _merge_prereqs(
+ ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ),
+ $static_prereqs
+);
+
+# Add dynamic prereqs to the included modules list (if we can)
+my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
+if ( $source && $HAS_CPAN_META ) {
+ if ( my $meta = eval { CPAN::Meta->load_file($source) } ) {
+ $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs);
+ }
+}
+else {
+ $source = 'static metadata';
+}
+
+my @full_reports;
+my @dep_errors;
+my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
+
+# Add static includes into a fake section
+for my $mod (@include) {
+ $req_hash->{other}{modules}{$mod} = 0;
+}
+
+for my $phase ( qw(configure build test runtime develop other) ) {
+ next unless $req_hash->{$phase};
+ next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING});
+
+ for my $type ( qw(requires recommends suggests conflicts modules) ) {
+ next unless $req_hash->{$phase}{$type};
+
+ my $title = ucfirst($phase).' '.ucfirst($type);
+ my @reports = [qw/Module Want Have/];
+
+ for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) {
+ next if $mod eq 'perl';
+ next if grep { $_ eq $mod } @exclude;
+
+ my $file = $mod;
+ $file =~ s{::}{/}g;
+ $file .= ".pm";
+ my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC;
+
+ my $want = $req_hash->{$phase}{$type}{$mod};
+ $want = "undef" unless defined $want;
+ $want = "any" if !$want && $want == 0;
+
+ my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required";
+
+ if ($prefix) {
+ my $have = MM->parse_version( File::Spec->catfile($prefix, $file) );
+ $have = "undef" unless defined $have;
+ push @reports, [$mod, $want, $have];
+
+ if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) {
+ if ( $have !~ /\A$lax_version_re\z/ ) {
+ push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)";
+ }
+ elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) {
+ push @dep_errors, "$mod version '$have' is not in required range '$want'";
+ }
+ }
+ }
+ else {
+ push @reports, [$mod, $want, "missing"];
+
+ if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
+ push @dep_errors, "$mod is not installed ($req_string)";
+ }
+ }
+ }
+
+ if ( @reports ) {
+ push @full_reports, "=== $title ===\n\n";
+
+ my $ml = _max( map { length $_->[0] } @reports );
+ my $wl = _max( map { length $_->[1] } @reports );
+ my $hl = _max( map { length $_->[2] } @reports );
+
+ if ($type eq 'modules') {
+ splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
+ push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
+ }
+ else {
+ splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
+ push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
+ }
+
+ push @full_reports, "\n";
+ }
+ }
+}
+
+if ( @full_reports ) {
+ diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports;
+}
+
+if ( @dep_errors ) {
+ diag join("\n",
+ "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n",
+ "The following REQUIRED prerequisites were not satisfied:\n",
+ @dep_errors,
+ "\n"
+ );
+}
+
+pass;
+
+# vim: ts=4 sts=4 sw=4 et:
@@ -1,35 +0,0 @@
-#!/usr/bin/perl
-
-use Test::More;
-
-BEGIN {
- plan skip_all => "Spelling tests only for authors"
- unless -e '.author'
-}
-
-use Test::Spelling;
-set_spell_cmd('aspell list -l en');
-add_stopwords(<DATA>);
-all_pod_files_spelling_ok('lib');
-
-__END__
-Github
-GitHub
-MongoDB
-MongoDB's
-deserialization
-ixhash
-unordered
-Timestamp
-timestamp
-minimalist
-minimalistic
-BSON
-BSON's
-OOP
-MinKey
-MaxKey
-ObjectId
-sharding
-Kostyuk
-Oleg
@@ -1,12 +0,0 @@
-#!/usr/bin/perl
-
-use Test::More;
-
-BEGIN {
- plan skip_all => "Manifest tests only for authors"
- unless -e '.author'
-}
-
-use Test::CheckManifest;
-ok_manifest({ filter => [qr/\.(git|author)/, qr/ignore\.txt/] });
-done_testing();
@@ -0,0 +1,63 @@
+use 5.006;
+use strict;
+use warnings;
+
+# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.052
+
+use Test::More;
+
+plan tests => 11;
+
+my @module_files = (
+ 'BSON.pm',
+ 'BSON/Binary.pm',
+ 'BSON/Bool.pm',
+ 'BSON/Code.pm',
+ 'BSON/MaxKey.pm',
+ 'BSON/MinKey.pm',
+ 'BSON/ObjectId.pm',
+ 'BSON/String.pm',
+ 'BSON/Time.pm',
+ 'BSON/Timestamp.pm'
+);
+
+
+
+# fake home for cpan-testers
+use File::Temp;
+local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 );
+
+
+my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
+
+use File::Spec;
+use IPC::Open3;
+use IO::Handle;
+
+open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
+
+my @warnings;
+for my $lib (@module_files)
+{
+ # see L<perlfaq8/How can I capture STDERR from an external command?>
+ my $stderr = IO::Handle->new;
+
+ my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
+ binmode $stderr, ':crlf' if $^O eq 'MSWin32';
+ my @_warnings = <$stderr>;
+ waitpid($pid, 0);
+ is($?, 0, "$lib loaded ok");
+
+ if (@_warnings)
+ {
+ warn @_warnings;
+ push @warnings, @_warnings;
+ }
+}
+
+
+
+is(scalar(@warnings), 0, 'no warnings found')
+ or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) );
+
+
@@ -0,0 +1,12 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More;
+use English qw(-no_match_vars);
+
+eval "use Test::Perl::Critic";
+plan skip_all => 'Test::Perl::Critic required to criticise code' if $@;
+Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc";
+all_critic_ok();
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+use Test::More;
+
+# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006008
+use Test::Spelling 0.12;
+use Pod::Wordlist;
+
+
+add_stopwords(<DATA>);
+all_pod_files_spelling_ok( qw( bin lib ) );
+__DATA__
+ixhash
+sharding
+minimalist
+David
+Golden
+david
+and
+MongoDB
+Inc
+Eric
+Daniels
+eric
+Pat
+Gunn
+pgunn
+Yury
+Zavarin
+yury
+Oleg
+Kostyuk
+cub
+lib
+BSON
+Binary
+Bool
+Code
+MaxKey
+MinKey
+ObjectId
+String
+Time
+Timestamp
@@ -0,0 +1,6 @@
+#!perl
+# This file was automatically generated by Dist::Zilla::Plugin::MetaTests.
+
+use Test::CPAN::Meta;
+
+meta_yaml_ok();
@@ -0,0 +1,8 @@
+#!perl
+
+use Test::More;
+
+eval "use Test::MinimumVersion";
+plan skip_all => "Test::MinimumVersion required for testing minimum versions"
+ if $@;
+all_minimum_version_ok( qq{5.010} );
@@ -0,0 +1,7 @@
+#!perl
+# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
+
+use Test::Pod::Coverage 1.08;
+use Pod::Coverage::TrustPod;
+
+all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
@@ -0,0 +1,6 @@
+#!perl
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
+use Test::More;
+use Test::Pod 1.41;
+
+all_pod_files_ok();
@@ -0,0 +1,12 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval 'use Test::Portability::Files';
+plan skip_all => 'Test::Portability::Files required for testing portability'
+ if $@;
+options(test_one_dot => 0);
+run_tests();
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+use Test::More;
+
+# generated by Dist::Zilla::Plugin::Test::Version 0.003001
+use Test::Version;
+
+my @imports = ( 'version_all_ok' );
+
+my $params = {
+ is_strict => 0,
+ has_version => 1,
+};
+
+push @imports, $params
+ if version->parse( $Test::Version::VERSION ) >= version->parse('1.002');
+
+
+Test::Version->import(@imports);
+
+version_all_ok;
+done_testing;