lib-filter

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.281   2021-08-29  Released-By: PERLANCAR; Urgency: medium

	- Observe PERL_LIB_FILTER_DEBUG.

	- [ux] Make our hook an object, to show clearly when @INC is printed;
	  revert 'use no modules' commit.


0.280   2021-05-20  Released-By: PERLANCAR; Urgency: low

        - No functional changes.

	- [doc] Mention lib::noop.


0.27    2016-08-24  Released-By: PERLANCAR

	- No functional changes.

	- [test] Use overload.pm instead of base.pm when testing for core
	  module, because base.pm is dual-life.


0.26    2016-08-23  Released-By: PERLANCAR

        - No functional changes.

        - [test] Replace dumping all installed modules when diagnosing require
          test failure to just printing the require'd module's path.


0.25    2016-07-09  Released-By: PERLANCAR

        - No functional changes.

        - Document, add test and example for allow_is_recursive=1.

        - [doc] Fix typos in examples.


0.24    2016-07-08  Released-By: PERLANCAR

	- Also deduce caller package name from filename, this handles e.g.
	  Getopt::Long::Callback inside Getopt/Long.pm requiring other
	  modules.


0.23    2016-07-08  Released-By: PERLANCAR

	- Add option: allow_is_recursive.

	- Make it possible to disallow modules that are already loaded,
	  e.g. strict, warnings, Config, etc.

	- [doc] Mention File::Which::Patch::Hide.


0.22    2016-05-19  Released-By: PERLANCAR

        - No functional changes.

        - [test] Replace Module::List::WithPath with PERLANCAR::Module::List,
          make it optional.


0.21    2016-05-18  Released-By: PERLANCAR

	- Show error message "Can't locate FILE (...)" to fool Test::Needs.


0.20    2015-07-01  Released-By: PERLANCAR

	- No functional changes.

	- [doc] Rework documentation, present alternatives to using
	  lib::filter for some tasks.


0.19    2015-06-30  Released-By: PERLANCAR

	- Add lib::coreplus.


0.18    2015-06-29  Released-By: PERLANCAR

	- Update example because using 'allow_noncore=0 + allow some
	  non-core XS modules' doesn't work because the non-core XS modules
	  will still search for loadable object in @INC; instead we'll use
	  custom filter for this.

	- Add option: debug.


0.17    2015-06-28  Released-By: PERLANCAR

	- No functional changes.

	- [testing] Included Module::List::WithPath in t/lib/Module/List.pm
	  instead of t/lib/Module/List/WithPath.pm, derp.


0.16    2015-06-28  Released-By: PERLANCAR

	- No functional changes.

	- [testing] Replace Exporter with base, due to failure reports in
	  some system where Exporter is located in non-core dir [CT].


0.15    2015-06-28  Released-By: PERLANCAR

        - Add option: filter.


0.14    2015-06-28  Released-By: PERLANCAR

	- No functional changes.

	- [dist] Put Module::List::WithPath as TestSuggests to mark where
	  that module is used as prereq.


0.13    2015-06-28  Released-By: PERLANCAR

        - [testing] Print list of modules on failure to require.

        - [testing] Remove the use of Test::Exception (unused) and
          IPC::System::Options (replaced with plain system()) so that lib-filter
          now does not depend on any non-core modules.


0.12    2015-06-26  Released-By: PERLANCAR

	- No functional changes.

	- Allow running in perl 5.8.


0.11    2015-06-26  Released-By: PERLANCAR

	- [testing] Use dummy modules for most testing [GH#4].


0.10    2015-06-25  Released-By: PERLANCAR

        - [testing] Fix test failures.


0.09    2015-06-24  Released-By: PERLANCAR

        - [testing] Change tests to use external Perl interpreters instead of
          in-process, to isolate from internals of Test::More, etc.


0.08    2015-06-18  Released-By: PERLANCAR

	- No functional changes.

	- [testing] Preload Scalar::Util because it's used by Test::More (delay
	  loading).

	- [testing] Remove stacktrace printer.


0.07    2015-06-18  Released-By: PERLANCAR

        - No functional changes.

        - [testing] [build] Rebuild with updated/fixed stacktrace printer from
          Code::Embeddable.


0.06    2015-06-18  Released-By: PERLANCAR

        - [testing] Preload Test::Builder's prerequisites before loading Test::*
          (thanks Sinan Ünür).

        - [testing] Install a simple stacktrace printer in the tests, to help
          debug problems.

        - Doc tweaks.


0.05    2015-05-27  Released-By: PERLANCAR

        - No functional changes.

        - [testing] Fix tests [GH #2].

        - [testing] Add more tests.


0.04    2015-05-26  Released-By: PERLANCAR

        - Add lib::allow, lib::disallow.

        - Tweak POD & examples.

        - Reduce use of modules (we're now down to Config, strict, warnings; no
          more experimental).


0.03    2015-05-22  Released-By: PERLANCAR

        - Add unimport().

        - [testing] Add minimal tests.


0.02    2015-05-19  Released-By: PERLANCAR

	- No functional changes.

	- Fix/add examples in Synopsis.


0.01    2015-04-12  Released-By: PERLANCAR

        - First release.

LICENSE  view on Meta::CPAN

This software is copyright (c) 2021, 2016, 2015 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

Terms of the Perl programming language system itself

a) the GNU General Public License as published by the Free
   Software Foundation; either version 1, or (at your option) any
   later version, or
b) the "Artistic License"

--- The GNU General Public License, Version 1, February 1989 ---

This software is Copyright (c) 2021, 2016, 2015 by perlancar <perlancar@cpan.org>.

This is free software, licensed under:

  The GNU General Public License, Version 1, February 1989

                    GNU GENERAL PUBLIC LICENSE
                     Version 1, February 1989

 Copyright (C) 1989 Free Software Foundation, Inc.
 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The license agreements of most software companies try to keep users
at the mercy of those companies.  By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must tell them their rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  The precise terms and conditions for copying, distribution and
modification follow.

                    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License.  The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications.  Each
licensee is addressed as "you".

  1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program.  You may charge a fee for the physical act of
transferring a copy.

  2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:

    a) cause the modified files to carry prominent notices stating that
    you changed the files and the date of any change; and

    b) cause the whole of any work that you distribute or publish, that
    in whole or in part contains the Program or any part thereof, either
    with or without modifications, to be licensed at no charge to all
    third parties under the terms of this General Public License (except
    that you may choose to grant warranty protection to some or all
    third parties, at your option).

    c) If the modified program normally reads commands interactively when
    run, you must cause it, when started running for such interactive use
    in the simplest and most usual way, to print or display an
    announcement including an appropriate copyright notice and a notice
    that there is no warranty (or else, saying that you provide a
    warranty) and that users may redistribute the program under these
    conditions, and telling the user how to view a copy of this General
    Public License.

    d) You may charge a fee for the physical act of transferring a
    copy, and you may at your option offer warranty protection in
    exchange for a fee.

Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.

  3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:

    a) accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of
    Paragraphs 1 and 2 above; or,

    b) accompany it with a written offer, valid for at least three
    years, to give any third party free (except for a nominal charge
    for the cost of distribution) a complete machine-readable copy of the
    corresponding source code, to be distributed under the terms of
    Paragraphs 1 and 2 above; or,

    c) accompany it with the information you received as to where the
    corresponding source code may be obtained.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form alone.)

