diff --git a/Changes b/Changes index c44657e..c0f129a 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,6 @@ -Revision history for Perl extension Exception::Class::DBI. +Revision history for Exception-Class-DBI + +1.04 2021-06-05 14:07:07 +0000 1.04 2019-05-27 14:41:02 -0400 - Production release identical to 1.03_01 diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..9464226 --- /dev/null +++ b/INSTALL @@ -0,0 +1,75 @@ +This is the Perl distribution Exception-Class-DBI. + +Installing Exception-Class-DBI is straightforward. + +## Installation with cpanm + +If you have cpanm, you only need one line: + + % cpanm Exception::Class::DBI + +If it does not have permission to install modules to the current perl, cpanm +will automatically set up and install to a local::lib in your home directory. +See the local::lib documentation (https://metacpan.org/pod/local::lib) for +details on enabling it in your environment. + +## Installing with the CPAN shell + +Alternatively, if your CPAN shell is set up, you should just be able to do: + + % cpan Exception::Class::DBI + +## Manual installation + +As a last resort, you can manually install it. If you have not already +downloaded the release tarball, you can find the download link on the module's +MetaCPAN page: https://metacpan.org/pod/Exception::Class::DBI + +Untar the tarball, install configure prerequisites (see below), then build it: + + % perl Makefile.PL + % make && make test + +Then install it: + + % make install + +On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. + +If your perl is system-managed, you can create a local::lib in your home +directory to install modules to. For details, see the local::lib documentation: +https://metacpan.org/pod/local::lib + +The prerequisites of this distribution will also have to be installed manually. The +prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated +by running the manual build process described above. + +## Configure Prerequisites + +This distribution requires other modules to be installed before this +distribution's installer can be run. They can be found under the +"configure_requires" key of META.yml or the +"{prereqs}{configure}{requires}" key of META.json. + +## Other Prerequisites + +This distribution may require additional modules to be installed after running +Makefile.PL. +Look for prerequisites in the following phases: + +* to run make, PHASE = build +* to use the module code itself, PHASE = runtime +* to run tests, PHASE = test + +They can all be found in the "PHASE_requires" key of MYMETA.yml or the +"{prereqs}{PHASE}{requires}" key of MYMETA.json. + +## Documentation + +Exception-Class-DBI documentation is available as POD. +You can run `perldoc` from a shell to read the documentation: + + % perldoc Exception::Class::DBI + +For more information on installing Perl modules via CPAN, please see: +https://www.cpan.org/modules/INSTALL.html diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f0a3973 --- /dev/null +++ b/LICENSE @@ -0,0 +1,379 @@ +This software is copyright (c) 2002-2021 by David E. Wheeler. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +Terms of the Perl programming language system itself + +a) the GNU General Public License as published by the Free + Software Foundation; either version 1, or (at your option) any + later version, or +b) the "Artistic License" + +--- The GNU General Public License, Version 1, February 1989 --- + +This software is Copyright (c) 2002-2021 by David E. Wheeler. + +This is free software, licensed under: + + The GNU General Public License, Version 1, February 1989 + + GNU GENERAL PUBLIC LICENSE + Version 1, February 1989 + + Copyright (C) 1989 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The license agreements of most software companies try to keep users +at the mercy of those companies. By contrast, our General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. The +General Public License applies to the Free Software Foundation's +software and to any other program whose authors commit to using it. +You can use it for your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Specifically, the General Public License is designed to make +sure that you have the freedom to give away or sell copies of free +software, that you receive source code or can get it if you want it, +that you can change the software or use pieces of it in new free +programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of a such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must tell them their rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any program or other work which +contains a notice placed by the copyright holder saying it may be +distributed under the terms of this General Public License. The +"Program", below, refers to any such program or work, and a "work based +on the Program" means either the Program or any work containing the +Program or a portion of it, either verbatim or with modifications. Each +licensee is addressed as "you". + + 1. You may copy and distribute verbatim copies of the Program's source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this +General Public License and to the absence of any warranty; and give any +other recipients of the Program a copy of this General Public License +along with the Program. You may charge a fee for the physical act of +transferring a copy. + + 2. You may modify your copy or copies of the Program or any portion of +it, and copy and distribute such modifications under the terms of Paragraph +1 above, provided that you also do the following: + + a) cause the modified files to carry prominent notices stating that + you changed the files and the date of any change; and + + b) cause the whole of any work that you distribute or publish, that + in whole or in part contains the Program or any part thereof, either + with or without modifications, to be licensed at no charge to all + third parties under the terms of this General Public License (except + that you may choose to grant warranty protection to some or all + third parties, at your option). + + c) If the modified program normally reads commands interactively when + run, you must cause it, when started running for such interactive use + in the simplest and most usual way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this General + Public License. + + d) You may charge a fee for the physical act of transferring a + copy, and you may at your option offer warranty protection in + exchange for a fee. + +Mere aggregation of another independent work with the Program (or its +derivative) on a volume of a storage or distribution medium does not bring +the other work under the scope of these terms. + + 3. You may copy and distribute the Program (or a portion or derivative of +it, under Paragraph 2) in object code or executable form under the terms of +Paragraphs 1 and 2 above provided that you also do one of the following: + + a) accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of + Paragraphs 1 and 2 above; or, + + b) accompany it with a written offer, valid for at least three + years, to give any third party free (except for a nominal charge + for the cost of distribution) a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of + Paragraphs 1 and 2 above; or, + + c) accompany it with the information you received as to where the + corresponding source code may be obtained. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form alone.) + +Source code for a work means the preferred form of the work for making +modifications to it. For an executable file, complete source code means +all the source code for all modules it contains; but, as a special +exception, it need not include source code for modules which are standard +libraries that accompany the operating system on which the executable +file runs, or for standard header files or definitions files that +accompany that operating system. + + 4. You may not copy, modify, sublicense, distribute or transfer the +Program except as expressly provided under this General Public License. +Any attempt otherwise to copy, modify, sublicense, distribute or transfer +the Program is void, and will automatically terminate your rights to use +the Program under this License. However, parties who have received +copies, or rights to use copies, from you under this General Public +License will not have their licenses terminated so long as such parties +remain in full compliance. + + 5. By copying, distributing or modifying the Program (or any work based +on the Program) you indicate your acceptance of this license to do so, +and all its terms and conditions. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the original +licensor to copy, distribute or modify the Program subject to these +terms and conditions. You may not impose any further restrictions on the +recipients' exercise of the rights granted herein. + + 7. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of the license which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +the license, you may choose any version ever published by the Free Software +Foundation. + + 8. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to humanity, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + + To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19xx name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, the +commands you use may be called something other than `show w' and `show +c'; they could even be mouse-clicks or menu items--whatever suits your +program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (a program to direct compilers to make passes + at assemblers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +That's all there is to it! + + +--- The Artistic License 1.0 --- + +This software is Copyright (c) 2002-2021 by David E. Wheeler. + +This is free software, licensed under: + + The Artistic License 1.0 + +The Artistic License + +Preamble + +The intent of this document is to state the conditions under which a Package +may be copied, such that the Copyright Holder maintains some semblance of +artistic control over the development of the package, while giving the users of +the package the right to use and distribute the Package in a more-or-less +customary fashion, plus the right to make reasonable modifications. + +Definitions: + + - "Package" refers to the collection of files distributed by the Copyright + Holder, and derivatives of that collection of files created through + textual modification. + - "Standard Version" refers to such a Package if it has not been modified, + or has been modified in accordance with the wishes of the Copyright + Holder. + - "Copyright Holder" is whoever is named in the copyright or copyrights for + the package. + - "You" is you, if you're thinking about copying or distributing this Package. + - "Reasonable copying fee" is whatever you can justify on the basis of media + cost, duplication charges, time of people involved, and so on. (You will + not be required to justify it to the Copyright Holder, but only to the + computing community at large as a market that must bear the fee.) + - "Freely Available" means that no fee is charged for the item itself, though + there may be fees involved in handling the item. It also means that + recipients of the item may redistribute it under the same conditions they + received it. + +1. You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that you +duplicate all of the original copyright notices and associated disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications derived +from the Public Domain or from the Copyright Holder. A Package modified in such +a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided that +you insert a prominent notice in each changed file stating how and when you +changed that file, and provided that you do at least ONE of the following: + + a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or an + equivalent medium, or placing the modifications on a major archive site + such as ftp.uu.net, or by allowing the Copyright Holder to include your + modifications in the Standard Version of the Package. + + b) use the modified Package only within your corporation or organization. + + c) rename any non-standard executables so the names do not conflict with + standard executables, which must also be provided, and provide a separate + manual page for each non-standard executable that clearly documents how it + differs from the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or executable +form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where to + get the Standard Version. + + b) accompany the distribution with the machine-readable source of the Package + with your modifications. + + c) accompany any non-standard executables with their corresponding Standard + Version executables, giving the non-standard executables non-standard + names, and clearly documenting the differences in manual pages (or + equivalent), together with instructions on where to get the Standard + Version. + + d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this +Package. You may charge any fee you choose for support of this Package. You +may not charge a fee for this Package itself. However, you may distribute this +Package in aggregate with other (possibly commercial) programs as part of a +larger (possibly commercial) software distribution provided that you do not +advertise this Package as a product of your own. + +6. The scripts and library files supplied as input to or produced as output +from the programs of this Package do not automatically fall under the copyright +of this Package, but belong to whomever generated them, and may be sold +commercially, and may be aggregated with this Package. + +7. C or perl subroutines supplied by you and linked into this Package shall not +be considered part of this Package. + +8. The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. + +9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +The End + diff --git a/MANIFEST b/MANIFEST index 4b53b59..3095da5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,14 +1,29 @@ +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.017. Changes +INSTALL +LICENSE +MANIFEST +META.json +META.yml +Makefile.PL +README +author.yml +dist.ini lib/Exception/Class/DBI.pm -maint/releaseprep -Makefile.PL -MANIFEST This list of files -README.md +t/00_diag.t t/dbh.t t/dbi.t t/drh.t t/sth.t t/subclass.t t/z_pod.t -META.yml Module YAML meta-data (added by MakeMaker) -META.json Module JSON meta-data (added by MakeMaker) +xt/author/eol.t +xt/author/no_tabs.t +xt/author/pod.t +xt/author/pod_coverage.t +xt/author/pod_spelling_common.t +xt/author/pod_spelling_system.t +xt/author/strict.t +xt/author/version.t +xt/release/changes.t +xt/release/fixme.t diff --git a/META.json b/META.json index 965eec8..394ff0b 100644 --- a/META.json +++ b/META.json @@ -1,10 +1,11 @@ { "abstract" : "DBI Exception objects", "author" : [ - "unknown" + "David E. Wheeler ", + "Graham Ollis " ], - "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -13,49 +14,64 @@ "version" : 2 }, "name" : "Exception-Class-DBI", - "no_index" : { - "directory" : [ - "t", - "inc" - ] - }, "prereqs" : { - "build" : { + "configure" : { "requires" : { - "ExtUtils::MakeMaker" : "6.64" + "ExtUtils::MakeMaker" : "0", + "perl" : "5.006" } }, - "configure" : { + "develop" : { "requires" : { - "ExtUtils::MakeMaker" : "6.64" + "File::Spec" : "0", + "FindBin" : "0", + "Test::CPAN::Changes" : "0", + "Test::EOL" : "0", + "Test::Fixme" : "0.07", + "Test::More" : "0.98", + "Test::NoTabs" : "0", + "Test::Pod" : "0", + "Test::Pod::Coverage" : "0", + "Test::Pod::Spelling::CommonMistakes" : "0", + "Test::Spelling" : "0", + "Test::Strict" : "0", + "YAML" : "0" } }, "runtime" : { "requires" : { "DBI" : "1.28", "Exception::Class" : "1.02", - "perl" : "5.006000" + "perl" : "5.006" } }, "test" : { "requires" : { + "DBD::ExampleP" : "0", + "DBI" : "1.28", "Test::Harness" : "2.03", - "Test::More" : "0.17" + "Test::More" : "0.98", + "base" : "0", + "perl" : "5.006" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { - "web" : "https://github.com/plicease/Exception-Class-DBI/issues" + "web" : "https://github.com/uperl/libexception-class-dbi-perl/issues" }, - "homepage" : "https://metacpan.org/pod/Exception-Class-DBI", + "homepage" : "https://metacpan.org/pod/libexception::class::dbi::perl", "repository" : { "type" : "git", - "url" : "https://github.com/plicease/Exception-Class-DBI.git", - "web" : "https://github.com/plicease/Exception-Class-DBI" + "url" : "git://github.com/uperl/libexception-class-dbi-perl.git", + "web" : "https://github.com/uperl/libexception-class-dbi-perl" } }, "version" : "1.04", - "x_serialization_backend" : "JSON::PP version 4.02" + "x_generated_by_perl" : "v5.32.1", + "x_serialization_backend" : "Cpanel::JSON::XS version 4.25", + "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later", + "x_use_unsafe_inc" : 0 } + diff --git a/META.yml b/META.yml index 399ae8b..50840dc 100644 --- a/META.yml +++ b/META.yml @@ -1,31 +1,35 @@ --- abstract: 'DBI Exception objects' author: - - unknown + - 'David E. Wheeler ' + - 'Graham Ollis ' build_requires: - ExtUtils::MakeMaker: '6.64' + DBD::ExampleP: '0' + DBI: '1.28' Test::Harness: '2.03' - Test::More: '0.17' + Test::More: '0.98' + base: '0' + perl: '5.006' configure_requires: - ExtUtils::MakeMaker: '6.64' -dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' + ExtUtils::MakeMaker: '0' + perl: '5.006' +dynamic_config: 0 +generated_by: 'Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Exception-Class-DBI -no_index: - directory: - - t - - inc requires: DBI: '1.28' Exception::Class: '1.02' - perl: '5.006000' + perl: '5.006' resources: - bugtracker: https://github.com/plicease/Exception-Class-DBI/issues - homepage: https://metacpan.org/pod/Exception-Class-DBI - repository: https://github.com/plicease/Exception-Class-DBI.git + bugtracker: https://github.com/uperl/libexception-class-dbi-perl/issues + homepage: https://metacpan.org/pod/libexception::class::dbi::perl + repository: git://github.com/uperl/libexception-class-dbi-perl.git version: '1.04' -x_serialization_backend: 'CPAN::Meta::YAML version 0.018' +x_generated_by_perl: v5.32.1 +x_serialization_backend: 'YAML::Tiny version 1.73' +x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' +x_use_unsafe_inc: 0 diff --git a/Makefile.PL b/Makefile.PL index 0f68063..80414dd 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,45 +1,62 @@ +BEGIN { + use strict; use warnings; + unless(eval q{ use 5.006; 1}) { + print "Perl 5.006 or better required\n"; + exit; + } +} +# This file was automatically generated by Dist::Zilla::Plugin::Author::Plicease::MakeMaker v2.64. use strict; use warnings; use 5.006; -use ExtUtils::MakeMaker 6.64; +use ExtUtils::MakeMaker; -WriteMakefile( - NAME => 'Exception::Class::DBI', - LICENSE => 'perl', - VERSION_FROM => 'lib/Exception/Class/DBI.pm', - ABSTRACT_FROM => 'lib/Exception/Class/DBI.pm', - MIN_PERL_VERSION => '5.006000', +my %WriteMakefileArgs = ( + "ABSTRACT" => "DBI Exception objects", + "AUTHOR" => "David E. Wheeler , Graham Ollis ", + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => 0 + }, + "DISTNAME" => "Exception-Class-DBI", + "LICENSE" => "perl", + "MIN_PERL_VERSION" => "5.006", + "NAME" => "Exception::Class::DBI", + "PM" => { + "lib/Exception/Class/DBI.pm" => "\$(INST_LIB)/Exception/Class/DBI.pm" + }, + "PREREQ_PM" => { + "DBI" => "1.28", + "Exception::Class" => "1.02" + }, + "TEST_REQUIRES" => { + "DBD::ExampleP" => 0, + "DBI" => "1.28", + "Test::Harness" => "2.03", + "Test::More" => "0.98", + "base" => 0 + }, + "VERSION" => "1.04", + "test" => { + "TESTS" => "t/*.t" + } +); - CONFIGURE_REQUIRES => { - 'ExtUtils::MakeMaker' => '6.64', - }, +my %FallbackPrereqs = ( + "DBD::ExampleP" => 0, + "DBI" => "1.28", + "Exception::Class" => "1.02", + "Test::Harness" => "2.03", + "Test::More" => "0.98", + "base" => 0 +); - BUILD_REQUIRES => { - 'ExtUtils::MakeMaker' => '6.64', - }, +unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { + delete $WriteMakefileArgs{TEST_REQUIRES}; + delete $WriteMakefileArgs{BUILD_REQUIRES}; + $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; +} - TEST_REQUIRES => { - 'Test::More' => '0.17', - 'Test::Harness' => '2.03', - }, +delete $WriteMakefileArgs{CONFIGURE_REQUIRES} + unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; - PREREQ_PM => { - 'DBI' => '1.28', - 'Exception::Class' => '1.02', - }, - - META_MERGE => { - 'meta-spec' => { version => 2 }, - resources => { - bugtracker => { - web => 'https://github.com/plicease/Exception-Class-DBI/issues', - }, - homepage => 'https://metacpan.org/pod/Exception-Class-DBI', - repository => { - type => 'git', - url => 'https://github.com/plicease/Exception-Class-DBI.git', - web => 'https://github.com/plicease/Exception-Class-DBI', - }, - } - }, -); +WriteMakefile(%WriteMakefileArgs); \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..e0885ae --- /dev/null +++ b/README @@ -0,0 +1,511 @@ +NAME + + Exception::Class::DBI - DBI Exception objects + +VERSION + + version 1.04 + +Name + + Exception::Class::DBI - DBI Exception objects + +Synopsis + + use DBI; + use Exception::Class::DBI; + + my $dbh = DBI->connect($dsn, $user, $pass, { + PrintError => 0, + RaiseError => 0, + HandleError => Exception::Class::DBI->handler, + }); + + eval { $dbh->do($sql) }; + + if (my $ex = $@) { + print STDERR "DBI Exception:\n"; + print STDERR " Exception Type: ", ref $ex, "\n"; + print STDERR " Error: ", $ex->error, "\n"; + print STDERR " Err: ", $ex->err, "\n"; + print STDERR " Errstr: ", $ex->errstr, "\n"; + print STDERR " State: ", $ex->state, "\n"; + print STDERR " Return Value: ", ($ex->retval || 'undef'), "\n"; + } + +Description + + This module offers a set of DBI-specific exception classes. They + inherit from Exception::Class, the base class for all exception objects + created by the Exception::Class module from the CPAN. + Exception::Class::DBI itself offers a single class method, handler(), + that returns a code reference appropriate for passing to the DBI + HandleError attribute. + + The exception classes created by Exception::Class::DBI are designed to + be thrown in certain DBI contexts; the code reference returned by + handler() and passed to the DBI HandleError attribute determines the + context and throws the appropriate exception. + + Each of the Exception::Class::DBI classes offers a set of object + accessor methods in addition to those provided by Exception::Class. + These can be used to output detailed diagnostic information in the + event of an exception. + +Interface + + Exception::Class::DBI inherits from Exception::Class, and thus its + entire interface. Refer to the Exception::Class documentation for + details. + + Class Method + + handler + + my $dbh = DBI->connect($data_source, $username, $auth, { + PrintError => 0, + RaiseError => 0, + HandleError => Exception::Class::DBI->handler + }); + + This method returns a code reference appropriate for passing to the + DBI HandleError attribute. When DBI encounters an error, it checks + its PrintError, RaiseError, and HandleError attributes to decide what + to do about it. When HandleError has been set to a code reference, + DBI executes it, passing it the error string that would be printed + for PrintError, the DBI handle object that was executing the method + call that triggered the error, and the return value of that method + call (usually undef). Using these arguments, the code reference + provided by handler() determines what type of exception to throw. + Exception::Class::DBI contains the subclasses detailed below, each + relevant to the DBI handle that triggered the error. + +Classes + + Exception::Class::DBI creates a number of exception classes, each one + specific to a particular DBI error context. Most of the object methods + described below correspond to like-named attributes in the DBI itself. + Thus the documentation below summarizes the DBI attribute + documentation, so you should refer to DBI itself for more in-depth + information. + + Exception::Class::DBI + + All of the Exception::Class::DBI classes documented below inherit from + Exception::Class::DBI. It offers the several object methods in addition + to those it inherits from its parent, Exception::Class. These methods + correspond to the DBI dynamic attributes, as well as to the values + passed to the handler() exception handler via the DBI HandleError + attribute. Exceptions of this base class are only thrown when there is + no DBI handle object executing, e.g. in the DBI connect() method. Note: + This functionality is not yet implemented in DBI -- see the discussion + that starts here: + http://archive.develooper.com/dbi-dev@perl.org/msg01438.html. + + error + + my $error = $ex->error; + + Exception::Class::DBI actually inherits this method from + Exception::Class. It contains the error string that DBI prints when + its PrintError attribute is enabled, or dies with when its + attribute is enabled. + + err + + my $err = $ex->err; + + Corresponds to the $DBI::err dynamic attribute. Returns the native + database engine error code from the last driver method called. + + errstr + + my $errstr = $ex->errstr; + + Corresponds to the $DBI::errstr dynamic attribute. Returns the native + database engine error message from the last driver method called. + + state + + my $state = $ex->state; + + Corresponds to the $DBI::state dynamic attribute. Returns an error + code in the standard SQLSTATE five character format. + + retval + + my $retval = $ex->retval; + + The first value being returned by the DBI method that failed + (typically undef). + + handle + + my $db_handle = $ex->handle; + + The DBI handle appropriate to the exception class. For + Exception::Class::DBI::DRH, it will be a driver handle. For + Exception::Class::DBI::DBH it will be a database handle. And for + Exception::Class::DBI::STH it will be a statement handle. If there is + no handle thrown in the exception (because, say, the exception was + thrown before a driver handle could be created), the handle will be + undef. + + Exception::Class::DBI::H + + This class inherits from Exception::Class::DBI, and is the base class + for all DBI handle exceptions (see below). It will not be thrown + directly. Its methods correspond to the DBI attributes common to all + handles. + + warn + + my $warn = $ex->warn; + + Boolean value indicating whether DBI warnings have been enabled. + Corresponds to the DBI Warn attribute. + + active + + my $active = $ex->active; + + Boolean value indicating whether the DBI handle that encountered the + error is active. Corresponds to the DBI Active attribute. + + kids + + my $kids = $ex->kids; + + For a driver handle, Kids is the number of currently existing + database handles that were created from that driver handle. For a + database handle, Kids is the number of currently existing statement + handles that were created from that database handle. Corresponds to + the DBI Kids attribute. + + active_kids + + my $active_kids = $ex->active_kids; + + Like kids, but only counting those that are active (as above). + Corresponds to the DBI ActiveKids attribute. + + compat_mode + + my $compat_mode = $ex->compat_mode; + + Boolean value indicating whether an emulation layer (such as Oraperl) + enables compatible behavior in the underlying driver (e.g., + DBD::Oracle) for this handle. Corresponds to the DBI CompatMode + attribute. + + inactive_destroy + + my $inactive_destroy = $ex->inactive_destroy; + + Boolean value indicating whether the DBI has disabled the database + engine related effect of DESTROYing a handle. Corresponds to the DBI + InactiveDestroy attribute. + + trace_level + + my $trace_level = $ex->trace_level; + + Returns the DBI trace level set on the handle that encountered the + error. Corresponds to the DBI TraceLevel attribute. + + fetch_hash_key_name + + my $fetch_hash_key_name = $ex->fetch_hash_key_name; + + Returns the attribute name the DBI fetchrow_hashref() method should + use to get the field names for the hash keys. Corresponds to the DBI + FetchHashKeyName attribute. + + chop_blanks + + my $chop_blanks = $ex->chop_blanks; + + Boolean value indicating whether DBI trims trailing space characters + from fixed width character (CHAR) fields. Corresponds to the DBI + ChopBlanks attribute. + + long_read_len + + my $long_read_len = $ex->long_read_len; + + Returns the maximum length of long fields ("blob", "memo", etc.) + which the DBI driver will read from the database automatically when + it fetches each row of data. Corresponds to the DBI LongReadLen + attribute. + + long_trunc_ok + + my $long_trunc_ok = $ex->long_trunc_ok; + + Boolean value indicating whether the DBI will truncate values it + retrieves from long fields that are longer than the value returned by + long_read_len(). Corresponds to the DBI LongTruncOk attribute. + + taint + + my $taint = $ex->taint; + + Boolean value indicating whether data fetched from the database is + considered tainted. Corresponds to the DBI Taint attribute. + + Exception::Class::DBI::DRH + + DBI driver handle exceptions objects. This class inherits from + Exception::Class::DBI::H, and offers no extra methods of its own. + + Exception::Class::DBI::DBH + + DBI database handle exceptions objects. This class inherits from + Exception::Class::DBI::H Its methods correspond to the DBI database + handle attributes. + + auto_commit + + my $auto_commit = $ex->auto_commit; + + Returns true if the database handle AutoCommit attribute is enabled. + meaning that database changes cannot be rolled back. Corresponds to + the DBI database handle AutoCommit attribute. + + db_name + + my $db_name = $ex->db_name; + + Returns the "name" of the database. Corresponds to the DBI database + handle Name attribute. + + statement + + my $statement = $ex->statement; + + Returns the statement string passed to the most recent call to the + DBI prepare() method in this database handle. If it was the prepare() + method that encountered the error and triggered the exception, the + statement string will be the statement passed to prepare(). + Corresponds to the DBI database handle Statement attribute. + + row_cache_size + + my $row_cache_size = $ex->row_cache_size; + + Returns the hint to the database driver indicating the size of the + local row cache that the application would like the driver to use for + future SELECT statements. Corresponds to the DBI database handle + RowCacheSize attribute. + + Exception::Class::DBI::STH + + DBI statement handle exceptions objects. This class inherits from + Exception::Class::DBI::H Its methods correspond to the DBI statement + handle attributes. + + num_of_fields + + my $num_of_fields = $ex->num_of_fields; + + Returns the number of fields (columns) the prepared statement will + return. Corresponds to the DBI statement handle NUM_OF_FIELDS + attribute. + + num_of_params + + my $num_of_params = $ex->num_of_params; + + Returns the number of parameters (placeholders) in the prepared + statement. Corresponds to the DBI statement handle NUM_OF_PARAMS + attribute. + + field_names + + my $field_names = $ex->field_names; + + Returns a reference to an array of field names for each column. + Corresponds to the DBI statement handle NAME attribute. + + type + + my $type = $ex->type; + + Returns a reference to an array of integer values for each column. + The value indicates the data type of the corresponding column. + Corresponds to the DBI statement handle TYPE attribute. + + precision + + my $precision = $ex->precision; + + Returns a reference to an array of integer values for each column. + For non-numeric columns, the value generally refers to either the + maximum length or the defined length of the column. For numeric + columns, the value refers to the maximum number of significant digits + used by the data type (without considering a sign character or + decimal point). Corresponds to the DBI statement handle PRECISION + attribute. + + scale + + my $scale = $ex->scale; + + Returns a reference to an array of integer values for each column. + Corresponds to the DBI statement handle SCALE attribute. + + nullable + + my $nullable = $ex->nullable; + + Returns a reference to an array indicating the possibility of each + column returning a null. Possible values are 0 (or an empty string) = + no, 1 = yes, 2 = unknown. Corresponds to the DBI statement handle + NULLABLE attribute. + + cursor_name + + my $cursor_name = $ex->cursor_name; + + Returns the name of the cursor associated with the statement handle, + if available. Corresponds to the DBI statement handle CursorName + attribute. + + param_values + + my $param_values = $ex->param_values; + + Returns a reference to a hash containing the values currently bound + to placeholders. Corresponds to the DBI statement handle ParamValues + attribute. + + statement + + my $statement = $ex->statement; + + Returns the statement string passed to the DBI prepare() method. + Corresponds to the DBI statement handle Statement attribute. + + rows_in_cache + + my $rows_in_cache = $ex->rows_in_cache; + + the number of unfetched rows in the cache if the driver supports a + local row cache for SELECT statements. Corresponds to the DBI + statement handle RowsInCache attribute. + + Exception::Class::DBI::Unknown + + Exceptions of this class are thrown when the context for a DBI error + cannot be determined. Inherits from Exception::Class::DBI, but + implements no methods of its own. + +Note + + Note: Not all of the attributes offered by the DBI are exploited by + these exception classes. For example, the PrintError and RaiseError + attributes seemed redundant. But if folks think it makes sense to + include the missing attributes for the sake of completeness, let me + know. Enough interest will motivate me to get them in. + +Subclassing + + It is possible to subclass Exception::Class::DBI. The trick is to + subclass its subclasses, too. Similar to subclassing DBI itself, this + means that the handle subclasses should exist as subnamespaces of your + base subclass. + + It's easier to explain with an example. Say that you wanted to add a + new method to all DBI exceptions that outputs a nicely formatted error + message. You might do it like this: + + package MyApp::Ex::DBI; + use base 'Exception::Class::DBI'; + + sub full_message { + my $self = shift; + return $self->SUPER::full_message unless $self->can('statement'); + return $self->SUPER::full_message + . ' [for Statement "' + . $self->statement . '"]'; + } + + You can then use this subclass just like Exception::Class::DBI itself: + + my $dbh = DBI->connect($dsn, $user, $pass, { + PrintError => 0, + RaiseError => 0, + HandleError => MyApp::Ex::DBI->handler, + }); + + And that's all well and good, except that none of + Exception::Class::DBI's own subclasses inherit from your class, so most + exceptions won't be able to use your spiffy new method. + + The solution is to create subclasses of both the Exception::Class::DBI + subclasses and your own base subclass, as long as they each use the + same package name as your subclass, plus "H", "DRH", "DBH", "STH", and + "Unknown". Here's what it looks like: + + package MyApp::Ex::DBI::H; + use base 'MyApp::Ex::DBI', 'Exception::Class::DBI::H'; + + package MyApp::Ex::DBI::DRH; + use base 'MyApp::Ex::DBI', 'Exception::Class::DBI::DRH'; + + package MyApp::Ex::DBI::DBH; + use base 'MyApp::Ex::DBI', 'Exception::Class::DBI::DBH'; + + package MyApp::Ex::DBI::STH; + use base 'MyApp::Ex::DBI', 'Exception::Class::DBI::STH'; + + package MyApp::Ex::DBI::Unknown; + use base 'MyApp::Ex::DBI', 'Exception::Class::DBI::Unknown'; + + And then things should work just spiffy! Of course, you probably don't + need the H subclass unless you want to add other methods for the DRH, + DBH, and STH classes to inherit from. + +To Do + + * I need to figure out a non-database specific way of testing STH + exceptions. DBD::ExampleP works well for DRH and DBH exceptions, but + not so well for STH exceptions. + +Support + + This module is stored in an open GitHub repository + . Feel free to fork and + contribute! + + Please file bug reports via GitHub Issues + . + +Author + + Original Author is David E. Wheeler + + Current maintainer is Graham Ollis + +See Also + + You should really only be using this module in conjunction with Tim + Bunce's DBI, so it pays to be familiar with its documentation. + + See the documentation for Dave Rolsky's Exception::Class module for + details on the methods this module's classes inherit from it. There's + lots more information in these exception objects, so use them! + +AUTHORS + + * David E. Wheeler + + * Graham Ollis + +COPYRIGHT AND LICENSE + + This software is copyright (c) 2002-2021 by David E. Wheeler. + + This is free software; you can redistribute it and/or modify it under + the same terms as the Perl 5 programming language system itself. + diff --git a/README.md b/README.md deleted file mode 100644 index ce70053..0000000 --- a/README.md +++ /dev/null @@ -1,54 +0,0 @@ -Exception/Class/DBI version 1.02 -================================ - -This module offers a set of DBI-specific exception classes. They inherit from -Exception::Class::Base, the base class for all exception objects created by -the [Exception::Class](http://search.cpan.org/perldoc?Exception::Class) module -from the CPAN. Exception::Class::DBI itself offers a single class method, -`handler()`, that returns a code reference appropriate for passing the -[DBI](http://search.cpan.org/perldoc?DBI) `HandleError` attribute. - -The exception classes created by Exception::Class::DBI are designed to be -thrown in certain DBI contexts; the code reference returned by `handler()` and -passed to the DBI `HandleError attribute determines the context, assembles the -necessary metadata, and throws the apopropriate exception. - -Each of the Exception::Class::DBI classes offers a set of object accessor -methods in addition to those provided by Exception::Class::Base. These can be -used to output detailed output in the event of an exception. - -Installation ------------- - -To install this module, type the following: - - perl Build.PL - ./Build - ./Build test - ./Build install - -Or, if you don't have Module::Build installed, type the following: - - perl Makefile.PL - make - make test - make install - -Dependencies ------------- - -This module requires these other modules and libraries: - -* Perl 5.6 or later -* DBI 1.28 or later (1.30 or later strongly recommended). -* Exception::Class 1.02 or later (1.05 or later strongly recommended). -* Test::Simple 0.40 (for testing). - -Copyright and Licence ---------------------- - -Copyright (c) 2002-2011, David E. Wheeler. Some Rights Reserved. - -This module is free software; you can redistribute it and/or modify it under -the same terms as Perl itself. - diff --git a/author.yml b/author.yml new file mode 100644 index 0000000..8c986ef --- /dev/null +++ b/author.yml @@ -0,0 +1,22 @@ +--- +pod_spelling_system: + skip: 0 + # list of words that are spelled correctly + # (regardless of what spell check thinks) + stopwords: + - DBH + - DRH + - oraperl + - Rolsky + - SQLSTATE + - STH + - subnamespaces + - unfetched + +pod_coverage: + skip: 0 + # format is "Class#method" or "Class", regex allowed + # for either Class or method. + private: + - Exception::Class::DBI#Fields + - Exception::Class::DBI#description diff --git a/debian/changelog b/debian/changelog index 79cbf0f..8ba36cf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ -libexception-class-dbi-perl (1.04-2) UNRELEASED; urgency=medium +libexception-class-dbi-perl (1.0301+git20210528.1.05aa9c2-1) UNRELEASED; urgency=medium * Set upstream metadata fields: Bug-Submit. + * New upstream snapshot. - -- Debian Janitor Wed, 11 Mar 2020 12:36:14 +0000 + -- Debian Janitor Sat, 05 Jun 2021 15:07:22 -0000 libexception-class-dbi-perl (1.04-1) unstable; urgency=medium diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..ba39280 --- /dev/null +++ b/dist.ini @@ -0,0 +1,35 @@ +name = Exception-Class-DBI +author = David E. Wheeler +author = Graham Ollis +license = Perl_5 +copyright_holder = David E. Wheeler +copyright_year = 2002-2021 +version = 1.04 + +[@Author::Plicease] +:version = 2.63 +release_tests = 1 +github_user = uperl + +workflow = linux +workflow = macos +workflow = windows +workflow = cygwin +workflow = msys2-mingw + +[Prereqs] +DBI = 1.28 + +[Prereqs / TestPrereqs] +-phase = test +Test::Harness = 2.03 + +[RemovePrereqs] +remove = strict +remove = warnings + +remove = Exception::Class::DBI::DRH +remove = Exception::Class::DBI::Unknown + +[Author::Plicease::Upload] +cpan = 1 diff --git a/lib/Exception/Class/DBI.pm b/lib/Exception/Class/DBI.pm index deb4593..9c76351 100644 --- a/lib/Exception/Class/DBI.pm +++ b/lib/Exception/Class/DBI.pm @@ -3,9 +3,10 @@ use 5.006; use strict; use warnings; -use Exception::Class; - -our $VERSION = '1.04'; +use Exception::Class 1.02; + +# ABSTRACT: DBI Exception objects +our $VERSION = '1.04'; # VERSION use Exception::Class ( 'Exception::Class::DBI' => { @@ -123,7 +124,20 @@ sub rows_in_cache { shift->handle->{RowsInCache} } 1; + __END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Exception::Class::DBI - DBI Exception objects + +=head1 VERSION + +version 1.04 =head1 Name @@ -219,7 +233,7 @@ C attribute. Exceptions of this base class are only thrown when there is no DBI handle object executing, e.g. in the DBI C method. B This functionality is not yet implemented in DBI -- see the -discusion that starts here: +discussion that starts here: L. =over 4 @@ -606,13 +620,11 @@ =head1 Support This module is stored in an open L. Feel free to fork +repository|http://github.com/uperl/Exception-Class-DBI/>. Feel free to fork and contribute! Please file bug reports via L or by sending -mail to -L. +Issues|http://github.com/uperl/Exception-Class-DBI/issues/>. =head1 Author @@ -629,11 +641,25 @@ module for details on the methods this module's classes inherit from it. There's lots more information in these exception objects, so use them! +=head1 AUTHORS + +=over 4 + +=item * + +David E. Wheeler + +=item * + +Graham Ollis + +=back + =head1 COPYRIGHT AND LICENSE -Copyright (c) 2002-2019, David E. Wheeler. Some Rights Reserved. - -This module is free software; you can redistribute it and/or modify it under -the same terms as Perl itself. +This software is copyright (c) 2002-2021 by David E. Wheeler. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. =cut diff --git a/maint/releaseprep b/maint/releaseprep deleted file mode 100755 index 6159b16..0000000 --- a/maint/releaseprep +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use warnings; -use autodie qw( :all ); -use App::RewriteVersion; - -my $version = shift @ARGV; -my $time = `date +'%F %T %z'`; -chomp $time; - -if($version) -{ - # update the version number in all modules - { - my $rewrite = App::RewriteVersion->new; - $rewrite->allow_decimal_underscore(1); - $rewrite->verbose(1); - $rewrite->rewrite_versions($version); - } - - # update the Changes file - { - my @lines; - my $fh; - my $first = 1; - open $fh, '<', 'Changes'; - while(my $line = <$fh>) - { - if($first && $line =~ /^\s+-/) - { - push @lines, "$version $time\n"; - $first = 0; - } - push @lines, $line; - } - close $fh; - open $fh, '>', 'Changes'; - print $fh $_ for @lines; - close $fh; - } -} - diff --git a/t/00_diag.t b/t/00_diag.t new file mode 100644 index 0000000..7e400f8 --- /dev/null +++ b/t/00_diag.t @@ -0,0 +1,88 @@ +use strict; +use warnings; +use Config; +use Test::More tests => 1; + +# This .t file is generated. +# make changes instead to dist.ini + +my %modules; +my $post_diag; + +$modules{$_} = $_ for qw( + DBD::ExampleP + DBI + Exception::Class + ExtUtils::MakeMaker + Test::Harness + Test::More +); + + + +my @modules = sort keys %modules; + +sub spacer () +{ + diag ''; + diag ''; + diag ''; +} + +pass 'okay'; + +my $max = 1; +$max = $_ > $max ? $_ : $max for map { length $_ } @modules; +our $format = "%-${max}s %s"; + +spacer; + +my @keys = sort grep /(MOJO|PERL|\A(LC|HARNESS)_|\A(SHELL|LANG)\Z)/i, keys %ENV; + +if(@keys > 0) +{ + diag "$_=$ENV{$_}" for @keys; + + if($ENV{PERL5LIB}) + { + spacer; + diag "PERL5LIB path"; + diag $_ for split $Config{path_sep}, $ENV{PERL5LIB}; + + } + elsif($ENV{PERLLIB}) + { + spacer; + diag "PERLLIB path"; + diag $_ for split $Config{path_sep}, $ENV{PERLLIB}; + } + + spacer; +} + +diag sprintf $format, 'perl', "$] $^O $Config{archname}"; + +foreach my $module (@modules) +{ + my $pm = "$module.pm"; + $pm =~ s{::}{/}g; + if(eval { require $pm; 1 }) + { + my $ver = eval { $module->VERSION }; + $ver = 'undef' unless defined $ver; + diag sprintf $format, $module, $ver; + } + else + { + diag sprintf $format, $module, '-'; + } +} + +if($post_diag) +{ + spacer; + $post_diag->(); +} + +spacer; + diff --git a/xt/author/eol.t b/xt/author/eol.t new file mode 100644 index 0000000..801ee44 --- /dev/null +++ b/xt/author/eol.t @@ -0,0 +1,16 @@ +use strict; +use warnings; +use Test::More; +BEGIN { + plan skip_all => 'test requires Test::EOL' + unless eval q{ use Test::EOL; 1 }; +}; +use Test::EOL; +use FindBin; +use File::Spec; + +chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); + +all_perl_files_ok(grep { -e $_ } qw( bin lib t Makefile.PL )); + + diff --git a/xt/author/no_tabs.t b/xt/author/no_tabs.t new file mode 100644 index 0000000..e990e72 --- /dev/null +++ b/xt/author/no_tabs.t @@ -0,0 +1,16 @@ +use strict; +use warnings; +use Test::More; +BEGIN { + plan skip_all => 'test requires Test::NoTabs' + unless eval q{ use Test::NoTabs; 1 }; +}; +use Test::NoTabs; +use FindBin; +use File::Spec; + +chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); + +all_perl_files_ok( grep { -e $_ } qw( bin lib t Makefile.PL )); + + diff --git a/xt/author/pod.t b/xt/author/pod.t new file mode 100644 index 0000000..186707f --- /dev/null +++ b/xt/author/pod.t @@ -0,0 +1,16 @@ +use strict; +use warnings; +use Test::More; +BEGIN { + plan skip_all => 'test requires Test::Pod' + unless eval q{ use Test::Pod; 1 }; +}; +use Test::Pod; +use FindBin; +use File::Spec; + +chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); + +all_pod_files_ok( grep { -e $_ } qw( bin lib )); + + diff --git a/xt/author/pod_coverage.t b/xt/author/pod_coverage.t new file mode 100644 index 0000000..a463f4c --- /dev/null +++ b/xt/author/pod_coverage.t @@ -0,0 +1,77 @@ +use strict; +use warnings; +use Test::More; +BEGIN { + plan skip_all => 'test requires 5.010 or better' + unless $] >= 5.010; + plan skip_all => 'test requires Test::Pod::Coverage' + unless eval q{ use Test::Pod::Coverage; 1 }; + plan skip_all => 'test requires YAML' + unless eval q{ use YAML; 1; }; + plan skip_all => 'test does not always work in cip check' + if defined $ENV{CIPSTATIC} && $ENV{CIPSTATIC} eq 'true'; +}; +use Test::Pod::Coverage; +use YAML qw( LoadFile ); +use FindBin; +use File::Spec; + +my $config_filename = File::Spec->catfile( + $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' +); + +my $config; +$config = LoadFile($config_filename) + if -r $config_filename; + +plan skip_all => 'disabled' if $config->{pod_coverage}->{skip}; + +chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); + +my @private_classes; +my %private_methods; + +push $config->{pod_coverage}->{private}->@*, + 'Alien::.*::Install::Files#Inline'; + +foreach my $private ($config->{pod_coverage}->{private}->@*) +{ + my($class,$method) = split /#/, $private; + if(defined $class && $class ne '') + { + my $regex = eval 'qr{^' . $class . '$}'; + if(defined $method && $method ne '') + { + push @private_classes, { regex => $regex, method => $method }; + } + else + { + push @private_classes, { regex => $regex, all => 1 }; + } + } + elsif(defined $method && $method ne '') + { + $private_methods{$_} = 1 for split /,/, $method; + } +} + +my @classes = all_modules; + +plan tests => scalar @classes; + +foreach my $class (@classes) +{ + SKIP: { + my($is_private_class) = map { 1 } grep { $class =~ $_->{regex} && $_->{all} } @private_classes; + skip "private class: $class", 1 if $is_private_class; + + my %methods = map {; $_ => 1 } map { split /,/, $_->{method} } grep { $class =~ $_->{regex} } @private_classes; + $methods{$_} = 1 for keys %private_methods; + + my $also_private = eval 'qr{^' . join('|', keys %methods ) . '$}'; + + pod_coverage_ok $class, { also_private => [$also_private] }; + }; +} + + diff --git a/xt/author/pod_spelling_common.t b/xt/author/pod_spelling_common.t new file mode 100644 index 0000000..2bd36be --- /dev/null +++ b/xt/author/pod_spelling_common.t @@ -0,0 +1,29 @@ +use strict; +use warnings; +use Test::More; +BEGIN { + plan skip_all => 'test requires Test::Pod::Spelling::CommonMistakes' + unless eval q{ use Test::Pod::Spelling::CommonMistakes; 1 }; + plan skip_all => 'test requires YAML' + unless eval q{ use YAML qw( LoadFile ); 1 }; +}; +use Test::Pod::Spelling::CommonMistakes; +use FindBin; +use File::Spec; + +my $config_filename = File::Spec->catfile( + $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' +); + +my $config; +$config = LoadFile($config_filename) + if -r $config_filename; + +plan skip_all => 'disabled' if $config->{pod_spelling_common}->{skip}; + +chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); + +# TODO: test files in bin too. +all_pod_files_ok; + + diff --git a/xt/author/pod_spelling_system.t b/xt/author/pod_spelling_system.t new file mode 100644 index 0000000..1637a97 --- /dev/null +++ b/xt/author/pod_spelling_system.t @@ -0,0 +1,102 @@ +use strict; +use warnings; +use Test::More; +BEGIN { + plan skip_all => 'test requires Test::Spelling' + unless eval q{ use Test::Spelling; 1 }; + plan skip_all => 'test requires YAML' + unless eval q{ use YAML; 1; }; +}; +use Test::Spelling; +use YAML qw( LoadFile ); +use FindBin; +use File::Spec; + +my $config_filename = File::Spec->catfile( + $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' +); + +my $config; +$config = LoadFile($config_filename) + if -r $config_filename; + +plan skip_all => 'disabled' if $config->{pod_spelling_system}->{skip}; + +chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); + +add_stopwords($config->{pod_spelling_system}->{stopwords}->@*); +add_stopwords(qw( +Plicease +stdout +stderr +stdin +subref +loopback +username +os +Ollis +Mojolicious +plicease +CPAN +reinstall +TODO +filename +filenames +login +callback +callbacks +standalone +VMS +hostname +hostnames +TCP +UDP +IP +API +MSWin32 +OpenBSD +FreeBSD +NetBSD +unencrypted +WebSocket +WebSockets +timestamp +timestamps +poney +BackPAN +portably +RedHat +AIX +BSD +XS +FFI +perlish +optimizations +subdirectory +RESTful +SQLite +JavaScript +dir +plugins +munge +jQuery +namespace +PDF +PDFs +usernames +DBI +pluggable +APIs +SSL +JSON +YAML +uncommented +Solaris +OpenVMS +URI +URL +CGI +)); +all_pod_files_spelling_ok; + + diff --git a/xt/author/strict.t b/xt/author/strict.t new file mode 100644 index 0000000..d5146f0 --- /dev/null +++ b/xt/author/strict.t @@ -0,0 +1,23 @@ +use strict; +use warnings; +use Test::More; +BEGIN { + plan skip_all => 'test requires Test::Strict' + unless eval q{ use Test::Strict; 1 }; +}; +use Test::Strict; +use FindBin; +use File::Spec; + +chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); + +unshift @Test::Strict::MODULES_ENABLING_STRICT, + 'ozo', + 'Test2::Bundle::SIPS', + 'Test2::V0', + 'Test2::Bundle::Extended'; +note "enabling strict = $_" for @Test::Strict::MODULES_ENABLING_STRICT; + +all_perl_files_ok( grep { -e $_ } qw( bin lib t Makefile.PL )); + + diff --git a/xt/author/version.t b/xt/author/version.t new file mode 100644 index 0000000..7638e80 --- /dev/null +++ b/xt/author/version.t @@ -0,0 +1,39 @@ +use strict; +use warnings; +use Test::More; +use FindBin (); +BEGIN { + + plan skip_all => "test requires Test::Version 2.00" + unless eval q{ + use Test::Version 2.00 qw( version_all_ok ), { + has_version => 1, + filename_match => sub { $_[0] !~ m{/(ConfigData|Install/Files)\.pm$} }, + }; + 1 + }; + + plan skip_all => 'test requires YAML' + unless eval q{ use YAML; 1; }; +} + +use YAML qw( LoadFile ); +use FindBin; +use File::Spec; + +my $config_filename = File::Spec->catfile( + $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' +); + +my $config; +$config = LoadFile($config_filename) + if -r $config_filename; + +if($config->{version}->{dir}) +{ + note "using dir " . $config->{version}->{dir} +} + +version_all_ok($config->{version}->{dir} ? ($config->{version}->{dir}) : ()); +done_testing; + diff --git a/xt/release/changes.t b/xt/release/changes.t new file mode 100644 index 0000000..7781a30 --- /dev/null +++ b/xt/release/changes.t @@ -0,0 +1,29 @@ +use strict; +use warnings; +use Test::More; +BEGIN { + plan skip_all => 'test requires Test::CPAN::Changes' + unless eval q{ use Test::CPAN::Changes; 1 }; +}; +use Test::CPAN::Changes; +use FindBin; +use File::Spec; + +chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); + +do { + my $old = \&Test::Builder::carp; + my $new = sub { + my($self, @messages) = @_; + return if $messages[0] =~ /^Date ".*" is not in the recommend format/; + $old->($self, @messages); + }; + no warnings 'redefine'; + *Test::Builder::carp = $new; +}; + +changes_file_ok; + +done_testing; + + diff --git a/xt/release/fixme.t b/xt/release/fixme.t new file mode 100644 index 0000000..f1f17de --- /dev/null +++ b/xt/release/fixme.t @@ -0,0 +1,20 @@ +use strict; +use warnings; +use Test::More; +BEGIN { + plan skip_all => 'test requires Test::Fixme' + unless eval q{ use Test::Fixme 0.14; 1 }; +}; +use Test::Fixme 0.07; +use FindBin; +use File::Spec; + +chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); + +run_tests( + match => qr/FIXME/, + where => [ grep { -e $_ } qw( bin lib t Makefile.PL Build.PL )], + warn => 1, +); + +