Perl-Critic-Pulp-97/ 0002755 0001750 0001750 00000000000 13552456764 012145 5 ustar gg gg Perl-Critic-Pulp-97/COPYING 0000644 0001750 0001750 00000104374 10641206144 013164 0 ustar gg gg
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), 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 prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey 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;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
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.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
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.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
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 the public, 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
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
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 3 of the License, 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, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program 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, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
Perl-Critic-Pulp-97/Changes 0000644 0001750 0001750 00000030631 13552456746 013441 0 ustar gg gg Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019 Kevin Ryde
This file is part of Perl-Critic-Pulp.
Perl-Critic-Pulp 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 3, or (at
your option) any later version.
Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
Version 97, October 2019
- RequireFinalSemicolon allow hashref in arrayref (which PPI 1.270
says code block), as reported by Andy Lester RT#130725
Version 96, December 2017
- ProhibitUnknownBackslash allow for non-ascii in strings, as
reported by Mark Fowler RT#123922
Version 95, October 2017
- RequireFinalSemicolon also sort{} blocks are an expression
Version 94, June 2017
- ProhibitUnknownBackslash \N also Perl 5.16, as reported by
Ed Davis RT#122064
Version 93, April 2017
- some doubtfulness in Makefile.PL meta bits
Version 92, November 2016
- ProhibitPOSIXimport oops, don't use // operator, per paul RT#118959
Version 91, November 2016
- RequireFinalCut allow no blank line before =cut, as reported by
Andy Lester RT#118722
- RequireLinkedURLs allow example.com
Version 90, March 2015
- PerlMinimumVersionAndWhy actually check Modern::Perl
- ProhibitNullStatements beware of extra stuff after try/catch
Version 89, January 2015
- PerlMinimumVersionAndWhy experiment Modern::Perl meaning 5.10,
as proposed by Ed Avis RT#100290
- RequireFinalSemicolon recognise try/catch of Try.pm, TryCatch.pm
and Syntax::Feature::Try, as proposed by Ed Avis RT#100291.
Various List::Util functions as expression blocks.
- RequireTrailingCommaAtNewline exception for single here-documents,
as proposed by Ed Avis RT#100292
- ProhibitNullStatements report null ; on try/catch, and look
inside try/catch/finally blocks
Version 88, November 2014
- ConstantBeforeLt oops again, PPI incompatibility too much, must
do and depend on its 1.220
Version 87, November 2014
- ConstantBeforeLt really allow for PPI
Version 86, November 2014
- ConstantBeforeLt allow for PPI incompatible change to ->prototype()
Version 85, May 2014
- oops forgot Pod::Escapes in PREREQ_PM, per Petr Pisar RT#95440
Version 84, May 2014
- new Documentation::RequireFilenameMarkup
Version 83, May 2014
- PerlMinimumVersionAndWhy new 5.10 -e -x stacked filetest per
Kent Fredric RT#95208
Version 82, April 2014
- ProhibitAdjacentLinks, ProhibitLinkToSelf,
ProhibitParagraphTwoDots, ProhibitUnbalancedParens,
ProhibitVerbatimMarkup, RequireLinkedURLs check =begin blocks
only for POD-type ":"
- ProhibitBadAproposMarkup check =begin :man and :roff only
- ProhibitDuplicateSeeAlso ignore all =begin blocks
Version 81, April 2014
- ProhibitAdjacentLinks fix warnings when internal and external
links adjacent, as reported by Mike O'Regan RT#94318
- ConstantPragmaHash and ConstantLeadingUnderscore pass ->content
to version.pm as it enquires too much into a PPI object ref,
per RT#92100 dmacks and ppisar
Version 80, July 2013
- new policy Documentation::ProhibitParagraphEndComma
- tests UnexpandedSpecialLiteral.t don't exercise __PACKAGE__ =>
across newline since that might be going to change in Perl 5.20,
as reported by Reini Urban RT#87307
Version 79, March 2013
- fix ProhibitFatCommaNewline load version.pm for perl 5.8, as
reported by paul RT#83990
Version 78, March 2013
- new policies CodeLayout::ProhibitIfIfSameLine,
CodeLayout::ProhibitFatCommaNewline
Version 77, February 2013
- new policy Documentation::ProhibitDuplicateHeadings
- fix POD parse losing violations across =cut gaps
Version 76, January 2013
- RequireNumericVersion explicit check for exponential strings "1e6"
Version 75, November 2012
- ProhibitEmptyCommas fix for [{%a},{}] reported by Mike O'Regan
RT#81390
Version 74, October 2012
- tests RequireNumericVersion skip version.pm 1e6 uncertain quite yet
Version 73, June 2012
- tests fix for File::Temp in perl pre-5.10
Version 72, June 2012
- TextDomainPlaceholders fix #line regexp plain \2 for perl before 5.10
Version 71, June 2012
- RequireLinkedURLs - skip "=begin html" etc blocks
- RequireFinalCut - cut not required if only =begin foo/=end foo block
Version 70, May 2012
- new policy Documentation::RequireFinalCut
Version 69, January 2012
- new policy ValuesAndExpressions::ProhibitDuplicateHashKeys
- PerlMinimumVersionAndWhy
- new keys @array, values @array and each @array are 5.12
- new eval '#line' with #line the very first thing is 5.8
- Perl::Critic::Pulp::Utils new elem_is_comma_operator()
Version 68, January 2012
- RequireNumericVersion
- recognise fully-qualified $Foo::VERSION
- recognise "$VERSION = eval $VERSION" trick
Version 67, December 2011
- RequireTrailingCommaAtNewline allow "return(123 newline );"
Version 66, December 2011
- new policy Documentation::ProhibitDuplicateSeeAlso
Version 65, September 2011
- PerlMinimumVersionAndWhy
- new UNIVERSAL.pm methods in 5.004 and 5.10
- new "Foo->$method" no-args without parens is 5.6
Version 64, August 2011
- fix ProhibitLinkToSelf warnings on no L<> display part
Version 63, August 2011
- new policy Documentation::ProhibitLinkToSelf
Version 62, July 2011
- Makefile.PL depends PPI 1.212 for literal()
Version 61, June 2011
- new policies ProhibitArrayAssignAref, RequireTrailingCommaAtNewline,
ProhibitUnbalancedParens
Version 60, May 2011
- PerlMinimumVersionAndWhy new 5.6 open(my $fh,...)
Version 59, May 2011
- tests don't die on a deliberately induced version.pm warning
Version 58, May 2011
- new policy Documentation::ProhibitParagraphTwoDots
Version 57, May 2011
- ProhibitUnknownBackslash
- allow \: etc stopping interpolation
- \N only when "use charnames" in scope
Version 56, April 2011
- new policy Documentation::ProhibitAdjacentLinks
- PerlMinimumVersionAndWhy new 5.6 syswrite() length optional
Version 55, April 2011
- PerlMinimumVersionAndWhy add 5.8 pack() "[123]" brackets
Version 54, April 2011
- PerlMinimumVersionAndWhy
- new check 5.005 for "my (undef,$x)",
- fix for "delete $array[0]{'key'}" is hash not array
- document 5.8 for "=>" across newline
- document 5.004 for "$coderef->()" call and "sysseek()" func
Version 53, April 2011
- new policy Documentation::RequireLinkedURLs
Version 52, April 2011
- new policy Compatibility::ConstantLeadingUnderscore
- Perl::Critic::Pulp::Utils new elem_in_BEGIN()
Version 51, April 2011
- depend on Pod::MinimumVersion 50 for fix to =item C<< >> detection
Version 50, March 2011
- fix Compatibility::PodMinimumVersion to use its documented
"above_version", as reported by Mark Gardner
- fix Perl::Critic::Pulp::Utils parameter_parse_version() to store
with __set_parameter_value(), so field "_foo" not "foo"
Version 49, March 2011
- split Pod::MinimumVersion to its own distribution
Version 48, March 2011
- PerlMinimumVersionAndWhy some bits now in Perl::MinimumVersion itself
Version 47, February 2011
- fix Makefile.PL for perl 5.6
- UnexpandedSpecialLiteral allow fat comma after newline
- PerlMinimumVersionAndWhy report pragmas too
Version 46, January 2011
- new policy ValuesAndExpressions::RequireNumericVersion
Version 45, December 2010
- oops, tests really fix ProhibitVerbatimMarkup.t
Version 44, December 2010
- tests fix ProhibitVerbatimMarkup.t some version number checks
Version 43, September 2010
- test manifest only as an author test
- tests drop backslash of more wide chars which bomb on 5.8.x, maybe
Version 42, September 2010
- tests avoid warnings from Pod::Parser 1.37 on empty =encoding
- tests and docs Perl::Critic 1.110 for annotations past __END__
Version 41, July 2010
- TextDomainPlaceholders allow literal number for __xn() count
Version 40, July 2010
- new policy Modules::ProhibitModuleShebang
Version 39, July 2010
- PerlMinimumVersionAndWhy add
- 0b110011 binary literals new in 5.006
- new policy Documentation::ProhibitVerbatimMarkup
Version 38, June 2010
- new policy CodeLayout::RequireFinalSemicolon
Version 37, May 2010
- tests don't try wide chars in PPI input string, doesn't work in
5.8.6 and not sure if it's meant to
Version 36, May 2010
- PerlMinimumVersionAndWhy add
- "foreach my $foo" lexical loop variable new in 5.004
- "$coderef->()" call new in 5.004
Version 35, April 2010
- PerlMinimumVersionAndWhy add
- special __PACKAGE__ new in 5.004
- "use VERSION" or "use MODULE VERSION" new in 5.004
Version 34, April 2010
- new policy ValuesAndExpressions::ProhibitBarewordDoubleColon
- PerlMinimumVersionAndWhy new option skip_checks
Version 33, April 2010
- ProhibitBadAproposMarkup and Pod::MinimumVersion quietly ignore
POD parse errors
Version 32, March 2010
- PerlMinimumVersionAndWhy add
- exists() and delete() subs and arrays new in 5.006
- Foo::Bar:: double-colon bareword new in 5.005
Version 31, February 2010
- ProhibitUnknownBackslash fix for interpolated "$#array"
Version 30, January 2010
- PerlMinimumVersionAndWhy new pack/unpack format string checks
Version 29, January 2010
- fix dependency, P::C 1.084 for highest_explicit_perl_version()
Version 28, January 2010
- new policy Compatibility::ProhibitUnixDevNull
Version 27, December 2009
- ProhibitUnknownBackslash also \c control chars
Version 26, December 2009
- new policy ValuesAndExpressions::ProhibitUnknownBackslash
Version 25, December 2009
- new policy ValuesAndExpressions::ProhibitFiletest_f
Version 24, December 2009
- new policy Documentation::ProhibitBadAproposMarkup
Version 23, November 2009
- PodMinimumVersion 5.004 for =for, =begin, =end
Version 22, September 2009
- new policy Modules::ProhibitPOSIXimport
- TextDomainPlaceholders -- allow non-ascii keys
Version 21, August 2009
- PodMinimumVersion -- update the location offset hack
Version 20, August 2009
- PerlMinimumVersionAndWhy -- add report qr//m needs 5.10
- fix some "use" module version cases
- ProhibitNullStatements -- workaround incompatible changes in PPI 1.205
Version 19, June 2009
- new policy Compatibility::PerlMinimumVersionAndWhy
- new policy Compatibility::PodMinimumVersion
Version 18, June 2009
- new policy Compatibility::Gtk2Constants
- TextDomainPlaceholders -- check __px() and __npx(), and try to
notice a missing count arg in __nx(), __xn() and __npx()
Version 17, May 2009
- TextDomainUnused -- recognise __p() etc new in libintl-perl
1.17, as advised by Guido Flohr
Version 16, April 2009
- new policy Modules::ProhibitUseQuotedVersion
Version 15, March 2009
- new policy Miscellanea::TextDomainUnused
Version 14, January 2009
- ConstantPragmaHash -- fix for document with no includes at all
Version 13, January 2009
- ConstantPragmaHash -- fix location reported
Version 12, January 2009
- new policy Compatibility::ConstantPragmaHash
Version 11, December 2008
- oops, in the tests PPI 1.203 doesn't like an empty document
Version 10, December 2008
- new policy Documentation::RequireEndBeforeLastPod
Version 9, December 2008
- new policy ValuesAndExpressions::ProhibitEmptyCommas
Version 8, October 2008
- UnexpandedSpecialLiteral -- rename from LiteralSpecialLiteral,
for clarity
Version 7, August 2008
- new policy LiteralSpecialLiteral
Version 6, August 2008
- new policy Miscellanea::TextDomainPlaceholders
Version 5, July 2008
- new policy ValuesAndExpressions::NotWithCompare
Version 4, July 2008
- another go at the CPAN indexing
Version 3, July 2008
- fixes for CPAN indexing
Version 2, July 2008
- new toplevel module Perl::Critic::Pulp
- ConstantBeforeLt -- depends on prototyping, not perl version
Version 1, June 2008
- the first version, with ConstantBeforeLt and ProhibitNullStatements
Perl-Critic-Pulp-97/xtools/ 0002755 0001750 0001750 00000000000 13552456763 013474 5 ustar gg gg Perl-Critic-Pulp-97/xtools/my-wunused.sh 0000755 0001750 0001750 00000003130 13433430641 016124 0 ustar gg gg #!/bin/sh
# my-wunused.sh -- run warnings::unused on dist files
# Copyright 2009, 2010, 2011, 2012, 2013, 2015, 2019 Kevin Ryde
# my-wunused.sh is shared by several distributions.
#
# my-wunused.sh 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 3, or (at your option) any later
# version.
#
# my-wunused.sh 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 file. If not, see .
set -e
set -x
EXE_FILES=`sed -n 's/^EXE_FILES = \(.*\)/\1/p' Makefile`
TO_INST_PM=`find lib -name \*.pm`
LINT_FILES="Makefile.PL $EXE_FILES $TO_INST_PM"
if test -e "t/*.t"; then
LINT_FILES="$LINT_FILES t/*.t"
fi
if test -e "xt/*.t"; then
LINT_FILES="$LINT_FILES xt/*.t"
fi
for i in t xt examples devel; do
if test -e "$i/*.pl"; then
LINT_FILES="$LINT_FILES $i/*.pl"
fi
if test -e "$i/*.pm"; then
LINT_FILES="$LINT_FILES $i/*.pm"
fi
done
echo "$LINT_FILES"
for i in $LINT_FILES; do
# warnings::unused broken by perl 5.14, so use 5.10 for checks
perl -I /usr/share/perl5 -Mwarnings::unused=-global -I lib -c $i
# # full path name or else the "require" looks through @INC
# echo "\"$i\""
# perl -e 'use Test::More tests=>1; use Test::Vars; Test::Vars::vars_ok($ARGV[0])' "`pwd`/$i"
done
Perl-Critic-Pulp-97/xtools/my-diff-prev.sh 0000755 0001750 0001750 00000003006 11776230514 016323 0 ustar gg gg #!/bin/sh
# my-diff-prev.sh -- diff against previous version
# Copyright 2009, 2010, 2011, 2012 Kevin Ryde
# my-diff-prev.sh is shared by several distributions.
#
# my-diff-prev.sh 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 3, or (at your option) any later
# version.
#
# my-diff-prev.sh 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 file. If not, see .
set -e
set -x
DISTNAME=`sed -n 's/^DISTNAME = \(.*\)/\1/p' Makefile`
if test -z "$DISTNAME"; then
echo "DISTNAME not found"
exit 1
fi
VERSION=`sed -n 's/^VERSION = \(.*\)/\1/p' Makefile`
if test -z "$VERSION"; then
echo "VERSION not found"
exit 1
fi
case $VERSION in
3.*) PREV_VERSION=3.018000 ;;
1.*) PREV_VERSION=1.16 ;;
*) PREV_VERSION="`expr $VERSION - 1`" ;;
esac
if test -z "$VERSION"; then
echo "PREV_VERSION not established"
exit 1
fi
rm -rf diff.tmp
mkdir -p diff.tmp
(cd diff.tmp;
tar xfz ../$DISTNAME-$PREV_VERSION.tar.gz
tar xfz ../$DISTNAME-$VERSION.tar.gz
diff -ur $DISTNAME-$PREV_VERSION \
$DISTNAME-$VERSION \
>tree.diff || true
)
${PAGER:-more} diff.tmp/tree.diff || true
rm -rf diff.tmp
exit 0
Perl-Critic-Pulp-97/xtools/my-check-file-part-of.sh 0000644 0001750 0001750 00000001723 11714421457 020002 0 ustar gg gg #!/bin/sh
# my-check-file-is-part-of.sh -- grep for spelling errors
# Copyright 2009, 2010, 2011, 2012 Kevin Ryde
# my-check-file-is-part-of.sh is shared by several distributions.
#
# my-check-file-is-part-of.sh 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 3, or (at your
# option) any later version.
#
# my-check-file-is-part-of.sh 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 file. If not, see .
exit 0
set -e
set -x
# $(MY_EXTRA_FILE_PART_OF)
if grep --text 'This file is'' part of ' -r . | egrep -iv '$DISTNAME'
then false
else true
fi
Perl-Critic-Pulp-97/xtools/my-tags.sh 0000644 0001750 0001750 00000002003 11714065142 015363 0 ustar gg gg #!/bin/sh
# my-tags.sh -- make tags
# Copyright 2009, 2010, 2011, 2012 Kevin Ryde
# my-tags.sh is shared by several distributions.
#
# my-tags.sh 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 3, or (at your option) any later
# version.
#
# my-tags.sh 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 file. If not, see .
set -e
set -x
# in a hash-style multi-const this "use constant" pattern only picks up the
# first constant, unfortunately, but it's better than nothing
etags \
--regex='{perl}/use[ \t]+constant\(::defer\)?[ \t]+\({[ \t]*\)?\([A-Za-z_][^ \t=,;]+\)/\3/' \
`find lib -type f`
Perl-Critic-Pulp-97/xtools/my-check-spelling.sh 0000755 0001750 0001750 00000003765 13532576741 017354 0 ustar gg gg #!/bin/sh
# my-check-spelling.sh -- grep for spelling errors
# Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2018, 2019 Kevin Ryde
# my-check-spelling.sh is shared by several distributions.
#
# my-check-spelling.sh 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 3, or (at your option) any later
# version.
#
# my-check-spelling.sh 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 file. If not, see .
set -e
# set -x
# | tee /dev/stdout
# -name samp -prune \
# -o -name formats -prune \
# -o -name "*~" -prune \
# -o -name "*.tar.gz" -prune \
# -o -name "*.deb" -prune \
# -o
# -o -name dist-deb -prune \
# | egrep -v '(Makefile|dist-deb)' \
# --colour=always
if find . -name my-check-spelling.sh -prune \
-o -type f -print0 \
| xargs -0 egrep -nHi 'simlar|roughtly|randomes|silbing|minmal|wiht|\bits the\b|\bint he\b|withtout|occured|exmaple|weiner|rigth|peroid|Manhatten|occuring|optino|recurrance|nineth|\bon on\b|\bto to\b|tranpose|adjustement|glpyh|rectanglar|availabe|grabing|cusor|refering|writeable|nineth|\bommitt?ed|omited|[$][rd]elf|requrie|noticable|continous|existant|explict|agument|destionation|\bthe the\b|\bfor for\b|\bare have\b|\bare are\b|\bwith with\b|\bin in\b|\b[tw]hen then\b|\bnote sure\b|\bnote yet\b|correspondance|sprial|wholely|satisif|\bteh\b|\btje\b|\btained\b|zip.com.au'
then
echo '(word)'
exit 1
fi
if find . -name my-check-spelling.sh -prune \
-o -name \*.gz -prune \
-o -type f -print0 \
| xargs -0 egrep -nH '\bov\b|\bTH[a-ce-z]'
then
echo '(ov or TH)'
exit 1
fi
exit 0
Perl-Critic-Pulp-97/xtools/my-kwalitee.sh 0000755 0001750 0001750 00000002146 11775434756 016267 0 ustar gg gg #!/bin/sh
# my-kwalitee.sh -- run cpants_lint kwalitee checker
# Copyright 2009, 2010, 2011, 2012 Kevin Ryde
# my-kwalitee.sh is shared by several distributions.
#
# my-kwalitee.sh 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 3, or (at your option) any later
# version.
#
# my-kwalitee.sh 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 file. If not, see .
# Module::CPANTS::Analyse
set -e
set -x
DISTVNAME=`sed -n 's/^DISTVNAME = \(.*\)/\1/p' Makefile`
if test -z "$DISTVNAME"; then
echo "DISTVNAME not found"
exit 1
fi
if [ -e ~/bin/my-gpg-agent-daemon ]; then
eval `my-gpg-agent-daemon`
echo "gpg-agent $GPG_AGENT_INFO"
fi
TGZ="$DISTVNAME.tar.gz"
make "$TGZ"
cpants_lint "$TGZ"
Perl-Critic-Pulp-97/xtools/my-pc.sh 0000755 0001750 0001750 00000003243 12666236402 015047 0 ustar gg gg #!/bin/sh
# my-pc.sh -- run cpants_lint kwalitee checker
# Copyright 2009, 2010, 2011, 2012, 2013, 2016 Kevin Ryde
# my-pc.sh is shared by several distributions.
#
# my-pc.sh 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 3, or (at your
# option) any later version.
#
# my-pc.sh 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 file. If not, see .
set -x
# PERLRUNINST=`sed -n 's/^PERLRUNINST = \(.*\)/\1/p' Makefile`
# if test -z "$PERLRUNINST"; then
# echo "PERLRUNINST not found"
# exit 1
# fi
EXE_FILES=`sed -n 's/^EXE_FILES = \(.*\)/\1/p' Makefile`
TO_INST_PM=`find lib -name \*.pm`
LINT_FILES="Makefile.PL $EXE_FILES $TO_INST_PM"
if test -e "t/*.t"; then
LINT_FILES="$LINT_FILES t/*.t"
fi
if test -e "xt/*.t"; then
LINT_FILES="$LINT_FILES xt/*.t"
fi
for i in t xt examples devel; do
if test -e "$i/*.pl"; then
LINT_FILES="$LINT_FILES $i/*.pl"
fi
if test -e "$i/*.pm"; then
LINT_FILES="$LINT_FILES $i/*.pm"
fi
done
# perl -e 'use Test::Vars; all_vars_ok()'
# MyMakeMakerExtras_Pod_Coverage
perl -e 'use Pod::Coverage package => $class'
podlinkcheck -I lib `ls $LINT_FILES | grep -v '\.bash$$|\.desktop$$\.png$$|\.xpm$$'`
podchecker -nowarnings `ls $LINT_FILES | grep -v '\.bash$$|\.desktop$$\.png$$|\.xpm$$'`
perlcritic $LINT_FILES
Perl-Critic-Pulp-97/xtools/my-deb.sh 0000755 0001750 0001750 00000011015 13525170710 015165 0 ustar gg gg #!/bin/sh
# my-deb.sh -- make .deb
# Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2019 Kevin Ryde
# my-deb.sh is shared by several distributions.
#
# my-deb.sh 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 3, or (at your option) any later
# version.
#
# my-deb.sh 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 file. If not, see .
# warnings::unused broken by perl 5.14, so use 5.10 for checks
set -e
set -x
DISTNAME=`sed -n 's/^DISTNAME = \(.*\)/\1/p' Makefile`
if test -z "$DISTNAME"; then
echo "DISTNAME not found"
exit 1
fi
echo "DISTNAME $DISTNAME"
VERSION=`sed -n 's/^VERSION = \(.*\)/\1/p' Makefile`
if test -z "$VERSION"; then
echo "VERSION not found"
exit 1
fi
echo "VERSION $VERSION"
DISTVNAME=`sed -n 's/^DISTVNAME = \(.*\)/\1/p' Makefile`
if test -z "$DISTVNAME"; then
echo "DISTVNAME not found"
exit 1
fi
DISTVNAME=`echo "$DISTVNAME" | sed "s/[$][(]VERSION[)]/$VERSION/"`
DISTVNAME=`echo "$DISTVNAME" | sed "s/[$][(]DISTNAME[)]/$DISTNAME/"`
echo "DISTVNAME $DISTVNAME"
XS_FILES=`sed -n 's/^XS_FILES = \(.*\)/\1/p' Makefile`
EXE_FILES=`sed -n 's/^EXE_FILES = \(.*\)/\1/p' Makefile`
if test "$DISTNAME" = pngtextadd
then DPKG_ARCH=`dpkg --print-architecture`
elif test -n "$XS_FILES"
then DPKG_ARCH=`dpkg --print-architecture`
else DPKG_ARCH=all
fi
echo "DPKG_ARCH $DPKG_ARCH"
# programs named after the dist, libraries named with "lib"
# gtk2-ex-splash and wx-perl-podbrowser programs are lib too though
DEBNAME=`echo $DISTNAME | tr A-Z a-z`
DEBNAME=`echo $DEBNAME | sed 's/app-//'`
IS_PERL_LIB=0
if test -f Makefile.PL; then # Perl modules
IS_PERL_LIB=1
fi
if test -n "$EXE_FILES"; then # Perl programs
IS_PERL_LIB=0
fi
case $DISTNAME in
# these have EXE_FILES programs but still named lib...-perl
Gtk2-Ex-Splash|Wx-Perl-PodBrowser)
IS_PERL_LIB=1 ;;
esac
if test $IS_PERL_LIB = 1; then
DEBNAME="lib${DEBNAME}-perl"
fi
echo "DEBNAME $DEBNAME"
DEBVNAME="${DEBNAME}_$VERSION-0.1"
DEBFILE="${DEBVNAME}_$DPKG_ARCH.deb"
echo "DEBVNAME $DEBVNAME"
echo "DEBFILE $DEBFILE"
# ExtUtils::MakeMaker 6.42 of perl 5.10.0 makes "$(DISTVNAME).tar.gz" depend
# on "$(DISTVNAME)" distdir directory, which is always non-existent after a
# successful dist build, so the .tar.gz is always rebuilt.
#
# So although the .deb depends on the .tar.gz don't express that here or it
# rebuilds the .tar.gz every time.
#
# The right rule for the .tar.gz would be to depend on the files which go
# into it of course ...
#
# DISPLAY is unset for making a deb since under fakeroot gtk stuff may try
# to read config files like ~/.pangorc from root's home dir /root/.pangorc,
# and that dir will be unreadable by ordinary users (normally), provoking
# warnings and possible failures from nowarnings().
#
test -f $DISTVNAME.tar.gz || make $DISTVNAME.tar.gz
debver="`dpkg-parsechangelog -c1 | sed -n -r -e 's/^Version: (.*)-[0-9.]+$/\1/p'`"
echo "debver $debver", want $VERSION
test "$debver" = "$VERSION"
rm -rf $DISTVNAME
tar xfz $DISTVNAME.tar.gz
unset DISPLAY; export DISPLAY
cd $DISTVNAME
if test -d examples; then
if ! grep _examples debian/rules; then
echo "examples directory not in debian/rules"
fi
fi
dpkg-checkbuilddeps debian/control
fakeroot debian/rules binary
cd ..
rm -rf $DISTVNAME
#------------------------------------------------------------------------------
# source .dsc
cp $DISTVNAME.tar.gz ${DEBNAME}_$VERSION.orig.tar.gz
tar xfz ${DEBNAME}_$VERSION.orig.tar.gz
if test "$DISTVNAME" != "$DEBNAME-$VERSION"; then
mv -T $DISTVNAME $DEBNAME-$VERSION
fi
dpkg-source -b $DEBNAME-$VERSION ${DEBNAME}_$VERSION.orig.tar.gz
rm -rf $DEBNAME-$VERSION
#------------------------------------------------------------------------------
# lintian .deb and source
lintian -I -i \
--suppress-tags new-package-should-close-itp-bug,desktop-entry-contains-encoding-key,command-in-menu-file-and-desktop-file,emacsen-common-without-dh-elpa,bugs-field-does-not-refer-to-debian-infrastructure \
$DEBFILE
lintian -I -i \
--suppress-tags maintainer-upload-has-incorrect-version-number,changelog-should-mention-nmu,empty-debian-diff,debian-rules-uses-deprecated-makefile,testsuite-autopkgtest-missing *.dsc
exit 0
Perl-Critic-Pulp-97/xtools/my-manifest.sh 0000755 0001750 0001750 00000001652 11764227757 016270 0 ustar gg gg #!/bin/sh
# my-manifest.sh -- update MANIFEST file
# Copyright 2009, 2010, 2011, 2012 Kevin Ryde
# my-manifest.sh is shared by several distributions.
#
# my-manifest.sh 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 3, or (at your option) any later
# version.
#
# my-manifest.sh 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 file. If not, see .
set -e
if [ -e MANIFEST ]; then
mv MANIFEST MANIFEST.old || true
fi
touch SIGNATURE
(
make manifest 2>&1;
diff -u MANIFEST.old MANIFEST
) | ${PAGER:-more}
Perl-Critic-Pulp-97/xtools/my-check-copyright-years.sh 0000755 0001750 0001750 00000005045 13360263206 020645 0 ustar gg gg #!/bin/sh
# my-check-copyright-years.sh -- check copyright years in dist
# Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2017, 2018 Kevin Ryde
# my-check-copyright-years.sh is shared by several distributions.
#
# my-check-copyright-years.sh 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 3, or (at your
# option) any later version.
#
# my-check-copyright-years.sh 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 file. If not, see .
set -e # die on error
set -x # echo
# find files in the dist with mod times this year, but without this year in
# the copyright line
if test -z "$DISTVNAME"; then
DISTVNAME=`sed -n 's/^DISTVNAME = \(.*\)/\1/p' Makefile`
fi
case $DISTVNAME in
*\$*) DISTVNAME=`make echo-DISTVNAME` ;;
esac
if test -z "$DISTVNAME"; then
echo "DISTVNAME not set and not in Makefile"
exit 1
fi
TARGZ="$DISTVNAME.tar.gz"
if test -e "$TARGZ"; then :;
else
pwd
echo "TARGZ $TARGZ not found"
exit 1
fi
MY_HIDE=
year=`date +%Y`
result=0
# files with dates $year
tar tvfz $TARGZ \
| egrep "$year-|debian/copyright" \
| sed "s:^.*$DISTVNAME/::" \
| {
while read i
do
# echo "consider $i"
GREP=grep
case $i in \
'' | */ \
| ppport.h \
| debian/changelog | debian/doc-base \
| debian/compat | debian/emacsen-compat | debian/source/format \
| debian/patches/*.diff \
| COPYING | MANIFEST* | SIGNATURE | META.yml | META.json \
| version.texi | */version.texi \
| *utf16* | examples/rs''s2lea''fnode.conf \
| */MathI''mage/ln2.gz | */MathI''mage/pi.gz \
| *.mo | *.locatedb* | t/samp.* \
| t/empty.dat | t/*.xpm | t/*.xbm | t/*.jpg | t/*.gif \
| t/*.g${MY_HIDE}d \
| tools/*-oeis-samples.gp \
| test-oeis-samples.gp \
| tools/configurations-gfs-generated.gp \
| devel/configurations-t-generated.gp \
| test-symbols.txt | test-funcs.txt \
| devel/minimal-domsets-max-even2.c \
| */_whizzy*)
continue ;;
*.gz)
GREP=zgrep
esac; \
if test -e "$srcdir/$i"
then f="$srcdir/$i"
else f="$i"
fi
if $GREP -q -e "Copyright.*$year" $f
then :;
else
echo "$i:1: this file"
grep Copyright $f
result=1
fi
done
}
exit $result
Perl-Critic-Pulp-97/xt/ 0002755 0001750 0001750 00000000000 13552456763 012577 5 ustar gg gg Perl-Critic-Pulp-97/xt/0-Test-ConsistentVersion.t 0000644 0001750 0001750 00000002253 11655356324 017527 0 ustar gg gg #!/usr/bin/perl -w
# 0-Test-ConsistentVersion.t -- run Test::ConsistentVersion if available
# Copyright 2011 Kevin Ryde
# 0-Test-ConsistentVersion.t is shared by several distributions.
#
# 0-Test-ConsistentVersion.t 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 3, or (at your option) any
# later version.
#
# 0-Test-ConsistentVersion.t 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 file. If not, see .
use 5.004;
use strict;
use Test::More;
eval { require Test::ConsistentVersion }
or plan skip_all => "due to Test::ConsistentVersion not available -- $@";
Test::ConsistentVersion::check_consistent_versions
(no_readme => 1, # no version number in my READMEs
no_pod => 1, # no version number in my docs, at the moment
);
# ! -e 'README');
exit 0;
Perl-Critic-Pulp-97/xt/0-Test-Synopsis.t 0000755 0001750 0001750 00000001764 11655356314 015667 0 ustar gg gg #!/usr/bin/perl -w
# 0-Test-Synopsis.t -- run Test::Synopsis if available
# Copyright 2009, 2010, 2011 Kevin Ryde
# 0-Test-Synopsis.t is shared by several distributions.
#
# 0-Test-Synopsis.t 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 3, or (at your option) any later
# version.
#
# 0-Test-Synopsis.t 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 file. If not, see .
use 5.004;
use strict;
use Test::More;
eval 'use Test::Synopsis; 1'
or plan skip_all => "due to Test::Synopsis not available -- $@";
## no critic (ProhibitCallsToUndeclaredSubs)
all_synopsis_ok();
exit 0;
Perl-Critic-Pulp-97/xt/0-no-debug-left-on.t 0000755 0001750 0001750 00000007016 13166050667 016162 0 ustar gg gg #!/usr/bin/perl -w
# 0-no-debug-left-on.t -- check no Smart::Comments left on
# Copyright 2011, 2012, 2017 Kevin Ryde
# 0-no-debug-left-on.t is shared by several distributions.
#
# 0-no-debug-left-on.t 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 3, or (at your option) any
# later version.
#
# 0-no-debug-left-on.t 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 file. If not, see .
# cf Test::NoSmartComments which uses Module::ScanDeps.
require 5;
use strict;
Test::NoDebugLeftOn->Test_More(verbose => 0);
exit 0;
package Test::NoDebugLeftOn;
use strict;
use ExtUtils::Manifest;
sub Test_More {
my ($class, %options) = @_;
require Test::More;
Test::More::plan (tests => 1);
Test::More::ok ($class->check (diag => \&Test::More::diag,
%options));
1;
}
sub check {
my ($class, %options) = @_;
my $diag = $options{'diag'};
if (! -e 'Makefile.PL') {
&$diag ('skip, no Makefile.PL so not ExtUtils::MakeMaker');
return 1;
}
my $href = ExtUtils::Manifest::maniread();
my @files = keys %$href;
my $good = 1;
my @perl_files = grep {m{
^lib/
|^(lib|examples|x?t)/.*\.(p[lm]|t)$
|^Makefile.PL$
|^[^/]+$
}x
} @files;
my $filename;
foreach $filename (@perl_files) {
if ($options{'verbose'}) {
&$diag ("perl file ",$filename);
}
if (! open FH, "< $filename") {
&$diag ("Oops, cannot open $filename: $!");
$good = 0;
next;
}
while () {
if (/^__END__/) {
last;
}
# only a DEBUG=> non-zero number is bad, so an expression can copy a
# debug from another package
if (/(DEBUG\s*=>\s*[1-9][0-9]*)/
|| /^[ \t]*((use|no) (Smart|Devel)::Comments)/
) {
print STDERR "\n$filename:$.: leftover: $_\n";
$good = 0;
}
# no "use lib ... devel", except in xt/*.t
unless ($filename =~ /\bxt\b/) {
if (/^[ \t]*(use lib\b.*devel.*)/) {
print STDERR "\n$filename:$.: leftover: $_\n";
$good = 0;
}
}
}
if (! close FH) {
&$diag ("Oops, error closing $filename: $!");
$good = 0;
next;
}
}
my @C_files = grep {m{
# toplevel or lib .c and .xs files
^[^/]*\.([ch]|xs)$
|^(lib|examples|x?t)/.*\.([ch]|xs)$
}x
} @files;
foreach $filename (@C_files) {
if ($options{'verbose'}) {
&$diag ("C/XS file ",$filename);
}
if (! open FH, "< $filename") {
&$diag ("Oops, cannot open $filename: $!");
$good = 0;
next;
}
while () {
if (/^#\s*define\s+DEBUG\s+[1-9]/
) {
print STDERR "\n$filename:$.: leftover: $_\n";
$good = 0;
}
}
if (! close FH) {
&$diag ("Oops, error closing $filename: $!");
$good = 0;
next;
}
}
&$diag ("checked ",scalar(@perl_files)," perl files, ",
scalar(@C_files)," C/XS files\n");
return $good;
}
Perl-Critic-Pulp-97/xt/0-file-is-part-of.t 0000644 0001750 0001750 00000006222 12536755447 016021 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2011, 2012, 2013, 2015 Kevin Ryde
# 0-file-is-part-of.t is shared by several distributions.
#
# 0-file-is-part-of.t 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 3, or (at your option) any
# later version.
#
# 0-file-is-part-of.t 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 file. If not, see .
require 5;
use strict;
use Test::More tests => 1;
use lib 't';
use MyTestHelpers;
BEGIN { MyTestHelpers::nowarnings(); }
ok (Test::FileIsPartOfDist->check(verbose=>1),
'Test::FileIsPartOfDist');
exit 0;
package Test::FileIsPartOfDist;
BEGIN { require 5 }
use strict;
use ExtUtils::Manifest;
use File::Slurp;
# uncomment this to run the ### lines
# use Smart::Comments;
sub import {
my $class = shift;
my $arg;
foreach $arg (@_) {
if ($arg eq '-test') {
require Test;
Test::plan(tests=>1);
is ($class->check, 1, 'Test::FileIsPartOfDist');
}
}
return 1;
}
sub new {
my $class = shift;
return bless { @_ }, $class;
}
sub check {
my $class = shift;
my $self = $class->new(@_);
my $manifest = ExtUtils::Manifest::maniread();
if (! $manifest) {
$self->diag("no MANIFEST perhaps");
return 0;
}
my @filenames = keys %$manifest;
my $distname = $self->makefile_distname;
if (! defined $distname) {
$self->diag("Oops, DISTNAME not found in Makefile");
return 0;
}
if ($self->{'verbose'}) {
$self->diag("DISTNAME $distname");
}
my $good = 1;
my $filename;
foreach $filename (@filenames) {
if (! $self->check_file_is_part_of($filename,$distname)) {
$good = 0;
}
}
return $good;
}
sub makefile_distname {
my ($self) = @_;
my $filename = "Makefile";
my $content = File::Slurp::read_file ($filename);
if (! defined $content) {
$self->diag("Cannot read $filename: $!");
return undef;
}
my $distname;
if ($content =~ /^DISTNAME\s*=\s*([^#\n]*)/m) {
$distname = $1;
$distname =~ s/\s+$//;
### $distname
if ($distname eq 'App-Chart') { $distname = 'Chart'; } # hack
}
return $distname;
}
sub check_file_is_part_of {
my ($self, $filename, $distname) = @_;
my $content = File::Slurp::read_file ($filename);
if (! defined $content) {
$self->diag("Cannot read $filename: $!");
return 0;
}
$content =~ /([T]his file is part of[^\n]*)/i
or return 1;
my $got = $1;
if ($got =~ /[T]his file is part of \Q$distname\E\b/i) {
return 1;
}
$self->diag("$filename: $got");
$self->diag("expected DISTNAME: $distname");
return 0;
}
sub diag {
my $self = shift;
my $func = $self->{'diag_func'}
|| eval { Test::More->can('diag') }
|| \&_diag;
&$func(@_);
}
sub _diag {
my $msg = join('', map {defined($_)?$_:'[undef]'} @_)."\n";
$msg =~ s/^/# /mg;
print STDERR $msg;
}
Perl-Critic-Pulp-97/xt/0-Test-DistManifest.t 0000755 0001750 0001750 00000002311 11655356331 016416 0 ustar gg gg #!/usr/bin/perl -w
# 0-Test-DistManifest.t -- run Test::DistManifest if available
# Copyright 2009, 2010, 2011 Kevin Ryde
# 0-Test-DistManifest.t is shared by several distributions.
#
# 0-Test-DistManifest.t 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 3, or (at your option) any
# later version.
#
# 0-Test-DistManifest.t 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 file. If not, see .
use 5.004;
use strict;
use Test::More;
# This is only an author test really and it only really does much in a
# working directory where newly added files will exist. In a dist dir
# something would have to be badly wrong for the manifest to be off.
eval { require Test::DistManifest }
or plan skip_all => "due to Test::DistManifest not available -- $@";
Test::DistManifest::manifest_ok();
exit 0;
Perl-Critic-Pulp-97/xt/0-Test-YAML-Meta.t 0000755 0001750 0001750 00000003461 13046214104 015444 0 ustar gg gg #!/usr/bin/perl -w
# 0-Test-YAML-Meta.t -- run Test::CPAN::Meta::YAML if available
# Copyright 2009, 2010, 2011, 2013, 2014, 2017 Kevin Ryde
# 0-Test-YAML-Meta.t is shared by several distributions.
#
# 0-Test-YAML-Meta.t 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 3, or (at your option) any later
# version.
#
# 0-Test-YAML-Meta.t 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 file. If not, see .
use 5.004;
use strict;
use Test::More;
my $meta_filename = 'META.yml';
unless (-e $meta_filename) {
plan skip_all => "$meta_filename doesn't exist -- assume this is a working directory not a dist";
}
plan tests => 3;
SKIP: {
eval { require CPAN::Meta::Validator; 1 }
or skip "due to CPAN::Meta::Validator not available -- $@";
eval { require YAML; 1 }
or skip "due to YAML module not available -- $@", 1;
diag "CPAN::Meta::Validator version ", CPAN::Meta::Validator->VERSION;
my $struct = YAML::LoadFile ($meta_filename);
my $cmv = CPAN::Meta::Validator->new($struct);
ok ($cmv->is_valid);
if (! $cmv->is_valid) {
diag "CPAN::Meta::Validator errors:";
foreach ($cmv->errors) { diag $_; }
}
}
{
# Test::CPAN::Meta::YAML version 0.15 for upper case "optional_features" names
#
eval 'use Test::CPAN::Meta::YAML 0.15; 1'
or plan skip_all => "due to Test::CPAN::Meta::YAML 0.15 not available -- $@";
Test::CPAN::Meta::YAML::meta_spec_ok('META.yml');
}
exit 0;
Perl-Critic-Pulp-97/xt/0-META-read.t 0000755 0001750 0001750 00000010715 12136177162 014553 0 ustar gg gg #!/usr/bin/perl -w
# 0-META-read.t -- check META.yml can be read by various YAML modules
# Copyright 2009, 2010, 2011, 2012, 2013 Kevin Ryde
# 0-META-read.t is shared among several distributions.
#
# 0-META-read.t 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 3, or (at your option) any later
# version.
#
# 0-META-read.t 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 file. If not, see .
use 5.005;
use strict;
use Test::More;
use lib 't';
use MyTestHelpers;
BEGIN { MyTestHelpers::nowarnings(); }
# When some of META.yml is generated by explicit text in Makefile.PL it can
# be easy to make a mistake in the syntax, or indentation, etc, so the idea
# here is to check it's readable from some of the YAML readers.
#
# The various readers differ in how strictly they look at the syntax.
# There's no attempt here to say one of them is best or tightest or
# whatever, just see that they all work.
#
# See 0-Test-YAML-Meta.t for Test::YAML::Meta which looks into field
# contents, as well as maybe the YAML formatting.
my $meta_filename;
# allow for ancient perl, maybe
eval { require FindBin; 1 } # new in 5.004
or plan skip_all => "FindBin not available -- $@";
eval { require File::Spec; 1 } # new in 5.005
or plan skip_all => "File::Spec not available -- $@";
diag "FindBin $FindBin::Bin";
$meta_filename = File::Spec->catfile
($FindBin::Bin, File::Spec->updir, 'META.yml');
-e $meta_filename
or plan skip_all => "$meta_filename doesn't exist -- assume this is a working directory not a dist";
plan tests => 5;
SKIP: {
eval { require YAML; 1 }
or skip "due to YAML module not available -- $@", 1;
my $ok = eval { YAML::LoadFile ($meta_filename); 1 }
or diag "YAML::LoadFile() error -- $@";
ok ($ok, "Read $meta_filename with YAML module");
}
# YAML 0.68 is in fact YAML::Old, or something weird -- don't think they can
# load together
#
# SKIP: {
# eval { require YAML::Old; 1 }
# or skip 'due to YAML::Old not available -- $@', 1;
#
# eval { YAML::Old::LoadFile ($meta_filename) };
# is ($@, '',
# "Read $meta_filename with YAML::Old");
# }
SKIP: {
eval { require YAML::Syck; 1 }
or skip "due to YAML::Syck not available -- $@", 1;
my $ok = eval { YAML::Syck::LoadFile ($meta_filename); 1 }
or diag "YAML::Syck::LoadFile() error -- $@";
ok ($ok, "Read $meta_filename with YAML::Syck");
}
SKIP: {
eval { require YAML::Tiny; 1 }
or skip "due to YAML::Tiny not available -- $@", 1;
my $ok = eval { YAML::Tiny->read ($meta_filename); 1 }
or diag "YAML::Tiny->read() error -- $@";
ok ($ok, "Read $meta_filename with YAML::Tiny");
}
SKIP: {
eval { require YAML::XS; 1 }
or skip "due to YAML::XS not available -- $@", 1;
my $ok = eval { YAML::XS::LoadFile ($meta_filename); 1 }
or diag "YAML::XS::LoadFile() error -- $@";
ok ($ok, "Read $meta_filename with YAML::XS");
}
# Parse::CPAN::Meta describes itself for use on "typical" META.yml, so not
# sure if demanding it works will more exercise its subset of yaml than the
# correctness of our META.yml. At any rate might like to know if it fails,
# so as to avoid tricky yaml for everyone's benefit, maybe.
#
SKIP: {
eval { require Parse::CPAN::Meta; 1 }
or skip "due to Parse::CPAN::Meta not available -- $@", 1;
my $ok = eval { Parse::CPAN::Meta::LoadFile ($meta_filename); 1 }
or diag "Parse::CPAN::Meta::LoadFile() error -- $@";
ok ($ok, "Read $meta_filename with Parse::CPAN::Meta::LoadFile");
}
# Data::YAML::Reader 0.06 doesn't like header "--- #YAML:1.0" with the #
# part produced by other YAML writers, so skip for now
#
# SKIP: {
# eval { require Data::YAML::Reader; 1 }
# or skip 'due to Data::YAML::Reader not available -- $@', 1;
#
# my $reader = Data::YAML::Reader->new;
# open my $fh, '<', $meta_filename
# or die "Cannot open $meta_filename";
# my $str = do { local $/=undef; <$fh> };
# close $fh or die;
#
# # if ($str !~ /\.\.\.$/) {
# # $str .= "...";
# # }
# my @lines = split /\n/, $str;
# push @lines, "...";
# use Data::Dumper;
# print Dumper(\@lines);
#
# # { local $,="\n"; print @lines,"\n"; }
exit 0;
Perl-Critic-Pulp-97/xt/policy-lists.t 0000644 0001750 0001750 00000004700 12111612241 015365 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2013 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any later
# version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
# Check that the supported fields described in each pod matches what the
# code says.
use 5.005;
use strict;
use FindBin;
use ExtUtils::Manifest;
use List::Util 'max';
use File::Spec;
use Test::More;
use lib 't','xt';
use MyTestHelpers;
BEGIN { MyTestHelpers::nowarnings() }
# uncomment this to run the ### lines
# use Smart::Comments;
plan tests => 1;
my $toplevel_dir = File::Spec->catdir ($FindBin::Bin, File::Spec->updir);
my $manifest_file = File::Spec->catfile ($toplevel_dir, 'MANIFEST');
my $manifest = ExtUtils::Manifest::maniread ($manifest_file);
my @lib_policies
= map {m{^lib/Perl/Critic/Policy/(.+)\.pm$} ? $1 : ()} keys %$manifest;
foreach (@lib_policies) { s{/}{::} }
@lib_policies = sort @lib_policies;
### @lib_policies
diag "module policies count ",scalar(@lib_policies);
#------------------------------------------------------------------------------
{
open FH, 'lib/Perl/Critic/Pulp.pm' or die $!;
my $content = do { local $/; }; # slurp
close FH or die;
# ### $content
{
$content =~ /=for my_pod policy_list begin(.*)=for my_pod policy_list end/s
or die "pulp_list not matched, content:\n",$content;
my $pulp_list = $1;
my @pulp_list;
while ($pulp_list =~ /^=item L<([^|]+)/mg) {
push @pulp_list, $1;
}
@pulp_list = sort @pulp_list;
### @pulp_list
diag "pulp list count ",scalar(@pulp_list);
my $s = join(', ',@pulp_list);
my $l = join(', ',@lib_policies);
is ($s, $l, 'Pulp.pm policy list');
my $j = "$s\n$l";
$j =~ /^(.*)(.*)\n\1(.*)/ or die;
my $sd = $2;
my $ld = $3;
if ($sd) {
diag "pulp list: ",$sd;
diag "modules: ",$ld;
}
}
}
#------------------------------------------------------------------------------
exit 0;
Perl-Critic-Pulp-97/xt/0-Test-Pod.t 0000755 0001750 0001750 00000001751 11655356337 014563 0 ustar gg gg #!/usr/bin/perl -w
# 0-Test-Pod.t -- run Test::Pod if available
# Copyright 2009, 2010, 2011 Kevin Ryde
# 0-Test-Pod.t is shared by several distributions.
#
# 0-Test-Pod.t 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 3, or (at your option) any later
# version.
#
# 0-Test-Pod.t 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 file. If not, see .
use 5.004;
use strict;
use Test::More;
# all_pod_files_ok() is new in Test::Pod 1.00
#
eval 'use Test::Pod 1.00; 1'
or plan skip_all => "due to Test::Pod 1.00 not available -- $@";
Test::Pod::all_pod_files_ok();
exit 0;
Perl-Critic-Pulp-97/Makefile.PL 0000755 0001750 0001750 00000011267 13074053433 014110 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2017 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use 5.006;
use strict;
use warnings;
use ExtUtils::MakeMaker;
WriteMakefile
(NAME => 'Perl::Critic::Pulp',
ABSTRACT => 'Some add-on policies for Perl::Critic.',
VERSION_FROM => 'lib/Perl/Critic/Pulp.pm',
AUTHOR => 'Kevin Ryde ',
LICENSE => 'gpl_3',
SIGN => 1,
MIN_PERL_VERSION => '5.006',
PREREQ_PM => {
# 1.220 for its incompatible PPI::Statement::Sub->prototype()
'PPI' => '1.220',
'PPI::Document' => 0,
# actually PPI::Dumper only used in the .t scripts if
# there's an error ...
'PPI::Dumper' => 0,
# 1.082 or some such for new style parameter specs
# 1.084 for highest_explicit_perl_version() method
'Perl::Critic' => '1.084',
# parts of Perl::Critic, used so name them explicitly
'Perl::Critic::Policy' => '1.084',
# Utils 1.100 for precedence_of() supporting -f etc filetests
'Perl::Critic::Utils' => '1.100',
'Perl::Critic::Utils::PPI' => 0,
'Perl::Critic::Violation' => 0,
# Required by Perl::Critic itself anyway.
# 1.02 for avoiding leaks in perl 5.8, probably
# something newer has more merit though
'IO::String' => '1.02',
# Also used by Perl::Critic itself. Maybe should
# require 0.24 for various XS bugfixes.
'List::MoreUtils' => '0.24', # 0.24 for stack growing, maybe
# Could make this optional, but it doesn't drag in anything
# outrageous.
'Pod::MinimumVersion' => 50, # v.50 fix text in =item etc
# Builtin in recent perl anyway.
'List::Util' => 0,
'Test::More' => 0,
'Scalar::Util' => 0,
# Required by Perl::Critic itself anyway,
# and comes with perl 5.10 anyway too.
'version' => 0,
'Pod::Escapes' => 0,
'Pod::Parser' => 0,
'Pod::ParseLink' => 0,
},
META_MERGE =>
{ 'meta-spec' => { version => 2 },
resources =>
{ homepage => 'http://user42.tuxfamily.org/perl-critic-pulp/index.html',
license => 'http://www.gnu.org/licenses/gpl.html',
},
# don't index "package Perl::MinimumVersion" additions there
no_index => { package => [ 'Perl::MinimumVersion' ],
directory=>['devel','xt'],
},
recommends => { 'Perl::MinimumVersion' => 0,
},
prereqs =>
{ test =>
{ suggests =>
{ 'Perl::MinimumVersion' => 0,
},
},
},
optional_features =>
{ maximum_policies =>
{ description => 'Have the policies check as much as possible.',
prereqs =>
{ runtime =>
{ requires => { 'Perl::MinimumVersion' => 0,
},
},
},
},
},
},
);
# maximum_devel =>
# { description => 'Stuff used variously for development.',
# requires => { 'PPI::Document' => 0,
# 'Perl::MinimumVersion' => 0,
# 'Encode' => 0,
# 'Perl6::Slurp' => 0,
# 'Regexp::Common' => 0,
# 'Devel::Mallinfo' => 0,
# 'IO::Uncompress::AnyInflate' => 0,
# 'lib::abs' => 0,
# 'IO::String' => 0,
# 'Digest::MD5' => 0,
# 'I18N::Langinfo' => 0,
# 'Locale::TextDomain' => 0,
# 'File::Locate' => 0,
#
# 'File::Locate::Iterator' => 0, # mine
# # parts of File::Locate::Iterator
# 'Iterator::Simple' => 0,
# 'Iterator::Simple::Locate' => 0,
# },
# },
Perl-Critic-Pulp-97/devel/ 0002755 0001750 0001750 00000000000 13552456763 013243 5 ustar gg gg Perl-Critic-Pulp-97/devel/grep-fat-comma.pl 0000644 0001750 0001750 00000004325 12326663420 016365 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2009, 2010, 2011, 2013, 2014 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
# cf
# egrep -nH -ire '[^[a-z-]-[a-ln-z0-9][a-z0-9]*::' /usr/share/perl/5.10
# /usr/share/perl/5.14/Math/Complex.pm:712: -CORE::exp(CORE::log(-$z)/3) :
# /usr/share/perl/5.14/Math/Complex.pm:1043: my $v = -CORE::log($alpha + CORE::sqrt($alpha*$alpha-1));
# cf \c control characters in lower case
# XML::RSS::TimingBot \cm\cj
use 5.005;
use strict;
use warnings;
use Perl::Critic::Utils 'is_perl_builtin';
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
# uncomment this to run the ### lines
# use Smart::Comments;
my $verbose = 0;
my $l = MyLocatePerl->new;
while (my ($filename, $str) = $l->next) {
if ($verbose) { print "look at $filename\n"; }
# if ($str =~ /^__END__/m) {
# substr ($str, $-[0], length($str), '');
# }
# strip comments
# $str =~ s/#.*//mg;
while ($str =~ /((^|[^>A-Za-z])(\w+)
([ \t]*(\#[^\n]*)?\n)+
[ \t]*=>
)/sgx) {
my $whole = $1;
my $word = $3;
next unless is_perl_builtin(_sans_dash($word));
my $pos_end = pos($str);
my $pos = $pos_end - length($whole) + 1;
my ($line, $col) = MyStuff::pos_to_line_and_column ($str, $pos);
my $l1 = MyStuff::line_at_pos($str, $pos);
my $l2 = MyStuff::line_at_pos($str, $pos_end);
### $l1
# substr($s,0,$col) =~ /q[qx]|"/ or next;
print "$filename:$line:$col:\n $l1 $l2";
}
}
sub _sans_dash {
my ($str) = @_;
$str =~ s/^-//;
return $str;
}
exit 0;
__END__
print # foo
=> '123',
-caller # jkdf
=> '123',
Perl-Critic-Pulp-97/devel/notwithcompare.pl 0000755 0001750 0001750 00000002727 11424406722 016636 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2008, 2009, 2010 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use strict;
use warnings;
use Data::Dumper;
{
sub func1 { print "func1 $_[0]\n" }
sub func2 ($) { print "func2 $_[0]\n" }
my $x = 0;
if (! func1 $x != 123) { print "yes\n"; } else { print "no\n"; }
if (! func2 $x != 123) { print "yes\n"; } else { print "no\n"; }
exit 0;
}
{ my $x = 'b';
if (! $x eq 'a') { print "yes\n"; } else { print "no\n"; }
}
{ my $attribs = 1;
my $x = !( $attribs & 1 ) << 1;
$x = !( $attribs & 1 );
$x = $x << 1;
# $attribs = 0;
# $x = $attribs & 1;
# $x = ($x) << 1;
print Dumper($x);
}
# use Test::More tests => 1;
# Test::More::eq_array(123, 456);
# Test::More::is_deeply([123], [456]);
{ my $x = 'a';
if (! $x =~ /b/) { print "yes\n"; } else { print "no\n"; }
}
# ! $x + $y == 1
exit 0;
Perl-Critic-Pulp-97/devel/grep-duplicate-use.pl 0000644 0001750 0001750 00000004541 12277565746 017306 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2013, 2014 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
# Usage: perl grep-duplicate-use.pl
#
use 5.010;
use strict;
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
use MyStuff;
# uncomment this to run the ### lines
#use Smart::Comments;
my $verbose = 0;
my $l = MyLocatePerl->new (exclude_t => 1,
under_directory => '/usr/share/perl5',
# under_directory => '/usr/share/perl/5.14/',
# under_directory => "$ENV{HOME}/p/",
# under_directory => "/usr/share/perl5/Wx/DemoHints/",
);
my $count;
{
while (my ($filename, $content) = $l->next) {
file ($filename, $content);
}
exit 0;
}
sub file {
my ($filename, $str) = @_;
if ($verbose) {
print "$filename\n";
}
# ([A-Za-z0-9_:]*)/mg) {
# [ \t]*
my %seen;
my $package = 'main';
while ($str =~ /^(__END__)|^(use|no|package)[ \t\r\n]+([^;]*)/mg) {
last if $1;
my $type = $2;
my $module = $3;
my $pos = pos($str)-length($module);
$module =~ s/[ \t\r\n]+/ /g;
$module =~ s/^[ \t\r\n]+//g;
$module =~ s/[ \t\r\n]+$//g;
# next if $module eq 'integer'; # pragma
if ($type eq 'package') {
$package = $module;
next;
}
if ($type eq 'no') {
delete $seen{$package}->{$module}; # = 'pragma';
next;
}
if ($seen{$package}->{$module}) {
if ($seen{$package}->{$module} eq 'pragma') { next; }
my ($line, $col) = MyStuff::pos_to_line_and_column ($str, $pos);
print "$filename:$line:$col: (package $package)\n",
MyStuff::line_at_pos($str, $pos);
} else {
$seen{$package}->{$module} = 1;
}
}
}
exit 0;
Perl-Critic-Pulp-97/devel/grep-pod-verbatim-unindent.pl 0000644 0001750 0001750 00000005047 12326663443 020743 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2009, 2010, 2011, 2014 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
# various
# some DB<1> debugger prompts
use 5.005;
use strict;
use warnings;
use Perl6::Slurp;
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
use FindBin;
my $script_filename = File::Spec->catfile ($FindBin::Bin, $FindBin::Script);
# uncomment this to run the ### lines
#use Smart::Comments;
my $verbose = 0;
my $parser = MyParser->new;
$parser->errorsub(sub{1}); # no error prints
$parser->parse_from_file ($script_filename);
#exit 0;
my $l = MyLocatePerl->new (include_pod => 1,
exclude_t => 1);
while (my ($filename, $str) = $l->next) {
if ($verbose) { print "look at $filename\n"; }
if ($str =~ /^__END__/m) {
substr ($str, $-[0], length($str), '');
}
$parser->parse_from_string ($str, $filename);
}
package MyParser;
use strict;
use warnings;
use base 'Pod::Parser';
sub parse_from_string {
my ($self, $str, $filename) = @_;
require IO::String;
my $fh = IO::String->new ($str);
$self->{_INFILE} = $filename;
return $self->parse_from_filehandle ($fh);
}
sub command {
my ($self, $command) = @_;
if ($command eq 'begin') {
$self->{'in_begin'} = 1;
} elsif ($command eq 'end') {
$self->{'in_begin'} = 0;
}
return '';
}
sub verbatim {
my ($self, $text, $linenum, $paraobj) = @_;
### verbatim: $text
return if $self->{'in_begin'};
if ($text =~ /\n=[^\n]*/g) {
my $pos = pos($text);
my $initial = substr($text,0,$pos);
my $filename = $self->{_INFILE};
print "$filename:$linenum:1: verbatim runs over directive:\n$initial\n";
}
if ($text =~ /\n\S[^\n]*/g) {
my $pos = pos($text);
my $initial = substr($text,0,$pos);
my $filename = $self->{_INFILE};
print "$filename:$linenum:1: unindented verbatim:\n$initial\n";
}
}
sub textblock {
my ($self, $text, $linenum, $paraobj) = @_;
return '';
}
exit 0;
=pod
fjksds
djksf
=cut
Perl-Critic-Pulp-97/devel/grep-condsub.pl 0000644 0001750 0001750 00000003223 12060735311 016144 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2009, 2010, 2012 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use 5.006;
use strict;
use warnings;
use Regexp::Common 'comment';
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
use Text::Tabs ();
my $verbose = 0;
my $l = MyLocatePerl->new;
while (my ($filename, $str) = $l->next) {
if ($verbose) { print "look at $filename\n"; }
if ($str =~ /^__END__/m) {
substr ($str, $-[0], length($str), '');
}
# strip comments
$str =~ s/$RE{comment}{Perl}//og;
while ($str =~ /^([ \t])+(sub [[:alnum:]]|\b(BEGIN|END|CHECK|INIT)\b)/mg) {
my $pos = pos($str);
my ($indent) = Text::Tabs::expand ($1);
$indent = length ($indent);
my $before = substr ($str, 0, $pos);
$indent--;
$before =~ /^ {0,$indent}(if|unless)\b/m
or next;
my $before_pos = $-[0];
my ($line, $col) = MyStuff::pos_to_line_and_column ($str, $pos);
print "$filename:$line:$col:\n",
MyStuff::line_at_pos($str, $before_pos),
MyStuff::line_at_pos($str, $pos);
}
}
exit 0;
Perl-Critic-Pulp-97/devel/version_check.pl 0000644 0001750 0001750 00000002004 11571602261 016375 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2010, 2011 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use strict;
use warnings;
use lib '.';
use lib 'devel';
use version_check 1.1;
{
my $v = version_check->VERSION;
print "ref: ",ref $v,"\n";
}
{
my $ret = version_check->VERSION('0');
print "ret $ret\n";
}
{
my $ret = version_check->VERSION('0');
print "ret $ret\n";
}
print "done\n";
Perl-Critic-Pulp-97/devel/MyStuff.pm 0000644 0001750 0001750 00000006561 11606171461 015167 0 ustar gg gg # Copyright 2009, 2011 Kevin Ryde.
# MyStuff.pm is shared by various distributions.
#
# MyStuff.pm 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 3, or (at your option) any later
# version.
#
# MyStuff.pm 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 file. If not, see .
package MyStuff;
use 5.010;
use strict;
use warnings;
use Text::Tabs;
#my $verbose = 0;
sub line_at_pos {
my ($str, $pos) = @_;
my $start = (rindex ($str, "\n", $pos) || -1) + 1;
my $end = (index ($str, "\n", $pos) || length($str)-1) + 1;
return substr($str, $start, $end - $start);
}
sub pos_to_line_and_column {
my ($str, $pos) = @_;
$str = substr ($str, 0, $pos);
my $nlpos = rindex ($str, "\n");
my $lastline = substr ($str, $nlpos+1);
$lastline = Text::Tabs::expand ($lastline);
my $colnum = 1 + length ($lastline);
my $linenum = 1 + scalar($str =~ tr/\n//);
return ($linenum, $colnum);
}
package Iterator::Simple::FileUniq;
sub new {
my ($class, $it) = (shift, shift);
my $fu = FileUniq->new (@_);
return Iterator::Simple::iterator
(sub {
my $filename;
while (defined (my $filename = $it->next)) {
last if $fu->uniq ($filename);
}
});
}
package Locator;
sub new {
my ($class, @args) = @_;
open my $fh, '-|', 'locate', '-0', '--', @args or die;
return bless { fh => $fh,
}, $class;
}
sub next {
my ($self) = @_;
my $fh = $self->{'fh'};
my $filename;
{
local $/ = "\0";
$filename = <$fh>;
if (defined $filename) {
chomp $filename;
}
}
return $filename;
}
package Locator::BinScripts;
sub new {
my ($class, $type) = @_;
return bless { 'type' => $type,
'locator' => Locator->new ('/bin/*',
'/usr/bin/*',
'/usr/local/bin/*',
'/usr/local/bin2/*',
) }, $class;
}
sub next {
my ($self) = @_;
my $type = $self->{'type'};
for (;;) {
my $filename = $self->{'locator'}->next // return undef;
my ($fh, $buf);
if (open($fh,'<',$filename)
&& read($fh,$buf,80)
&& $buf =~ m{^#![a-z0-9/]*/$type([ \t]|$)}) {
return $filename;
}
}
}
package Locator::Concat;
sub new {
my ($class, @locators) = @_;
return bless { 'locators' => \@locators }, $class;
}
sub next {
my ($self) = @_;
my $locators = $self->{'locators'};
for (;;) {
@$locators or return undef;
my $filename = $locators->[0]->next;
if (defined $filename) { return $filename; }
shift @$locators;
}
}
1;
__END__
my @files = split /\n/, `locate \*.t \*.pm \*.pl`;
@files = grep {-f $_} @files;
@files = uniq_by_func (\&stat_dev_ino, @files);
sub uniq_by_func {
my $func = shift;
my %seen;
return grep { $seen{$func->($_)}++ == 0 } @_;
}
sub stat_dev_ino {
my ($filename) = @_;
my ($dev, $ino) = stat ($filename);
return "$dev,$ino";
}
print "look at ",scalar(@files)," files\n";
Perl-Critic-Pulp-97/devel/posix-size.pl 0000644 0001750 0001750 00000005476 11424406722 015706 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2009, 2010 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use strict;
use warnings;
use Devel::Mallinfo;
use POSIX;
package Foo;
package Bar;
package Quux;
my ($x, $y);
my $n = 0;
sub packname { ++$n; return "Pack$n" }
foreach (1 .. 10) {
my $package = packname();
eval "package $package;our \$VERSION = 1";
$x = Devel::Mallinfo::mallinfo()->{'uordblks'};
eval "package $package;use POSIX";
$y = Devel::Mallinfo::mallinfo()->{'uordblks'};
print "$package adds @{[$y-$x]}\n";
}
foreach (1 .. 10) {
my $package = packname();
eval "package $package;our \$VERSION = 1";
$x = Devel::Mallinfo::mallinfo()->{'uordblks'};
eval "package $package;use POSIX ()";
$y = Devel::Mallinfo::mallinfo()->{'uordblks'};
print "$package adds @{[$y-$x]}\n";
}
package Bar;
use constant FOO => 123;
BEGIN { print $x = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
use POSIX;
BEGIN { print $y = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
BEGIN { print __PACKAGE__." adds ", $y-$x,"\n"; }
print "Bar count ",scalar(keys %Bar::),"\n";
#{ local $, = "\n"; print keys %Bar::,"\n"; }
package Quux;
BEGIN { print $x = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
use POSIX;
BEGIN { print $y = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
BEGIN { print __PACKAGE__." adds ", $y-$x,"\n"; }
print "Quux count ",scalar(keys %Quux::),"\n";
package Four;
use constant FOO => 123;
BEGIN { print $x = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
use POSIX qw(dup);
BEGIN { print $y = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
BEGIN { print __PACKAGE__." adds ", $y-$x,"\n"; }
package Five;
use constant FOO => 123;
BEGIN { print $x = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
use POSIX ();
BEGIN { print $y = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
BEGIN { print __PACKAGE__." adds ", $y-$x,"\n"; }
package Six;
use constant FOO => 123;
BEGIN { print $x = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
use POSIX qw(dup EBADF);
BEGIN { print $y = Devel::Mallinfo::mallinfo()->{'uordblks'},"\n"; }
BEGIN { print __PACKAGE__." adds ", $y-$x,"\n"; }
print "POSIX EXPORT ",scalar(@POSIX::EXPORT),"\n";
#{ local $, = "\n"; print keys %Bar::,"\n"; }
exit 0;
Perl-Critic-Pulp-97/devel/version.pl 0000644 0001750 0001750 00000002652 11672322722 015254 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2010, 2011 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use strict;
use warnings;
# uncomment this to run the ### lines
use Smart::Comments;
use Test::Without::Module 'version::vxs';
use blib "$ENV{HOME}/perl/version/version-0.88/blib";
# use version::vxs;
# use version::vpp;
my $vpp = version::vpp->VERSION;
### $vpp
{
require version;
print "version.pm ", version->VERSION, "\n";
# my $v = version->new('1.234.567');
my $v = version->new('1e6');
print "v $v\n";
print "done\n";
exit 0;
}
{
use Perl::Critic::Utils 1.0;
use Perl::Critic::Utils 1.0 'precedence_of';
print Perl::Critic::Utils->VERSION,"\n";
exit 0;
}
{
my $x = '1e6';
print ($x > 2);
exit 0;
}
{
require AptPkg::Policy;
print AptPkg::Policy->VERSION,"\n";
exit 0;
}
Perl-Critic-Pulp-97/devel/grep-pod-final-cut.pl 0000644 0001750 0001750 00000005714 13015435020 017153 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2009, 2010, 2012, 2014, 2016 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
# Look for __END__ without a pod =cut before it
#
# /usr/share/perl/5.24/ExtUtils/MM_BeOS.pm
# /usr/share/perl/5.24/IPC/Cmd.pm
use 5.005;
use strict;
use warnings;
use Perl6::Slurp;
use FindBin;
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
# uncomment this to run the ### lines
use Smart::Comments;
my $verbose = 1;
my $count_all = 0;
my $count_pod = 0;
my $count_code = 0;
my $count_cut = 0;
my $count_nocut = 0;
{
my $filename = File::Spec->catfile ($FindBin::Bin, $FindBin::Script);
my $str = Perl6::Slurp::slurp($filename);
my_grep ($filename, $str);
}
{
my $filename = '/usr/share/perl/5.14/ExtUtils/MM_BeOS.pm';
my $str = Perl6::Slurp::slurp($filename);
my_grep ($filename, $str);
}
{
my $l = MyLocatePerl->new (exclude_t => 1,
# under_directory => '/usr/share/perl5',
under_directory => '/usr/share/perl/5.14/',
);
while (my ($filename, $str) = $l->next) {
my_grep ($filename, $str);
}
}
sub last_pod_command {
my ($str) = @_;
my $pos = length($str);
for (;;) {
$pos = rindex($str, "\n=", $pos-1);
if ($pos < 0) {
last;
}
pos($str) = $pos + 1;
if ($str =~ /\G(=[a-z]+)/mg) {
return ($pos, $1);
}
# some "==" or "=>", not a pod directive, keep looking
}
if ($str =~ /^(=[a-z]+)/) {
return (0, $1);
}
return;
}
sub my_grep {
my ($filename, $str) = @_;
$count_all++;
my ($podpos, $command) = last_pod_command ($str)
or return;
$count_pod++;
if ($verbose) {
my ($line, $col) = MyStuff::pos_to_line_and_column ($str, $podpos);
print "$filename:$line: $command\n";
}
pos($str) = $podpos;
my $endpodpos = index ($str, "\n\n", $podpos);
if ($endpodpos < 0) {
$endpodpos = length($str);
}
if ($command ne '=cut') {
$count_nocut++;
return;
}
my $trailing = substr($str, $endpodpos);
if ($trailing =~ /\S/) {
if ($verbose) { print " code after pod\n"; }
# code after pod
$count_code++;
return;
}
$count_cut++;
}
print "total $count_all\n";
print "contains pod $count_pod\n";
print "end non-cut $count_nocut\n";
print "end with code $count_code\n";
print "end with cut $count_cut\n";
exit 0;
=pod
__END__
Perl-Critic-Pulp-97/devel/churn-unbalanced.pl 0000644 0001750 0001750 00000003131 11571547354 017001 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2009, 2010, 2011 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use 5.005;
use strict;
use warnings;
use lib::abs '.', 'lib';
use MyLocatePerl;
use MyStuff;
use Perl::Critic::Policy::Documentation::ProhibitUnbalancedParens;
# uncomment this to run the ### lines
#use Smart::Comments;
my $verbose = 0;
{
package MyParser;
use base 'Perl::Critic::Pulp::PodParser::ProhibitUnbalancedParens';
sub violation_at_linenum_and_textpos {
my ($self, $message, $linenum, $str, $pos) = @_;
my $filename = $self->{'filename'};
my ($pos_linenum, $column) = MyStuff::pos_to_line_and_column($str,$pos);
$linenum += $pos_linenum - 1;
print "$filename:$linenum:$column: $message\n";
}
}
my $parser = MyParser->new;
my $l = MyLocatePerl->new (exclude_t => 1);
while (my ($filename, $str) = $l->next) {
if ($verbose) { print "look at $filename\n"; }
$parser->{'filename'} = $filename;
$parser->parse_from_file ($filename);
}
exit 0;
Perl-Critic-Pulp-97/devel/const-noproto.pl 0000644 0001750 0001750 00000001704 11424406724 016410 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2008, 2009, 2010 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use strict;
use warnings;
use Data::Dumper;
use Socket;
my $p = prototype('Socket::SOCK_DGRAM');
print "SOCK_DGRAM ",Dumper($p);
sub FOO { return 123; }
# bad
# if (FOO < 456) { print "yes\n"; } else { print "no\n"; }
exit 0
Perl-Critic-Pulp-97/devel/grep-pod-gt.pl 0000644 0001750 0001750 00000006602 12326663661 015722 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2009, 2010, 2013, 2014 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
# /usr/share/perl/5.10.1/Dumpvalue.pm ->
# /usr/share/perl/5.10.1/Test/Builder/Tester.pm C<>
use 5.005;
use strict;
use warnings;
use Perl6::Slurp;
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
my $verbose = 0;
my $l = MyLocatePerl->new (under_directory => '/usr/share/perl5',
# under_directory => '/usr/share/perl/5.14/',
);
while (my ($filename, $str) = $l->next) {
if ($verbose) { print "look at $filename\n"; }
if ($str =~ /^__END__/m) {
substr ($str, $-[0], length($str), '');
}
my $parser = MyParser->new;
$parser->errorsub(sub{1}); # no error prints
$parser->parse_from_string ($str, $filename);
}
package MyParser;
use strict;
use warnings;
use base 'Pod::Parser';
sub parse_from_string {
my ($self, $str, $filename) = @_;
require IO::String;
my $fh = IO::String->new ($str);
$self->{_INFILE} = $filename;
return $self->parse_from_filehandle ($fh);
}
sub command {
return '';
}
sub verbatim {
return '';
}
sub textblock {
my ($self, $text, $linenum, $paraobj) = @_;
### textblock
# while ($text =~ /->[^[:space:]]/g) {
# my $pos = pos($text);
# my ($line, $col) = MyStuff::pos_to_line_and_column ($text, $pos);
# $line += $linenum - 1;
#
# my $filename = $self->{_INFILE};
# print "$filename:$line:$col: bad -> markup\n",
# MyStuff::line_at_pos($text, $pos);
# }
# return '';
my $tree = $self->parse_text ($text, $linenum);
my @pending = reverse $tree->children;
my $prev = '';
my $next = '';
for ( ; @pending; $prev = $next) {
$next = pop @pending;
if (ref $next && $next->isa('Pod::ParseTree')) {
push @pending, reverse $next->children;
next;
}
next if ref $next;
{
while ($next =~ /([IBCLFSX]<<+[^ \n])/g) {
my $bad = $1;
my $filename = $self->output_file;
print "$filename:$linenum:1: no space after << markup\n$bad\n";
}
}
{
ref $prev or next;
$prev->isa('Pod::InteriorSequence') or next;
my $prev_text = $prev->raw_text;
$prev_text =~ /->$/ or next;
$next =~ /^[_[:alpha:]]/ or next;
my ($filename, $line) = $prev->file_line;
my $pos = length($prev_text);
my ($offset_line, $col)
= MyStuff::pos_to_line_and_column ($prev_text, $pos);
$line += $offset_line - 1;
$col = 1; # col not right if $prev not at start of line
my $str = $prev_text . $next;
print "$filename:$line:$col: probable unescaped -> markup\n",
MyStuff::line_at_pos($str, $pos);
print "prev ",$prev_text,"\n";
print "next ",$next,"\n";
}
}
return '';
}
exit 0;
Perl-Critic-Pulp-97/devel/MyLocatePerl.pm 0000644 0001750 0001750 00000007671 12214704771 016137 0 ustar gg gg # Copyright 2009, 2010, 2011, 2012, 2013 Kevin Ryde.
# MyLocatePerl.pm is shared by various distributions.
#
# MyLocatePerl.pm 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 3, or (at your option) any later
# version.
#
# MyLocatePerl.pm 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 file. If not, see .
package MyLocatePerl;
use 5.006;
use strict;
use warnings;
use base 'File::Locate::Iterator';
use FindBin;
use File::Slurp 'slurp';
use IO::File;
use IO::Uncompress::AnyInflate;
use MyUniqByInode;
use MyUniqByMD5;
# uncomment this to run the ### lines
# use Smart::Comments;
# glob => '/usr/share/perl5/Debconf/FrontEnd/*'
my $compressed_re = qr/\.gz$/;
sub new {
my ($class, %options) = @_;
my @suffixes = ('t','pm','pl','PL');
if (delete $options{'include_pod'}) {
push @suffixes, 'pod';
}
if (delete $options{'exclude_t'}) {
@suffixes = grep {$_ ne 't'} @suffixes;
}
if (delete $options{'only_t'}) {
@suffixes = ('t');
}
my $suffixes = join('|',@suffixes);
my $suffixes_re = qr/\.($suffixes)($compressed_re)?$/;
### $suffixes
### $suffixes_re
my $locate_regexp = $suffixes_re;
if (defined (my $under_directory = $options{'under_directory'})) {
unless ($under_directory =~ m{/$}) {
$under_directory .= '/';
}
$locate_regexp = qr/^\Q$under_directory\E.*$suffixes_re/;
}
### $locate_regexp
my $self = $class->SUPER::new (
# globs => ['/bin/*',
# '/usr/bin/*',
# '/usr/local/bin/*',
# '/usr/local/bin2/*'],
regexp => $locate_regexp,
%options);
$self->{'uniq_ino'} = MyUniqByInode->new;
$self->{'uniq_md5'} = MyUniqByMD5->new;
$self->{'my_suffixes_re'} = $suffixes_re;
return $self;
}
sub next {
my ($self) = @_;
unless ($self->{'done_script'}) {
$self->{'done_script'} = 1;
my $filename = File::Spec->catfile ($FindBin::Bin, $FindBin::Script);
### $filename
my $content = slurp($filename);
return ($filename, $content);
}
for (;;) {
defined(my $filename = $self->SUPER::next) or return;
### consider: $filename
next if $filename =~ m{/blib/};
next if $filename =~ m{/DateTime/TimeZone/}; # data .pm's
next if $filename =~ m{/Date/Manip/TZ/}; # data .pm's
next if $filename =~ m{/Date/Manip/Offset/}; # data .pm's
next if $filename =~ m{/Text/Unidecode/}; # data .pm's
next if $filename =~ m{/junk.pl};
my $io;
if ($filename =~ $compressed_re) {
$io = IO::Uncompress::AnyInflate->new ($filename);
} else {
$io = IO::File->new ($filename, 'r');
}
$io or next;
$self->{'uniq_ino'}->uniq($filename) or next; # or $io ???
my $content = _slurp_if_perl ($self, $filename, $io);
### content: $content && "ok"
next if ! defined $content;
$self->{'uniq_md5'}->uniq_str($content) or next;
### return: $filename
return ($filename, $content);
}
}
sub _slurp_if_perl {
my ($self, $filename, $io) = @_;
### slurp: "$io"
my $first = '';
if ($filename !~ $self->{'my_suffixes_re'}) {
# file in /bin etc must have #!.../perl
$io->read($first, 128) or return;
### first part: $first
if ($first !~ m{^#!([^\r\n]*/|[ \t]*)perl[ \t\r\n]}) {
### no #!perl
return;
}
}
my $rest = do { local $/; $io->getline }; # slurp
if (! defined $rest) {
### read error: $!
return;
}
return $first . $rest;
}
1;
__END__
Perl-Critic-Pulp-97/devel/grep-qw.pl 0000644 0001750 0001750 00000002760 11570053417 015150 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2011 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use 5.005;
use strict;
use warnings;
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
# uncomment this to run the ### lines
#use Smart::Comments;
my $verbose = 0;
my $l = MyLocatePerl->new;
OUTER: while (my ($filename, $str) = $l->next) {
if ($verbose) { print "look at $filename\n"; }
while ($str =~ m%
qw(
\([^)]*\)
|\[[^]]*\]
|\{[^}]*\}
)
%gx
) {
my $qw = substr($1,1,-1);
my $qwpos = pos($str)-length($1);
while ($qw =~ /['"]/g) {
my $pos = $qwpos + pos($qw)-1;
my ($line, $col) = MyStuff::pos_to_line_and_column ($str, $pos);
print "$filename:$line:$col:\n",
MyStuff::line_at_pos($str, $pos);
}
}
}
exit 0;
Perl-Critic-Pulp-97/devel/grep-pod-section-end-comma.pl 0000644 0001750 0001750 00000013626 12174316203 020602 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2012, 2013 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
# Usage: perl grep-pod-section-end-comma.pl
#
# Search for POD paragraphs ending with a comma.
use strict;
use warnings;
use FindBin;
use Perl6::Slurp;
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
# uncomment this to run the ### lines
# use Smart::Comments;
my $verbose = 0;
my $l = MyLocatePerl->new (include_pod => 1,
under_directory => '/usr/share/perl5');
my $filename;
# {
# $filename = "$FindBin::Bin/$FindBin::Script";
# if ($verbose) { print "look at $filename\n"; }
# my $str = Perl6::Slurp::slurp ($filename);
# my $p = MyParser->new;
# $p->parse_from_string ($str);
# }
my $count = 0;
while (($filename, my $str) = $l->next) {
if ($verbose) { print "look at $filename\n"; }
my $p = MyParser->new;
$p->parse_from_string ($str);
$p->check_last();
$count++;
}
print "total $count\n";
exit 0;
package MyParser;
use base 'Perl::Critic::Pulp::PodParser';
sub new {
my $class = shift;
### new() ...
return $class->SUPER::new (last_text => '',
last_command => '',
@_);
}
sub command {
my ($self, $command, $text, $linenum, $paraobj) = @_;
### command(): $command
if ($command eq 'for' || $command eq 'pod') {
### ignore ...
return;
}
# my $this_level = $command_level{$command} || 0;
# my $prev_level = $command_level{$self->{'last_command'}} || 0;
if ($command eq 'item' && $self->{'last_command'} eq 'item') {
} elsif ($command eq 'over'
|| $command eq 'back') {
} else {
$self->check_last;
}
$self->{'last_text'} = '';
$self->{'last_command'} = $command;
}
sub textblock {
my ($self, $text, $linenum, $paraobj) = @_;
### textblock(): $text
$self->check_last;
if (! defined $text) {
$text = '';
}
$self->{'last_linenum'} = $linenum;
$self->{'last_text'} = $text;
}
sub verbatim {
my ($self, $text, $linenum, $paraobj) = @_;
### verbatim() ...
$self->{'last_text'} = '';
}
sub check_last {
my ($self) = @_;
### check_last(): $self->{'last_text'}
if ($self->{'last_text'} =~ /,\s*$/s) {
print "$filename:$self->{'last_linenum'}:1: end comma\n";
$self->{'last_text'} = '';
}
}
=pod
=head1 ONE
Using pages like,
=for Finance_Quote_Grab symbols MNG
=over 4
blah
=back
=head1 TWO
This one bad,
This one ok.
=head2
This one ok,
=cut
=pod
verbatim para
Blah.
=cut
# Old stuff for comma following L<> link.
# sub new {
# my $class = shift;
# my $self = $class->SUPER::new (last => '',
# @_);
# $self->parseopts(-process_cut_cmd => 1);
# return $self;
# }
#
# sub parse_from_filehandle {
# my $self = shift;
# $self->SUPER::parse_from_filehandle(@_);
# $self->comma_violation_maybe;
# }
#
# sub comma_violation_maybe {
# my ($self) = @_;
# if ($self->{'last'} eq 'L-comma') {
# $self->violation_at_linenum_and_textpos
# ("Comma after L<> at end of section, should it be a full stop, or removed?",
# $self->{'saw_comma_linenum'},
# $self->{'saw_comma_text'},
# $self->{'saw_comma_textpos'});
# }
# }
#
# my %command_non_text = (for => 1,
# begin => 1,
# end => 1,
# cut => 1);
#
# sub command {
# my ($self, $command, $text, $linenum, $paraobj) = @_;
# ### $command
# ### last: $self->{'last'}
# # ### $text
#
# if ($command_non_text{$command}) {
# # skip directives
# return '';
# }
#
# if (# before =over is ok
# $command eq 'over'
#
# # in between successive =item is ok
# || ($command eq 'item' && $self->{'last'} eq '=item')) {
#
# } else {
# # before =head or =cut is bad
# $self->comma_violation_maybe;
# }
#
# $self->{'last'} = '';
# return '';
# }
#
# sub verbatim {
# my ($self) = @_;
# ### verbatim
# $self->{'last'} = '';
# return '';
# }
#
# sub textblock {
# my ($self, $text, $linenum, $pod_para) = @_;
# ### textblock
# ### $text
# $self->{'saw_comma_linenum'} = $linenum;
# $self->{'saw_comma_text'} = $text;
# $self->parse_text({-expand_seq => 'textblock_seq',
# -expand_text => 'textblock_text' },
# $text, $linenum);
# ### last now: $self->{'last'}
# return '';
# }
# sub textblock_seq {
# my ($self, $seq) = @_;
# ### seqsubr: $seq
# my $cmd = $seq->cmd_name;
# if ($cmd eq 'L') {
# if ($self->{'last'} eq 'L') {
# $self->violation_at_linenum_and_textpos
# ("Missing comma between L<> sequences",
# $self->{'saw_comma_linenum'},
# '', 0);
# }
# $self->{'last'} = 'L';
#
# } elsif ($cmd eq 'X') {
# # ignore X<>
#
# } else {
# # other like C<> as text
# ### raw_text: $seq->raw_text
# $self->textblock_text ($seq->raw_text, $seq);
# }
# return;
# }
# sub textblock_text {
# my ($self, $text, $textnode) = @_;
# ### textsubr: $text
# ### $textnode
# if ($text =~ /^(\s.*),\s*$/) {
# if ($self->{'last'} eq 'L') {
# $self->{'last'} = 'L-comma';
# $self->{'saw_comma_textpos'} = length($text) - length($1);
# return;
# }
# }
# if ($text !~ /^\s.*$/) {
# $self->{'last'} = '';
# }
# ### last now: $self->{'last'}
# return;
# }
Perl-Critic-Pulp-97/devel/grep-rootdir.pl 0000644 0001750 0001750 00000002425 12326663661 016211 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2009, 2010, 2012, 2014 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use strict;
use warnings;
use Perl6::Slurp;
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
my $verbose = 0;
my $l = MyLocatePerl->new;
while (my ($filename, $str) = $l->next) {
if ($verbose) { print "look at $filename\n"; }
pos($str) = 0;
while ($str =~ m{(join\s*\(\s*)?
("/"|'/')
}gsx) {
next if defined $1;
my $pos = pos($str);
my ($line, $col) = MyStuff::pos_to_line_and_column ($str, $pos);
print "$filename:$line:$col: root dir /\n",
MyStuff::line_at_pos($str, $pos);
}
}
exit 0;
Perl-Critic-Pulp-97/devel/grep-pod-para-dots.pl 0000644 0001750 0001750 00000004027 12206610450 017162 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2009, 2010, 2011, 2013 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
use strict;
use warnings;
use Perl6::Slurp;
use lib::abs '.';
use MyLocatePerl;
use MyStuff;
my $verbose = 0;
my $l = MyLocatePerl->new (include_pod => 1,
exclude_t => 1);
my $p = MyParser->new;
my $count = 0;
my $filename;
# $SIG{__WARN__} = sub {
# my ($str) = @_;
# print STDERR "$filename:1:\n";
# warn $str; # re-throw
# };
while (($filename, my $str) = $l->next) {
if ($verbose) { print "look at $filename\n"; }
$p->parse_from_string ($str, $filename);
}
print "total $count\n";
exit 0;
package MyParser;
use base 'Perl::Critic::Pulp::PodParser';
sub command {
my $self = shift;
return $self->command_as_textblock(@_);
}
sub textblock {
my ($self, $text, $linenum, $paraobj) = @_;
# Pod::ParseLink for display part of L<>
# ,. probably wrong
#
if ($text =~ /[^.],\.\s*$/sg) {
print "$filename:$linenum: end with comma dot\n";
$count++;
}
# # ,. probably wrong
# # ;. doubtful, but maybe some code or :-;. smiley
# # ;. doubtful, but maybe some code
# #
# if ($text =~ /[^.]\.\.\s*$/sg) {
# print "$filename:$linenum: end with dots\n";
# $count++;
# }
# $[. is ok
# :-(. sad face
# !. not too bad
#
#
# if ($text =~ /[,;\\!?({[<]\.\s*$/sg) {
# print "$filename:$linenum: end with dots\n";
# $count++;
# }
}
Perl-Critic-Pulp-97/devel/grep-use-quoted.pl 0000644 0001750 0001750 00000003252 11424406722 016610 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2008, 2009, 2010 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
# Look for "use" statements with quoted version numbers, like
#
# use Foo '1.5';
#
use 5.006;
use strict;
use warnings;
use Perl6::Slurp;
my @files = ($0, split /\n/, `locate \\*.t \\*.pm \\*.pl`);
print scalar(@files),"\n";
foreach my $filename (@files) {
my $str = eval { Perl6::Slurp::slurp ($filename) }
|| do { # print "Cannot read $filename: $!\n";
next;
};
while ($str =~ /((use|no)[ \t]+
[A-Za-z0-9_:]+[ \t]+
(['"]|qq?.?])
(v?[0-9][0-9._e]*)
['"}][ \t]*
;.*
# [^-a-zA-Z.$:][^\n]*
)/gx) {
my $line = $1;
my $pos = pos($str);
# $3 =~ /[0-9]/ or next; # not '..' for use lib etc
my $tmp = substr ($str, 0, $pos);
my $count = ($tmp =~ tr/\n//) + 1;
print "$filename:$count:1: $line\n";
}
}
__END__
use foo '123';
use Foo::Bar '123';
{ no Foo::Bar '123'; }
use foo 'v1.5';
Perl-Critic-Pulp-97/devel/parse-backslash.pl 0000644 0001750 0001750 00000001672 11577246535 016646 0 ustar gg gg #!/usr/bin/perl -w
# Copyright 2011 Kevin Ryde
# This file is part of Perl-Critic-Pulp.
#
# Perl-Critic-Pulp 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 3, or (at your option) any
# later version.
#
# Perl-Critic-Pulp 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 Perl-Critic-Pulp. If not, see .
# use strict;
my $char = '"';
my $search = qr/^(.*?(?