Source code for a work means the preferred form of the work for making
modifications to it.  For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.

  4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License.  However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.

  5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions.  You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.

  7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.

  8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

                            NO WARRANTY

  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

                     END OF TERMS AND CONDITIONS

        Appendix: How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.

  To do so, attach the following notices to the program.  It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 19yy  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA  02110-1301 USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) 19xx name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License.  Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the
  program `Gnomovision' (a program to direct compilers to make passes
  at assemblers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

That's all there is to it!


--- The Artistic License 1.0 ---

This software is Copyright (c) 2021, 2016, 2015 by perlancar <perlancar@cpan.org>.

This is free software, licensed under:

  The Artistic License 1.0

The Artistic License

Preamble

The intent of this document is to state the conditions under which a Package
may be copied, such that the Copyright Holder maintains some semblance of
artistic control over the development of the package, while giving the users of
the package the right to use and distribute the Package in a more-or-less
customary fashion, plus the right to make reasonable modifications.

Definitions:

  - "Package" refers to the collection of files distributed by the Copyright
    Holder, and derivatives of that collection of files created through
    textual modification. 
  - "Standard Version" refers to such a Package if it has not been modified,
    or has been modified in accordance with the wishes of the Copyright
    Holder. 
  - "Copyright Holder" is whoever is named in the copyright or copyrights for
    the package. 
  - "You" is you, if you're thinking about copying or distributing this Package.
  - "Reasonable copying fee" is whatever you can justify on the basis of media
    cost, duplication charges, time of people involved, and so on. (You will
    not be required to justify it to the Copyright Holder, but only to the
    computing community at large as a market that must bear the fee.) 
  - "Freely Available" means that no fee is charged for the item itself, though
    there may be fees involved in handling the item. It also means that
    recipients of the item may redistribute it under the same conditions they
    received it. 

1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.

2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such
a way shall still be considered the Standard Version.

3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:

  a) place your modifications in the Public Domain or otherwise make them
     Freely Available, such as by posting said modifications to Usenet or an
     equivalent medium, or placing the modifications on a major archive site
     such as ftp.uu.net, or by allowing the Copyright Holder to include your
     modifications in the Standard Version of the Package.

  b) use the modified Package only within your corporation or organization.

  c) rename any non-standard executables so the names do not conflict with
     standard executables, which must also be provided, and provide a separate
     manual page for each non-standard executable that clearly documents how it
     differs from the Standard Version.

  d) make other distribution arrangements with the Copyright Holder.

4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:

  a) distribute a Standard Version of the executables and library files,
     together with instructions (in the manual page or equivalent) on where to
     get the Standard Version.

  b) accompany the distribution with the machine-readable source of the Package
     with your modifications.

  c) accompany any non-standard executables with their corresponding Standard
     Version executables, giving the non-standard executables non-standard
     names, and clearly documenting the differences in manual pages (or
     equivalent), together with instructions on where to get the Standard
     Version.

  d) make other distribution arrangements with the Copyright Holder.

5. You may charge a reasonable copying fee for any distribution of this
Package.  You may charge any fee you choose for support of this Package. You
may not charge a fee for this Package itself. However, you may distribute this
Package in aggregate with other (possibly commercial) programs as part of a
larger (possibly commercial) software distribution provided that you do not
advertise this Package as a product of your own.

6. The scripts and library files supplied as input to or produced as output
from the programs of this Package do not automatically fall under the copyright
of this Package, but belong to whomever generated them, and may be sold
commercially, and may be aggregated with this Package.

7. C or perl subroutines supplied by you and linked into this Package shall not
be considered part of this Package.

8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.

9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

The End

MANIFEST  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.017.
Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
dist.ini
lib/lib/allow.pm
lib/lib/coreplus.pm
lib/lib/disallow.pm
lib/lib/filter.pm
t/00-compile.t
t/allow.t
t/author-critic.t
t/author-pod-coverage.t
t/author-pod-syntax.t
t/disallow.t
t/filter.t
t/lib/Bar.pm
t/lib/Baz.pm
t/lib/Foo.pm
t/lib/testlib.pl
weaver.ini

META.json  view on Meta::CPAN

{
   "abstract" : "Allow/disallow loading modules",
   "author" : [
      "perlancar <perlancar@cpan.org>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : 2
   },
   "name" : "lib-filter",
   "prereqs" : {
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         },
         "suggests" : {
            "JSON::PP" : "2.27300"
         }
      },
      "develop" : {
         "requires" : {
            "Pod::Coverage::TrustPod" : "0",
            "Test::Perl::Critic" : "0",
            "Test::Pod" : "1.41",
            "Test::Pod::Coverage" : "1.08"
         }
      },
      "runtime" : {
         "requires" : {
            "Config" : "0",
            "Module::CoreList" : "0",
            "strict" : "0",
            "warnings" : "0"
         }
      },
      "test" : {
         "requires" : {
            "File::Spec" : "0",
            "File::Temp" : "0.2307",
            "FindBin" : "0",
            "IO::Handle" : "0",
            "IPC::Open3" : "0",
            "Module::Path::More" : "0.32",
            "Test::More" : "0.98",
            "Test::Needs" : "0",
            "lib" : "0"
         }
      }
   },
   "provides" : {
      "lib::allow" : {
         "file" : "lib/lib/allow.pm",
         "version" : "0.281"
      },
      "lib::coreplus" : {
         "file" : "lib/lib/coreplus.pm",
         "version" : "0.281"
      },
      "lib::disallow" : {
         "file" : "lib/lib/disallow.pm",
         "version" : "0.281"
      },
      "lib::filter" : {
         "file" : "lib/lib/filter.pm",
         "version" : "0.281"
      }
   },
   "release_status" : "stable",
   "resources" : {
      "bugtracker" : {
         "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=lib-filter"
      },
      "homepage" : "https://metacpan.org/release/lib-filter",
      "repository" : {
         "type" : "git",
         "url" : "git://github.com/perlancar/perl-lib-filter.git",
         "web" : "https://github.com/perlancar/perl-lib-filter"
      }
   },
   "version" : "0.281",
   "x_Dist_Zilla" : {
      "perl" : {
         "version" : "5.034000"
      },
      "plugins" : [
         {
            "class" : "Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease",
            "name" : "@Author::PERLANCAR/PERLANCAR::CheckPendingRelease",
            "version" : "0.001"
         },
         {
            "class" : "Dist::Zilla::Plugin::GatherDir",
            "config" : {
               "Dist::Zilla::Plugin::GatherDir" : {
                  "exclude_filename" : [],
                  "exclude_match" : [],
                  "follow_symlinks" : 0,
                  "include_dotfiles" : 0,
                  "prefix" : "",
                  "prune_directory" : [],
                  "root" : "."
               }
            },
            "name" : "@Author::PERLANCAR/@Filter/GatherDir",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::PruneCruft",
            "name" : "@Author::PERLANCAR/@Filter/PruneCruft",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::ManifestSkip",
            "name" : "@Author::PERLANCAR/@Filter/ManifestSkip",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::MetaYAML",
            "name" : "@Author::PERLANCAR/@Filter/MetaYAML",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::License",
            "name" : "@Author::PERLANCAR/@Filter/License",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::PodCoverageTests",
            "name" : "@Author::PERLANCAR/@Filter/PodCoverageTests",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
            "name" : "@Author::PERLANCAR/@Filter/PodSyntaxTests",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::ExtraTests",
            "name" : "@Author::PERLANCAR/@Filter/ExtraTests",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::ExecDir",
            "name" : "@Author::PERLANCAR/@Filter/ExecDir",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::ShareDir",
            "name" : "@Author::PERLANCAR/@Filter/ShareDir",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::MakeMaker",
            "config" : {
               "Dist::Zilla::Role::TestRunner" : {
                  "default_jobs" : 1
               }
            },
            "name" : "@Author::PERLANCAR/@Filter/MakeMaker",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::Manifest",
            "name" : "@Author::PERLANCAR/@Filter/Manifest",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::ConfirmRelease",
            "name" : "@Author::PERLANCAR/@Filter/ConfirmRelease",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::ExecDir",
            "name" : "@Author::PERLANCAR/ExecDir script",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::PERLANCAR::BeforeBuild",
            "name" : "@Author::PERLANCAR/PERLANCAR::BeforeBuild",
            "version" : "0.605"
         },
         {
            "class" : "Dist::Zilla::Plugin::Rinci::AbstractFromMeta",
            "name" : "@Author::PERLANCAR/Rinci::AbstractFromMeta",
            "version" : "0.10"
         },
         {
            "class" : "Dist::Zilla::Plugin::PodnameFromFilename",
            "name" : "@Author::PERLANCAR/PodnameFromFilename",
            "version" : "0.02"
         },
         {
            "class" : "Dist::Zilla::Plugin::PERLANCAR::EnsurePrereqToSpec",
            "name" : "@Author::PERLANCAR/PERLANCAR::EnsurePrereqToSpec",
            "version" : "0.062"
         },
         {
            "class" : "Dist::Zilla::Plugin::PERLANCAR::MetaResources",
            "name" : "@Author::PERLANCAR/PERLANCAR::MetaResources",
            "version" : "0.043"
         },
         {
            "class" : "Dist::Zilla::Plugin::CheckChangeLog",
            "name" : "@Author::PERLANCAR/CheckChangeLog",
            "version" : "0.05"
         },
         {
            "class" : "Dist::Zilla::Plugin::CheckMetaResources",
            "name" : "@Author::PERLANCAR/CheckMetaResources",
            "version" : "0.001"
         },
         {
            "class" : "Dist::Zilla::Plugin::CheckSelfDependency",
            "config" : {
               "Dist::Zilla::Plugin::CheckSelfDependency" : {
                  "finder" : [
                     ":InstallModules"
                  ]
               },
               "Dist::Zilla::Role::ModuleMetadata" : {
                  "Module::Metadata" : "1.000037",
                  "version" : "0.006"
               }
            },
            "name" : "@Author::PERLANCAR/CheckSelfDependency",
            "version" : "0.011"
         },
         {
            "class" : "Dist::Zilla::Plugin::Git::Contributors",
            "config" : {
               "Dist::Zilla::Plugin::Git::Contributors" : {
                  "git_version" : "2.25.1",
                  "include_authors" : 0,
                  "include_releaser" : 1,
                  "order_by" : "name",
                  "paths" : []
               }
            },
            "name" : "@Author::PERLANCAR/Git::Contributors",
            "version" : "0.036"
         },
         {
            "class" : "Dist::Zilla::Plugin::CopyrightYearFromGit",
            "name" : "@Author::PERLANCAR/CopyrightYearFromGit",
            "version" : "0.009"
         },
         {
            "class" : "Dist::Zilla::Plugin::IfBuilt",
            "name" : "@Author::PERLANCAR/IfBuilt",
            "version" : "0.02"
         },
         {
            "class" : "Dist::Zilla::Plugin::MetaJSON",
            "name" : "@Author::PERLANCAR/MetaJSON",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::MetaConfig",
            "name" : "@Author::PERLANCAR/MetaConfig",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::MetaProvides::Package",
            "config" : {
               "Dist::Zilla::Plugin::MetaProvides::Package" : {
                  "finder_objects" : [
                     {
                        "class" : "Dist::Zilla::Plugin::FinderCode",
                        "name" : "@Author::PERLANCAR/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
                        "version" : "6.017"
                     }
                  ],
                  "include_underscores" : 0
               },
               "Dist::Zilla::Role::MetaProvider::Provider" : {
                  "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004",
                  "inherit_missing" : 1,
                  "inherit_version" : 1,
                  "meta_noindex" : 1
               },
               "Dist::Zilla::Role::ModuleMetadata" : {
                  "Module::Metadata" : "1.000037",
                  "version" : "0.006"
               }
            },
            "name" : "@Author::PERLANCAR/MetaProvides::Package",
            "version" : "2.004003"
         },
         {
            "class" : "Dist::Zilla::Plugin::PERLANCAR::Authority",
            "name" : "@Author::PERLANCAR/PERLANCAR::Authority",
            "version" : "0.001"
         },
         {
            "class" : "Dist::Zilla::Plugin::OurDate",
            "name" : "@Author::PERLANCAR/OurDate",
            "version" : "0.03"
         },
         {
            "class" : "Dist::Zilla::Plugin::OurDist",
            "name" : "@Author::PERLANCAR/OurDist",
            "version" : "0.02"
         },
         {
            "class" : "Dist::Zilla::Plugin::OurPkgVersion",
            "name" : "@Author::PERLANCAR/OurPkgVersion",
            "version" : "0.21"
         },
         {
            "class" : "Dist::Zilla::Plugin::PodWeaver",
            "config" : {
               "Dist::Zilla::Plugin::PodWeaver" : {
                  "finder" : [
                     ":InstallModules",
                     ":ExecFiles"
                  ],
                  "plugins" : [
                     {
                        "class" : "Pod::Weaver::Plugin::EnsurePod5",
                        "name" : "@CorePrep/EnsurePod5",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Plugin::H1Nester",
                        "name" : "@CorePrep/H1Nester",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Name",
                        "name" : "@Author::PERLANCAR/Name",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Version",
                        "name" : "@Author::PERLANCAR/Version",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Region",
                        "name" : "@Author::PERLANCAR/prelude",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Generic",
                        "name" : "SYNOPSIS",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Generic",
                        "name" : "DESCRIPTION",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Generic",
                        "name" : "OVERVIEW",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Collect",
                        "name" : "ATTRIBUTES",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Collect",
                        "name" : "METHODS",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Collect",
                        "name" : "FUNCTIONS",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Leftovers",
                        "name" : "@Author::PERLANCAR/Leftovers",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Region",
                        "name" : "@Author::PERLANCAR/postlude",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Completion::GetoptLongComplete",
                        "name" : "@Author::PERLANCAR/Completion::GetoptLongComplete",
                        "version" : "0.08"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Completion::GetoptLongSubcommand",
                        "name" : "@Author::PERLANCAR/Completion::GetoptLongSubcommand",
                        "version" : "0.04"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Completion::GetoptLongMore",
                        "name" : "@Author::PERLANCAR/Completion::GetoptLongMore",
                        "version" : "0.001"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Homepage::DefaultCPAN",
                        "name" : "@Author::PERLANCAR/Homepage::DefaultCPAN",
                        "version" : "0.05"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Source::DefaultGitHub",
                        "name" : "@Author::PERLANCAR/Source::DefaultGitHub",
                        "version" : "0.07"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Bugs::DefaultRT",
                        "name" : "@Author::PERLANCAR/Bugs::DefaultRT",
                        "version" : "0.06"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Authors",
                        "name" : "@Author::PERLANCAR/Authors",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Contributors",
                        "name" : "@Author::PERLANCAR/Contributors",
                        "version" : "0.009"
                     },
                     {
                        "class" : "Pod::Weaver::Section::PERLANCAR::Contributing",
                        "name" : "@Author::PERLANCAR/PERLANCAR/Contributing",
                        "version" : "0.292"
                     },
                     {
                        "class" : "Pod::Weaver::Section::Legal",
                        "name" : "@Author::PERLANCAR/Legal",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Plugin::Rinci",
                        "name" : "@Author::PERLANCAR/Rinci",
                        "version" : "0.780"
                     },
                     {
                        "class" : "Pod::Weaver::Plugin::AppendPrepend",
                        "name" : "@Author::PERLANCAR/AppendPrepend",
                        "version" : "0.01"
                     },
                     {
                        "class" : "Pod::Weaver::Plugin::EnsureUniqueSections",
                        "name" : "@Author::PERLANCAR/EnsureUniqueSections",
                        "version" : "0.163250"
                     },
                     {
                        "class" : "Pod::Weaver::Plugin::SingleEncoding",
                        "name" : "@Author::PERLANCAR/SingleEncoding",
                        "version" : "4.017"
                     },
                     {
                        "class" : "Pod::Weaver::Plugin::PERLANCAR::SortSections",
                        "name" : "@Author::PERLANCAR/PERLANCAR::SortSections",
                        "version" : "0.082"
                     }
                  ]
               }
            },
            "name" : "@Author::PERLANCAR/PodWeaver",
            "version" : "4.008"
         },
         {
            "class" : "Dist::Zilla::Plugin::PruneFiles",
            "name" : "@Author::PERLANCAR/PruneFiles",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::Pod2Readme",
            "name" : "@Author::PERLANCAR/Pod2Readme",
            "version" : "0.004"
         },
         {
            "class" : "Dist::Zilla::Plugin::Rinci::AddPrereqs",
            "name" : "@Author::PERLANCAR/Rinci::AddPrereqs",
            "version" : "0.145"
         },
         {
            "class" : "Dist::Zilla::Plugin::Rinci::AddToDb",
            "name" : "@Author::PERLANCAR/Rinci::AddToDb",
            "version" : "0.020"
         },
         {
            "class" : "Dist::Zilla::Plugin::Rinci::EmbedValidator",
            "name" : "@Author::PERLANCAR/Rinci::EmbedValidator",
            "version" : "0.251"
         },
         {
            "class" : "Dist::Zilla::Plugin::SetScriptShebang",
            "name" : "@Author::PERLANCAR/SetScriptShebang",
            "version" : "0.01"
         },
         {
            "class" : "Dist::Zilla::Plugin::Test::Compile",
            "config" : {
               "Dist::Zilla::Plugin::Test::Compile" : {
                  "bail_out_on_fail" : 0,
                  "fail_on_warning" : "author",
                  "fake_home" : 0,
                  "filename" : "t/00-compile.t",
                  "module_finder" : [
                     ":InstallModules"
                  ],
                  "needs_display" : 0,
                  "phase" : "test",
                  "script_finder" : [
                     ":PerlExecFiles"
                  ],
                  "skips" : [],
                  "switch" : []
               }
            },
            "name" : "@Author::PERLANCAR/Test::Compile",
            "version" : "2.058"
         },
         {
            "class" : "Dist::Zilla::Plugin::Test::Perl::Critic::Subset",
            "config" : {
               "Dist::Zilla::Plugin::Test::Perl::Critic::Subset" : {
                  "finder" : [
                     ":ExecFiles",
                     ":InstallModules",
                     ":TestFiles"
                  ]
               }
            },
            "name" : "@Author::PERLANCAR/Test::Perl::Critic::Subset",
            "version" : "3.001.006"
         },
         {
            "class" : "Dist::Zilla::Plugin::Test::Rinci",
            "name" : "@Author::PERLANCAR/Test::Rinci",
            "version" : "0.040"
         },
         {
            "class" : "Dist::Zilla::Plugin::StaticInstall",
            "config" : {
               "Dist::Zilla::Plugin::StaticInstall" : {
                  "dry_run" : 0,
                  "mode" : "on"
               }
            },
            "name" : "@Author::PERLANCAR/StaticInstall",
            "version" : "0.012"
         },
         {
            "class" : "Dist::Zilla::Plugin::EnsureSQLSchemaVersionedTest",
            "name" : "@Author::PERLANCAR/EnsureSQLSchemaVersionedTest",
            "version" : "0.03"
         },
         {
            "class" : "Dist::Zilla::Plugin::Acme::CPANModules::Blacklist",
            "name" : "@Author::PERLANCAR/Acme::CPANModules::Blacklist",
            "version" : "0.001"
         },
         {
            "class" : "Dist::Zilla::Plugin::Prereqs::EnsureVersion",
            "name" : "@Author::PERLANCAR/Prereqs::EnsureVersion",
            "version" : "0.050"
         },
         {
            "class" : "Dist::Zilla::Plugin::Prereqs::CheckCircular",
            "name" : "@Author::PERLANCAR/Prereqs::CheckCircular",
            "version" : "0.006"
         },
         {
            "class" : "Dist::Zilla::Plugin::UploadToCPAN::WWWPAUSESimple",
            "name" : "@Author::PERLANCAR/UploadToCPAN::WWWPAUSESimple",
            "version" : "0.04"
         },
         {
            "class" : "Dist::Zilla::Plugin::Prereqs",
            "config" : {
               "Dist::Zilla::Plugin::Prereqs" : {
                  "phase" : "test",
                  "type" : "requires"
               }
            },
            "name" : "TestRequires",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::Prereqs",
            "config" : {
               "Dist::Zilla::Plugin::Prereqs" : {
                  "phase" : "test",
                  "type" : "recommends"
               }
            },
            "name" : "TestRecommends",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::Prereqs",
            "config" : {
               "Dist::Zilla::Plugin::Prereqs" : {
                  "phase" : "runtime",
                  "type" : "requires"
               }
            },
            "name" : "Prereqs",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":InstallModules",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":IncModules",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":TestFiles",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":ExtraTestFiles",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":ExecFiles",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":PerlExecFiles",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":ShareFiles",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":MainModule",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":AllFiles",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":NoFiles",
            "version" : "6.017"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : "@Author::PERLANCAR/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
            "version" : "6.017"
         }
      ],
      "zilla" : {
         "class" : "Dist::Zilla::Dist::Builder",
         "config" : {
            "is_trial" : 0
         },
         "version" : "6.017"
      }
   },
   "x_authority" : "cpan:PERLANCAR",
   "x_contributors" : [
      "A. Sinan Unur <nanis@cpan.org>",
      "Olivier Mengu\u00e9 <dolmen@cpan.org>"
   ],
   "x_generated_by_perl" : "v5.34.0",
   "x_serialization_backend" : "Cpanel::JSON::XS version 4.26",
   "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later",
   "x_static_install" : 1
}

META.yml  view on Meta::CPAN

---
abstract: 'Allow/disallow loading modules'
author:
  - 'perlancar <perlancar@cpan.org>'
build_requires:
  File::Spec: '0'
  File::Temp: '0.2307'
  FindBin: '0'
  IO::Handle: '0'
  IPC::Open3: '0'
  Module::Path::More: '0.32'
  Test::More: '0.98'
  Test::Needs: '0'
  lib: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: lib-filter
provides:
  lib::allow:
    file: lib/lib/allow.pm
    version: '0.281'
  lib::coreplus:
    file: lib/lib/coreplus.pm
    version: '0.281'
  lib::disallow:
    file: lib/lib/disallow.pm
    version: '0.281'
  lib::filter:
    file: lib/lib/filter.pm
    version: '0.281'
requires:
  Config: '0'
  Module::CoreList: '0'
  strict: '0'
  warnings: '0'
resources:
  bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=lib-filter
  homepage: https://metacpan.org/release/lib-filter
  repository: git://github.com/perlancar/perl-lib-filter.git
version: '0.281'
x_Dist_Zilla:
  perl:
    version: '5.034000'
  plugins:
    -
      class: Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease
      name: '@Author::PERLANCAR/PERLANCAR::CheckPendingRelease'
      version: '0.001'
    -
      class: Dist::Zilla::Plugin::GatherDir
      config:
        Dist::Zilla::Plugin::GatherDir:
          exclude_filename: []
          exclude_match: []
          follow_symlinks: 0
          include_dotfiles: 0
          prefix: ''
          prune_directory: []
          root: .
      name: '@Author::PERLANCAR/@Filter/GatherDir'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::PruneCruft
      name: '@Author::PERLANCAR/@Filter/PruneCruft'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::ManifestSkip
      name: '@Author::PERLANCAR/@Filter/ManifestSkip'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::MetaYAML
      name: '@Author::PERLANCAR/@Filter/MetaYAML'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::License
      name: '@Author::PERLANCAR/@Filter/License'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::PodCoverageTests
      name: '@Author::PERLANCAR/@Filter/PodCoverageTests'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::PodSyntaxTests
      name: '@Author::PERLANCAR/@Filter/PodSyntaxTests'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::ExtraTests
      name: '@Author::PERLANCAR/@Filter/ExtraTests'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::ExecDir
      name: '@Author::PERLANCAR/@Filter/ExecDir'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::ShareDir
      name: '@Author::PERLANCAR/@Filter/ShareDir'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::MakeMaker
      config:
        Dist::Zilla::Role::TestRunner:
          default_jobs: 1
      name: '@Author::PERLANCAR/@Filter/MakeMaker'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::Manifest
      name: '@Author::PERLANCAR/@Filter/Manifest'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::ConfirmRelease
      name: '@Author::PERLANCAR/@Filter/ConfirmRelease'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::ExecDir
      name: '@Author::PERLANCAR/ExecDir script'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::PERLANCAR::BeforeBuild
      name: '@Author::PERLANCAR/PERLANCAR::BeforeBuild'
      version: '0.605'
    -
      class: Dist::Zilla::Plugin::Rinci::AbstractFromMeta
      name: '@Author::PERLANCAR/Rinci::AbstractFromMeta'
      version: '0.10'
    -
      class: Dist::Zilla::Plugin::PodnameFromFilename
      name: '@Author::PERLANCAR/PodnameFromFilename'
      version: '0.02'
    -
      class: Dist::Zilla::Plugin::PERLANCAR::EnsurePrereqToSpec
      name: '@Author::PERLANCAR/PERLANCAR::EnsurePrereqToSpec'
      version: '0.062'
    -
      class: Dist::Zilla::Plugin::PERLANCAR::MetaResources
      name: '@Author::PERLANCAR/PERLANCAR::MetaResources'
      version: '0.043'
    -
      class: Dist::Zilla::Plugin::CheckChangeLog
      name: '@Author::PERLANCAR/CheckChangeLog'
      version: '0.05'
    -
      class: Dist::Zilla::Plugin::CheckMetaResources
      name: '@Author::PERLANCAR/CheckMetaResources'
      version: '0.001'
    -
      class: Dist::Zilla::Plugin::CheckSelfDependency
      config:
        Dist::Zilla::Plugin::CheckSelfDependency:
          finder:
            - ':InstallModules'
        Dist::Zilla::Role::ModuleMetadata:
          Module::Metadata: '1.000037'
          version: '0.006'
      name: '@Author::PERLANCAR/CheckSelfDependency'
      version: '0.011'
    -
      class: Dist::Zilla::Plugin::Git::Contributors
      config:
        Dist::Zilla::Plugin::Git::Contributors:
          git_version: 2.25.1
          include_authors: 0
          include_releaser: 1
          order_by: name
          paths: []
      name: '@Author::PERLANCAR/Git::Contributors'
      version: '0.036'
    -
      class: Dist::Zilla::Plugin::CopyrightYearFromGit
      name: '@Author::PERLANCAR/CopyrightYearFromGit'
      version: '0.009'
    -
      class: Dist::Zilla::Plugin::IfBuilt
      name: '@Author::PERLANCAR/IfBuilt'
      version: '0.02'
    -
      class: Dist::Zilla::Plugin::MetaJSON
      name: '@Author::PERLANCAR/MetaJSON'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::MetaConfig
      name: '@Author::PERLANCAR/MetaConfig'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::MetaProvides::Package
      config:
        Dist::Zilla::Plugin::MetaProvides::Package:
          finder_objects:
            -
              class: Dist::Zilla::Plugin::FinderCode
              name: '@Author::PERLANCAR/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
              version: '6.017'
          include_underscores: 0
        Dist::Zilla::Role::MetaProvider::Provider:
          $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004'
          inherit_missing: '1'
          inherit_version: '1'
          meta_noindex: '1'
        Dist::Zilla::Role::ModuleMetadata:
          Module::Metadata: '1.000037'
          version: '0.006'
      name: '@Author::PERLANCAR/MetaProvides::Package'
      version: '2.004003'
    -
      class: Dist::Zilla::Plugin::PERLANCAR::Authority
      name: '@Author::PERLANCAR/PERLANCAR::Authority'
      version: '0.001'
    -
      class: Dist::Zilla::Plugin::OurDate
      name: '@Author::PERLANCAR/OurDate'
      version: '0.03'
    -
      class: Dist::Zilla::Plugin::OurDist
      name: '@Author::PERLANCAR/OurDist'
      version: '0.02'
    -
      class: Dist::Zilla::Plugin::OurPkgVersion
      name: '@Author::PERLANCAR/OurPkgVersion'
      version: '0.21'
    -
      class: Dist::Zilla::Plugin::PodWeaver
      config:
        Dist::Zilla::Plugin::PodWeaver:
          finder:
            - ':InstallModules'
            - ':ExecFiles'
          plugins:
            -
              class: Pod::Weaver::Plugin::EnsurePod5
              name: '@CorePrep/EnsurePod5'
              version: '4.017'
            -
              class: Pod::Weaver::Plugin::H1Nester
              name: '@CorePrep/H1Nester'
              version: '4.017'
            -
              class: Pod::Weaver::Section::Name
              name: '@Author::PERLANCAR/Name'
              version: '4.017'
            -
              class: Pod::Weaver::Section::Version
              name: '@Author::PERLANCAR/Version'
              version: '4.017'
            -
              class: Pod::Weaver::Section::Region
              name: '@Author::PERLANCAR/prelude'
              version: '4.017'
            -
              class: Pod::Weaver::Section::Generic
              name: SYNOPSIS
              version: '4.017'
            -
              class: Pod::Weaver::Section::Generic
              name: DESCRIPTION
              version: '4.017'
            -
              class: Pod::Weaver::Section::Generic
              name: OVERVIEW
              version: '4.017'
            -
              class: Pod::Weaver::Section::Collect
              name: ATTRIBUTES
              version: '4.017'
            -
              class: Pod::Weaver::Section::Collect
              name: METHODS
              version: '4.017'
            -
              class: Pod::Weaver::Section::Collect
              name: FUNCTIONS
              version: '4.017'
            -
              class: Pod::Weaver::Section::Leftovers
              name: '@Author::PERLANCAR/Leftovers'
              version: '4.017'
            -
              class: Pod::Weaver::Section::Region
              name: '@Author::PERLANCAR/postlude'
              version: '4.017'
            -
              class: Pod::Weaver::Section::Completion::GetoptLongComplete
              name: '@Author::PERLANCAR/Completion::GetoptLongComplete'
              version: '0.08'
            -
              class: Pod::Weaver::Section::Completion::GetoptLongSubcommand
              name: '@Author::PERLANCAR/Completion::GetoptLongSubcommand'
              version: '0.04'
            -
              class: Pod::Weaver::Section::Completion::GetoptLongMore
              name: '@Author::PERLANCAR/Completion::GetoptLongMore'
              version: '0.001'
            -
              class: Pod::Weaver::Section::Homepage::DefaultCPAN
              name: '@Author::PERLANCAR/Homepage::DefaultCPAN'
              version: '0.05'
            -
              class: Pod::Weaver::Section::Source::DefaultGitHub
              name: '@Author::PERLANCAR/Source::DefaultGitHub'
              version: '0.07'
            -
              class: Pod::Weaver::Section::Bugs::DefaultRT
              name: '@Author::PERLANCAR/Bugs::DefaultRT'
              version: '0.06'
            -
              class: Pod::Weaver::Section::Authors
              name: '@Author::PERLANCAR/Authors'
              version: '4.017'
            -
              class: Pod::Weaver::Section::Contributors
              name: '@Author::PERLANCAR/Contributors'
              version: '0.009'
            -
              class: Pod::Weaver::Section::PERLANCAR::Contributing
              name: '@Author::PERLANCAR/PERLANCAR/Contributing'
              version: '0.292'
            -
              class: Pod::Weaver::Section::Legal
              name: '@Author::PERLANCAR/Legal'
              version: '4.017'
            -
              class: Pod::Weaver::Plugin::Rinci
              name: '@Author::PERLANCAR/Rinci'
              version: '0.780'
            -
              class: Pod::Weaver::Plugin::AppendPrepend
              name: '@Author::PERLANCAR/AppendPrepend'
              version: '0.01'
            -
              class: Pod::Weaver::Plugin::EnsureUniqueSections
              name: '@Author::PERLANCAR/EnsureUniqueSections'
              version: '0.163250'
            -
              class: Pod::Weaver::Plugin::SingleEncoding
              name: '@Author::PERLANCAR/SingleEncoding'
              version: '4.017'
            -
              class: Pod::Weaver::Plugin::PERLANCAR::SortSections
              name: '@Author::PERLANCAR/PERLANCAR::SortSections'
              version: '0.082'
      name: '@Author::PERLANCAR/PodWeaver'
      version: '4.008'
    -
      class: Dist::Zilla::Plugin::PruneFiles
      name: '@Author::PERLANCAR/PruneFiles'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::Pod2Readme
      name: '@Author::PERLANCAR/Pod2Readme'
      version: '0.004'
    -
      class: Dist::Zilla::Plugin::Rinci::AddPrereqs
      name: '@Author::PERLANCAR/Rinci::AddPrereqs'
      version: '0.145'
    -
      class: Dist::Zilla::Plugin::Rinci::AddToDb
      name: '@Author::PERLANCAR/Rinci::AddToDb'
      version: '0.020'
    -
      class: Dist::Zilla::Plugin::Rinci::EmbedValidator
      name: '@Author::PERLANCAR/Rinci::EmbedValidator'
      version: '0.251'
    -
      class: Dist::Zilla::Plugin::SetScriptShebang
      name: '@Author::PERLANCAR/SetScriptShebang'
      version: '0.01'
    -
      class: Dist::Zilla::Plugin::Test::Compile
      config:
        Dist::Zilla::Plugin::Test::Compile:
          bail_out_on_fail: '0'
          fail_on_warning: author
          fake_home: 0
          filename: t/00-compile.t
          module_finder:
            - ':InstallModules'
          needs_display: 0
          phase: test
          script_finder:
            - ':PerlExecFiles'
          skips: []
          switch: []
      name: '@Author::PERLANCAR/Test::Compile'
      version: '2.058'
    -
      class: Dist::Zilla::Plugin::Test::Perl::Critic::Subset
      config:
        Dist::Zilla::Plugin::Test::Perl::Critic::Subset:
          finder:
            - ':ExecFiles'
            - ':InstallModules'
            - ':TestFiles'
      name: '@Author::PERLANCAR/Test::Perl::Critic::Subset'
      version: 3.001.006
    -
      class: Dist::Zilla::Plugin::Test::Rinci
      name: '@Author::PERLANCAR/Test::Rinci'
      version: '0.040'
    -
      class: Dist::Zilla::Plugin::StaticInstall
      config:
        Dist::Zilla::Plugin::StaticInstall:
          dry_run: 0
          mode: on
      name: '@Author::PERLANCAR/StaticInstall'
      version: '0.012'
    -
      class: Dist::Zilla::Plugin::EnsureSQLSchemaVersionedTest
      name: '@Author::PERLANCAR/EnsureSQLSchemaVersionedTest'
      version: '0.03'
    -
      class: Dist::Zilla::Plugin::Acme::CPANModules::Blacklist
      name: '@Author::PERLANCAR/Acme::CPANModules::Blacklist'
      version: '0.001'
    -
      class: Dist::Zilla::Plugin::Prereqs::EnsureVersion
      name: '@Author::PERLANCAR/Prereqs::EnsureVersion'
      version: '0.050'
    -
      class: Dist::Zilla::Plugin::Prereqs::CheckCircular
      name: '@Author::PERLANCAR/Prereqs::CheckCircular'
      version: '0.006'
    -
      class: Dist::Zilla::Plugin::UploadToCPAN::WWWPAUSESimple
      name: '@Author::PERLANCAR/UploadToCPAN::WWWPAUSESimple'
      version: '0.04'
    -
      class: Dist::Zilla::Plugin::Prereqs
      config:
        Dist::Zilla::Plugin::Prereqs:
          phase: test
          type: requires
      name: TestRequires
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::Prereqs
      config:
        Dist::Zilla::Plugin::Prereqs:
          phase: test
          type: recommends
      name: TestRecommends
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::Prereqs
      config:
        Dist::Zilla::Plugin::Prereqs:
          phase: runtime
          type: requires
      name: Prereqs
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':InstallModules'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':IncModules'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':TestFiles'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':ExtraTestFiles'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':ExecFiles'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':PerlExecFiles'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':ShareFiles'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':MainModule'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':AllFiles'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':NoFiles'
      version: '6.017'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: '@Author::PERLANCAR/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
      version: '6.017'
  zilla:
    class: Dist::Zilla::Dist::Builder
    config:
      is_trial: '0'
    version: '6.017'
x_authority: cpan:PERLANCAR
x_contributors:
  - 'A. Sinan Unur <nanis@cpan.org>'
  - 'Olivier Mengué <dolmen@cpan.org>'
x_generated_by_perl: v5.34.0
x_serialization_backend: 'YAML::Tiny version 1.73'
x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
x_static_install: 1

Makefile.PL  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.017.
use strict;
use warnings;



use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Allow/disallow loading modules",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "lib-filter",
  "LICENSE" => "perl",
  "NAME" => "lib::filter",
  "PREREQ_PM" => {
    "Config" => 0,
    "Module::CoreList" => 0,
    "strict" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {
    "File::Spec" => 0,
    "File::Temp" => "0.2307",
    "FindBin" => 0,
    "IO::Handle" => 0,
    "IPC::Open3" => 0,
    "Module::Path::More" => "0.32",
    "Test::More" => "0.98",
    "Test::Needs" => 0,
    "lib" => 0
  },
  "VERSION" => "0.281",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


my %FallbackPrereqs = (
  "Config" => 0,
  "File::Spec" => 0,
  "File::Temp" => "0.2307",
  "FindBin" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,
  "Module::CoreList" => 0,
  "Module::Path::More" => "0.32",
  "Test::More" => "0.98",
  "Test::Needs" => 0,
  "lib" => 0,
  "strict" => 0,
  "warnings" => 0
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};
  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}

delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };

WriteMakefile(%WriteMakefileArgs);

README  view on Meta::CPAN

NAME
    lib::filter - Allow/disallow loading modules

VERSION
    This document describes version 0.281 of lib::filter (from Perl
    distribution lib-filter), released on 2021-08-29.

SYNOPSIS
     use lib::filter %opts;

DESCRIPTION
    lib::filter lets you allow/disallow loading modules using some rules. It
    works by installing a coderef in @INC (and additionally by pruning some
    entries in @INC). The main use-case for this pragma is for testing.

    It has been pointed out to me that for some tasks, alternatives to using
    this module exist, so I'll be presenting those in the examples below.

    *   To disallow loading any module:

         % perl -Mlib::filter=allow_core,0,allow_noncore,0 yourscript.pl

        You can also use lib::none for this, or simply empty @INC yourself,
        e.g.:

         {
             local @INC = ();
             ...
         }

        To no-op instead of disallowing, see lib::noop::all.

    *   To allow only core modules:

        For example for testing a fatpacked script (see App::FatPacker):

         % perl -Mlib::filter=allow_noncore,0 yourscript.pl

        You can also use lib::core::only for this, which comes with the
        App::FatPacker distribution.

    *   To only allow a specific set of modules:

         % perl -Mlib::filter=allow_core,0,allow_noncore,0,allow,'XSLoader;List::Util' yourscript.pl

        To no-op instead of disallowing, see lib::noop::except.

    *   To allow core modules plus some additional modules:

        For example to test a fatpacked script that might still require some
        XS modules:

         # allow additional modules by pattern
         % perl -Mlib::filter=allow_noncore,0,allow_re,'^DateTime::.*' yourscript.pl

         # allow additional modules listed in a file
         % perl -Mlib::filter=allow_noncore,0,allow_list,'/tmp/allow.txt' yourscript.pl

         # allow core modules plus additional modules found in some dirs
         % perl -Mlib::filter=allow_noncore,0,extra_inc,'.:proj/lib' yourscript.pl

         # allow some non-core XS modules
         % perl -MModule::CoreList -Mlib::filter=filter,'sub{ return 1 if Module::CoreList->is_core($_); return 1 if m!Clone|Acme/Damn!; 0' yourscript.pl
         % perl -Mlib::coreplus=Clone,Acme::Damn yourscript.pl

        Alternatively, you can also test by preloading the additional
        modules before using lib::core::only:

         % perl -mClone -mAcme::Damn -Mlib::core::only yourscript.pl

    *   To allow a module and recursively all other modules that the module
        requires

        This is convenient when we want to allow a non-trivial module which
        itself uses some other modules, e.g. Moo or Moose:

         % perl -Mlib::filter=allow_noncore,0,allow,Moo,allow_is_recursive=0

    *   To disallow some modules:

        For example to test that a script can still run without a module
        (e.g. an optional prereq):

         % perl -Mlib::filter=disallow,'YAML::XS;JSON::XS' yourscript.pl

         # idem, but the list of disallowed modules are retrieved from a file
         % perl -Mlib::filter=disallow_list,/tmp/disallow.txt yourscript.pl

        Devel::Hide is another module which you can you for exactly this
        purpose:

         % perl -MDevel::Hide=YAML::XS,JSON::XS yourscript.pl

        To no-op instead of disallowing, see lib::noop.

    *   Do custom filtering

         % perl -Mlib::filter=filter,sub{not/^Foo::/} yourscript.pl

OPTIONS
    Known options:

    *   debug => bool

        If set to true, print diagnostics when filtering.

    *   disallow => str

        Add a semicolon-separated list of modules to disallow.

    *   disallow_re => str

        Add modules matching regex pattern to disallow.

    *   disallow_list => filename

        Read a file containing list of modules to disallow (one module per
        line).

    *   allow => str

        Add a semicolon-separated list of module names to allow.

    *   allow_re => str

        Allow modules matching regex pattern.

    *   allow_list => filename

        Read a file containing list of modules to allow (one module per
        line).

    *   allow_is_recursive => bool (default: 0)

        If set to 1, then will also allow modules that are required by the
        allowed modules (and modules that are allowed by *those* modules,
        and so on). This is convenient if you want to allow a non-trivial
        module, say, Moo or Moose which will require other modules too.
        Without this option, you will need to explicitly allow each of those
        modules yourself.

    *   allow_core => bool (default: 1)

        Allow core modules.

    *   allow_noncore => bool (default: 1)

        Allow non-core modules.

    *   extra_inc => str

        Add additional path to search modules in. String must be
        colon-separated paths.

    *   filter => code

        Do custom filtering. Code will receive module name (e.g.
        "Foo/Bar.pm") as its argument ($_ is also localized to contained the
        module name, for convenience) and should return 1 if the module
        should be allowed.

    How a module is filtered:

    *   First it's checked against "filter", if that option is defined

    *   then, it is checked against the
        "disallow"/"disallow_re"/"disallow_list".

        If it matches one of those options then the module is disallowed.

    *   Otherwise it is checked against the "allow"/"allow_re"/"allow_list".

        If it matches one of those options and the module's path is found in
        the directories in @INC, then the module is allowed.

    *   If "allow_is_recursive" is true, check the requirer.

        If the calling package is already in %INC, we allow that. For
        example, if we allow "Moo" and "Moo" calls Moo::_strictures and
        Module::Runtime, we will also allow them. Later if
        "Moo::_strictures" tries to load strictures, we also allow it, and
        so on.

    *   Finally, allow_core/allow_noncore is checked.

        When "allow_core" is set to false, core directories are excluded.
        Likewise, when "allow_noncore" is set to false, non-core directories
        are excluded.

ENVIRONMENT
  PERL_LIB_FILTER_DEBUG
    Boolean. Sets the default for the "debug" option.

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/lib-filter>.

SOURCE
    Source repository is at <https://github.com/perlancar/perl-lib-filter>.

SEE ALSO
    Related/similar modules: lib::none, lib::core::only, Devel::Hide,
    Test::Without::Module.

    To simulate the absence of certain programs in PATH, you can try
    File::Which::Patch::Hide.

    To no-op instead of disallowing, see lib::noop.

AUTHOR
    perlancar <perlancar@cpan.org>

CONTRIBUTORS
    *   A. Sinan Unur <nanis@cpan.org>

    *   Olivier Mengué <dolmen@cpan.org>

CONTRIBUTING
    To contribute, you can send patches by email/via RT, or send pull
    requests on GitHub.

    Most of the time, you don't need to build the distribution yourself. You
    can simply modify the code, then test via:

     % prove -l

    If you want to build the distribution (e.g. to try to install it locally
    on your system), you can install Dist::Zilla,
    Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two
    other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional
    steps required beyond that are considered a bug and can be reported to
    me.

COPYRIGHT AND LICENSE
    This software is copyright (c) 2021, 2016, 2015 by perlancar
    <perlancar@cpan.org>.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    <https://rt.cpan.org/Public/Dist/Display.html?Name=lib-filter>

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

dist.ini  view on Meta::CPAN

;---------------------------------
author  = perlancar <perlancar@cpan.org>
copyright_holder = perlancar <perlancar@cpan.org>
license = Perl_5
;---------------------------------

version=0.281

name=lib-filter

[@Author::PERLANCAR]
:version=0.605

[Prereqs / TestRequires]
lib=0
File::Temp=0.2307
FindBin=0
Module::Path::More=0.32
Test::More=0.98
Test::Needs=0

[Prereqs / TestRecommends]

[Prereqs]
strict=0
warnings=0
Config=0
Module::CoreList=0

lib/lib/allow.pm  view on Meta::CPAN

package lib::allow;

use strict;
use warnings;

require lib::filter;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2021-08-29'; # DATE
our $DIST = 'lib-filter'; # DIST
our $VERSION = '0.281'; # VERSION

sub import {
    my $pkg = shift;

    lib::filter->import(allow_core=>0, allow_noncore=>0, allow=>join(';',@_));
}

sub unimport {
    lib::filter->unimport;
}

1;
# ABSTRACT: Only allow a list of modules to be locateable/loadable

__END__

=pod

=encoding UTF-8

=head1 NAME

lib::allow - Only allow a list of modules to be locateable/loadable

=head1 VERSION

This document describes version 0.281 of lib::allow (from Perl distribution lib-filter), released on 2021-08-29.

=head1 SYNOPSIS

 % perl -Mlib::allow=XSLoader,List::Util yourscript.pl

=head1 DESCRIPTION

This pragma is a shortcut for L<lib::filter>. This:

 use lib::allow qw(Foo Bar::Baz Qux);

is equivalent to:

 use lib::filter allow_core=>0, allow_noncore=>0, allow=>'Foo;Bar::Baz;Qux';

=for Pod::Coverage .+

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/lib-filter>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-lib-filter>.

=head1 SEE ALSO

L<lib::filter>

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 CONTRIBUTING


To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.

Most of the time, you don't need to build the distribution yourself. You can
simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your
system), you can install L<Dist::Zilla>,
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required
beyond that are considered a bug and can be reported to me.

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2021, 2016, 2015 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=lib-filter>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=cut

lib/lib/coreplus.pm  view on Meta::CPAN

package lib::coreplus;

use strict;
use warnings;

use Module::CoreList;
use lib::filter ();

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2021-08-29'; # DATE
our $DIST = 'lib-filter'; # DIST
our $VERSION = '0.281'; # VERSION

sub import {
    my $pkg = shift;

    my $re = join('|', map {quotemeta} @_);
    $re = qr/\A($re)\z/;

    lib::filter->import(
        filter => sub {
            return 1 if Module::CoreList->is_core($_);
            return 1 if $_ =~ $re;
            0;
        },
    );
}

sub unimport {
    lib::filter->unimport;
}

1;
# ABSTRACT: Allow core modules plus a few others

__END__

=pod

=encoding UTF-8

=head1 NAME

lib::coreplus - Allow core modules plus a few others

=head1 VERSION

This document describes version 0.281 of lib::coreplus (from Perl distribution lib-filter), released on 2021-08-29.

=head1 SYNOPSIS

 % perl -Mlib::coreplus=Clone,Data::Structure::Util yourscript.pl

=head1 DESCRIPTION

This pragma uses L<lib::filter>'s custom C<filter> to accomplish its function.

Rationale for this pragma: using C<lib::filter>'s C<allow_noncore=0>+C<allow>
doesn't work for non-core XS modules because C<allow_noncore=0> will remove
non-core directories from C<@INC>, while XS modules will still look for their
loadable objects in C<@INC> during loading.

So the alternative approach used by C<lib::coreplus> is to check the module
against C<< Module::CoreList->is_core >>. If the module is not a core module
according to C<is_core>, it is then checked against the list of additional
modules specified by the user. If both checks fail, the module is disallowed.
lib::coreplus does not remove directories from C<@INC> because it does not use
C<allow_noncore=0>.

=for Pod::Coverage .+

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/lib-filter>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-lib-filter>.

=head1 SEE ALSO

L<lib::filter>

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 CONTRIBUTING


To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.

Most of the time, you don't need to build the distribution yourself. You can
simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your
system), you can install L<Dist::Zilla>,
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required
beyond that are considered a bug and can be reported to me.

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2021, 2016, 2015 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=lib-filter>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=cut

lib/lib/disallow.pm  view on Meta::CPAN

package lib::disallow;

use strict;
use warnings;

require lib::filter;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2021-08-29'; # DATE
our $DIST = 'lib-filter'; # DIST
our $VERSION = '0.281'; # VERSION

sub import {
    my $pkg = shift;

    lib::filter->import(disallow=>join(';',@_));
}

sub unimport {
    lib::filter->unimport;
}

1;
# ABSTRACT: Disallow a list of modules from being locateable/loadable

__END__

=pod

=encoding UTF-8

=head1 NAME

lib::disallow - Disallow a list of modules from being locateable/loadable

=head1 VERSION

This document describes version 0.281 of lib::disallow (from Perl distribution lib-filter), released on 2021-08-29.

=head1 SYNOPSIS

 % perl -Mlib::disallow=YAML,YAML::Syck,YAML::XS yourscript.pl

=head1 DESCRIPTION

This pragma is a shortcut for L<lib::filter>. This:

 use lib::disallow qw(YAML YAML::Syck YAML::XS);

is equivalent to:

 use lib::filter disallow=>'YAML;YAML::Syck;YAML::XS';

=for Pod::Coverage .+

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/lib-filter>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-lib-filter>.

=head1 SEE ALSO

L<lib::filter>

If an application checks the availability of modules by using L<Module::Path> or
L<Module::Path::More> instead of trying to load them, you can try:
L<Module::Path::Patch::Hide> or L<Module::Path::More::Patch::Hide>.

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 CONTRIBUTING


To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.

Most of the time, you don't need to build the distribution yourself. You can
simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your
system), you can install L<Dist::Zilla>,
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required
beyond that are considered a bug and can be reported to me.

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2021, 2016, 2015 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=lib-filter>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=cut

lib/lib/filter.pm  view on Meta::CPAN

package lib::filter;

#use 5.008009;  # the first version where Module::CoreList becomes core
use strict 'subs', 'vars'; # no need to avoid strict & warnings, because Config uses them
use warnings;
use Config;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2021-08-29'; # DATE
our $DIST = 'lib-filter'; # DIST
our $VERSION = '0.281'; # VERSION

# BEGIN snippet from Module::Path::More, with mods/simplification
my $SEPARATOR;
BEGIN {
    if ($^O =~ /^(dos|os2)/i) {
        $SEPARATOR = '\\';
    } elsif ($^O =~ /^MacOS/i) {
        $SEPARATOR = ':';
    } else {
        $SEPARATOR = '/';
    }
}
sub module_path {
    my ($file, $inc) = @_;

    foreach my $dir (@$inc) {
        next if !defined($dir);
        next if ref($dir);
        my $path = $dir . $SEPARATOR . $file;
        return $path if -f $path;
    }
    undef;
}
# END snippet from Module::Path::More

sub _open_handle {
    my $path = shift;
    open my($fh), "<", $path
        or die "Can't open $path: $!";
    $fh;
}

my $handler;
my $hook;
my ($orig_inc, $orig_inc_sorted_by_len);

sub lib::filter::INC { goto $handler }

sub import {
    my ($class, %opts) = @_;

    my $dbgh = "[lib::filter]";

    for (keys %opts) {
        die "Unknown option $_"
            unless /\A(
                        debug|
                        allow_core|allow_noncore|
                        extra_inc|
                        allow|allow_list|allow_re|
                        allow_is_recursive|
                        disallow|disallow_list|disallow_re|
                        filter
                    )\z/x;
    }

    $opts{debug} = $ENV{PERL_LIB_FILTER_DEBUG} unless defined($opts{debug});

    $opts{allow_core}    = 1 if !defined($opts{allow_core});
    $opts{allow_noncore} = 1 if !defined($opts{allow_noncore});

    if ($opts{filter} && !ref($opts{filter})) {
        # convenience, for when filter is specified from command-line (-M)
        $opts{filter} = eval $opts{filter}; ## no critic: BuiltinFunctions::ProhibitStringyEval
        die "Error in filter code: $@" if $@;
    }

    if ($opts{extra_inc}) {
        unshift @INC, split(/:/, $opts{extra_inc});
    }

    if (!$orig_inc) {
        $orig_inc = [@INC];
        $orig_inc_sorted_by_len = [sort {length($b) <=> length($a)} @INC];
    }

    my $core_inc = [@Config{qw(privlibexp archlibexp)}];
    my $noncore_inc = [grep {$_ ne $Config{privlibexp} &&
                                 $_ ne $Config{archlibexp}} @$orig_inc];
    my %allow;
    if ($opts{allow}) {
        for (split /\s*;\s*/, $opts{allow}) {
            $allow{$_} = "allow";
        }
    }
    if ($opts{allow_list}) {
        open my($fh), "<", $opts{allow_list}
            or die "Can't open allow_list file '$opts{allow_list}': $!";
        while (my $line = <$fh>) {
            $line =~ s/^\s+//;
            $line =~ /^(\w+(?:::\w+)*)/ or next;
            $allow{$1} ||= "allow_list";
        }
    }

    my %disallow;
    if ($opts{disallow}) {
        for (split /\s*;\s*/, $opts{disallow}) {
            $disallow{$_} = "disallow";
            (my $pm = "$_.pm") =~ s!::!/!g; delete $INC{$pm};
        }
    }
    if ($opts{disallow_list}) {
        open my($fh), "<", $opts{disallow_list}
            or die "Can't open disallow_list file '$opts{disallow_list}': $!";
        while (my $line = <$fh>) {
            $line =~ s/^\s+//;
            $line =~ /^(\w+(?:::\w+)*)/ or next;
            $disallow{$1} ||= "disallow_list";
            (my $pm = "$1.pm") =~ s!::!/!g; delete $INC{$pm};
        }
    }

    $handler = sub {
        my ($self, $file) = @_;

        my @caller = caller(0);

        warn "$dbgh hook called for $file (from package $caller[0] file $caller[1])\n" if $opts{debug};

        my $path;
      FILTER:
        {
            my $mod = $file; $mod =~ s/\.pm$//; $mod =~ s!/!::!g;
            my $err_prefix = "Can't locate $file";
            if ($opts{filter}) {
                local $_ = $mod;
                warn "$dbgh Checking against custom filter ...\n" if $opts{debug};
                unless ($opts{filter}->($mod)) {
                    die "$err_prefix (module '$mod' is disallowed (filter))";
                }
            }
            if ($opts{disallow_re} && $mod =~ /$opts{disallow_re}/) {
                die "$err_prefix (module '$mod' is disallowed (disallow_re))";
            }
            if ($disallow{$mod}) {
                die "$err_prefix (module '$mod' is disallowed ($disallow{$mod}))";
            }
            if ($opts{allow_re} && $mod =~ /$opts{allow_re}/) {
                warn "$dbgh module $mod matches allow_re\n" if $opts{debug};
                $path = module_path($file, $orig_inc);
                last FILTER if $path;
                die "$err_prefix (module '$mod' is allowed (allow_re) but can't locate $file in \@INC (\@INC contains: ".join(" ", @INC)."))";
            }
            if ($allow{$mod}) {
                warn "$dbgh module $mod matches $allow{$mod}\n" if $opts{debug};
                $path = module_path($file, $orig_inc);
                last FILTER if $path;
                die "$err_prefix (module '$mod' is allowed ($allow{$mod}) but can't locate $file in \@INC (\@INC contains: ".join(" ", @INC)."))";
            }
            if ($opts{allow_is_recursive}) {
                my $caller_pkg_from_file;
                for (@$orig_inc_sorted_by_len) {
                    #print "D:\$_=<$_> vs $caller[1]\n";
                    if (index($caller[1], $_) == 0) {
                        $caller_pkg_from_file = substr($caller[1], length($_)+1);
                        #print "D:caller_pkg_from_file=<$caller_pkg_from_file>\n";
                        $caller_pkg_from_file =~ s/\.pm\z//;
                        $caller_pkg_from_file =~ s/\Q$Config{archname}\E.//;
                        $caller_pkg_from_file =~ s![/\\]!::!g;
                    }
                }
                for my $caller_pkg (grep {defined} $caller[0], $caller_pkg_from_file) {
                    (my $pm = "$caller_pkg.pm") =~ s!::!/!g;
                    if (exists $INC{$pm}) {
                        $path = module_path($file, $orig_inc);
                        if ($path) {
                            warn "$dbgh module '$mod' allowed because it is require'd by $caller_pkg (allow_is_recursive=1)\n" if $opts{debug};
                            last FILTER;
                        }
                    }
                }
            }

            my $inc;
            if ($opts{allow_noncore} && $opts{allow_core}) {
                $inc = $orig_inc;
            } elsif ($opts{allow_core}) {
                $inc = $core_inc;
            } elsif ($opts{allow_noncore}) {
                $inc = $noncore_inc;
            }
            if ($inc) {
                warn "$dbgh searching $file in (".join(", ", @$inc).")\n" if $opts{debug};
                $path = module_path($file, $inc);
            }
            last FILTER if $path;
        } # FILTER

        unless ($path) {
            warn "$dbgh $file not found\n" if $opts{debug};
            return;
        }

        warn "$dbgh $file found at $path\n" if $opts{debug};
        $INC{$file} = $path;
        return _open_handle($path);
    };
    $hook = bless(sub{"dummy"}, __PACKAGE__);

    @INC = (
        $hook,
        grep {
            my $mod = $_;
            if ("$mod" eq "$hook") {
                0;
            } elsif ($opts{allow_core} && grep {$mod eq $_} @$core_inc) {
                1;
            } elsif ($opts{allow_noncore} && grep {$mod eq $_} @$noncore_inc) {
                1;
            } else {
                0;
            }
        } @$orig_inc,
    );
    #use DD; dd $orig_inc;
    #use DD; dd \@INC;
}

sub unimport {
    return unless $hook;
    @INC = grep { "$_" ne "$hook" } @INC;
}

1;
# ABSTRACT: Allow/disallow loading modules

__END__

=pod

=encoding UTF-8

=head1 NAME

lib::filter - Allow/disallow loading modules

=head1 VERSION

This document describes version 0.281 of lib::filter (from Perl distribution lib-filter), released on 2021-08-29.

=head1 SYNOPSIS

 use lib::filter %opts;

=head1 DESCRIPTION

lib::filter lets you allow/disallow loading modules using some rules. It works
by installing a coderef in C<@INC> (and additionally by pruning some entries in
C<@INC>). The main use-case for this pragma is for testing.

It has been pointed out to me that for some tasks, alternatives to using this
module exist, so I'll be presenting those in the examples below.

=over

=item * To disallow loading any module:

 % perl -Mlib::filter=allow_core,0,allow_noncore,0 yourscript.pl

You can also use L<lib::none> for this, or simply empty C<@INC> yourself, e.g.:

 {
     local @INC = ();
     ...
 }

To no-op instead of disallowing, see L<lib::noop::all>.

=item * To allow only core modules:

For example for testing a fatpacked script (see L<App::FatPacker>):

 % perl -Mlib::filter=allow_noncore,0 yourscript.pl

You can also use L<lib::core::only> for this, which comes with the
L<App::FatPacker> distribution.

=item * To only allow a specific set of modules:

 % perl -Mlib::filter=allow_core,0,allow_noncore,0,allow,'XSLoader;List::Util' yourscript.pl

To no-op instead of disallowing, see L<lib::noop::except>.

=item * To allow core modules plus some additional modules:

For example to test a fatpacked script that might still require some XS modules:

 # allow additional modules by pattern
 % perl -Mlib::filter=allow_noncore,0,allow_re,'^DateTime::.*' yourscript.pl

 # allow additional modules listed in a file
 % perl -Mlib::filter=allow_noncore,0,allow_list,'/tmp/allow.txt' yourscript.pl

 # allow core modules plus additional modules found in some dirs
 % perl -Mlib::filter=allow_noncore,0,extra_inc,'.:proj/lib' yourscript.pl

 # allow some non-core XS modules
 % perl -MModule::CoreList -Mlib::filter=filter,'sub{ return 1 if Module::CoreList->is_core($_); return 1 if m!Clone|Acme/Damn!; 0' yourscript.pl
 % perl -Mlib::coreplus=Clone,Acme::Damn yourscript.pl

Alternatively, you can also test by preloading the additional modules before
using lib::core::only:

 % perl -mClone -mAcme::Damn -Mlib::core::only yourscript.pl

=item * To allow a module and recursively all other modules that the module requires

This is convenient when we want to allow a non-trivial module which itself uses
some other modules, e.g. L<Moo> or L<Moose>:

 % perl -Mlib::filter=allow_noncore,0,allow,Moo,allow_is_recursive=0

=item * To disallow some modules:

For example to test that a script can still run without a module (e.g. an
optional prereq):

 % perl -Mlib::filter=disallow,'YAML::XS;JSON::XS' yourscript.pl

 # idem, but the list of disallowed modules are retrieved from a file
 % perl -Mlib::filter=disallow_list,/tmp/disallow.txt yourscript.pl

L<Devel::Hide> is another module which you can you for exactly this purpose:

 % perl -MDevel::Hide=YAML::XS,JSON::XS yourscript.pl

To no-op instead of disallowing, see L<lib::noop>.

=item * Do custom filtering

 % perl -Mlib::filter=filter,sub{not/^Foo::/} yourscript.pl

=back

=for Pod::Coverage .+

=head1 OPTIONS

Known options:

=over

=item * debug => bool

If set to true, print diagnostics when filtering.

=item * disallow => str

Add a semicolon-separated list of modules to disallow.

=item * disallow_re => str

Add modules matching regex pattern to disallow.

=item * disallow_list => filename

Read a file containing list of modules to disallow (one module per line).

=item * allow => str

Add a semicolon-separated list of module names to allow.

=item * allow_re => str

Allow modules matching regex pattern.

=item * allow_list => filename

Read a file containing list of modules to allow (one module per line).

=item * allow_is_recursive => bool (default: 0)

If set to 1, then will also allow modules that are required by the allowed
modules (and modules that are allowed by I<those> modules, and so on). This is
convenient if you want to allow a non-trivial module, say, L<Moo> or L<Moose>
which will require other modules too. Without this option, you will need to
explicitly allow each of those modules yourself.

=item * allow_core => bool (default: 1)

Allow core modules.

=item * allow_noncore => bool (default: 1)

Allow non-core modules.

=item * extra_inc => str

Add additional path to search modules in. String must be colon-separated paths.

=item * filter => code

Do custom filtering. Code will receive module name (e.g. C<Foo/Bar.pm>) as its
argument (C<$_> is also localized to contained the module name, for convenience)
and should return 1 if the module should be allowed.

=back

How a module is filtered:

=over

=item * First it's checked against C<filter>, if that option is defined

=item * then, it is checked against the C<disallow>/C<disallow_re>/C<disallow_list>.

If it matches one of those options then the module is disallowed.

=item * Otherwise it is checked against the C<allow>/C<allow_re>/C<allow_list>.

If it matches one of those options and the module's path is found in the
directories in C<@INC>, then the module is allowed.

=item * If C<allow_is_recursive> is true, check the requirer.

If the calling package is already in C<%INC>, we allow that. For example, if we
allow C<Moo> and C<Moo> calls L<Moo::_strictures> and L<Module::Runtime>, we
will also allow them. Later if C<Moo::_strictures> tries to load L<strictures>,
we also allow it, and so on.

=item * Finally, allow_core/allow_noncore is checked.

When C<allow_core> is set to false, core directories are excluded. Likewise,
when C<allow_noncore> is set to false, non-core directories are excluded.

=back

=head1 ENVIRONMENT

=head2 PERL_LIB_FILTER_DEBUG

Boolean. Sets the default for the C<debug> option.

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/lib-filter>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-lib-filter>.

=head1 SEE ALSO

Related/similar modules: L<lib::none>, L<lib::core::only>, L<Devel::Hide>,
L<Test::Without::Module>.

To simulate the absence of certain programs in PATH, you can try
L<File::Which::Patch::Hide>.

To no-op instead of disallowing, see L<lib::noop>.

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 CONTRIBUTORS

=for stopwords A. Sinan Unur Olivier Mengué

=over 4

=item *

A. Sinan Unur <nanis@cpan.org>

=item *

Olivier Mengué <dolmen@cpan.org>

=back

=head1 CONTRIBUTING


To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.

Most of the time, you don't need to build the distribution yourself. You can
simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your
system), you can install L<Dist::Zilla>,
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required
beyond that are considered a bug and can be reported to me.

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2021, 2016, 2015 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=lib-filter>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=cut

t/00-compile.t  view on Meta::CPAN

use 5.006;
use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058

use Test::More;

plan tests => 4 + ($ENV{AUTHOR_TESTING} ? 1 : 0);

my @module_files = (
    'lib/allow.pm',
    'lib/coreplus.pm',
    'lib/disallow.pm',
    'lib/filter.pm'
);



# no fake home requested

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<perlfaq8/How can I capture STDERR from an external command?>
    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) ) if $ENV{AUTHOR_TESTING};


t/allow.t  view on Meta::CPAN

#!perl

BEGIN { @main::ORIG_INC = @INC }

use strict;
use warnings;

use FindBin '$Bin';
use lib "$Bin/lib";
BEGIN { require "testlib.pl" };
use lib::allow ();

test_lib_allow(
    name => "basics",
    args => ["Foo"],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    require_ok => ["Foo"],
    require_nok => ["Bar"],
);

done_testing;

t/author-critic.t  view on Meta::CPAN

#!perl

BEGIN {
  unless ($ENV{AUTHOR_TESTING}) {
    print qq{1..0 # SKIP these tests are for testing by the author\n};
    exit
  }
}


use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Perl::Critic::Subset 3.001.006

use Test::Perl::Critic (-profile => "") x!! -e "";

my $filenames = ['lib/lib/allow.pm','lib/lib/coreplus.pm','lib/lib/disallow.pm','lib/lib/filter.pm'];
unless ($filenames && @$filenames) {
    $filenames = -d "blib" ? ["blib"] : ["lib"];
}

all_critic_ok(@$filenames);

t/author-pod-coverage.t  view on Meta::CPAN

#!perl

BEGIN {
  unless ($ENV{AUTHOR_TESTING}) {
    print qq{1..0 # SKIP these tests are for testing by the author\n};
    exit
  }
}

# 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' });

t/author-pod-syntax.t  view on Meta::CPAN

#!perl

BEGIN {
  unless ($ENV{AUTHOR_TESTING}) {
    print qq{1..0 # SKIP these tests are for testing by the author\n};
    exit
  }
}

# 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();

t/disallow.t  view on Meta::CPAN

#!perl

BEGIN { @main::ORIG_INC = @INC }

use strict;
use warnings;

use FindBin '$Bin';
use lib "$Bin/lib";
BEGIN { require "testlib.pl" };
use lib::disallow ();

test_lib_disallow(
    name => "basics",
    args => ['Foo'],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    require_nok => ["Foo"],
    require_ok => ["Bar"],
);

done_testing;

t/filter.t  view on Meta::CPAN

#!perl

BEGIN { @main::ORIG_INC = @INC }

use strict;
use warnings;

use FindBin '$Bin';
use lib "$Bin/lib";
BEGIN { require "testlib.pl" };

use Test::Needs;

test_lib_filter(
    name => 'filter sub{0}',
    args => ["filter", "sub{0}"],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    require_nok => ["Foo"],
);

test_lib_filter(
    name => 'filter sub{1}',
    args => ["filter", "sub{1}"],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    require_ok => ["Foo"],
);

test_lib_filter(
    name => 'disallow',
    args => ["disallow", "Foo;Bar"],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    require_nok => ["Foo", "Bar"],
    require_ok  => ["Baz"],
);

test_lib_filter(
    name => 'disallow_re',
    args => ['disallow_re', 'Ba.'],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    require_nok => ["Bar", "Baz"],
    require_ok => ["Foo"],
);

{
    my ($fh, $filename) = tempfile();
    print $fh "Foo\nBaz\n";
    close $fh;

    test_lib_filter(
        name => 'disallow_list',
        args => ['disallow_list' => $filename],
        extra_libs => ["$Bin/../lib", "$Bin/lib"],
        require_nok => ["Foo", "Baz"],
        require_ok => ["Bar"],
    );
}

test_lib_filter(
    name => 'allow',
    args => [allow_core=>0, allow_noncore=>0, allow=>'Foo'],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    require_ok => ["Foo"],
    require_nok => ["Bar", "Baz"],
);

test_lib_filter(
    name => 'allow_re',
    args => [allow_core=>0, allow_noncore=>0, allow_re => 'Ba.'],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    require_ok => ["Bar", "Baz"],
    require_nok => ["Foo"],
);

{
    my ($fh, $filename) = tempfile();
    print $fh "Foo\nBar\n";
    close $fh;

    test_lib_filter(
        name => 'allow_list',
        args => [allow_core=>0, allow_noncore=>0, allow_list=>$filename],
        extra_libs => ["$Bin/../lib", "$Bin/lib"],
        require_ok => ["Foo", "Bar"],
        require_nok => ["Baz"],
    );
}

subtest "allow_is_recursive" => sub {
    test_needs "Moo";

    test_lib_filter(
        name => 'allow_is_recursive=0',
        args => [allow_noncore=>0, allow => 'Moo'],
        require_nok => ["Moo"],
    );
    test_lib_filter(
        name => 'allow_is_recursive=1',
        args => [allow_noncore=>0, allow_is_recursive=>1, allow => 'Moo'],
        require_ok => ["Moo"],
    );
};

test_lib_filter(
    name => "allow_core=0",
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    args => [allow_core=>0],

    # XXX we need to select modules which are only available in core dir and not
    # in non-core dir. e.g. a core, non-dual-life module.

    # require_nok => ["overload"],

    require_ok => ["Foo"],
);

test_lib_filter(
    name => "allow_noncore=0",
    args => [allow_noncore=>0],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],

    # 2021-08-29 - temporarily disabled, for some reason 'dzil test' fails this but 'prove -l' succeeds
    #require_ok => ["overload"], # core non-dual-life

    require_nok => ["Foo"],
);

test_lib_filter(
    name => "ordering (disallow before allow)",
    args => [allow => 'Foo', disallow=>'Foo'],
    extra_libs => ["$Bin/../lib", "$Bin/lib"],
    require_nok => ["Foo"],
);

# XXX more ordering tests

done_testing;

t/lib/Bar.pm  view on Meta::CPAN

# just an empty module for testing
package Bar;

1;

t/lib/Baz.pm  view on Meta::CPAN

# just an empty module for testing
package Baz;

1;

t/lib/Foo.pm  view on Meta::CPAN

# just an empty module for testing
package Foo;

1;

t/lib/testlib.pl  view on Meta::CPAN

use File::Temp qw(tempfile);
use Module::Path::More qw(module_path);
use Test::More 0.98;

sub _test_lib {
    my $which = shift;
    my %args = @_;

    my $name = $args{name} || "args: " . join(" ", @{$args{args}});
    subtest $name => sub {
        for my $ent (
            (map {+{module=>$_, ok=>1}} @{$args{require_ok} || []}),
            (map {+{module=>$_, ok=>0}} @{$args{require_nok} || []}),
        ) {
            my @system_args = (
                $^X,
                (map {"-I$_"} @{ $args{extra_libs} || []}),
                "-Mlib::$which". (@{$args{args}} ? "=".
                                      join(",",@{$args{args}}):""),
                "-e",
                "use $ent->{module}",
            );
            note "system: " . join(" ", @system_args);
            system(@system_args);
            my $child_err = $?;
            if ($ent->{ok}) {
                unless (ok(!$child_err, "require $ent->{module} ok")) {
                    local @INC = (
                        @{ $args{extra_lib} || [] },
                        @main::ORIG_INC,
                    );
                    my $path = module_path(module => $ent->{module});
                    diag "Path for module $ent->{module}: " .
                        ($path // "(not found)");
                }
            } else {
                ok( $child_err, "require $ent->{module} nok");
            }
        }
    };
}

sub test_lib_filter {
    _test_lib('filter', @_);
}

sub test_lib_allow {
    _test_lib('allow', @_);
}

sub test_lib_disallow {
    _test_lib('disallow', @_);
}

1;

weaver.ini  view on Meta::CPAN

[@Author::PERLANCAR]

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.038 second using v1.00-cache-2.02-grep-82fe00e-cpan-503542c4f10 )