Data-Fake-0.006/000755 000766 000024 00000000000 14016050606 013465 5ustar00davidstaff000000 000000 Data-Fake-0.006/LICENSE000644 000766 000024 00000026354 14016050606 014504 0ustar00davidstaff000000 000000 This software is Copyright (c) 2015 by David Golden. 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. Data-Fake-0.006/cpanfile000644 000766 000024 00000003051 14016050606 015170 0ustar00davidstaff000000 000000 # This file is generated by Dist::Zilla::Plugin::CPANFile v6.017 # Do not edit this file directly. To change prereqs, edit the `dist.ini` file. requires "Carp" => "0"; requires "Exporter" => "5.57"; requires "Import::Into" => "1.002005"; requires "List::Util" => "0"; requires "Text::Lorem" => "0"; requires "Time::Piece" => "1.27"; requires "perl" => "5.008001"; requires "strict" => "0"; requires "warnings" => "0"; on 'test' => sub { requires "ExtUtils::MakeMaker" => "0"; requires "File::Spec" => "0"; requires "Test::Deep" => "0"; requires "Test::More" => "0.96"; 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 'configure' => sub { suggests "JSON::PP" => "2.27300"; }; on 'develop' => sub { requires "Dist::Zilla" => "5"; 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 "Pod::Wordlist" => "0"; requires "Software::License::Apache_2_0" => "0"; requires "Test::CPAN::Meta" => "0"; requires "Test::MinimumVersion" => "0"; requires "Test::More" => "0"; requires "Test::Perl::Critic" => "0"; requires "Test::Pod" => "1.41"; requires "Test::Pod::Coverage" => "1.08"; requires "Test::Portability::Files" => "0"; requires "Test::Spelling" => "0.12"; requires "Test::Version" => "1"; }; Data-Fake-0.006/Changes000644 000766 000024 00000001727 14016050606 014767 0ustar00davidstaff000000 000000 Revision history for Data-Fake 0.006 2021-02-25 20:40:16-05:00 America/New_York [FIXED] - Text generators like fake_words() are now guaranteed to return a scalar. They did originally, but Text::Lorem 0.32 broke its API and started returning lists in list context. 0.005 2020-10-01 16:59:05-04:00 America/New_York [FIXED] - Require Import::Into 1.002005 - Allow calling text generators with no argument 0.004 2018-06-20 14:40:25-06:00 America/Denver [ADDED] - fake_flatten to flatten hash or array generators to a list [DOCS] - Fixed an example involving dates 0.003 2016-08-20 21:25:58-04:00 America/New_York [DOCS] - Improved description of escaping # in fake_digits 0.002 2015-02-05 18:54:46-05:00 America/New_York [FIXES] - Work around Time::Piece portability problems; requires Time::Piece 1.27 0.001 2015-01-21 16:08:10-05:00 America/New_York - First release Data-Fake-0.006/MANIFEST000644 000766 000024 00000001363 14016050606 014621 0ustar00davidstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.017. CONTRIBUTING.mkdn Changes LICENSE MANIFEST META.json META.yml Makefile.PL README cpanfile dist.ini examples/synopsis.pl examples/urls.pl lib/Data/Fake.pm lib/Data/Fake/Company.pm lib/Data/Fake/Core.pm lib/Data/Fake/Dates.pm lib/Data/Fake/Examples.pod lib/Data/Fake/Internet.pm lib/Data/Fake/Names.pm lib/Data/Fake/Text.pm perlcritic.rc t/00-report-prereqs.dd t/00-report-prereqs.t t/api.t t/company.t t/core.t t/dates.t t/internet.t t/names.t t/text.t tidyall.ini xt/author/00-compile.t xt/author/critic.t xt/author/distmeta.t xt/author/minimum-version.t xt/author/pod-coverage.t xt/author/pod-spell.t xt/author/pod-syntax.t xt/author/portability.t xt/author/test-version.t Data-Fake-0.006/perlcritic.rc000644 000766 000024 00000001166 14016050606 016157 0ustar00davidstaff000000 000000 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] Data-Fake-0.006/CONTRIBUTING.mkdn000644 000766 000024 00000006604 14016050606 016255 0ustar00davidstaff000000 000000 ## 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 that 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. ### Where to send patches and pull requests If you found this distribution on Github, sending a pull-request is the best way to contribute. If a pull-request isn't possible, a bug ticket with a patch file is the next best option. As a last resort, an email to the author(s) is acceptable. ## Installing and using Dist::Zilla Dist::Zilla is not required for contributing, but if you'd like to learn more, this section will get you up to speed. 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/ Data-Fake-0.006/t/000755 000766 000024 00000000000 14016050606 013730 5ustar00davidstaff000000 000000 Data-Fake-0.006/xt/000755 000766 000024 00000000000 14016050606 014120 5ustar00davidstaff000000 000000 Data-Fake-0.006/README000644 000766 000024 00000015153 14016050606 014352 0ustar00davidstaff000000 000000 NAME Data::Fake - Declaratively generate fake structured data for testing VERSION version 0.006 SYNOPSIS use Data::Fake qw/Core Names Text Dates/; my $hero_generator = fake_hash( { name => fake_name(), battlecry => fake_sentences(1), birthday => fake_past_datetime("%Y-%m-%d"), friends => fake_array( fake_int(2,4), fake_name() ), gender => fake_pick(qw/Male Female Other/), } ); my $hero = $hero_generator->(); ### example output ### # { # 'name' => 'Antonio Nicholas Preston' # 'battlecry' => 'Est ipsum corrupti quia voluptatibus.', # 'birthday' => '2004-04-21', # 'friends' => [ # 'Jaylin Lillianna Morgan', # 'Colin Noel Estes', # 'Justice Aron Hale', # 'Franco Zane Oneil' # ], # 'gender' => 'Male', # }; DESCRIPTION This module generates randomized, fake structured data using declarative syntax. "Data::Fake" is built on higher-order programming principles. It provides users with "factory" functions, which create "generator" functions for specific pieces of data. Wherever randomized, fake data is desired, a generator code reference is used as a placeholder for the desired output. Each time the top-level generator is run, nested generators are recursively run to turn placeholders into the desired randomized data. For example, the SYNOPSIS declares the desired form of a "hero" using the "fake_hash" factory function. The input is a hash-reference, with nested generators created as placeholders by the "fake_name", "fake_sentences", etc. factory functions: my $hero_generator = fake_hash( { name => fake_name(), battlecry => fake_sentences(1), birthday => fake_past_datetime("%Y-%m-%d"), friends => fake_array( fake_int(2,4), fake_name() ), gender => fake_pick(qw/Male Female Other/), } ); Every time $hero_generator is run, a new hash is generated based on the template and nested generators. USAGE Loading the right submodules Factory functions are exported by submodules, loosely grouped by topic: * Data::Fake::Core – general purpose generators: hashes, arrays, numeric values, string templates * Data::Fake::Company – company name, job title * Data::Fake::Dates – past and future dates * Data::Fake::Internet – domain names, email addresses * Data::Fake::Names – first and last names * Data::Fake::Text – characters, words, sentences, paragraphs Submodules can be loaded directly, to control exactly which functions are exported, or they can be loaded by the "Data::Fake" import function like so: use Data::Fake qw/Core Company Dates Names/; In this case, the listed submodules are loaded and all their functions are imported. Constructing the desired output Use the factory functions to construct a generator for your data. Start with the highest level structure using fake_hash or fake_array. Use other factory functions to create placeholders with specific data types. For example, a hash generator with placeholders for phone numbers: $hash_generator = fake_hash( { home => fake_digits("###-###-####"), work => fake_digits("###-###-####"), cell => fake_digits("###-###-####"), } ); Or build them up piece by piece. For example, an array of 100 of the previous hash references: $array_generator = fake_array( 100, $hash_generator ); Then generate the hundred instances, each with three fake phone numbers: $aoh = $array_generator->(); See Data::Fake::Examples for ideas for how to use and combine generators. Using custom generators Generators are just code references. You can use your own anywhere a Data::Fake generator could be used: $generator = fake_hash( favorite_color => \&my_favorite_color_picker, number_squared => sub { ( int(rand(10)) + 1 ) ** 2 }, ); You can (and probably should) write your own factory functions for anything complex or that you'll use more than once. You can use Data::Fake generators as part of these functions. use Data::Fake qw/Core/; sub fake_squared_int { my $max_int = shift; my $prng = fake_int( 1, $max_int ); return sub { $prng->() ** 2 }; } $generator = fake_hash( number_squared => fake_squared_int(10), ); Caveats and special cases Because many data structures are walked recursively looking for code-references to replace, circular references will cause an infinite loop. If you need a code references as part of your output data structure, you need to wrap it in a code reference. $generator = fake_hash( a_function => sub { \&some_function }, ); CONTRIBUTING If you have ideas for additional generator functions and think they would be sensible additions to the main distribution, please open a support ticket to discuss it. To be included in the main distribution, additional generator functions should add few, if any, additional dependencies. If you would like to release your own distributions in the "Data::Fake::*" namespace, please follow the conventions of the existing modules: * factory function names start with "fake_" * export all factory functions by default * allow code-references where you would allow a sizing constant SEE ALSO * Data::Faker – similar but object oriented; doesn't do structured data; always loads all plugins * Data::Random – generate several random types of data * Test::Sims – generator for libraries generating random data * Text::Lorem – just fake text AUTHOR David Golden CONTRIBUTORS * Chloé Kekoa <50083900+chloekek@users.noreply.github.com> * José Joaquín Atria * Ricardo Signes * Stuart Skelton COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 Data-Fake-0.006/examples/000755 000766 000024 00000000000 14016050606 015303 5ustar00davidstaff000000 000000 Data-Fake-0.006/META.yml000644 000766 000024 00000003525 14016050606 014743 0ustar00davidstaff000000 000000 --- abstract: 'Declaratively generate fake structured data for testing' author: - 'David Golden ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' Test::Deep: '0' Test::More: '0.96' perl: '5.008001' configure_requires: ExtUtils::MakeMaker: '6.17' perl: '5.008001' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010' license: apache meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Data-Fake no_index: directory: - corpus - examples - t - xt package: - DB provides: Data::Fake: file: lib/Data/Fake.pm version: '0.006' Data::Fake::Company: file: lib/Data/Fake/Company.pm version: '0.006' Data::Fake::Core: file: lib/Data/Fake/Core.pm version: '0.006' Data::Fake::Dates: file: lib/Data/Fake/Dates.pm version: '0.006' Data::Fake::Internet: file: lib/Data/Fake/Internet.pm version: '0.006' Data::Fake::Names: file: lib/Data/Fake/Names.pm version: '0.006' Data::Fake::Text: file: lib/Data/Fake/Text.pm version: '0.006' requires: Carp: '0' Exporter: '5.57' Import::Into: '1.002005' List::Util: '0' Text::Lorem: '0' Time::Piece: '1.27' perl: '5.008001' strict: '0' warnings: '0' resources: bugtracker: https://github.com/dagolden/Data-Fake/issues homepage: https://github.com/dagolden/Data-Fake repository: https://github.com/dagolden/Data-Fake.git version: '0.006' x_authority: cpan:DAGOLDEN x_contributors: - 'Chloé Kekoa <50083900+chloekek@users.noreply.github.com>' - 'José Joaquín Atria ' - 'Ricardo Signes ' - 'Stuart Skelton ' x_generated_by_perl: v5.32.0 x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: Apache-2.0 Data-Fake-0.006/tidyall.ini000644 000766 000024 00000000240 14016050606 015624 0ustar00davidstaff000000 000000 ; Install Code::TidyAll ; run "tidyall -a" to tidy all files ; run "tidyall -g" to tidy only files modified from git [PerlTidy] select = {lib,t}/**/*.{pl,pm,t} Data-Fake-0.006/lib/000755 000766 000024 00000000000 14016050606 014233 5ustar00davidstaff000000 000000 Data-Fake-0.006/Makefile.PL000644 000766 000024 00000003023 14016050606 015435 0ustar00davidstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.017. use strict; use warnings; use 5.008001; use ExtUtils::MakeMaker 6.17; my %WriteMakefileArgs = ( "ABSTRACT" => "Declaratively generate fake structured data for testing", "AUTHOR" => "David Golden ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.17" }, "DISTNAME" => "Data-Fake", "LICENSE" => "apache", "MIN_PERL_VERSION" => "5.008001", "NAME" => "Data::Fake", "PREREQ_PM" => { "Carp" => 0, "Exporter" => "5.57", "Import::Into" => "1.002005", "List::Util" => 0, "Text::Lorem" => 0, "Time::Piece" => "1.27", "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::Deep" => 0, "Test::More" => "0.96" }, "VERSION" => "0.006", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "Exporter" => "5.57", "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Import::Into" => "1.002005", "List::Util" => 0, "Test::Deep" => 0, "Test::More" => "0.96", "Text::Lorem" => 0, "Time::Piece" => "1.27", "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); Data-Fake-0.006/META.json000644 000766 000024 00000007512 14016050606 015113 0ustar00davidstaff000000 000000 { "abstract" : "Declaratively generate fake structured data for testing", "author" : [ "David Golden " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010", "license" : [ "apache_2_0" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Data-Fake", "no_index" : { "directory" : [ "corpus", "examples", "t", "xt" ], "package" : [ "DB" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17", "perl" : "5.008001" }, "suggests" : { "JSON::PP" : "2.27300" } }, "develop" : { "requires" : { "Dist::Zilla" : "5", "Dist::Zilla::PluginBundle::DAGOLDEN" : "0.072", "File::Spec" : "0", "File::Temp" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Pod::Coverage::TrustPod" : "0", "Pod::Wordlist" : "0", "Software::License::Apache_2_0" : "0", "Test::CPAN::Meta" : "0", "Test::MinimumVersion" : "0", "Test::More" : "0", "Test::Perl::Critic" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Portability::Files" : "0", "Test::Spelling" : "0.12", "Test::Version" : "1" } }, "runtime" : { "requires" : { "Carp" : "0", "Exporter" : "5.57", "Import::Into" : "1.002005", "List::Util" : "0", "Text::Lorem" : "0", "Time::Piece" : "1.27", "perl" : "5.008001", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "Test::Deep" : "0", "Test::More" : "0.96", "perl" : "5.008001" } } }, "provides" : { "Data::Fake" : { "file" : "lib/Data/Fake.pm", "version" : "0.006" }, "Data::Fake::Company" : { "file" : "lib/Data/Fake/Company.pm", "version" : "0.006" }, "Data::Fake::Core" : { "file" : "lib/Data/Fake/Core.pm", "version" : "0.006" }, "Data::Fake::Dates" : { "file" : "lib/Data/Fake/Dates.pm", "version" : "0.006" }, "Data::Fake::Internet" : { "file" : "lib/Data/Fake/Internet.pm", "version" : "0.006" }, "Data::Fake::Names" : { "file" : "lib/Data/Fake/Names.pm", "version" : "0.006" }, "Data::Fake::Text" : { "file" : "lib/Data/Fake/Text.pm", "version" : "0.006" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/dagolden/Data-Fake/issues" }, "homepage" : "https://github.com/dagolden/Data-Fake", "repository" : { "type" : "git", "url" : "https://github.com/dagolden/Data-Fake.git", "web" : "https://github.com/dagolden/Data-Fake" } }, "version" : "0.006", "x_authority" : "cpan:DAGOLDEN", "x_contributors" : [ "Chlo\u00e9 Kekoa <50083900+chloekek@users.noreply.github.com>", "Jos\u00e9 Joaqu\u00edn Atria ", "Ricardo Signes ", "Stuart Skelton " ], "x_generated_by_perl" : "v5.32.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.24", "x_spdx_expression" : "Apache-2.0" } Data-Fake-0.006/dist.ini000644 000766 000024 00000000361 14016050606 015131 0ustar00davidstaff000000 000000 name = Data-Fake author = David Golden license = Apache_2_0 copyright_holder = David Golden copyright_year = 2015 [@DAGOLDEN] :version = 0.072 stopwords = declaratively stopwords = Glassdoor stopwords = submodules Data-Fake-0.006/lib/Data/000755 000766 000024 00000000000 14016050606 015104 5ustar00davidstaff000000 000000 Data-Fake-0.006/lib/Data/Fake.pm000644 000766 000024 00000015707 14016050606 016322 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; package Data::Fake; # ABSTRACT: Declaratively generate fake structured data for testing our $VERSION = '0.006'; use Import::Into 1.002005; sub import { my $class = shift; for my $m (@_) { my $module = "Data::Fake::$m"; $module->import::into( scalar caller ); } } 1; # vim: ts=4 sts=4 sw=4 et tw=75: __END__ =pod =encoding UTF-8 =head1 NAME Data::Fake - Declaratively generate fake structured data for testing =head1 VERSION version 0.006 =head1 SYNOPSIS use Data::Fake qw/Core Names Text Dates/; my $hero_generator = fake_hash( { name => fake_name(), battlecry => fake_sentences(1), birthday => fake_past_datetime("%Y-%m-%d"), friends => fake_array( fake_int(2,4), fake_name() ), gender => fake_pick(qw/Male Female Other/), } ); my $hero = $hero_generator->(); ### example output ### # { # 'name' => 'Antonio Nicholas Preston' # 'battlecry' => 'Est ipsum corrupti quia voluptatibus.', # 'birthday' => '2004-04-21', # 'friends' => [ # 'Jaylin Lillianna Morgan', # 'Colin Noel Estes', # 'Justice Aron Hale', # 'Franco Zane Oneil' # ], # 'gender' => 'Male', # }; =head1 DESCRIPTION This module generates randomized, fake structured data using declarative syntax. C is built on higher-order programming principles. It provides users with "factory" functions, which create "generator" functions for specific pieces of data. Wherever randomized, fake data is desired, a generator code reference is used as a placeholder for the desired output. Each time the top-level generator is run, nested generators are recursively run to turn placeholders into the desired randomized data. For example, the SYNOPSIS declares the desired form of a "hero" using the C factory function. The input is a hash-reference, with nested generators created as placeholders by the C, C, etc. factory functions: my $hero_generator = fake_hash( { name => fake_name(), battlecry => fake_sentences(1), birthday => fake_past_datetime("%Y-%m-%d"), friends => fake_array( fake_int(2,4), fake_name() ), gender => fake_pick(qw/Male Female Other/), } ); Every time C<$hero_generator> is run, a new hash is generated based on the template and nested generators. =head1 USAGE =head2 Loading the right submodules Factory functions are exported by submodules, loosely grouped by topic: =over 4 =item * L – general purpose generators: hashes, arrays, numeric values, string templates =item * L – company name, job title =item * L – past and future dates =item * L – domain names, email addresses =item * L – first and last names =item * L – characters, words, sentences, paragraphs =back Submodules can be loaded directly, to control exactly which functions are exported, or they can be loaded by the C import function like so: use Data::Fake qw/Core Company Dates Names/; In this case, the listed submodules are loaded and all their functions are imported. =head2 Constructing the desired output Use the factory functions to construct a generator for your data. Start with the highest level structure using L or L. Use other factory functions to create placeholders with specific data types. For example, a hash generator with placeholders for phone numbers: $hash_generator = fake_hash( { home => fake_digits("###-###-####"), work => fake_digits("###-###-####"), cell => fake_digits("###-###-####"), } ); Or build them up piece by piece. For example, an array of 100 of the previous hash references: $array_generator = fake_array( 100, $hash_generator ); Then generate the hundred instances, each with three fake phone numbers: $aoh = $array_generator->(); See L for ideas for how to use and combine generators. =head2 Using custom generators Generators are just code references. You can use your own anywhere a Data::Fake generator could be used: $generator = fake_hash( favorite_color => \&my_favorite_color_picker, number_squared => sub { ( int(rand(10)) + 1 ) ** 2 }, ); You can (and probably should) write your own factory functions for anything complex or that you'll use more than once. You can use Data::Fake generators as part of these functions. use Data::Fake qw/Core/; sub fake_squared_int { my $max_int = shift; my $prng = fake_int( 1, $max_int ); return sub { $prng->() ** 2 }; } $generator = fake_hash( number_squared => fake_squared_int(10), ); =head2 Caveats and special cases Because many data structures are walked recursively looking for code-references to replace, circular references will cause an infinite loop. If you need a code references as part of your output data structure, you need to wrap it in a code reference. $generator = fake_hash( a_function => sub { \&some_function }, ); =for Pod::Coverage BUILD =head1 CONTRIBUTING If you have ideas for additional generator functions and think they would be sensible additions to the main distribution, please open a support ticket to discuss it. To be included in the main distribution, additional generator functions should add few, if any, additional dependencies. If you would like to release your own distributions in the C namespace, please follow the conventions of the existing modules: =over 4 =item * factory function names start with "fake_" =item * export all factory functions by default =item * allow code-references where you would allow a sizing constant =back =head1 SEE ALSO =over 4 =item * L – similar but object oriented; doesn't do structured data; always loads all plugins =item * L – generate several random types of data =item * L – generator for libraries generating random data =item * L – just fake text =back =head1 AUTHOR David Golden =head1 CONTRIBUTORS =for stopwords Chloé Kekoa José Joaquín Atria Ricardo Signes Stuart Skelton =over 4 =item * Chloé Kekoa <50083900+chloekek@users.noreply.github.com> =item * José Joaquín Atria =item * Ricardo Signes =item * Stuart Skelton =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut Data-Fake-0.006/lib/Data/Fake/000755 000766 000024 00000000000 14016050606 015752 5ustar00davidstaff000000 000000 Data-Fake-0.006/lib/Data/Fake/Examples.pod000644 000766 000024 00000001554 14016050606 020241 0ustar00davidstaff000000 000000 # PODNAME: Data::Fake::Examples # ABSTRACT: Examples of combining Data::Fake generators __END__ =pod =encoding UTF-8 =head1 NAME Data::Fake::Examples - Examples of combining Data::Fake generators =head1 VERSION version 0.006 =head1 EXAMPLES I plan to add additional examples here over time. Contributions are welcome. =head2 URLs # http://example.com/ # https://www.example.com/ # http://www23.example.com/ use Data::Fake qw/Core Internet/; my $fake_url = fake_template( "%s://%s%s/", fake_pick(qw(http https)), fake_pick( "", "www.", fake_digits("www##.") ), fake_domain(), ); =head1 AUTHOR David Golden =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut Data-Fake-0.006/lib/Data/Fake/Company.pm000644 000766 000024 00000011432 14016050606 017717 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; package Data::Fake::Company; # ABSTRACT: Fake company and job data generators our $VERSION = '0.006'; use Exporter 5.57 qw/import/; our @EXPORT = qw( fake_company fake_title ); use Data::Fake::Core (); use Data::Fake::Names (); my ( @job_titles, $job_title_count ); my ( @company_suffix, $company_suffix_count ); sub _job_title { return $job_titles[ int( rand($job_title_count) ) ] } sub _company_suffix { return $company_suffix[ int( rand($company_suffix_count) ) ] } #pod =func fake_company #pod #pod $generator = fake_company(); #pod #pod Takes no arguments and returns a generator that returns a randomly generated #pod fake company name. #pod #pod =cut sub fake_company { my $fake_surname = Data::Fake::Names::fake_surname(); return Data::Fake::Core::fake_pick( Data::Fake::Core::fake_template( "%s, %s", $fake_surname, \&_company_suffix ), Data::Fake::Core::fake_template( "%s-%s", ($fake_surname) x 2 ), Data::Fake::Core::fake_template( "%s, %s and %s", ($fake_surname) x 3 ), ); } #pod =func fake_title #pod #pod $generator = fake_title(); #pod #pod Takes no arguments and returns a generator that returns a randomly generated #pod job title (drawn from a corpus of ~90 common titles sources from Glassdoor). #pod #pod =cut sub fake_title { return sub { _job_title() } } # list of most common job titles from glassdoor.com with some edits and # amendments @job_titles = ( 'Account Executive', 'Account Manager', 'Accountant', 'Actuary', 'Administrative Assistant', 'Analyst', 'Applications Engineer', 'Architect', 'Art Director', 'Assistant Manager', 'Assistant Store Manager', 'Assistant Vice President', 'Associate', 'Associate Consultant', 'Associate Director', 'Attorney', 'Audit Associate', 'Branch Manager', 'Business Analyst', 'Business Development Manager', 'Cashier', 'Civil Engineer', 'Consultant', 'Customer Service', 'Customer Service Representative', 'Data Analyst', 'Design Engineer', 'Developer', 'Director', 'Editor', 'Electrical Engineer', 'Engineer', 'Engineering Manager', 'Executive Assistant', 'Finance Manager', 'Financial Advisor', 'Financial Analyst', 'Financial Representative', 'Flight Attendant', 'General Manager', 'Graduate Research Assistant', 'Graphic Designer', 'Hardware Engineer', 'Human Resources Manager', 'Investment Banking Analyst', 'IT Analyst', 'It Manager', 'IT Specialist', 'Law Clerk', 'Management Trainee', 'Manager', 'Marketing Assistant', 'Marketing Director', 'Marketing Manager', 'Mechanical Engineer', 'Member of Technical Staff', 'Network Engineer', 'Office Manager', 'Operations Analyst', 'Operations Manager', 'Personal Banker', 'Pharmacist', 'Principal Consultant', 'Principal Engineer', 'Principal Software Engineer', 'Process Engineer', 'Product Manager', 'Program Manager', 'Programmer', 'Programmer Analyst', 'Project Engineer', 'Project Manager', 'Public Relations', 'QA Engineer', 'Recruiter', 'Registered Nurse', 'Research Analyst', 'Research Assistant', 'Research Associate', 'Sales', 'Sales Associate', 'Sales Engineer', 'Sales Manager', 'Sales Representative', 'Senior Accountant', 'Senior Analyst', 'Senior Associate', 'Senior Business Analyst', 'Senior Consultant', 'Senior Director', 'Senior Engineer', 'Senior Financial Analyst', ); @company_suffix = qw( Inc. Corp. LP LLP LLC ); $job_title_count = @job_titles; $company_suffix_count = @company_suffix; # vim: ts=4 sts=4 sw=4 et tw=75: __END__ =pod =encoding UTF-8 =head1 NAME Data::Fake::Company - Fake company and job data generators =head1 VERSION version 0.006 =head1 SYNOPSIS use Data::Fake::Company; $fake_company = fake_company()->(); $fake_title = fake_title()->(); =head1 DESCRIPTION This module provides fake data generators for company names and job titles. All functions are exported by default. =head1 FUNCTIONS =head2 fake_company $generator = fake_company(); Takes no arguments and returns a generator that returns a randomly generated fake company name. =head2 fake_title $generator = fake_title(); Takes no arguments and returns a generator that returns a randomly generated job title (drawn from a corpus of ~90 common titles sources from Glassdoor). =for Pod::Coverage BUILD =head1 AUTHOR David Golden =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut Data-Fake-0.006/lib/Data/Fake/Internet.pm000644 000766 000024 00000007307 14016050606 020107 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; package Data::Fake::Internet; # ABSTRACT: Fake Internet-related data generators our $VERSION = '0.006'; use Exporter 5.57 qw/import/; our @EXPORT = qw( fake_tld fake_domain fake_email ); use Data::Fake::Text (); use Data::Fake::Names (); my ( @domain_suffixes, $domain_suffix_count ); sub _domain_suffix { return $domain_suffixes[ int( rand($domain_suffix_count) ) ] } #pod =func fake_tld #pod #pod $generator = fake_tld(); #pod #pod Returns a generator that randomly selects from a weighted list of about 50 #pod domain suffixes based on a list of the top 500 domains by inbound #pod root-domain links. #pod #pod =cut sub fake_tld { return sub { _domain_suffix }; } #pod =func fake_domain #pod #pod $generator = fake_domain(); #pod #pod Returns a generator that concatenates two random words with a random #pod domain suffix. #pod #pod =cut sub fake_domain { my $prefix_gen = Data::Fake::Text::fake_words(2); return sub { my $prefix = $prefix_gen->(); $prefix =~ s/\s//g; join( ".", $prefix, _domain_suffix ); }; } #pod =func fake_email #pod #pod $generator = fake_email(); #pod #pod Returns a generator that constructs an email from a random name and a #pod random domain. #pod #pod =cut sub fake_email { my $fn = Data::Fake::Names::fake_first_name; my $ln = Data::Fake::Names::fake_surname; my $dn = fake_domain; return sub { return sprintf( "%s.%s@%s", map { lc } map { $_->() } $fn, $ln, $dn ); }; } # list and frequencey of most common domains suffixes taken from moz.org # list of top 500 domains by inbound root domain links my @domain_suffix_freqs = qw( com 295 org 29 edu 27 gov 25 net 15 co.uk 12 ru 9 jp 7 ne.jp 7 de 6 co.jp 5 fr 4 gov.au 3 io 3 com.cn 3 it 3 cn 3 cz 3 gov.cn 2 me 2 ca 2 com.br 2 co 2 us 2 com.au 2 pl 2 uk 2 ac.uk 2 info 1 gl 1 tx.us 1 la 1 com.hk 1 gd 1 vu 1 eu 1 es 1 int 1 tv 1 or.jp 1 mil 1 cc 1 ch 1 ly 1 org.au 1 net.au 1 fm 1 be 1 nl 1 ); for my $i ( 0 .. @domain_suffix_freqs / 2 - 1 ) { my ( $s, $n ) = ( $domain_suffix_freqs[ 2 * $i ], $domain_suffix_freqs[ 2 * $i + 1 ] ); push @domain_suffixes, ($s) x $n; } $domain_suffix_count = @domain_suffixes; 1; # vim: ts=4 sts=4 sw=4 et tw=75: __END__ =pod =encoding UTF-8 =head1 NAME Data::Fake::Internet - Fake Internet-related data generators =head1 VERSION version 0.006 =head1 SYNOPSIS use Data::Fake::Internet; fake_tld()->(); # .gov, etc. fake_domain()->(); # atqueaut.gov, etc. fake_email()->(); # john.smith@atqueaut.gov, etc. =head1 DESCRIPTION This module provides fake data generators for Internet-related data. All functions are exported by default. =head1 FUNCTIONS =head2 fake_tld $generator = fake_tld(); Returns a generator that randomly selects from a weighted list of about 50 domain suffixes based on a list of the top 500 domains by inbound root-domain links. =head2 fake_domain $generator = fake_domain(); Returns a generator that concatenates two random words with a random domain suffix. =head2 fake_email $generator = fake_email(); Returns a generator that constructs an email from a random name and a random domain. =for Pod::Coverage BUILD =head1 AUTHOR David Golden =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut Data-Fake-0.006/lib/Data/Fake/Core.pm000644 000766 000024 00000042163 14016050606 017206 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; package Data::Fake::Core; # ABSTRACT: General purpose generators our $VERSION = '0.006'; use Exporter 5.57 qw/import/; our @EXPORT = qw( fake_hash fake_array fake_flatten fake_pick fake_binomial fake_weighted fake_int fake_float fake_digits fake_template fake_join ); our @EXPORT_OK = qw/_transform/; use Carp qw/croak/; use List::Util qw/sum/; #pod =func fake_hash #pod #pod $generator = fake_hash( #pod { #pod name => fake_name, #pod pet => fake_pick(qw/dog cat frog/), #pod } #pod ); #pod #pod $generator = fake_hash( @hash_or_hash_generators ); #pod #pod The C function returns a code reference that, when run, #pod generates a hash reference. #pod #pod The simplest way to use it is to provide a hash reference with some values #pod replaced with C generator functions. When the generator runs, the #pod hash will be walked recursively and any code reference found will be #pod replaced with its output. #pod #pod If more than one argument is provided, when the generator runs, they will #pod be merged according to the following rules: #pod #pod =for :list #pod * code references will be replaced with their outputs #pod * after replacement, if any arguments aren't hash references, an exception #pod will be thrown #pod * hash references will be shallow-merged #pod #pod This merging allows for generating sections of hashes differently or #pod generating hashes that have missing keys (e.g. using L): #pod #pod # 25% of the time, generate a hash with a 'spouse' key #pod $factory = fake_hash( #pod { ... }, #pod fake_binomial( 0.25, { spouse => fake_name() }, {} ), #pod ); #pod #pod =cut sub fake_hash { my (@parts) = @_; return sub { my $result = {}; for my $next ( map { _transform($_) } @parts ) { croak "fake_hash can only merge hash references" unless ref($next) eq 'HASH'; @{$result}{ keys %$next } = @{$next}{ keys %$next }; } return $result; }; } #pod =func fake_array #pod #pod $generator = fake_array( 5, fake_digits("###-###-####") ); #pod #pod The C takes a positive integer size and source argument and #pod returns a generator that returns an array reference with each element built #pod from the source. #pod #pod If the size is a code reference, it will be run and can set a different size #pod for every array generated: #pod #pod # arrays from size 1 to size 6 #pod $generator = fake_array( fake_int(1,6), fake_digits("###-###-###") ); #pod #pod If the source is a code reference, it will be run; if the source is a hash #pod or array reference, it will be recursively evaluated like C. #pod #pod =cut sub fake_array { my ( $size, $template ) = @_; return sub { [ map { _transform($template) } 1 .. _transform($size) ]; }; } #pod =func fake_pick #pod #pod $generator = fake_pick( qw/one two three/ ); #pod $generator = fake_pick( @generators ); #pod #pod Given literal values or code references, returns a generator that randomly #pod selects one of them with equal probability. If the choice is a code #pod reference, it will be run; if the choice is a hash or array reference, it #pod will be recursively evaluated like C or C would do. #pod #pod =cut sub fake_pick { my (@list) = @_; my $size = scalar @list; return sub { _transform( $list[ int( rand($size) ) ] ) }; } #pod =func fake_binomial #pod #pod $generator = fake_binomial( #pod 0.90, #pod { name => fake_name() }, # 90% likely #pod {}, # 10% likely #pod ); #pod #pod $generator = fake_binomial( $prob, $lte_outcome, $gt_outcome ); #pod #pod The C function takes a probability and two outcomes. The #pod probability (between 0 and 1.0) indicates the likelihood that the return #pod value will the first outcome. The rest of the time, the return value will #pod be the second outcome. If the outcome is a code reference, it will be run; #pod if the outcome is a hash or array reference, it will be recursively #pod evaluated like C or C would do. #pod #pod =cut sub fake_binomial { my ( $prob, $first, $second ) = @_; croak "fake_binomial probability must be between 0 and 1.0" unless defined($prob) && $prob >= 0 && $prob <= 1.0; return sub { return _transform( rand() <= $prob ? $first : $second ); }; } #pod =func fake_weighted #pod #pod $generator = fake_weighted( #pod [ 'a_choice', 1 ], #pod [ 'ten_times_likely', 10 ], #pod [ $another_generator, 1 ], #pod ); #pod #pod Given a list of array references, each containing a value and a #pod non-negative weight, returns a generator that randomly selects a value #pod according to the relative weights. #pod #pod If the value is a code reference, it will be run; if it is a hash or array #pod reference, it will be recursively evaluated like C or C #pod would do. #pod #pod =cut sub fake_weighted { my (@list) = @_; return sub { } unless @list; if ( @list != grep { ref($_) eq 'ARRAY' } @list ) { croak("fake_weighted requires a list of array references"); } # normalize weights into cumulative probabilities my $sum = sum( 0, map { $_->[1] } @list ); my $max = 0; for my $s (@list) { $s->[1] = $max += $s->[1] / $sum; } my $last = pop @list; return sub { my $rand = rand(); for my $s (@list) { return _transform( $s->[0] ) if $rand <= $s->[1]; } return _transform( $last->[0] ); }; } #pod =func fake_int #pod #pod $generator = fake_int(1, 6); #pod #pod Given a minimum and a maximum value as inputs, returns a generator that #pod will produce a random integer in that range. #pod #pod =cut sub fake_int { my ( $min, $max ) = map { int($_) } @_; croak "fake_int requires minimum and maximum" unless defined $min && defined $max; my $range = $max - $min + 1; return sub { return $min + int( rand($range) ); }; } #pod =func fake_float #pod #pod $generator = fake_float(1.0, 6.0); #pod #pod Given a minimum and a maximum value as inputs, returns a generator that #pod will produce a random floating point value in that range. #pod #pod =cut sub fake_float { my ( $min, $max ) = @_; croak "fake_float requires minimum and maximum" unless defined $min && defined $max; my $range = $max - $min; return sub { return $min + rand($range); }; } #pod =func fake_digits #pod #pod $generator = fake_digits('###-####'); # "555-1234" #pod $generator = fake_digits('\###'); # "#12" #pod #pod Given a text pattern, returns a generator that replaces all occurrences of #pod the sharp character (C<#>) with a randomly selected digit. To have a #pod literal sharp character, escape it with a backslash (do it in a #pod single-quoted string to avoid having to double your backslash to get a #pod backslash in the string.). #pod #pod Use this for phone numbers, currencies, or whatever else needs random #pod digits: #pod #pod fake_digits('###-##-####'); # US Social Security Number #pod fake_digits('(###) ###-####'); # (800) 555-1212 #pod #pod =cut my $DIGIT_RE = qr/(?(); #pod #pod Given a generator that returns an array ref (such as fake_array) or a #pod hash ref (fake_hash), fake_flatten returns a generator that, when run, #pod executes the generators and returns their result in a dereferenced state. #pod #pod This is particularly useful when the return value is used directly as #pod input to another function, for example within a fake_join. #pod #pod $generator = fake_join( " ", $flatten_generator ); #pod #pod =cut sub fake_flatten { my ($ref) = @_; return sub { my $result = _transform($ref); my $result_ref = ref($result); if ( $result_ref eq 'ARRAY' ) { return @$result; } elsif ( $result_ref eq 'HASH' ) { return %$result; } croak "I do not know how to flatten a $result_ref"; } } sub _transform { my ($template) = @_; my $type = ref($template); if ( $type eq 'CODE' ) { return $template->(); } elsif ( $type eq 'HASH' ) { my $copy = {}; while ( my ( $k, $v ) = each %$template ) { $copy->{$k} = ref($v) eq 'CODE' ? $v->() : ref($v) eq 'HASH' ? _transform($v) : ref($v) eq 'ARRAY' ? _transform($v) : $v; } return $copy; } elsif ( $type eq 'ARRAY' ) { my @copy = map { ref $_ eq 'CODE' ? $_->() : ref $_ eq 'HASH' ? _transform($_) : ref $_ eq 'ARRAY' ? _transform($_) : $_; } @$template; return \@copy; } else { # literal value return $template; } } 1; # vim: ts=4 sts=4 sw=4 et tw=75: __END__ =pod =encoding UTF-8 =head1 NAME Data::Fake::Core - General purpose generators =head1 VERSION version 0.006 =head1 SYNOPSIS use Data::Fake::Core; $generator = fake_hash( { ssn => fake_digits("###-##-###"), phrase => fake_template( "%s world", fake_pick(qw/hello goodbye/) ), die_rolls => fake_array( 3, fake_int(1, 6) ), temperature => fake_float(-20.0, 120.0), } ); =head1 DESCRIPTION This module provides a general-purpose set of fake data functions to generate structured data, numeric data, structured strings, and weighted alternatives. All functions are exported by default. =head1 FUNCTIONS =head2 fake_hash $generator = fake_hash( { name => fake_name, pet => fake_pick(qw/dog cat frog/), } ); $generator = fake_hash( @hash_or_hash_generators ); The C function returns a code reference that, when run, generates a hash reference. The simplest way to use it is to provide a hash reference with some values replaced with C generator functions. When the generator runs, the hash will be walked recursively and any code reference found will be replaced with its output. If more than one argument is provided, when the generator runs, they will be merged according to the following rules: =over 4 =item * code references will be replaced with their outputs =item * after replacement, if any arguments aren't hash references, an exception will be thrown =item * hash references will be shallow-merged =back This merging allows for generating sections of hashes differently or generating hashes that have missing keys (e.g. using L): # 25% of the time, generate a hash with a 'spouse' key $factory = fake_hash( { ... }, fake_binomial( 0.25, { spouse => fake_name() }, {} ), ); =head2 fake_array $generator = fake_array( 5, fake_digits("###-###-####") ); The C takes a positive integer size and source argument and returns a generator that returns an array reference with each element built from the source. If the size is a code reference, it will be run and can set a different size for every array generated: # arrays from size 1 to size 6 $generator = fake_array( fake_int(1,6), fake_digits("###-###-###") ); If the source is a code reference, it will be run; if the source is a hash or array reference, it will be recursively evaluated like C. =head2 fake_pick $generator = fake_pick( qw/one two three/ ); $generator = fake_pick( @generators ); Given literal values or code references, returns a generator that randomly selects one of them with equal probability. If the choice is a code reference, it will be run; if the choice is a hash or array reference, it will be recursively evaluated like C or C would do. =head2 fake_binomial $generator = fake_binomial( 0.90, { name => fake_name() }, # 90% likely {}, # 10% likely ); $generator = fake_binomial( $prob, $lte_outcome, $gt_outcome ); The C function takes a probability and two outcomes. The probability (between 0 and 1.0) indicates the likelihood that the return value will the first outcome. The rest of the time, the return value will be the second outcome. If the outcome is a code reference, it will be run; if the outcome is a hash or array reference, it will be recursively evaluated like C or C would do. =head2 fake_weighted $generator = fake_weighted( [ 'a_choice', 1 ], [ 'ten_times_likely', 10 ], [ $another_generator, 1 ], ); Given a list of array references, each containing a value and a non-negative weight, returns a generator that randomly selects a value according to the relative weights. If the value is a code reference, it will be run; if it is a hash or array reference, it will be recursively evaluated like C or C would do. =head2 fake_int $generator = fake_int(1, 6); Given a minimum and a maximum value as inputs, returns a generator that will produce a random integer in that range. =head2 fake_float $generator = fake_float(1.0, 6.0); Given a minimum and a maximum value as inputs, returns a generator that will produce a random floating point value in that range. =head2 fake_digits $generator = fake_digits('###-####'); # "555-1234" $generator = fake_digits('\###'); # "#12" Given a text pattern, returns a generator that replaces all occurrences of the sharp character (C<#>) with a randomly selected digit. To have a literal sharp character, escape it with a backslash (do it in a single-quoted string to avoid having to double your backslash to get a backslash in the string.). Use this for phone numbers, currencies, or whatever else needs random digits: fake_digits('###-##-####'); # US Social Security Number fake_digits('(###) ###-####'); # (800) 555-1212 =head2 fake_template $generator = fake_template("Hello, %s", fake_name()); Given a sprintf-style text pattern and a list of generators, returns a generator that, when run, executes the generators and returns the string populated with the output. Use this for creating custom generators from other generators. =head2 fake_join $generator = fake_join(" ", fake_first_name(), fake_surname() ); Given a character to join on a list of literals or generators, returns a generator that, when run, executes any generators and returns them concatenated together, separated by the separator character. The separator itself may also be a generator if you want that degree of randomness as well. $generator = fake_join( fake_pick( q{}, q{ }, q{,} ), @args ); =head2 fake_flatten $flatten_generator = fake_flatten( fake_array( 3, fake_first_name() ) ); @array_of_names = $flatten_generator->(); Given a generator that returns an array ref (such as fake_array) or a hash ref (fake_hash), fake_flatten returns a generator that, when run, executes the generators and returns their result in a dereferenced state. This is particularly useful when the return value is used directly as input to another function, for example within a fake_join. $generator = fake_join( " ", $flatten_generator ); =for Pod::Coverage BUILD =head1 AUTHOR David Golden =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut Data-Fake-0.006/lib/Data/Fake/Names.pm000644 000766 000024 00000060066 14016050606 017363 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; package Data::Fake::Names; # ABSTRACT: Fake name data generators our $VERSION = '0.006'; use Exporter 5.57 qw/import/; our @EXPORT = qw( fake_name fake_first_name fake_surname ); my ( @male_first, @female_first, @surnames ); my ( $male_count, $female_count, $surname_count ); sub _female_first { return $female_first[ int( rand($female_count) ) ] } sub _male_first { return $male_first[ int( rand($male_count) ) ] } sub _surname { return $surnames[ int( rand($surname_count) ) ] } #pod =func fake_name #pod #pod $generator = fake_name(); #pod #pod Returns a generator that provides a randomly selected name with #pod first, middle and last name parts. #pod #pod =cut sub fake_name { return sub { my $is_male = ( rand() < 0.5 ); my @given = map { $is_male ? _male_first() : _female_first() } 1 .. 2; return join( " ", @given, _surname() ); }; } #pod =func fake_first_name #pod #pod $generator = fake_first_name(); #pod #pod Returns a generator that provides a randomly selected first name. #pod It will be split 50/50 between male and female names. #pod #pod =cut sub fake_first_name { return sub { my $is_male = ( rand() < 0.5 ); return $is_male ? _male_first() : _female_first(); } } #pod =func fake_surname #pod #pod $generator = fake_surname(); #pod #pod Returns a generator that provides a randomly selected surname. #pod #pod =cut sub fake_surname { return sub { _surname() } } # first name data from 2013 US Social Security Administration @male_first = qw( Noah Liam Jacob Mason William Ethan Michael Alexander Jayden Daniel Elijah Aiden James Benjamin Matthew Jackson Logan David Anthony Joseph Joshua Andrew Lucas Gabriel Samuel Christopher John Dylan Isaac Ryan Nathan Carter Caleb Luke Christian Hunter Henry Owen Landon Jack Wyatt Jonathan Eli Isaiah Sebastian Jaxon Julian Brayden Gavin Levi Aaron Oliver Jordan Nicholas Evan Connor Charles Jeremiah Cameron Adrian Thomas Robert Tyler Colton Austin Jace Angel Dominic Josiah Brandon Ayden Kevin Zachary Parker Blake Jose Chase Grayson Jason Ian Bentley Adam Xavier Cooper Justin Nolan Hudson Easton Jase Carson Nathaniel Jaxson Kayden Brody Lincoln Luis Tristan Damian Camden Juan Vincent Bryson Ryder Asher Carlos Jesus Micah Maxwell Mateo Alex Max Leo Elias Cole Miles Silas Bryce Eric Brantley Sawyer Declan Braxton Kaiden Colin Timothy Santiago Antonio Giovanni Hayden Diego Leonardo Bryan Miguel Roman Jonah Steven Ivan Kaleb Wesley Richard Jaden Victor Ezra Joel Edward Jayce Aidan Preston Greyson Brian Kaden Ashton Alan Patrick Kyle Riley George Jesse Jeremy Marcus Harrison Jude Weston Ryker Alejandro Jake Axel Grant Maddox Theodore Emmanuel Cayden Emmett Brady Bradley Gael Malachi Oscar Abel Tucker Jameson Caden Abraham Mark Sean Ezekiel Kenneth Gage Everett Kingston Nicolas Zayden King Bennett Calvin Avery Tanner Paul Kai Maximus Rylan Luca Graham Omar Derek Jayceon Jorge Peter Peyton Devin Collin Andres Jaiden Cody Zane Amir Corbin Francisco Xander Eduardo Conner Javier Jax Myles Griffin Iker Garrett Damien Simon Zander Seth Travis Charlie Cristian Trevor Zion Lorenzo Dean Gunner Chance Elliot Lukas Cash Elliott Israel Manuel Josue Jasper Keegan Finn Spencer Stephen Fernando Ricardo Mario Jeffrey Shane Clayton Reid Erick Cesar Paxton Martin Raymond Judah Trenton Johnny Andre Tyson Beau Landen Caiden Maverick Dominick Troy Kyler Hector Cruz Beckett Johnathan Donovan Edwin Kameron Marco Drake Edgar Holden Rafael Dante Jaylen Emiliano Waylon Andy Alexis Rowan Felix Drew Emilio Gregory Karter Brooks Dallas Lane Anderson Jared Skyler Angelo Shawn Aden Erik Dalton Fabian Sergio Milo Louis Titus Kendrick Braylon August Dawson Reed Emanuel Arthur Jett Leon Brendan Frank Marshall Emerson Desmond Derrick Colt Karson Messiah Zaiden Braden Amari Roberto Romeo Joaquin Malik Walter Brennan Pedro Knox Nehemiah Julius Grady Allen Ali Archer Kamden Dakota Maximiliano Ruben Quinn Barrett Tate Corey Adan Braylen Marcos Remington Phillip Kason Major Kellan Cohen Walker Gideon Taylor River Jayson Brycen Abram Cade Matteo Dillon Damon Dexter Kolton Phoenix Noel Brock Porter Philip Enrique Leland Ty Esteban Danny Jay Gerardo Keith Kellen Gunnar Armando Zachariah Orion Ismael Colby Pablo Ronald Atticus Trey Quentin Ryland Kash Raul Enzo Julio Darius Rodrigo Landyn Donald Bruce Jakob Kade Ari Keaton Albert Muhammad Rocco Solomon Rhett Cason Jaime Scott Chandler Mathew Maximilian Russell Dustin Ronan Tony Cyrus Jensen Hugo Saul Trent Deacon Davis Colten Malcolm Mohamed Devon Izaiah Randy Ibrahim Jerry Prince Tristen Alec Chris Dennis Clark Gustavo Mitchell Rory Jamison Leonel Finnegan Pierce Nash Kasen Khalil Darren Moses Issac Adriel Lawrence Braydon Jaxton Alberto Justice Curtis Larry Warren Zayne Yahir Jimmy Uriel Finley Nico Thiago Armani Jacoby Jonas Rhys Casey Tobias Frederick Jaxen Kobe Franklin Ricky Talon Ace Marvin Alonzo Arjun Jalen Alfredo Moises Sullivan Francis Case Brayan Alijah Arturo Lawson Raylan Mekhi Nikolas Carmelo Byron Nasir Reece Royce Sylas Ahmed Mauricio Beckham Roy Payton Raiden Korbin Maurice Ellis Aarav Johan Gianni Kayson Aldo Arian Isaias Jamari Kristopher Uriah Douglas Kane Milan Skylar Dorian Tatum Wade Cannon Quinton Bryant Toby Dane Sam Moshe Asa Mohammed Joe Kieran Roger Channing Daxton Ezequiel Orlando Matias Malakai Nathanael Zackary Boston Ahmad Dominik Lance Alvin Conor Odin Cullen Mohammad Deandre Benson Gary Blaine Carl Sterling Nelson Kian Salvador Luka Nikolai Nixon Niko Bowen Kyrie Brenden Callen Vihaan Luciano Terry Demetrius Raphael Ramon Xzavier Amare Rohan Reese Quincy Eddie Noe Yusuf London Hayes Jefferson Matthias Kelvin Terrance Madden Bentlee Layne Harvey Sincere Kristian Julien Melvin Harley Emmitt Neil Rodney Winston Hank Ayaan Ernesto Jeffery Alessandro Lucian Rex Wilson Mathias Memphis Princeton Santino Jon Tripp Lewis Trace Dax Eden Joey Nickolas Neymar Bruno Marc Crosby Cory Kendall Abdullah Allan Davion Hamza Soren Brentley Jasiah Edison Harper Tommy Morgan Zain Flynn Roland Theo Chad Lee Bobby Rayan Samson Brett Kylan Branson Bronson Ray Arlo Lennox Stanley Zechariah Kareem Micheal Reginald Alonso Casen Guillermo Leonard Augustus Tomas Billy Conrad Aryan Makai Elisha Westin Otto Adonis Jagger Keagan Dayton Leonidas Kyson Brodie Alden Aydin Valentino Harry Willie Yosef Braeden Marlon Terrence Lamar Shaun Aron Blaze Layton Duke Legend Jessie Terrell Clay Dwayne Felipe Kamari Gerald Kody Kole Maxim Omari Chaim Crew Lionel Vicente Bo Sage Rogelio Jermaine Gauge Will Emery Giovani Ronnie Elian Hendrix Javon Rayden Alexzander Ben Camron Jamarion Kolby Remy Jamal Urijah Jaydon Kyree Ariel Braiden Cassius Triston Jerome Junior Landry Wayne Killian Jamie Davian Lennon Samir Oakley Rene Ronin Tristian Darian Giancarlo Jadiel Amos Eugene Mayson Vincenzo Alfonso Brent Cain Callan Leandro Callum Darrell Atlas Fletcher Jairo Jonathon Kenny Tyrone Adrien Markus Thaddeus Zavier Marcel Marquis Misael Abdiel Draven Ishaan Lyric Ulises Jamir Marcelo Davin Bodhi Justus Mack Rudy Cedric Craig Frankie Javion Maxton Deshawn Jair Duncan Hassan Gibson Isiah Cayson Darwin Kale Kolten Lucca Kase Konner Konnor Randall Azariah Stefan Enoch Kymani Dominique Maximo Van Forrest Alvaro Gannon Jordyn Rolando Sonny Brice Coleman Yousef Aydan Ean Johnathon Quintin Semaj Cristopher Harlan Vaughn Zeke Axton Damion Jovanni Fisher Heath Ramiro Seamus Vance Yael Jadon Kamdyn Rashad Camdyn Jedidiah Santos Steve Chace Marley Brecken Kamryn Valentin Dilan Mike Krish Salvatore Brantlee Gilbert Turner Camren Franco Hezekiah Zaid Anders Deangelo Harold Joziah Mustafa Emory Jamar Reuben Royal Zayn Arnav Bently Gavyn Ares Ameer Juelz Rodolfo Titan Bridger Briggs Cortez Blaise Demarcus Rey Hugh Benton Giovanny Tristin Aidyn Jovani Jaylin Jorden Kaeden Clinton Efrain Kingsley Makhi Aditya Teagan Jericho Kamron Xavi Ernest Kaysen Zaire Deon Foster Lochlan Gilberto Gino Izayah Maison Miller Antoine Garrison Rylee Cristiano Dangelo Keenan Stetson Truman Brysen Jaycob Kohen Augustine Castiel Langston Magnus Osvaldo Reagan Sidney Tyree Yair Deegan Kalel Todd Alfred Anson Apollo Rowen Santana Ephraim Houston Jayse Leroy Pierre Tyrell Camryn Grey Yadiel Aaden Corban Denzel Jordy Kannon Branden Brendon Brenton Dario Jakobe Lachlan Thatcher Immanuel Camilo Davon Graeme Rocky Broderick Clyde Darien ); @female_first = qw( Sophia Emma Olivia Isabella Ava Mia Emily Abigail Madison Elizabeth Charlotte Avery Sofia Chloe Ella Harper Amelia Aubrey Addison Evelyn Natalie Grace Hannah Zoey Victoria Lillian Lily Brooklyn Samantha Layla Zoe Audrey Leah Allison Anna Aaliyah Savannah Gabriella Camila Aria Kaylee Scarlett Hailey Arianna Riley Alexis Nevaeh Sarah Claire Sadie Peyton Aubree Serenity Ariana Genesis Penelope Alyssa Bella Taylor Alexa Kylie Mackenzie Caroline Kennedy Autumn Lucy Ashley Madelyn Violet Stella Brianna Maya Skylar Ellie Julia Sophie Katherine Mila Khloe Paisley Annabelle Alexandra Nora Melanie London Gianna Naomi Eva Faith Madeline Lauren Nicole Ruby Makayla Kayla Lydia Piper Sydney Jocelyn Morgan Kimberly Molly Jasmine Reagan Bailey Eleanor Alice Trinity Rylee Andrea Hadley Maria Brooke Mariah Isabelle Brielle Mya Quinn Vivian Natalia Mary Liliana Payton Lilly Eliana Jade Cora Paige Valentina Kendall Clara Elena Jordyn Kaitlyn Delilah Isabel Destiny Rachel Amy Mckenzie Gabrielle Brooklynn Katelyn Laila Aurora Ariel Angelina Aliyah Juliana Vanessa Adriana Ivy Lyla Sara Willow Reese Hazel Eden Elise Josephine Kinsley Ximena Jessica Londyn Makenzie Gracie Isla Michelle Valerie Kylee Melody Catherine Adalynn Jayla Alexia Valeria Adalyn Rebecca Izabella Alaina Margaret Alana Alivia Kate Luna Norah Kendra Summer Ryleigh Julianna Jennifer Lila Hayden Emery Stephanie Angela Fiona Daisy Presley Eliza Harmony Melissa Giselle Keira Kinley Alayna Alexandria Emilia Marley Arabella Emerson Adelyn Brynn Lola Leila Mckenna Aniyah Athena Genevieve Allie Gabriela Daniela Cecilia Rose Adrianna Callie Jenna Esther Haley Leilani Maggie Adeline Hope Jaylah Amaya Maci Ana Juliet Jacqueline Charlie Lucia Tessa Camille Katie Miranda Lexi Makenna Jada Delaney Cassidy Alina Georgia Iris Ashlyn Kenzie Megan Anastasia Paris Shelby Jordan Danielle Lilliana Sienna Teagan Josie Angel Parker Mikayla Brynlee Diana Chelsea Kathryn Erin Annabella Kaydence Lyric Arya Madeleine Kayleigh Vivienne Sabrina Cali Raelynn Leslie Kyleigh Ayla Nina Amber Daniella Finley Olive Miriam Dakota Elliana Juliette Noelle Alison Amanda Alessandra Evangeline Phoebe Bianca Christina Yaretzi Raegan Kelsey Lilah Fatima Kiara Elaina Cadence Nyla Addyson Giuliana Alondra Gemma Ashlynn Carly Kyla Alicia Adelaide Laura Allyson Charlee Nadia Mallory Heaven Cheyenne Ruth Tatum Lena Ainsley Amiyah Journey Malia Haylee Veronica Eloise Myla Mariana Jillian Joanna Madilyn Baylee Selena Briella Sierra Rosalie Gia Briana Talia Abby Heidi Annie Jane Maddison Kira Carmen Lucille Harley Macy Skyler Kali June Elsie Kamila Adelynn Arielle Kelly Scarlet Rylie Haven Marilyn Aubrie Kamryn Kara Hanna Averie Marissa Jayda Jazmine Camryn Everly Jazmin Lia Karina Maliyah Miley Bethany Mckinley Jayleen Esmeralda Macie Aleah Catalina Nayeli Daphne Janelle Camilla Madelynn Kyra Addisyn Aylin Julie Caitlyn Sloane Gracelyn Elle Helen Michaela Serena Lana Angelica Raelyn Nylah Karen Emely Bristol Sarai Alejandra Brittany Vera April Francesca Logan Rowan Skye Sasha Carolina Kassidy Miracle Ariella Tiffany Itzel Justice Ada Brylee Jazlyn Dahlia Julissa Kaelyn Savanna Kennedi Anya Viviana Cataleya Jayden Sawyer Holly Kaylie Blakely Kailey Jimena Melany Emmalyn Guadalupe Sage Annalise Cassandra Madisyn Anabelle Kaylin Amira Crystal Elisa Caitlin Lacey Rebekah Celeste Danna Marlee Gwendolyn Joselyn Karla Joy Audrina Janiyah Anaya Malaysia Annabel Kadence Zara Imani Maeve Priscilla Phoenix Aspen Katelynn Dylan Eve Jamie Lexie Jaliyah Kailyn Lilian Braelyn Angie Lauryn Cynthia Emersyn Lorelei Monica Alanna Brinley Sylvia Journee Nia Aniya Breanna Fernanda Lillie Amari Charley Lilyana Luciana Raven Kaliyah Emilee Anne Bailee Hallie Zariah Bridget Annika Gloria Zuri Madilynn Elsa Nova Kiley Johanna Liberty Rosemary Aleena Courtney Madalyn Aryanna Tatiana Angelique Harlow Leighton Hayley Skyla Kenley Tiana Dayana Evelynn Selah Helena Blake Virginia Cecelia Nathalie Jaycee Danica Dulce Gracelynn Ember Evie Anika Emilie Erica Tenley Anabella Liana Cameron Braylee Aisha Charleigh Hattie Leia Lindsey Marie Regina Isis Alyson Anahi Elyse Felicity Jaelyn Amara Natasha Samara Lainey Daleyza Miah Melina River Amani Aileen Jessie Whitney Beatrice Caylee Greta Jaelynn Milan Millie Lea Marina Kaylynn Kenya Mariam Amelie Kaia Maleah Ally Colette Elisabeth Dallas Erika Karlee Alayah Alani Farrah Bria Madalynn Mikaela Adelina Amina Cara Jaylynn Leyla Nataly Braelynn Kiera Laylah Paislee Desiree Malaya Azalea Kensley Shiloh Brenda Lylah Addilyn Amiya Amya Maia Irene Ryan Jasmin Linda Adele Matilda Emelia Emmy Juniper Saige Ciara Estrella Jaylee Jemma Meredith Myah Rosa Teresa Yareli Kimber Madyson Claudia Maryam Zoie Kathleen Mira Paityn Isabela Perla Sariah Sherlyn Paola Shayla Winter Mae Simone Laney Pearl Ansley Jazlynn Patricia Aliana Brenna Armani Giana Lindsay Natalee Lailah Siena Nancy Raquel Willa Lilianna Frances Halle Janessa Kynlee Tori Leanna Bryanna Ellen Alma Lizbeth Wendy Chaya Christine Elianna Mabel Clarissa Kassandra Mollie Charli Diamond Kristen Coraline Mckayla Ariah Arely Blair Edith Joslyn Hailee Jaylene Chanel Alia Reyna Casey Clare Dana Alena Averi Alissa Demi Aiyana Leona Kailee Karsyn Kallie Taryn Corinne Rayna Asia Jaylin Noemi Carlee Abbigail Aryana Ayleen Eileen Livia Lillianna Mara Danika Mina Aliya Paloma Aimee Kaya Kora Tabitha Denise Hadassah Kayden Monroe Briley Celia Sandra Elaine Hana Jolie Kristina Myra Milana Lisa Renata Zariyah Adrienne America Emmalee Zaniyah Celine Cherish Jaida Kimora Mariyah Avah Nola Iliana Chana Cindy Janiya Carolyn Marisol Maliah Galilea Kiana Milania Alaya Bryn Emory Lorelai Jocelynn Yamileth Martha Jenny Keyla Alyvia Wren Dorothy Jordynn Amirah Nathaly Taliyah Zaria Deborah Elin Rylan Aubrianna Yasmin Julianne Zion Roselyn Salma Ivanna Joyce Paulina Lilith Saniyah Janae Aubrielle Ayanna Henley Sutton Aurelia Lesly Remi Britney Heather Barbara Bryleigh Emmalynn Kaitlynn Elliot Milena Susan Ariyah Kyndall Paula Thalia Aubri Kaleigh Tegan Yaritza Angeline Mercy Kairi Kourtney Krystal Carla Carter Mercedes Alannah Lina Sonia Kenia Everleigh Ivory Sloan Abril Alisha Katalina Carlie Lara Laurel Scarlette Carley Dixie Miya Micah Regan Samiyah Charlize Sharon Rosie Aviana Aleigha Gwyneth Sky Estella Hadlee Luz Patience Temperance Ingrid Raina Libby Jurnee Zahra Belen Jewel Anabel Marianna Renee Rory Elliott Karlie Saylor Deanna Freya Lilia Marjorie Sidney Tara Azaria Campbell Kai Ann Destinee Ariya Lilyanna Avianna Macey Shannon Lennon Saniya Haleigh Jolene Liv Oakley Esme Hunter Aliza Amalia Annalee Evalyn Giavanna Karis Kaylen Rayne Audriana Emerie Giada Harlee Kori Margot Abrielle Ellison Gwen Moriah Wynter Alisson Belinda Cristina Lillyana Neriah Rihanna Tamia Rivka Annabell Araceli Ayana Emmaline Giovanna Kylah Kailani Karissa Nahla Zainab Devyn Karma Marleigh Meadow India Kaiya Sarahi Audrianna Natalya Bayleigh Estelle Kaidence Kaylyn Magnolia Princess Avalyn Ireland Jayde Roxanne Alaysia Amia Astrid Karly Dalilah Makena Penny Ryann Charity Judith Kenna Tess Tinley Collins ); # surname data from 1990 US Census @surnames = qw( Smith Johnson Williams Jones Brown Davis Miller Wilson Moore Taylor Anderson Thomas Jackson White Harris Martin Thompson Garcia Martinez Robinson Clark Rodriguez Lewis Lee Walker Hall Allen Young Hernandez King Wright Lopez Hill Scott Green Adams Baker Gonzalez Nelson Carter Mitchell Perez Roberts Turner Phillips Campbell Parker Evans Edwards Collins Stewart Sanchez Morris Rogers Reed Cook Morgan Bell Murphy Bailey Rivera Cooper Richardson Cox Howard Ward Torres Peterson Gray Ramirez James Watson Brooks Kelly Sanders Price Bennett Wood Barnes Ross Henderson Coleman Jenkins Perry Powell Long Patterson Hughes Flores Washington Butler Simmons Foster Gonzales Bryant Alexander Russell Griffin Diaz Hayes Myers Ford Hamilton Graham Sullivan Wallace Woods Cole West Jordan Owens Reynolds Fisher Ellis Harrison Gibson Mcdonald Cruz Marshall Ortiz Gomez Murray Freeman Wells Webb Simpson Stevens Tucker Porter Hunter Hicks Crawford Henry Boyd Mason Morales Kennedy Warren Dixon Ramos Reyes Burns Gordon Shaw Holmes Rice Robertson Hunt Black Daniels Palmer Mills Nichols Grant Knight Ferguson Rose Stone Hawkins Dunn Perkins Hudson Spencer Gardner Stephens Payne Pierce Berry Matthews Arnold Wagner Willis Ray Watkins Olson Carroll Duncan Snyder Hart Cunningham Bradley Lane Andrews Ruiz Harper Fox Riley Armstrong Carpenter Weaver Greene Lawrence Elliott Chavez Sims Austin Peters Kelley Franklin Lawson Fields Gutierrez Ryan Schmidt Carr Vasquez Castillo Wheeler Chapman Oliver Montgomery Richards Williamson Johnston Banks Meyer Bishop Mccoy Howell Alvarez Morrison Hansen Fernandez Garza Harvey Little Burton Stanley Nguyen George Jacobs Reid Kim Fuller Lynch Dean Gilbert Garrett Romero Welch Larson Frazier Burke Hanson Day Mendoza Moreno Bowman Medina Fowler Brewer Hoffman Carlson Silva Pearson Holland Douglas Fleming Jensen Vargas Byrd Davidson Hopkins May Terry Herrera Wade Soto Walters Curtis Neal Caldwell Lowe Jennings Barnett Graves Jimenez Horton Shelton Barrett Obrien Castro Sutton Gregory Mckinney Lucas Miles Craig Rodriquez Chambers Holt Lambert Fletcher Watts Bates Hale Rhodes Pena Beck Newman Haynes Mcdaniel Mendez Bush Vaughn Parks Dawson Santiago Norris Hardy Love Steele Curry Powers Schultz Barker Guzman Page Munoz Ball Keller Chandler Weber Leonard Walsh Lyons Ramsey Wolfe Schneider Mullins Benson Sharp Bowen Daniel Barber Cummings Hines Baldwin Griffith Valdez Hubbard Salazar Reeves Warner Stevenson Burgess Santos Tate Cross Garner Mann Mack Moss Thornton Dennis Mcgee Farmer Delgado Aguilar Vega Glover Manning Cohen Harmon Rodgers Robbins Newton Todd Blair Higgins Ingram Reese Cannon Strickland Townsend Potter Goodwin Walton Rowe Hampton Ortega Patton Swanson Joseph Francis Goodman Maldonado Yates Becker Erickson Hodges Rios Conner Adkins Webster Norman Malone Hammond Flowers Cobb Moody Quinn Blake Maxwell Pope Floyd Osborne Paul Mccarthy Guerrero Lindsey Estrada Sandoval Gibbs Tyler Gross Fitzgerald Stokes Doyle Sherman Saunders Wise Colon Gill Alvarado Greer Padilla Simon Waters Nunez Ballard Schwartz Mcbride Houston Christensen Klein Pratt Briggs Parsons Mclaughlin Zimmerman French Buchanan Moran Copeland Roy Pittman Brady Mccormick Holloway Brock Poole Frank Logan Owen Bass Marsh Drake Wong Jefferson Park Morton Abbott Sparks Patrick Norton Huff Clayton Massey Lloyd Figueroa Carson Bowers Roberson Barton Tran Lamb Harrington Casey Boone Cortez Clarke Mathis Singleton Wilkins Cain Bryan Underwood Hogan Mckenzie Collier Luna Phelps Mcguire Allison Bridges Wilkerson Nash Summers Atkins Wilcox Pitts Conley Marquez Burnett Richard Cochran Chase Davenport Hood Gates Clay Ayala Sawyer Roman Vazquez Dickerson Hodge Acosta Flynn Espinoza Nicholson Monroe Wolf Morrow Kirk Randall Anthony Whitaker Oconnor Skinner Ware Molina Kirby Huffman Bradford Charles Gilmore Dominguez Oneal Bruce Lang Combs Kramer Heath Hancock Gallagher Gaines Shaffer Short Wiggins Mathews Mcclain Fischer Wall Small Melton Hensley Bond Dyer Cameron Grimes Contreras Christian Wyatt Baxter Snow Mosley Shepherd Larsen Hoover Beasley Glenn Petersen Whitehead Meyers Keith Garrison Vincent Shields Horn Savage Olsen Schroeder Hartman Woodard Mueller Kemp Deleon Booth Patel Calhoun Wiley Eaton Cline Navarro Harrell Lester Humphrey Parrish Duran Hutchinson Hess Dorsey Bullock Robles Beard Dalton Avila Vance Rich Blackwell York Johns Blankenship Trevino Salinas Campos Pruitt Moses Callahan Golden Montoya Hardin Guerra Mcdowell Carey Stafford Gallegos Henson Wilkinson Booker Merritt Miranda Atkinson Orr Decker Hobbs Preston Tanner Knox Pacheco Stephenson Glass Rojas Serrano Marks Hickman English Sweeney Strong Prince Mcclure Conway Walter Roth Maynard Farrell Lowery Hurst Nixon Weiss Trujillo Ellison Sloan Juarez Winters Mclean Randolph Leon Boyer Villarreal Mccall Gentry Carrillo Kent Ayers Lara Shannon Sexton Pace Hull Leblanc Browning Velasquez Leach Chang House Sellers Herring Noble Foley Bartlett Mercado Landry Durham Walls Barr Mckee Bauer Rivers Everett Bradshaw Pugh Velez Rush Estes Dodson Morse Sheppard Weeks Camacho Bean Barron Livingston Middleton Spears Branch Blevins Chen Kerr Mcconnell Hatfield Harding Ashley Solis Herman Frost Giles Blackburn William Pennington Woodward Finley Mcintosh Koch Best Solomon Mccullough Dudley Nolan Blanchard Rivas Brennan Mejia Kane Benton Joyce Buckley Haley Valentine Maddox Russo Mcknight Buck Moon Mcmillan Crosby Berg Dotson Mays Roach Church Chan Richmond Meadows Faulkner Oneill Knapp Kline Barry Ochoa Jacobson Gay Avery Hendricks Horne Shepard Hebert Cherry Cardenas Mcintyre Whitney Waller Holman Donaldson Cantu Terrell Morin Gillespie Fuentes Tillman Sanford Bentley Peck Key Salas Rollins Gamble Dickson Battle Santana Cabrera Cervantes Howe Hinton Hurley Spence Zamora Yang Mcneil Suarez Case Petty Gould Mcfarland Sampson Carver Bray Rosario Macdonald Stout Hester Melendez Dillon Farley Hopper Galloway Potts Bernard Joyner Stein Aguirre Osborn Mercer Bender Franco Rowland Sykes Benjamin Travis Pickett Crane Sears Mayo Dunlap Hayden Wilder Mckay Coffey Mccarty Ewing Cooley Vaughan Bonner Cotton Holder Stark Ferrell Cantrell Fulton Lynn Lott Calderon Rosa Pollard Hooper Burch Mullen Fry Riddle Levy David Duke Odonnell Guy Michael Britt Frederick Daugherty Berger Dillard Alston Jarvis Frye Riggs Chaney Odom Duffy Fitzpatrick Valenzuela Merrill Mayer Alford Mcpherson Acevedo Donovan Barrera Albert Cote Reilly Compton Raymond Mooney Mcgowan Craft Cleveland Clemons Wynn Nielsen Baird Stanton Snider Rosales Bright Witt Stuart Hays Holden Rutledge Kinney Clements Castaneda Slater Hahn Emerson Conrad Burks Delaney Pate Lancaster Sweet Justice Tyson Sharpe Whitfield Talley Macias Irwin Burris Ratliff Mccray Madden Kaufman Beach Goff Cash Bolton Mcfadden Levine Good Byers Kirkland Kidd Workman Carney Dale Mcleod Holcomb England Finch Head Burt Hendrix Sosa Haney Franks Sargent Nieves Downs Rasmussen Bird Hewitt Lindsay Le Foreman Valencia Oneil Delacruz Vinson Dejesus Hyde Forbes Gilliam Guthrie Wooten Huber Barlow Boyle Mcmahon Buckner Rocha Puckett Langley Knowles Cooke Velazquez Whitley Noel Vang ); $male_count = @male_first; $female_count = @female_first; $surname_count = @surnames; # vim: ts=4 sts=4 sw=4 et tw=75: __END__ =pod =encoding UTF-8 =head1 NAME Data::Fake::Names - Fake name data generators =head1 VERSION version 0.006 =head1 SYNOPSIS use Data::Fake::Names; fake_first_name()->(); # Fred, Mary, etc. fake_surname()->(); # Cooke, Boyle, etc. fake_name()->(); # Fred James Cooke, etc. =head1 DESCRIPTION This module provides fake data generators for person names. Currently, all names are English ASCII, drawn from US government "top names" lists. All functions are exported by default. =head1 FUNCTIONS =head2 fake_name $generator = fake_name(); Returns a generator that provides a randomly selected name with first, middle and last name parts. =head2 fake_first_name $generator = fake_first_name(); Returns a generator that provides a randomly selected first name. It will be split 50/50 between male and female names. =head2 fake_surname $generator = fake_surname(); Returns a generator that provides a randomly selected surname. =for Pod::Coverage BUILD =head1 AUTHOR David Golden =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut Data-Fake-0.006/lib/Data/Fake/Text.pm000644 000766 000024 00000010473 14016050606 017241 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; package Data::Fake::Text; # ABSTRACT: Fake text data generators our $VERSION = '0.006'; use Exporter 5.57 qw/import/; our @EXPORT = qw( fake_words fake_sentences fake_paragraphs ); use Data::Fake::Core qw/_transform/; my $LOREM; #pod =func fake_words #pod #pod $generator = fake_words(); # single "lorem" word #pod $generator = fake_words($n); # N "lorem" words, space separated #pod $generator = fake_words( fake_int(1, 3) ); # random number of them #pod #pod Returns a generator that provides space-separated L words as a #pod single scalar value. The argument is the number of words to return (or a #pod code reference to provide the number of words); the default is one. #pod #pod =cut sub fake_words { my ($count) = @_; $count = 1 unless defined $count; require Text::Lorem; $LOREM ||= Text::Lorem->new; return sub { scalar $LOREM->words( _transform($count) ) }; } #pod =func fake_sentences #pod #pod $generator = fake_sentences(); # single fake sentence #pod $generator = fake_sentences($n); # N sentences #pod $generator = fake_sentences( fake_int(1, 3) ); # random number of them #pod #pod Returns a generator that provides L sentences as a single #pod scalar value. The argument is the number of sentences to return (or a code #pod reference to provide the number of sentences); the default is one. #pod #pod =cut sub fake_sentences { my ($count) = @_; $count = 1 unless defined $count; return sub { "" } if $count == 0; require Text::Lorem; $LOREM ||= Text::Lorem->new; return sub { scalar $LOREM->sentences( _transform($count) ) }; } #pod =func fake_paragraphs #pod #pod $generator = fake_paragraphs(); # single fake paragraph #pod $generator = fake_paragraphs($n); # N paragraph #pod $generator = fake_paragraphs( fake_int(1, 3) ); # random number of them #pod #pod Returns a generator that provides L paragraphs as a single #pod scalar value. The argument is the number of paragraphs to return (or a #pod code reference to provide the number of paragraphs); the default is one. #pod #pod =cut sub fake_paragraphs { my ($count) = @_; $count = 1 unless defined $count; require Text::Lorem; $LOREM ||= Text::Lorem->new; return sub { scalar $LOREM->paragraphs( _transform($count) ) }; } 1; # vim: ts=4 sts=4 sw=4 et tw=75: __END__ =pod =encoding UTF-8 =head1 NAME Data::Fake::Text - Fake text data generators =head1 VERSION version 0.006 =head1 SYNOPSIS use Data::Fake::Text; fake_words(2)->(); fake_sentences(3)->(); fake_paragraphs(1)->(); =head1 DESCRIPTION This module provides fake data generators for random words and other textual data. All functions are exported by default. =head1 FUNCTIONS =head2 fake_words $generator = fake_words(); # single "lorem" word $generator = fake_words($n); # N "lorem" words, space separated $generator = fake_words( fake_int(1, 3) ); # random number of them Returns a generator that provides space-separated L words as a single scalar value. The argument is the number of words to return (or a code reference to provide the number of words); the default is one. =head2 fake_sentences $generator = fake_sentences(); # single fake sentence $generator = fake_sentences($n); # N sentences $generator = fake_sentences( fake_int(1, 3) ); # random number of them Returns a generator that provides L sentences as a single scalar value. The argument is the number of sentences to return (or a code reference to provide the number of sentences); the default is one. =head2 fake_paragraphs $generator = fake_paragraphs(); # single fake paragraph $generator = fake_paragraphs($n); # N paragraph $generator = fake_paragraphs( fake_int(1, 3) ); # random number of them Returns a generator that provides L paragraphs as a single scalar value. The argument is the number of paragraphs to return (or a code reference to provide the number of paragraphs); the default is one. =for Pod::Coverage BUILD =head1 AUTHOR David Golden =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut Data-Fake-0.006/lib/Data/Fake/Dates.pm000644 000766 000024 00000011043 14016050606 017347 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; package Data::Fake::Dates; # ABSTRACT: Fake date data generators our $VERSION = '0.006'; use Exporter 5.57 qw/import/; our @EXPORT = qw( fake_past_epoch fake_future_epoch fake_past_datetime fake_future_datetime ); use Time::Piece 1.27; # portability fixes sub _past { int( rand(time) ) } sub _future { my $now = time; return $now + int( rand($now) ); } #pod =func fake_past_epoch #pod #pod $generator = fake_past_epoch(); #pod #pod This returns a generator that gives a randomly-selected integer number of #pod seconds between the Unix epoch and the current time. #pod #pod =cut sub fake_past_epoch { \&_past } #pod =func fake_future_epoch #pod #pod $generator = fake_future_epoch(); #pod #pod This returns a generator that gives a randomly-selected integer number of #pod seconds between the the current time and a period as far into the future as #pod the Unix epoch is in the past (i.e. about 45 years as of 2015). #pod #pod =cut sub fake_future_epoch { \&_future } #pod =func fake_past_datetime #pod #pod $generator = fake_past_datetime(); #pod $generator = fake_past_datetime("%Y-%m-%d"); #pod $generator = fake_past_datetime($strftime_format); #pod #pod This returns a generator that selects a past datetime like #pod C does but formats it as a string using FreeBSD-style #pod C formats. (See L for details.) #pod #pod The default format is ISO8601 UTC "Zulu" time (C<%Y-%m-%dT%TZ>). #pod #pod =cut sub fake_past_datetime { my ($format) = @_; $format ||= "%Y-%m-%dT%H:%M:%SZ"; return sub { Time::Piece->strptime( _past(), "%s" )->strftime($format); }; } #pod =func fake_future_datetime #pod #pod $generator = fake_future_datetime(); #pod $generator = fake_future_datetime("%Y-%m-%d"); #pod $generator = fake_future_datetime($strftime_format); #pod #pod This returns a generator that selects a future datetime like #pod C does but formats it as a string using FreeBSD-style #pod C formats. (See L for details.) #pod #pod The default format is ISO8601 UTC "Zulu" time (C<%Y-%m-%dT%TZ>). #pod #pod =cut sub fake_future_datetime { my ($format) = @_; $format ||= "%Y-%m-%dT%H:%M:%SZ"; return sub { Time::Piece->strptime( _future(), "%s" )->strftime($format); }; } # vim: ts=4 sts=4 sw=4 et tw=75: __END__ =pod =encoding UTF-8 =head1 NAME Data::Fake::Dates - Fake date data generators =head1 VERSION version 0.006 =head1 SYNOPSIS use Data::Fake::Dates; $past = fake_past_epoch()->(); $future = fake_future_epoch()->(); $past = fake_past_datetime()->(); # ISO-8601 UTC $future = fake_future_datetime()->(); # ISO-8601 UTC $past = fake_past_datetime("%Y-%m-%d")->(); $future = fake_future_datetime("%Y-%m-%d")->(); =head1 DESCRIPTION This module provides fake data generators for past and future dates and times. All functions are exported by default. =head1 FUNCTIONS =head2 fake_past_epoch $generator = fake_past_epoch(); This returns a generator that gives a randomly-selected integer number of seconds between the Unix epoch and the current time. =head2 fake_future_epoch $generator = fake_future_epoch(); This returns a generator that gives a randomly-selected integer number of seconds between the the current time and a period as far into the future as the Unix epoch is in the past (i.e. about 45 years as of 2015). =head2 fake_past_datetime $generator = fake_past_datetime(); $generator = fake_past_datetime("%Y-%m-%d"); $generator = fake_past_datetime($strftime_format); This returns a generator that selects a past datetime like C does but formats it as a string using FreeBSD-style C formats. (See L for details.) The default format is ISO8601 UTC "Zulu" time (C<%Y-%m-%dT%TZ>). =head2 fake_future_datetime $generator = fake_future_datetime(); $generator = fake_future_datetime("%Y-%m-%d"); $generator = fake_future_datetime($strftime_format); This returns a generator that selects a future datetime like C does but formats it as a string using FreeBSD-style C formats. (See L for details.) The default format is ISO8601 UTC "Zulu" time (C<%Y-%m-%dT%TZ>). =for Pod::Coverage BUILD =head1 AUTHOR David Golden =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2015 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut Data-Fake-0.006/examples/synopsis.pl000644 000766 000024 00000000707 14016050606 017533 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; use Data::Fake qw/Core Names Text Dates/; use Data::Dumper; my $hero_factory = fake_hash( { name => fake_name(), battlecry => fake_sentences(1), birthday => fake_past_datetime("%Y-%m-%d"), friends => fake_array( fake_int( 2, 4 ), fake_name() ), gender => fake_pick(qw/Male Female Other/), } ); my $hero = $hero_factory->(); print Dumper($hero) . "\n"; Data-Fake-0.006/examples/urls.pl000644 000766 000024 00000000427 14016050606 016630 0ustar00davidstaff000000 000000 #!/usr/bin/env perl use 5.008001; use strict; use warnings; use Data::Fake qw/Core Internet/; my $fake_url = fake_template( "%s://%s%s/", fake_pick(qw(http https)), fake_pick( "", "www.", fake_digits("www##.") ), fake_domain(), ); print $fake_url->() . "\n"; Data-Fake-0.006/xt/author/000755 000766 000024 00000000000 14016050606 015422 5ustar00davidstaff000000 000000 Data-Fake-0.006/xt/author/critic.t000644 000766 000024 00000000201 14016050606 017055 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; use Test::Perl::Critic (-profile => "perlcritic.rc") x!! -e "perlcritic.rc"; all_critic_ok(); Data-Fake-0.006/xt/author/minimum-version.t000644 000766 000024 00000000152 14016050606 020743 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; use Test::MinimumVersion; all_minimum_version_ok( qq{5.010} ); Data-Fake-0.006/xt/author/test-version.t000644 000766 000024 00000000637 14016050606 020257 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 0, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Data-Fake-0.006/xt/author/00-compile.t000644 000766 000024 00000003115 14016050606 017454 0ustar00davidstaff000000 000000 use 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 8; my @module_files = ( 'Data/Fake.pm', 'Data/Fake/Company.pm', 'Data/Fake/Core.pm', 'Data/Fake/Dates.pm', 'Data/Fake/Internet.pm', 'Data/Fake/Names.pm', 'Data/Fake/Text.pm' ); # fake home for cpan-testers use File::Temp; local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); my @switches = ( -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 my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; 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) ); Data-Fake-0.006/xt/author/pod-syntax.t000644 000766 000024 00000000252 14016050606 017714 0ustar00davidstaff000000 000000 #!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Data-Fake-0.006/xt/author/portability.t000644 000766 000024 00000000322 14016050606 020146 0ustar00davidstaff000000 000000 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(); Data-Fake-0.006/xt/author/distmeta.t000644 000766 000024 00000000172 14016050606 017421 0ustar00davidstaff000000 000000 #!perl # This file was automatically generated by Dist::Zilla::Plugin::MetaTests. use Test::CPAN::Meta; meta_yaml_ok(); Data-Fake-0.006/xt/author/pod-spell.t000644 000766 000024 00000000671 14016050606 017512 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007005 use Test::Spelling 0.12; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ 50083900 Atria Chloé Company Core Data Dates David Examples Fake Glassdoor Golden Internet Joaquín José Kekoa Names Ricardo Signes Skelton Stuart Text dagolden declaratively jjatria lib rjbs stuarts submodules Data-Fake-0.006/xt/author/pod-coverage.t000644 000766 000024 00000000334 14016050606 020162 0ustar00davidstaff000000 000000 #!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' }); Data-Fake-0.006/t/core.t000644 000766 000024 00000017163 14016050606 015055 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; use Test::More 0.96; use Test::Deep; use Data::Fake::Core; subtest 'fake_pick' => sub { my %list = map { $_ => 1 } qw/one two three/; my $chooser = fake_pick( keys %list ); for ( 1 .. 10 ) { my $got = $chooser->(); ok( exists( $list{$got} ), "got key $got in list" ); } $chooser = fake_pick( fake_int( 10, 99 ), fake_float( 0, 1 ), ); for ( 1 .. 10 ) { my $got = $chooser->(); my $re = qr/^(?:0\.\d+|\d\d)$/; like( $got, $re, "fake_pick evaluated options as expected" ); } }; subtest 'fake_int' => sub { for my $min ( -1, 0 .. 2 ) { for my $max ( 3, 5.1, 10 ) { my $rand = fake_int( $min, $max ); for ( 1 .. 5 ) { my $got = $rand->(); ok( $got >= $min && $got <= $max, "random ($got) in range ($min - $max)" ); } } } }; subtest 'fake_float' => sub { for my $min ( -1.0, 0, 2.2 ) { for my $max ( 3, 5.1, 9.9 ) { my $rand = fake_float( $min, $max ); for ( 1 .. 5 ) { my $got = $rand->(); ok( $got >= $min && $got <= $max, "random ($got) in range ($min - $max)" ); } } } }; subtest 'fake_digits' => sub { for ( 1 .. 3 ) { my $got = fake_digits("###")->(); like( $got, qr/^\d+$/, "digit replacement ($got)" ); } my $got = fake_digits('\####')->(); like( $got, qr/^#\d+$/, "digit replacement 1 ($got)" ); $got = fake_digits('###-\####-\####-###')->(); like( $got, qr/^\d{3}-#\d{3}-#\d{3}-\d{3}$/, "digit replacement 2 ($got)" ); }; subtest 'fake_template' => sub { for ( 1 .. 3 ) { my $fcn = fake_template( "%s.%s.%s.%s", map { fake_int( 1, 254 ) } 1 .. 4 ); my $got = $fcn->(); like( $got, qr/^\d+\.\d+\.\d+\.\d+$/, "template replacement ($got)" ); } for ( 1 .. 3 ) { my $fcn = fake_template( '$%.2f', fake_float( 0, 10 ) ); my $got = $fcn->(); like( $got, qr/^\$\d\.\d\d$/, "template replacement 2 ($got)" ); } }; subtest 'fake_array' => sub { my $re = re(qr/^(?:Larry|Damian|Randall)/); for my $size ( 2 .. 4 ) { my $factory = fake_array( $size, fake_pick(qw/Larry Damian Randall/) ); my $expected = [ map { $re } 1 .. $size ]; for my $i ( 1 .. 3 ) { my $got = $factory->(); cmp_deeply( $got, $expected, "generated array $i of size $size" ); } } my $got = fake_array( 0, "Larry" )->(); cmp_deeply( $got, [], "generated array of size 0 is empty" ); $got = fake_array( 2, { first => 1 } )->(); cmp_deeply( $got, [ { first => 1 }, { first => 1 } ], "generated array with constant hash structure" ); $got = fake_array( 2, { name => fake_pick(qw/Larry Damian Randall/) } )->(); cmp_deeply( $got, [ { name => $re }, { name => $re } ], "generated array with dynamic hash structure" ); }; subtest 'variable size fake_array' => sub { my $re = qr/^(?:Larry|Damian|Randall)/; for my $max_size ( 3 .. 4 ) { for my $min_size ( 0 .. 2 ) { my $factory = fake_array( fake_int( $min_size, $max_size ), fake_pick(qw/Larry Damian Randall/) ); for my $i ( 1 .. 10 ) { my $got = $factory->(); my $length = @$got; ok( $length >= $min_size && $length <= $max_size, "var array size $length between $min_size and $max_size" ); for my $item (@$got) { like( $item, $re, "element value correct" ); } } } } }; subtest 'fake_hash' => sub { my $factory = fake_hash( { name => fake_pick(qw/Larry Damian Randall/), phone => fake_hash( { home => fake_pick( "555-1212", "555-1234" ), work => fake_pick( "666-1234", "666-7777" ), } ), color => 'blue', } ); my $expected = { name => re(qr/^(?:Larry|Damian|Randall)/), phone => { home => re(qr/^555/), work => re(qr/^666/), }, color => 'blue', }; for my $i ( 1 .. 5 ) { my $got = $factory->(); cmp_deeply( $got, $expected, "generated hash $i" ); } $factory = fake_hash( { name => fake_pick(qw/Larry Damian Randall/) }, fake_hash( { phone => { home => fake_pick( "555-1212", "555-1234" ), work => fake_pick( "666-1234", "666-7777" ), }, } ), { color => 'blue' }, ); cmp_deeply( $factory->(), $expected, "generated hash from fragments" ); }; subtest 'fake_binomial' => sub { my $factory = fake_binomial( 0.999, { name => 'Joe' }, {} ); my $result; for ( 1 .. 3 ) { my $temp = $factory->(); if ( keys %$temp ) { $result ||= $temp; } } cmp_deeply( $result, { name => 'Joe' }, "maybe hash, likely" ); $factory = fake_binomial( 0.001, { name => 'Joe' }, {} ); $result = undef; for ( 1 .. 3 ) { my $temp = $factory->(); if ( !keys %$temp ) { $result ||= $temp; } } cmp_deeply( $result, {}, "maybe hash, unlikely" ); }; subtest 'fake_weighted' => sub { my $factory = fake_weighted( [ 'one' => 999 ], [ 'two' => 1 ] ); my $result; for ( 1 .. 3 ) { my $temp = $factory->(); if ( $temp eq 'one' ) { $result ||= $temp; } } is( $result, 'one', "got most likely choice" ); fake_weighted( [ 'one' => 2 ], [ two => 1 ], [ three => 1 ], [ four => 1 ] ); }; subtest 'fake_join' => sub { my $factory = fake_join( ",", ( fake_int( 1, 10 ) ) x 2 ); my $got = $factory->(); like( $got, qr/^\d+,\d+$/, "got joined output ($got)" ); }; subtest 'fake_flatten' => sub { my $fake_people_picker = fake_pick(qw/Larry Damian Randall/); my $fake_pet_picker = fake_pick(qw/Dog Cat Horse Hippopotamus/); # with fake_array my $factory = fake_flatten( fake_array( fake_int( 1, 5 ), $fake_people_picker ) ); for my $i ( 1 .. 5 ) { my @got_array = $factory->(); ok( scalar @got_array > 0, 'array should have more than zero elements' ); ok( scalar @got_array < 6, 'array should have less than six elements' ); } # chain the factory into a fake_join $factory = fake_join( ',', $factory ); my $got = $factory->(); like( $got, qr/^(\w+,)*\w+$/, "got joined output ($got)" ); # with fake_hash my $people_pet_factory = fake_hash( { name => $fake_people_picker, pet => $fake_pet_picker, } ); my $expected = { name => re(qr/^(?:Larry|Damian|Randall)/), pet => re(qr/^(?:Dog|Cat|Horse|Hippopotamus)/) }; for my $i ( 1 .. 5 ) { my %flatten_hash = fake_flatten($people_pet_factory)->(); cmp_deeply( \%flatten_hash, $expected, "generated hash $i" ); } # a fake_array with fake_hash my $flatten_array_hash_generator = fake_flatten( fake_array( fake_int( 3, 10 ), $people_pet_factory ) ); for my $hash_ref ( $flatten_array_hash_generator->() ) { cmp_deeply( $hash_ref, $expected, "generated hash" ); } }; done_testing; # # This file is part of Data-Fake # # This software is Copyright (c) 2015 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # # vim: ts=4 sts=4 sw=4 et tw=75: Data-Fake-0.006/t/text.t000644 000766 000024 00000003577 14016050606 015115 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; use Test::More 0.96; use Test::Deep; use Data::Fake::Text; subtest 'fake_words' => sub { for my $i ( undef, 0 .. 5 ) { my @args = defined $i ? $i : (); my $got = fake_words(@args)->(); ok( defined($got), "word is defined" ); my $n = defined $i ? $i : 1; my $msg = "word list of length $n"; $msg .= " (default)" unless defined $i; is( scalar split( / /, $got ), $n, $msg ); } }; subtest 'fake_sentences' => sub { for my $i ( undef, 0 .. 5 ) { my @args = defined $i ? $i : (); my $got = fake_sentences(@args)->(); ok( defined($got), "sentence is defined" ); my $n = defined $i ? $i : 1; my $msg = "sentence list of length $n"; $msg .= " (default)" unless defined $i; my $count =()= ( $got =~ /\./g ); is( $count, $n, $msg ) or diag $got; } }; subtest 'fake_paragraphs' => sub { for my $i ( undef, 0 .. 5 ) { my @args = defined $i ? $i : (); my $got = fake_paragraphs(@args)->(); ok( defined($got), "paragraph is defined" ); my $n = defined $i ? ( $i == 0 ? 0 : 2 * $i - 1 ) : 1; my $msg = "paragraph list of length $n"; $msg .= " (default)" unless defined $i; my $count = scalar split /^/, $got; is( $count, $n, $msg ) or diag $got; } }; subtest 'scalar context' => sub { my @words = fake_words(2)->(); is(scalar(@words), 1, "words"); my @sentences = fake_sentences(2)->(); is(scalar(@sentences), 1, "sentences"); my @paragraphs = fake_paragraphs(2)->(); is(scalar(@paragraphs), 1, "paragraphs"); }; done_testing; # # This file is part of Data-Fake # # This software is Copyright (c) 2015 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # # vim: ts=4 sts=4 sw=4 et tw=75: Data-Fake-0.006/t/internet.t000644 000766 000024 00000001642 14016050606 015750 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; use Test::More 0.96; use Data::Fake::Internet; subtest 'fake_tld' => sub { for my $i ( 0 .. 5 ) { my $got = fake_tld->(); ok( defined($got), "TLD ($got) is defined" ); } }; subtest 'fake_domain' => sub { for my $i ( 0 .. 5 ) { my $got = fake_domain->(); ok( defined($got), "domain ($got) is defined" ); like( $got, qr/\w\.\w/, "domain has dot separator" ); } }; subtest 'fake_email' => sub { for my $i ( 0 .. 5 ) { my $got = fake_email->(); ok( defined($got), "email ($got) is defined" ); like( $got, qr/^\w+\.\w+\@\w+\.\w+/, "email has expected form" ); } }; done_testing; # # This file is part of Data-Fake # # This software is Copyright (c) 2015 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # # vim: ts=4 sts=4 sw=4 et tw=75: Data-Fake-0.006/t/api.t000644 000766 000024 00000003061 14016050606 014666 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; use Test::More 0.96; subtest 'Core' => sub { package Test1; use Data::Fake qw/Core/; Test::More::can_ok( "Test1", $_ ) for qw( fake_hash fake_array fake_pick fake_binomial fake_weighted fake_int fake_float fake_digits fake_template fake_join ); }; subtest 'Company' => sub { package Test2; use Data::Fake qw/Company/; Test::More::can_ok( "Test2", $_ ) for qw( fake_company fake_title ); }; subtest 'Text' => sub { package Test3; use Data::Fake qw/Text/; Test::More::can_ok( "Test3", $_ ) for qw( fake_words fake_sentences fake_paragraphs ); }; subtest 'Dates' => sub { package Test4; use Data::Fake qw/Dates/; Test::More::can_ok( "Test4", $_ ) for qw( fake_past_epoch fake_future_epoch fake_past_datetime fake_future_datetime ); }; subtest 'Internet' => sub { package Test5; use Data::Fake qw/Internet/; Test::More::can_ok( "Test5", $_ ) for qw( fake_tld fake_domain fake_email ); }; subtest 'Names' => sub { package Test6; use Data::Fake qw/Names/; Test::More::can_ok( "Test6", $_ ) for qw( fake_name fake_first_name fake_surname ); }; done_testing; # # This file is part of Data-Fake # # This software is Copyright (c) 2015 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # # vim: ts=4 sts=4 sw=4 et tw=75: Data-Fake-0.006/t/names.t000644 000766 000024 00000001600 14016050606 015215 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; use Test::More 0.96; use Test::Deep; use Data::Fake::Names; subtest 'fake_name' => sub { for my $i ( 0 .. 5 ) { my $got = fake_name->(); ok( defined($got), "name is defined" ); is( scalar split( / /, $got ), 3, "name ($got) has three parts" ); } }; subtest 'fake_surname' => sub { for my $i ( 0 .. 5 ) { my $got = fake_surname->(); ok( defined($got), "surname ($got) is defined" ); } }; subtest 'fake_first_name' => sub { for my $i ( 0 .. 5 ) { my $got = fake_first_name->(); ok( defined($got), "first name ($got) is defined" ); } }; done_testing; # # This file is part of Data-Fake # # This software is Copyright (c) 2015 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # # vim: ts=4 sts=4 sw=4 et tw=75: Data-Fake-0.006/t/dates.t000644 000766 000024 00000003161 14016050606 015216 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; use Test::More 0.96; use Test::Deep; use Data::Fake::Dates; subtest 'fake epochs' => sub { for my $i ( 0 .. 5 ) { my $got = fake_past_epoch->(); my $now = time(); like( $got, qr/^\d+$/, "fake_past_epoch looks like integer" ); ok( $got <= $now, "fake_past_epoch ($got) is in the past" ); } for my $i ( 0 .. 5 ) { my $now = time(); my $got = fake_future_epoch->(); like( $got, qr/^\d+$/, "fake_future_epoch looks like integer" ); ok( $got >= $now, "fake_future_epoch ($got) is in the future" ); } }; subtest 'fake datetimes' => sub { my $date_re = qr/\d{4}-\d{2}-\d{2}/; my $time_re = qr/\d{2}:\d{2}:\d{2}Z/; my $iso8601_re = qr/^${date_re}T${time_re}$/; for my $i ( 0 .. 5 ) { my $got = fake_past_datetime->(); like( $got, $iso8601_re, "fake_past_datetime ($got) looks like ISO-8601" ); } for my $i ( 0 .. 5 ) { my $now = time(); my $got = fake_future_datetime->(); like( $got, $iso8601_re, "fake_future_datetime ($got) looks like ISO-8601" ); } # formats my $got = fake_past_datetime("%Y-%m-%d")->(); like( $got, qr/^$date_re$/, "fake_past_datetime('%Y-%m-%d') ($got)" ); $got = fake_future_datetime("%Y-%m-%d")->(); like( $got, qr/^$date_re$/, "fake_future_datetime('%Y-%m-%d') ($got)" ); }; done_testing; # # This file is part of Data-Fake # # This software is Copyright (c) 2015 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # # vim: ts=4 sts=4 sw=4 et tw=75: Data-Fake-0.006/t/00-report-prereqs.t000644 000766 000024 00000013452 14016050606 017331 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.028 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'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $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 ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass('Reported prereqs'); # vim: ts=4 sts=4 sw=4 et: Data-Fake-0.006/t/company.t000644 000766 000024 00000001205 14016050606 015561 0ustar00davidstaff000000 000000 use 5.008001; use strict; use warnings; use Test::More 0.96; use Data::Fake::Company; subtest 'fake_title' => sub { for my $i ( 0 .. 5 ) { my $got = fake_title->(); ok( defined($got), "title ($got) is defined" ); } }; subtest 'fake_company' => sub { for my $i ( 0 .. 5 ) { my $got = fake_company->(); ok( defined($got), "company ($got) is defined" ); } }; done_testing; # # This file is part of Data-Fake # # This software is Copyright (c) 2015 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # # vim: ts=4 sts=4 sw=4 et tw=75: Data-Fake-0.006/t/00-report-prereqs.dd000644 000766 000024 00000005576 14016050606 017465 0ustar00davidstaff000000 000000 do { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '6.17', 'perl' => '5.008001' }, 'suggests' => { 'JSON::PP' => '2.27300' } }, 'develop' => { 'requires' => { 'Dist::Zilla' => '5', 'Dist::Zilla::PluginBundle::DAGOLDEN' => '0.072', 'File::Spec' => '0', 'File::Temp' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Pod::Coverage::TrustPod' => '0', 'Pod::Wordlist' => '0', 'Software::License::Apache_2_0' => '0', 'Test::CPAN::Meta' => '0', 'Test::MinimumVersion' => '0', 'Test::More' => '0', 'Test::Perl::Critic' => '0', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08', 'Test::Portability::Files' => '0', 'Test::Spelling' => '0.12', 'Test::Version' => '1' } }, 'runtime' => { 'requires' => { 'Carp' => '0', 'Exporter' => '5.57', 'Import::Into' => '1.002005', 'List::Util' => '0', 'Text::Lorem' => '0', 'Time::Piece' => '1.27', 'perl' => '5.008001', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'Test::Deep' => '0', 'Test::More' => '0.96', 'perl' => '5.008001' } } }; $x; }