Import Upstream version 0.17029

This commit is contained in:
Lu zhiping 2022-07-05 20:26:20 +08:00
commit b3aba2ae00
45 changed files with 4628 additions and 0 deletions

68
Build.PL Normal file
View File

@ -0,0 +1,68 @@
# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.012.
use strict;
use warnings;
use Module::Build 0.28;
my %module_build_args = (
"build_requires" => {
"Module::Build" => "0.28"
},
"configure_requires" => {
"ExtUtils::MakeMaker" => 0,
"Module::Build" => "0.28"
},
"dist_abstract" => "Error/exception handling in an OO-ish way",
"dist_author" => [
"Shlomi Fish ( http://www.shlomifish.org/ )"
],
"dist_name" => "Error",
"dist_version" => "0.17029",
"license" => "perl",
"module_name" => "Error",
"recursive_test_files" => 1,
"requires" => {
"Carp" => 0,
"Exporter" => 0,
"Scalar::Util" => 0,
"overload" => 0,
"perl" => "5.006",
"strict" => 0,
"vars" => 0,
"warnings" => 0
},
"test_requires" => {
"File::Spec" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"Test::More" => "0.88",
"base" => 0,
"lib" => 0,
"perl" => "5.006"
}
);
my %fallback_build_requires = (
"File::Spec" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"Module::Build" => "0.28",
"Test::More" => "0.88",
"base" => 0,
"lib" => 0,
"perl" => "5.006"
);
unless ( eval { Module::Build->VERSION(0.4004) } ) {
delete $module_build_args{test_requires};
$module_build_args{build_requires} = \%fallback_build_requires;
}
my $build = Module::Build->new(%module_build_args);
$build->create_build_script;

335
ChangeLog Normal file
View File

@ -0,0 +1,335 @@
May 23 2018 <shlomif@shlomifish.org> (Shlomi Fish)
Error.pm #0.17026
- Convert to Dist-Zilla.
Aug 07 2017 <shlomif@shlomifish.org> (Shlomi Fish)
Error.pm #0.17025
- Fix 'use Error::Simple' overriding the $VERSION
- https://rt.cpan.org/Public/Bug/Display.html?id=122713
- Thanks to Matthew Horsfall for the report.
May 30 2015 <shlomif@shlomifish.org> (Shlomi Fish)
Error.pm #0.17024
- Add link to the VCS repository in META.yml
Feb 12 2015 <shlomif@shlomifish.org> (Shlomi Fish)
Error.pm #0.17023
- Minimal version of Module-Build reduced to 0.280801
- https://rt.cpan.org/Public/Bug/Display.html?id=102062
Jan 29 2014 <shlomif@shlomifish.org> (Shlomi Fish)
Error.pm #0.17022
- Add "use warnings;" to everything (CPANTS Kwalitee).
- Add a separate LICENSE file (CPANTS Kwalitee).
Aug 27 2013 <shlomif@shlomifish.org> (Shlomi Fish)
Error.pm #0.17021
- Fix for the format of the new Carp (in bleadperl)
- https://rt.cpan.org/Ticket/Display.html?id=88137
- Thanks to Zefram for the report and patch.
May 03 2013 <shlomif@shlomifish.org> (Shlomi Fish)
Error.pm #0.17020
- Correct typos.
- https://rt.cpan.org/Ticket/Display.html?id=85023
Nov 19 2012 <shlomif@shlomifish.org> (Shlomi Fish)
Error.pm #0.17019
- Change to Shlomi Fish's new E-mail and web address.
- Clarify the licence of lib/Error/Simple.pm .
- https://rt.cpan.org/Ticket/Display.html?id=81277
- Thanks to Marcela
May 08 2012 <shlomif@shlomifish.org> (Shlomi Fish)
Error.pm #0.17018
- Add a $VERSION variable for Error::Simple.
- thanks to Kevin Dawson for the report.
- Add scripts/bump-version-number.pl .
- This can be used to bump the version numbers globally.
Feb 11 2012 <shlomif@shlomifish.org> (Shlomi Fish)
- Bleadperl broke Error.pm's tests -
- https://rt.cpan.org/Ticket/Display.html?id=74770
- Applied a patch to check for optional trailing periods.
- Thanks to ANDK for the report and RURBAN for the patch
Dec 19 2009 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17016
- Mentioned the lack of compatibility of "use Error qw(:try)" with Moose.
Fixed: https://rt.cpan.org/Ticket/Display.html?id=46364
- Added TryCatch and Try::Tiny to the "SEE ALSO".
- Add the WARNING that this module is no longer recommended.
Jul 19 2008 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17015
- Added the "SEE ALSO" section to the Error.pm POD mentioning
Exception::Class and Error::Exception.
May 24 2008 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17014
- Made Makefile.PL require perl-5.6.0 and above.
May 22 2008 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17013
- Now building only on perl-5.6.0 and above.
- Added the line to the Build.PL
Jan 25 2008 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17012
- Added some examples to the examples/ directory.
- Applied the patch from hchbaw to fix:
-//rt.cpan.org/Public/Bug/Display.html?id=32638
- Thanks to hchbaw
Dec 25 2007 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17011
- added 'warnings' to the dependencies in the Build.PL/Makefile.PL as
we are using it.
- changed the author in Makefile.PL/Build.PL from GBARR to SHLOMIF:
- http://rt.cpan.org/Public/Bug/Display.html?id=31861
- Thanks to Michael Schwern
- added an empty line between the "__END__" and "=head1" in
lib/Error/Simple.pm for more pedantic POD parsers.
Nov 22 2007 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17010
- moved the first Error->new() POD portion over to the POD at the bottom, and
deleted the second, identical POD portion.
- closing http://rt.cpan.org/Public/Bug/Display.html?id=30906
( "Duplicate Error->new() documentation" )
Aug 28 2007 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17009
- fixed http://rt.cpan.org/Public/Bug/Display.html?id=20643 by applying
a modified version of the patch by MAREKR with the t/12wrong-error-var.t
regression test.
Oct 25 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17008
- Added the empty PL_FILES paramaeter to ExtUtils::MakeMaker so it won't
attempt to run Build.PL.
Oct 18 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17007
- Added the "COPYRIGHT" section to the POD with the correct
license. (several people have asked me about what the license is.)
- Added the Build.PL file so we'll have license meta data in the
distribution.
Oct 07 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17006
- t/11rethrow.t - added the test file by Thomas Equeter.
- Changed to the more correct behevaiour that fixes the rethrowning
error by Thomas Equeter.
- see http://rt.cpan.org/Public/Bug/Display.html?id=21612
- added t/pod.t to check for POD validity.
- added the t/pod-coverage.t file for POD coverage.
- added the missing POD.
- added "use strict" and "use warnings" to lib/Error/Simple.pm to make
CPANTS happy.
Oct 03 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17005
- t/09dollar-at.t - included in the distribution (it was not placed in
the MANIFEST previously.
- t/10throw-in-catch.t, t/Error.pm - Fixed:
http://rt.cpan.org/Public/Bug/Display.html?id=21884 when an error that
was thrown inside a catch or otherwise clause was not registered.
Sep 01 2006 <leonerd@leonerd.org.uk> (Paul Evans)
Error.pm #0.17004
- t/08warndie.t: Various fixes:
Workaround for ActivePerl bug when dup2()ing to STDERR - close it first
Should fix https://rt.cpan.org/Public/Bug/Display.html?id=21080 but I
have no means to test it
Use __LINE__ rather than a custom function implemented using caller()
Aug 20 2006 <leonerd@leonerd.org.uk> (Paul Evans)
Error.pm #0.17003
- Pass error in $@ as well as $_[0] to catch and otherwise blocks.
- t/08warndie.t: Various fixes for Win32:
Win32 can't open( HANDLE, "-|" ) - need manual pipe()/fork() workaround
Filename on Win32 is t\08warndie.t - need \Q in regexp to avoid
interpretation as an invalid octal character
Aug 17 2006 <leonerd@leonerd.org.uk> (Paul Evans)
Error.pm #0.17002
- Documentation fix for Error::Simple constructor in example
- t/80warndie.t: Bugfix to open() call to work on perl 5.6
Jul 24 2006 <leonerd@leonerd.org.uk> (Paul Evans)
Error.pm #0.17001
- Bugfix to t/08warndie.t - Don't abuse $! for forcing "die"'s exit status
Fixes http://rt.cpan.org/Public/Bug/Display.html?id=20549
Jul 13 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.17
- Added some examples to the examples/ directory.
- Updated the MANIFEST.
Jul 13 2006 <leonerd@leonerd.org.uk> (Paul Evans)
Error.pm #0.16001
- Added the :warndie tag and the internal Error::WarnDie package that
provides custom __WARN__ and __DIE__ handlers.
Apr 24 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.16
- Bumped the version number to indicate a new number with no known
bugs.
Apr 24 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.15009
- Added the flush() method from Alasdair Allan.
Apr 07 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.15008
- Fixed a test in t/05text-errors-with-file-handles.t to work on
MS Windows due to File::Spec and require inconsistency.
Apr 07 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.15007
- Fixed https://rt.cpan.org/Ticket/Display.html?id=3291
Apr 07 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.15006
- According to https://rt.cpan.org/Ticket/Display.html?id=6130 - made
the auto-conversion of textual errors to object customizable.
Apr 03 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.15005
- Fixed the conversion of textual messages to Error::Simple when
they contain information about an open filehandle. (as reported in
http://rt.cpan.org/Ticket/Display.html?id=6130 )
Apr 02 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.15004
- Added POD to the lib/Error/Simple.pm module.
Mar 31 2006 <shlomif@iglu.org.il> (Shlomi Fish)
Error.pm #0.15003
- Added the lib/Error/Simple.pm module (that just "use"'s Error) so
one can say "use base 'Error::Simple';' Added an appropriate test.
Fixes: http://rt.cpan.org/Public/Bug/Display.html?id=17841
Mar 30 2006 <shlomif@iglu.org.il> (Shlomi Fish)
- Added Scalar::Util to the dependencies in Makefile.PL.
Error.pm #0.15002
- Fixed http://rt.cpan.org/Public/Bug/Display.html?id=18024 and a related
exception thrown because ->isa was called on something that was not
certainly an object.
Error.pm #0.15001
- Moved Error.pm inside the distribution to reside under lib/.
Oct 9 2001 <u_arunkumar@yahoo.com> (Arun Kumar U)
Error.pm #0.15
- Removed the run_clauses calls from the stack trace
May 12 2001 <u_arunkumar@yahoo.com> (Arun Kumar U)
Error.pm #0.14
- Added overloading method for 'bool'. This was neccessary so that
examining the value of $@ after a eval block, returns a true
value
- Applied the diffs from Graham's code base
- Changed README with more information about the module
Change 436 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
Added ppd stuff to MANIFEST and Makefile.PL
Change 435 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
Changed README to contain examples from the POD
Change 434 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
Documentation updates
removed experimental warning, too many users now to change too much.
Change 422 on 2000/03/28 by <gbarr@pobox.com> (Graham Barr)
Some tidy-ups
Change 145 on 1998/05/31 by <gbarr@pobox.com> (Graham Barr)
Errno.pm
- Separated run_clauses out into a sub
Oct 28 1997 <gbarr@pobox.com>
Error.pm #0.12
- Removed proceed clause
Oct 27 1997 <gbarr@pobox.com>
Error.pm #0.11
- Fixed calling of otherwise clause if there are no catch claues
Oct 21 1997 <gbarr@pobox.com>
Error.pm #0.10
- Added proceed clause, the return value from the proceed block
will be returned by throw.
- try will now return the result from the try block
or from the catch
- Changed except clause handling so that block is only evaluated
once, the first time the result is required.
- Changed catch and proceed blocks to accept two arguments. The
second argument is a reference to a scalar, which if set to true
will cause Error to continue looking for a catch/proceed block
when the block returns.
Oct 19 1997 <gbarr@pobox.com>
- Added associate method so that an existing error may be associated
with an object.
Oct 10 1997 <gbarr@pobox.com>
- Initial release for private viewing

18
Changes Normal file
View File

@ -0,0 +1,18 @@
0.17029 2020-01-28
- Rebuild for order of 'NAME' and 'VERSION' sections in the generated
POD documentation (see 0.001004 in
https://metacpan.org/changes/distribution/Pod-Weaver-PluginBundle-SHLOMIF
).
- VERSION used to appear before NAME.
0.17028 2019-08-23
- Moved the VCS repo to https://github.com/shlomif/perl-error.pm
- No other significant changes.
0.17027 2018-10-28
- Documentation and examples enhancements.
- https://bitbucket.org/shlomif/perl-error.pm/pull-requests/1/october-prc-some-minor-mostly-doc-changes/diff
- Thanks to https://metacpan.org/author/JMERELO .
0.17026 2018-05-23
- Convert to Dist-Zilla.

396
LICENSE Normal file
View File

@ -0,0 +1,396 @@
Terms of Perl 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"
----------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, 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 licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU 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. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) 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
this service 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 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 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 show them these terms so they know 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.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
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 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 derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
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 License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
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.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary 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
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 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 Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing 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 for copying, distributing or modifying
the Program or works based on it.
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.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. 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 this 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
this License, you may choose any version ever published by the Free Software
Foundation.
10. 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
11. 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.
12. 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
----------------------------------------------------------------------------
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

46
MANIFEST Normal file
View File

@ -0,0 +1,46 @@
# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012.
Build.PL
ChangeLog
Changes
LICENSE
MANIFEST
MANIFEST.SKIP
META.json
META.yml
Makefile.PL
README
dist.ini
examples/example.pl
examples/next-in-loop/Error.pm-eval.pl
examples/next-in-loop/Error.pm-next-label.pl
examples/next-in-loop/Error.pm-next-out-of-catch.pl
examples/next-in-loop/Error.pm-next.pl
examples/next-in-loop/README
examples/warndie.pl
inc/Test/Run/Builder.pm
lib/Error.pm
lib/Error/Simple.pm
scripts/bump-version-number.pl
t/00-compile.t
t/01throw.t
t/02order.t
t/03throw-non-Error.t
t/04use-base-Error-Simple.t
t/05text-errors-with-file-handles.t
t/06customize-text-throw.t
t/07try-in-obj-destructor.t
t/08warndie.t
t/09dollar-at.t
t/10throw-in-catch.t
t/11rethrow.t
t/12wrong-error-var.t
t/13except-arg0.t
t/14Error-Simple-VERSION.t
t/lib/MyDie.pm
weaver.ini
xt/author/eol.t
xt/author/no-tabs.t
xt/author/pod-coverage.t
xt/author/pod-syntax.t
xt/release/cpan-changes.t
xt/release/trailing-space.t

1
MANIFEST.SKIP Normal file
View File

@ -0,0 +1 @@
~$

569
META.json Normal file
View File

@ -0,0 +1,569 @@
{
"abstract" : "Error/exception handling in an OO-ish way",
"author" : [
"Shlomi Fish ( http://www.shlomifish.org/ )"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010",
"keywords" : [
"deprecated",
"exceptions",
"oop"
],
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "Error",
"prereqs" : {
"build" : {
"requires" : {
"Module::Build" : "0.28"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0",
"Module::Build" : "0.28"
}
},
"develop" : {
"requires" : {
"Pod::Coverage::TrustPod" : "0",
"Test::CPAN::Changes" : "0.19",
"Test::EOL" : "0",
"Test::More" : "0.96",
"Test::NoTabs" : "0",
"Test::Pod" : "1.41",
"Test::Pod::Coverage" : "1.08",
"Test::TrailingSpace" : "0.0203"
}
},
"runtime" : {
"requires" : {
"Carp" : "0",
"Exporter" : "0",
"Scalar::Util" : "0",
"overload" : "0",
"perl" : "5.006",
"strict" : "0",
"vars" : "0",
"warnings" : "0"
}
},
"test" : {
"requires" : {
"File::Spec" : "0",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"Test::More" : "0.88",
"base" : "0",
"lib" : "0",
"perl" : "5.006"
}
}
},
"provides" : {
"Error" : {
"file" : "lib/Error.pm",
"version" : "0.17029"
},
"Error::Simple" : {
"file" : "lib/Error.pm",
"version" : "0.17029"
},
"Error::WarnDie" : {
"file" : "lib/Error.pm",
"version" : "0.17029"
},
"Error::subs" : {
"file" : "lib/Error.pm",
"version" : "0.17029"
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/shlomif/perl-error.pm/issues"
},
"homepage" : "http://metacpan.org/release/Error",
"repository" : {
"type" : "git",
"url" : "git://github.com/shlomif/perl-error.pm.git",
"web" : "https://github.com/shlomif/perl-error.pm"
}
},
"version" : "0.17029",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.030001"
},
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::Prereqs",
"config" : {
"Dist::Zilla::Plugin::Prereqs" : {
"phase" : "test",
"type" : "requires"
}
},
"name" : "@Filter/TestMoreDoneTesting",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::AutoPrereqs",
"name" : "@Filter/AutoPrereqs",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "@Filter/ExecDir",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::GatherDir",
"config" : {
"Dist::Zilla::Plugin::GatherDir" : {
"exclude_filename" : [],
"exclude_match" : [],
"follow_symlinks" : 0,
"include_dotfiles" : 0,
"prefix" : "",
"prune_directory" : [],
"root" : "."
}
},
"name" : "@Filter/GatherDir",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::ManifestSkip",
"name" : "@Filter/ManifestSkip",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@Filter/MetaYAML",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::PruneCruft",
"name" : "@Filter/PruneCruft",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::Readme",
"name" : "@Filter/Readme",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::RunExtraTests",
"config" : {
"Dist::Zilla::Role::TestRunner" : {
"default_jobs" : 1
}
},
"name" : "@Filter/RunExtraTests",
"version" : "0.029"
},
{
"class" : "Dist::Zilla::Plugin::ShareDir",
"name" : "@Filter/ShareDir",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::MakeMaker",
"config" : {
"Dist::Zilla::Role::TestRunner" : {
"default_jobs" : 1
}
},
"name" : "@Filter/MakeMaker",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::CheckChangesHasContent",
"name" : "@Filter/CheckChangesHasContent",
"version" : "0.011"
},
{
"class" : "Dist::Zilla::Plugin::ConfirmRelease",
"name" : "@Filter/ConfirmRelease",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@Filter/Manifest",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "@Filter/MetaConfig",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "@Filter/MetaJSON",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::MetaProvides::Package",
"config" : {
"Dist::Zilla::Plugin::MetaProvides::Package" : {
"finder_objects" : [
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
"version" : "6.012"
}
],
"include_underscores" : 0
},
"Dist::Zilla::Role::MetaProvider::Provider" : {
"$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004",
"inherit_missing" : 1,
"inherit_version" : 1,
"meta_noindex" : 1
},
"Dist::Zilla::Role::ModuleMetadata" : {
"Module::Metadata" : "1.000036",
"version" : "0.006"
}
},
"name" : "@Filter/MetaProvides::Package",
"version" : "2.004003"
},
{
"class" : "Dist::Zilla::Plugin::MetaResources",
"name" : "@Filter/MetaResources",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::ModuleBuild",
"config" : {
"Dist::Zilla::Role::TestRunner" : {
"default_jobs" : 1
}
},
"name" : "@Filter/ModuleBuild",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::PkgVersion",
"name" : "@Filter/PkgVersion",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::PodCoverageTests",
"name" : "@Filter/PodCoverageTests",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "@Filter/PodSyntaxTests",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::Test::Compile",
"config" : {
"Dist::Zilla::Plugin::Test::Compile" : {
"bail_out_on_fail" : 0,
"fail_on_warning" : "author",
"fake_home" : 0,
"filename" : "t/00-compile.t",
"module_finder" : [
":InstallModules"
],
"needs_display" : 0,
"phase" : "test",
"script_finder" : [
":PerlExecFiles"
],
"skips" : [],
"switch" : []
}
},
"name" : "@Filter/Test::Compile",
"version" : "2.058"
},
{
"class" : "Dist::Zilla::Plugin::Test::CPAN::Changes",
"config" : {
"Dist::Zilla::Plugin::Test::CPAN::Changes" : {
"changelog" : "Changes"
}
},
"name" : "@Filter/Test::CPAN::Changes",
"version" : "0.012"
},
{
"class" : "Dist::Zilla::Plugin::Test::EOL",
"config" : {
"Dist::Zilla::Plugin::Test::EOL" : {
"filename" : "xt/author/eol.t",
"finder" : [
":ExecFiles",
":InstallModules",
":TestFiles"
],
"trailing_whitespace" : 1
}
},
"name" : "@Filter/Test::EOL",
"version" : "0.19"
},
{
"class" : "Dist::Zilla::Plugin::Test::NoTabs",
"config" : {
"Dist::Zilla::Plugin::Test::NoTabs" : {
"filename" : "xt/author/no-tabs.t",
"finder" : [
":InstallModules",
":ExecFiles",
":TestFiles"
]
}
},
"name" : "@Filter/Test::NoTabs",
"version" : "0.15"
},
{
"class" : "Dist::Zilla::Plugin::Test::TrailingSpace",
"name" : "@Filter/Test::TrailingSpace",
"version" : "0.2.0"
},
{
"class" : "Dist::Zilla::Plugin::TestRelease",
"name" : "@Filter/TestRelease",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::PodWeaver",
"config" : {
"Dist::Zilla::Plugin::PodWeaver" : {
"finder" : [
":InstallModules",
":ExecFiles"
],
"plugins" : [
{
"class" : "Pod::Weaver::Plugin::SingleEncoding",
"name" : "@SHLOMIF/SingleEncoding",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Plugin::WikiDoc",
"name" : "@SHLOMIF/WikiDoc",
"version" : "0.093004"
},
{
"class" : "Pod::Weaver::Plugin::EnsurePod5",
"name" : "@CorePrep/EnsurePod5",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Plugin::H1Nester",
"name" : "@CorePrep/H1Nester",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Name",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Version",
"name" : "@SHLOMIF/Version",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "@SHLOMIF/Prelude",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Synopsis",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Description",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Usage",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Overview",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "@SHLOMIF/Stability",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Requirements",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Attributes",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Constructors",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Methods",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "Functions",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Leftovers",
"name" : "@SHLOMIF/Leftovers",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "@SHLOMIF/postlude",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Support",
"name" : "@SHLOMIF/Support",
"version" : "1.012"
},
{
"class" : "Pod::Weaver::Section::Authors",
"name" : "@SHLOMIF/Authors",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Bugs",
"name" : "@SHLOMIF/Bugs",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Section::Contributors",
"name" : "@SHLOMIF/Contributors",
"version" : "0.009"
},
{
"class" : "Pod::Weaver::Section::Legal",
"name" : "@SHLOMIF/Legal",
"version" : "4.015"
},
{
"class" : "Pod::Weaver::Plugin::Transformer",
"name" : "@SHLOMIF/List",
"version" : "4.015"
}
]
}
},
"name" : "@Filter/PodWeaver",
"version" : "4.008"
},
{
"class" : "Dist::Zilla::Plugin::UploadToCPAN",
"name" : "@Filter/UploadToCPAN",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::Keywords",
"config" : {
"Dist::Zilla::Plugin::Keywords" : {
"keywords" : [
"deprecated",
"exceptions",
"oop"
]
}
},
"name" : "Keywords",
"version" : "0.007"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":InstallModules",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":IncModules",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExtraTestFiles",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":PerlExecFiles",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":MainModule",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":AllFiles",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":NoFiles",
"version" : "6.012"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
"version" : "6.012"
}
],
"zilla" : {
"class" : "Dist::Zilla::Dist::Builder",
"config" : {
"is_trial" : 0
},
"version" : "6.012"
}
},
"x_generated_by_perl" : "v5.30.1",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.18"
}

415
META.yml Normal file
View File

@ -0,0 +1,415 @@
---
abstract: 'Error/exception handling in an OO-ish way'
author:
- 'Shlomi Fish ( http://www.shlomifish.org/ )'
build_requires:
File::Spec: '0'
IO::Handle: '0'
IPC::Open3: '0'
Module::Build: '0.28'
Test::More: '0.88'
base: '0'
lib: '0'
perl: '5.006'
configure_requires:
ExtUtils::MakeMaker: '0'
Module::Build: '0.28'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010'
keywords:
- deprecated
- exceptions
- oop
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Error
provides:
Error:
file: lib/Error.pm
version: '0.17029'
Error::Simple:
file: lib/Error.pm
version: '0.17029'
Error::WarnDie:
file: lib/Error.pm
version: '0.17029'
Error::subs:
file: lib/Error.pm
version: '0.17029'
requires:
Carp: '0'
Exporter: '0'
Scalar::Util: '0'
overload: '0'
perl: '5.006'
strict: '0'
vars: '0'
warnings: '0'
resources:
bugtracker: https://github.com/shlomif/perl-error.pm/issues
homepage: http://metacpan.org/release/Error
repository: git://github.com/shlomif/perl-error.pm.git
version: '0.17029'
x_Dist_Zilla:
perl:
version: '5.030001'
plugins:
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: test
type: requires
name: '@Filter/TestMoreDoneTesting'
version: '6.012'
-
class: Dist::Zilla::Plugin::AutoPrereqs
name: '@Filter/AutoPrereqs'
version: '6.012'
-
class: Dist::Zilla::Plugin::ExecDir
name: '@Filter/ExecDir'
version: '6.012'
-
class: Dist::Zilla::Plugin::GatherDir
config:
Dist::Zilla::Plugin::GatherDir:
exclude_filename: []
exclude_match: []
follow_symlinks: 0
include_dotfiles: 0
prefix: ''
prune_directory: []
root: .
name: '@Filter/GatherDir'
version: '6.012'
-
class: Dist::Zilla::Plugin::ManifestSkip
name: '@Filter/ManifestSkip'
version: '6.012'
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@Filter/MetaYAML'
version: '6.012'
-
class: Dist::Zilla::Plugin::PruneCruft
name: '@Filter/PruneCruft'
version: '6.012'
-
class: Dist::Zilla::Plugin::Readme
name: '@Filter/Readme'
version: '6.012'
-
class: Dist::Zilla::Plugin::RunExtraTests
config:
Dist::Zilla::Role::TestRunner:
default_jobs: 1
name: '@Filter/RunExtraTests'
version: '0.029'
-
class: Dist::Zilla::Plugin::ShareDir
name: '@Filter/ShareDir'
version: '6.012'
-
class: Dist::Zilla::Plugin::MakeMaker
config:
Dist::Zilla::Role::TestRunner:
default_jobs: 1
name: '@Filter/MakeMaker'
version: '6.012'
-
class: Dist::Zilla::Plugin::CheckChangesHasContent
name: '@Filter/CheckChangesHasContent'
version: '0.011'
-
class: Dist::Zilla::Plugin::ConfirmRelease
name: '@Filter/ConfirmRelease'
version: '6.012'
-
class: Dist::Zilla::Plugin::Manifest
name: '@Filter/Manifest'
version: '6.012'
-
class: Dist::Zilla::Plugin::MetaConfig
name: '@Filter/MetaConfig'
version: '6.012'
-
class: Dist::Zilla::Plugin::MetaJSON
name: '@Filter/MetaJSON'
version: '6.012'
-
class: Dist::Zilla::Plugin::MetaProvides::Package
config:
Dist::Zilla::Plugin::MetaProvides::Package:
finder_objects:
-
class: Dist::Zilla::Plugin::FinderCode
name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
version: '6.012'
include_underscores: 0
Dist::Zilla::Role::MetaProvider::Provider:
$Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004'
inherit_missing: '1'
inherit_version: '1'
meta_noindex: '1'
Dist::Zilla::Role::ModuleMetadata:
Module::Metadata: '1.000036'
version: '0.006'
name: '@Filter/MetaProvides::Package'
version: '2.004003'
-
class: Dist::Zilla::Plugin::MetaResources
name: '@Filter/MetaResources'
version: '6.012'
-
class: Dist::Zilla::Plugin::ModuleBuild
config:
Dist::Zilla::Role::TestRunner:
default_jobs: 1
name: '@Filter/ModuleBuild'
version: '6.012'
-
class: Dist::Zilla::Plugin::PkgVersion
name: '@Filter/PkgVersion'
version: '6.012'
-
class: Dist::Zilla::Plugin::PodCoverageTests
name: '@Filter/PodCoverageTests'
version: '6.012'
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: '@Filter/PodSyntaxTests'
version: '6.012'
-
class: Dist::Zilla::Plugin::Test::Compile
config:
Dist::Zilla::Plugin::Test::Compile:
bail_out_on_fail: '0'
fail_on_warning: author
fake_home: 0
filename: t/00-compile.t
module_finder:
- ':InstallModules'
needs_display: 0
phase: test
script_finder:
- ':PerlExecFiles'
skips: []
switch: []
name: '@Filter/Test::Compile'
version: '2.058'
-
class: Dist::Zilla::Plugin::Test::CPAN::Changes
config:
Dist::Zilla::Plugin::Test::CPAN::Changes:
changelog: Changes
name: '@Filter/Test::CPAN::Changes'
version: '0.012'
-
class: Dist::Zilla::Plugin::Test::EOL
config:
Dist::Zilla::Plugin::Test::EOL:
filename: xt/author/eol.t
finder:
- ':ExecFiles'
- ':InstallModules'
- ':TestFiles'
trailing_whitespace: 1
name: '@Filter/Test::EOL'
version: '0.19'
-
class: Dist::Zilla::Plugin::Test::NoTabs
config:
Dist::Zilla::Plugin::Test::NoTabs:
filename: xt/author/no-tabs.t
finder:
- ':InstallModules'
- ':ExecFiles'
- ':TestFiles'
name: '@Filter/Test::NoTabs'
version: '0.15'
-
class: Dist::Zilla::Plugin::Test::TrailingSpace
name: '@Filter/Test::TrailingSpace'
version: 0.2.0
-
class: Dist::Zilla::Plugin::TestRelease
name: '@Filter/TestRelease'
version: '6.012'
-
class: Dist::Zilla::Plugin::PodWeaver
config:
Dist::Zilla::Plugin::PodWeaver:
finder:
- ':InstallModules'
- ':ExecFiles'
plugins:
-
class: Pod::Weaver::Plugin::SingleEncoding
name: '@SHLOMIF/SingleEncoding'
version: '4.015'
-
class: Pod::Weaver::Plugin::WikiDoc
name: '@SHLOMIF/WikiDoc'
version: '0.093004'
-
class: Pod::Weaver::Plugin::EnsurePod5
name: '@CorePrep/EnsurePod5'
version: '4.015'
-
class: Pod::Weaver::Plugin::H1Nester
name: '@CorePrep/H1Nester'
version: '4.015'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Name'
version: '4.015'
-
class: Pod::Weaver::Section::Version
name: '@SHLOMIF/Version'
version: '4.015'
-
class: Pod::Weaver::Section::Region
name: '@SHLOMIF/Prelude'
version: '4.015'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Synopsis'
version: '4.015'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Description'
version: '4.015'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Usage'
version: '4.015'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Overview'
version: '4.015'
-
class: Pod::Weaver::Section::Generic
name: '@SHLOMIF/Stability'
version: '4.015'
-
class: Pod::Weaver::Section::Collect
name: Requirements
version: '4.015'
-
class: Pod::Weaver::Section::Collect
name: Attributes
version: '4.015'
-
class: Pod::Weaver::Section::Collect
name: Constructors
version: '4.015'
-
class: Pod::Weaver::Section::Collect
name: Methods
version: '4.015'
-
class: Pod::Weaver::Section::Collect
name: Functions
version: '4.015'
-
class: Pod::Weaver::Section::Leftovers
name: '@SHLOMIF/Leftovers'
version: '4.015'
-
class: Pod::Weaver::Section::Region
name: '@SHLOMIF/postlude'
version: '4.015'
-
class: Pod::Weaver::Section::Support
name: '@SHLOMIF/Support'
version: '1.012'
-
class: Pod::Weaver::Section::Authors
name: '@SHLOMIF/Authors'
version: '4.015'
-
class: Pod::Weaver::Section::Bugs
name: '@SHLOMIF/Bugs'
version: '4.015'
-
class: Pod::Weaver::Section::Contributors
name: '@SHLOMIF/Contributors'
version: '0.009'
-
class: Pod::Weaver::Section::Legal
name: '@SHLOMIF/Legal'
version: '4.015'
-
class: Pod::Weaver::Plugin::Transformer
name: '@SHLOMIF/List'
version: '4.015'
name: '@Filter/PodWeaver'
version: '4.008'
-
class: Dist::Zilla::Plugin::UploadToCPAN
name: '@Filter/UploadToCPAN'
version: '6.012'
-
class: Dist::Zilla::Plugin::Keywords
config:
Dist::Zilla::Plugin::Keywords:
keywords:
- deprecated
- exceptions
- oop
name: Keywords
version: '0.007'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':IncModules'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExtraTestFiles'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':PerlExecFiles'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':MainModule'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':AllFiles'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':NoFiles'
version: '6.012'
-
class: Dist::Zilla::Plugin::FinderCode
name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
version: '6.012'
zilla:
class: Dist::Zilla::Dist::Builder
config:
is_trial: '0'
version: '6.012'
x_generated_by_perl: v5.30.1
x_serialization_backend: 'YAML::Tiny version 1.73'

74
Makefile.PL Normal file
View File

@ -0,0 +1,74 @@
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012.
use strict;
use warnings;
use 5.006;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "Error/exception handling in an OO-ish way",
"AUTHOR" => "Shlomi Fish ( http://www.shlomifish.org/ )",
"BUILD_REQUIRES" => {
"Module::Build" => "0.28"
},
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0,
"Module::Build" => "0.28"
},
"DISTNAME" => "Error",
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.006",
"NAME" => "Error",
"PREREQ_PM" => {
"Carp" => 0,
"Exporter" => 0,
"Scalar::Util" => 0,
"overload" => 0,
"strict" => 0,
"vars" => 0,
"warnings" => 0
},
"TEST_REQUIRES" => {
"File::Spec" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"Test::More" => "0.88",
"base" => 0,
"lib" => 0
},
"VERSION" => "0.17029",
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"Carp" => 0,
"Exporter" => 0,
"File::Spec" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"Module::Build" => "0.28",
"Scalar::Util" => 0,
"Test::More" => "0.88",
"base" => 0,
"lib" => 0,
"overload" => 0,
"strict" => 0,
"vars" => 0,
"warnings" => 0
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
$WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);

12
README Normal file
View File

@ -0,0 +1,12 @@
This archive contains the distribution Error,
version 0.17029:
Error/exception handling in an OO-ish way
This software is copyright (c) 2020 by Shlomi Fish ( http://www.shlomifish.org/ ).
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
This README file was generated by Dist::Zilla::Plugin::Readme v6.012.

15
dist.ini Normal file
View File

@ -0,0 +1,15 @@
name = Error
version = 0.17029
author = Shlomi Fish ( http://www.shlomifish.org/ )
license = Perl_5
copyright_holder = Shlomi Fish ( http://www.shlomifish.org/ )
[@Filter]
-bundle = @SHLOMIF
-remove = License
dist = Error
github_name = perl-error.pm
[Keywords]
keyword = deprecated
keyword = exceptions
keyword = oop

54
examples/example.pl Normal file
View File

@ -0,0 +1,54 @@
use lib '.';
use Error qw(:try);
use strict;
use warnings;
@Error::Bad::ISA = qw(Error);
$Error::Debug = 1; # turn on verbose stacktrace
sub abc {
try {
try {
throw Error::Simple("a simple error");
}
catch Error::Simple with {
my $err = shift;
throw Error::Bad(-text => "some text");
}
except {
return {
'Error::Simple' => sub { warn "simple" }
}
}
otherwise {
1;
} finally {
warn "finally\n";
};
}
catch Error::Bad with {
1;
};
}
sub def {
unlink("not such file") or
record Error::Simple("unlink: $!", $!) and return;
1;
}
abc();
my $x = prior Error;
print "--\n",$x->stacktrace;
unless(defined def()) {
my $x = prior Error 'main';
print "--\n",0+$x,"\n",$x; # 0+$x converts to Integer via "value" method
}

View File

@ -0,0 +1,40 @@
#!/usr/bin/perl
use strict;
use warnings;
use Error qw(:try);
use Scalar::Util qw(blessed);
use IO::Handle;
package MyError;
use base 'Error';
package SecondError;
use base 'Error';
package main;
autoflush STDOUT 1;
SHLOMIF_FOREACH:
foreach my $i (1 .. 100)
{
eval
{
if ($i % 10 == 0)
{
throw MyError;
}
};
my $E = $@;
if (blessed($E) && $E->isa('MyError'))
{
next SHLOMIF_FOREACH;
}
print "$i\n";
}

View File

@ -0,0 +1,38 @@
#!/usr/bin/perl
use strict;
use warnings;
use Error qw(:try);
use IO::Handle;
package MyError;
use base 'Error';
package SecondError;
use base 'Error';
package main;
autoflush STDOUT 1;
SHLOMIF_FOREACH:
foreach my $i (1 .. 100)
{
try
{
if ($i % 10 == 0)
{
throw MyError;
}
}
catch MyError with
{
my $E = shift;
next SHLOMIF_FOREACH;
};
print "$i\n";
}

View File

@ -0,0 +1,43 @@
#!/usr/bin/perl
use strict;
use warnings;
use Error qw(:try);
use IO::Handle;
package MyError;
use base 'Error';
package SecondError;
use base 'Error';
package main;
autoflush STDOUT 1;
SHLOMIF_FOREACH:
foreach my $i (1 .. 100)
{
my $caught = 0;
try
{
if ($i % 10 == 0)
{
throw MyError;
}
}
catch MyError with
{
my $E = shift;
$caught = 1;
};
if ($caught)
{
next SHLOMIF_FOREACH;
}
print "$i\n";
}

View File

@ -0,0 +1,37 @@
#!/usr/bin/perl
use strict;
use warnings;
use Error qw(:try);
use IO::Handle;
package MyError;
use base 'Error';
package SecondError;
use base 'Error';
package main;
autoflush STDOUT 1;
foreach my $i (1 .. 100)
{
try
{
if ($i % 10 == 0)
{
throw MyError;
}
}
catch MyError with
{
my $E = shift;
next;
};
print "$i\n";
}

View File

@ -0,0 +1,3 @@
This is a case study for various ways to implement a "next" command
inside one of the Error.pm clauses, which itself will be inside an
inner loop inside Error.pm.

24
examples/warndie.pl Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/perl -w
# Usage: perl warndie.pl [1 or true or whatever if you want to use warndie]
require Error;
if( $ARGV[0] ) {
import Error qw( :warndie );
print "Imported the :warndie tag.\n";
print "\n";
}
else {
print "Running example without the :warndie tag.\n";
print "Try also passing a true value as \$ARGV[0] to import this tag\n";
print "\n";
}
sub inner {
shift->foo();
}
sub outer {
inner( @_ );
}
outer( undef );

65
inc/Test/Run/Builder.pm Normal file
View File

@ -0,0 +1,65 @@
package Test::Run::Builder;
use strict;
use warnings;
use Module::Build;
use vars qw(@ISA);
@ISA = (qw(Module::Build));
sub ACTION_runtest
{
my ($self) = @_;
my $p = $self->{properties};
$self->depends_on('code');
local @INC = @INC;
# Make sure we test the module in blib/
unshift @INC, (File::Spec->catdir($p->{base_dir}, $self->blib, 'lib'),
File::Spec->catdir($p->{base_dir}, $self->blib, 'arch'));
$self->do_test_run_tests;
}
sub ACTION_distruntest {
my ($self) = @_;
$self->depends_on('distdir');
my $start_dir = $self->cwd;
my $dist_dir = $self->dist_dir;
chdir $dist_dir or die "Cannot chdir to $dist_dir: $!";
# XXX could be different names for scripts
$self->run_perl_script('Build.PL') # XXX Should this be run w/ --nouse-rcfile
or die "Error executing 'Build.PL' in dist directory: $!";
$self->run_perl_script('Build')
or die "Error executing 'Build' in dist directory: $!";
$self->run_perl_script('Build', [], ['runtest'])
or die "Error executing 'Build test' in dist directory";
chdir $start_dir;
}
sub do_test_run_tests
{
my $self = shift;
require Test::Run::CmdLine::Iface;
my $test_run =
Test::Run::CmdLine::Iface->new(
{
'test_files' => [glob("t/*.t")],
}
# 'backend_params' => $self->_get_backend_params(),
);
return $test_run->run();
}
1;

1215
lib/Error.pm Normal file

File diff suppressed because it is too large Load Diff

181
lib/Error/Simple.pm Normal file
View File

@ -0,0 +1,181 @@
# Error/Simple.pm
#
# Copyright (c) 2006 Shlomi Fish <shlomif@shlomifish.org>.
# This file is free software; you can redistribute it and/or
# modify it under the terms of the MIT/X11 license (whereas the licence
# of the Error distribution as a whole is the GPLv1+ and the Artistic
# licence).
package Error::Simple;
$Error::Simple::VERSION = '0.17029';
use strict;
use warnings;
use Error;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Error::Simple - the simple error sub-class of Error
=head1 VERSION
version 0.17029
=head1 SYNOPSIS
use base 'Error::Simple';
=head1 DESCRIPTION
The only purpose of this module is to allow one to say:
use base 'Error::Simple';
and the only thing it does is "use" Error.pm. Refer to the documentation
of L<Error> for more information about Error::Simple.
=head1 METHODS
=head2 Error::Simple->new($text [, $value])
Constructs an Error::Simple with the text C<$text> and the optional value
C<$value>.
=head2 $err->stringify()
Error::Simple overloads this method.
=head1 KNOWN BUGS
None.
=head1 AUTHORS
Shlomi Fish ( L<http://www.shlomifish.org/> )
=head1 SEE ALSO
L<Error>
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
L<https://metacpan.org/release/Error>
=item *
Search CPAN
The default CPAN search engine, useful to view POD in HTML format.
L<http://search.cpan.org/dist/Error>
=item *
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
L<https://rt.cpan.org/Public/Dist/Display.html?Name=Error>
=item *
CPAN Ratings
The CPAN Ratings is a website that allows community ratings and reviews of Perl modules.
L<http://cpanratings.perl.org/d/Error>
=item *
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L<http://cpants.cpanauthors.org/dist/Error>
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L<http://www.cpantesters.org/distro/E/Error>
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L<http://matrix.cpantesters.org/?dist=Error>
=item *
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Error>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-error at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Error>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/perl-error.pm>
git clone git://github.com/shlomif/perl-error.pm.git
=head1 AUTHOR
Shlomi Fish ( http://www.shlomifish.org/ )
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L<https://github.com/shlomif/perl-error.pm/issues>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by Shlomi Fish ( http://www.shlomifish.org/ ).
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut

View File

@ -0,0 +1,43 @@
#!/usr/bin/perl
use strict;
use warnings;
use File::Find::Object;
use IO::All;
my $tree = File::Find::Object->new({}, 'lib/');
my $version_n = shift(@ARGV);
if (!defined($version_n))
{
die "Specify version number as an argument! bump-version-number.pl '0.0.1'";
}
sub process_file
{
# The filename.
my ($r) = @_;
my @lines = io->file($r)->getlines();
foreach (@lines)
{
s#(\$VERSION = "|^Version )\d+\.\d+(?:\.\d+)?("|)#$1 . $version_n . $2#e;
}
io->file($r)->print(
@lines
);
}
while (my $r = $tree->next()) {
if ($r =~ m{/\.(?:svn|hg|git)\z})
{
$tree->prune();
}
elsif ($r =~ m{\.pm\z})
{
process_file($r);
}
}

61
t/00-compile.t Normal file
View File

@ -0,0 +1,61 @@
use 5.006;
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058
use Test::More;
plan tests => 2 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
my @module_files = (
'Error.pm',
'Error/Simple.pm'
);
# no fake home requested
my @switches = (
-d 'blib' ? '-Mblib' : '-Ilib',
);
use File::Spec;
use IPC::Open3;
use IO::Handle;
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { +require blib; blib->VERSION('1.01') };
if (@_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
}
}
is(scalar(@warnings), 0, 'no warnings found')
or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};

28
t/01throw.t Normal file
View File

@ -0,0 +1,28 @@
use strict;
use warnings;
use Error qw(:try);
print "1..4\n";
try {
print "ok 1\n";
};
try {
throw Error::Simple("ok 2\n",2);
print "not ok 2\n";
}
catch Error::Simple with {
my $err = shift;
print "$err";
}
finally {
print "ok 3\n";
};
my $err = prior Error;
print "ok ",2+$err,"\n";;

61
t/02order.t Normal file
View File

@ -0,0 +1,61 @@
use strict;
use warnings;
use Error qw(:try);
@Error::Fatal::ISA = qw(Error);
print "1..6\n";
my $num = try
{
try
{
try
{
throw Error::Simple("ok 1\n");
}
catch Error::Simple with
{
my $err = shift;
print $err;
throw Error::Fatal( -value => 4 );
print "not ok 3\n";
}
catch Error::Fatal with
{
exit(1);
}
finally
{
print "ok 2\n";
};
}
finally
{
print "ok 3\n";
};
}
catch Error::Fatal with
{
my $err = shift;
my $more = shift;
$$more = 1;
print "ok ", 0 + $err, "\n";
}
catch Error::Fatal with
{
my $err = shift;
print "ok ", 1 + $err, "\n";
return 6;
}
catch Error::Fatal with
{
my $err = shift;
print "not ok ", 2 + $err, "\n";
};
print "ok ", $num, "\n";

32
t/03throw-non-Error.t Normal file
View File

@ -0,0 +1,32 @@
#!/usr/bin/perl
use strict;
use warnings;
use Error (qw(:try));
use Test::More tests => 2;
my $count_of_Error = 0;
eval
{
try
{
die +{ 'private' => "Shlomi", 'family' => "Fish" };
}
catch Error with
{
my $err = shift;
$count_of_Error++;
}
};
my $exception = $@;
# TEST
is_deeply (
$exception,
+{'private' => "Shlomi", 'family' => "Fish"},
"Testing for thrown exception",
);
# TEST
is ($count_of_Error, 0, "No Errors caught.");

View File

@ -0,0 +1,18 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 1;
package Error::MyError;
use base 'Error::Simple';
package main;
# TEST
ok(1, "Testing that the use base worked.");
1;

View File

@ -0,0 +1,52 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 4;
use Error qw(:try);
BEGIN
{
use File::Spec;
use lib File::Spec->catdir(File::Spec->curdir(), "t", "lib");
use MyDie;
}
package MyError::Foo;
use vars qw(@ISA);
@ISA=(qw(Error));
package main;
my $ok = 1;
eval
{
try
{
MyDie::mydie();
}
catch MyError::Foo with
{
my $err = shift;
$ok = 0;
};
};
my $err = $@;
# TEST
ok($ok, "Not MyError::Foo");
# TEST
ok($err->isa("Error::Simple"), "Testing");
# TEST
is($err->{-line}, 19, "Testing for correct line number");
# TEST
ok(($err->{-file} =~ m{MyDie\.pm$}), "Testing for correct module");

View File

@ -0,0 +1,67 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 3;
use Error qw(:try);
package MyError::Foo;
use vars qw(@ISA);
@ISA=qw(Error);
package MyError::Bar;
use vars qw(@ISA);
@ISA=qw(Error);
package main;
{
eval
{
try
{
die "Hello";
}
catch MyError::Foo with {
};
};
my $err = $@;
# TEST
ok($err->isa("Error::Simple"), "Error was auto-converted to Error::Simple");
}
sub throw_MyError_Bar
{
my $args = shift;
my $err = MyError::Bar->new();
$err->{'MyBarText'} = $args->{'text'};
return $err;
}
{
local $Error::ObjectifyCallback = \&throw_MyError_Bar;
eval
{
try
{
die "Hello\n";
}
catch MyError::Foo with {
};
};
my $err = $@;
# TEST
ok ($err->isa("MyError::Bar"), "Error was auto-converted to MyError::Bar");
# TEST
is ($err->{'MyBarText'}, "Hello\n", "Text of the error is correct");
}

View File

@ -0,0 +1,43 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 1;
use Error qw/ :try /;
package ErrorTest;
use Error qw/ :try /;
sub new {
return bless {}, 'ErrorTest';
}
sub DESTROY {
my $self = shift;
try { 1; } otherwise { };
return;
}
package main;
my $E;
try {
my $y = ErrorTest->new();
# throw Error::Simple("Object die");
die "throw normal die";
} catch Error with {
$E = shift;
} otherwise {
$E = shift;
};
# TEST
is ($E->{'-text'}, "throw normal die",
"Testing that the excpetion is not trampeled"
);

220
t/08warndie.t Normal file
View File

@ -0,0 +1,220 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use Test::More tests => 21;
use Error qw/ :warndie /;
# Turn on full stack trace capture
$Error::Debug = 1;
# This file's name - for string matching. We need to quotemeta it, because on
# Win32, the filename is t\08warndie.t, and we don't want that accidentally
# matching an (invalid) \08 octal digit
my $file = qr/\Q$0\E/;
# Most of these tests are fatal, and print data on STDERR. We therefore use
# this testing function to run a CODEref in a child process and captures its
# STDERR and note whether the CODE block exited
my ( $s, $felloffcode );
my $linekid = __LINE__ + 15; # the $code->() is 15 lines below this one
sub run_kid(&)
{
my ( $code ) = @_;
# Win32's fork() emulation can't correctly handle the open("-|") case yet
# So we'll implement this manually - inspired by 'perldoc perlfork'
pipe my $childh, my $child or die "Cannot pipe() - $!";
defined( my $kid = fork() ) or die "Cannot fork() - $!";
if ( !$kid ) {
close $childh;
close STDERR;
open(STDERR, ">&=" . fileno($child)) or die;
$code->();
print STDERR "FELL OUT OF CODEREF\n";
exit(1);
}
close $child;
$s = "";
while( defined ( $_ = <$childh> ) ) {
$s .= $_;
}
close( $childh );
waitpid( $kid, 0 );
$felloffcode = 0;
$s =~ tr/\r//d; # Remove Win32 \r linefeeds to make RE tests easier
if( $s =~ s/FELL OUT OF CODEREF\n$// ) {
$felloffcode = 1;
}
}
ok(1, "Loaded");
run_kid {
print STDERR "Print to STDERR\n";
};
is( $s, "Print to STDERR\n", "Test framework STDERR" );
is( $felloffcode, 1, "Test framework felloffcode" );
my $line;
$line = __LINE__;
run_kid {
warn "A warning\n";
};
my ( $linea, $lineb ) = ( $line + 2, $line + 3 );
like( $s, qr/^A warning at $file line $linea\.?:
\tmain::__ANON__\(\) called at $file line $linekid
\tmain::run_kid\('?CODE\(0x[0-9a-f]+\)'?\) called at $file line $lineb
$/, "warn \\n-terminated STDERR" );
is( $felloffcode, 1, "warn \\n-terminated felloffcode" );
$line = __LINE__;
run_kid {
warn "A warning";
};
( $linea, $lineb ) = ( $line + 2, $line + 3 );
like( $s, qr/^A warning at $file line $linea\.?:
\tmain::__ANON__\(\) called at $file line $linekid
\tmain::run_kid\('?CODE\(0x[0-9a-f]+\)'?\) called at $file line $lineb
$/, "warn unterminated STDERR" );
is( $felloffcode, 1, "warn unterminated felloffcode" );
$line = __LINE__;
run_kid {
die "An error\n";
};
( $linea, $lineb ) = ( $line + 2, $line + 3 );
like( $s, qr/^
Unhandled perl error caught at toplevel:
An error
Thrown from: $file:$linea
Full stack trace:
\tmain::__ANON__\(\) called at $file line $linekid
\tmain::run_kid\('?CODE\(0x[0-9a-f]+\)'?\) called at $file line $lineb
$/, "die \\n-terminated STDERR" );
is( $felloffcode, 0, "die \\n-terminated felloffcode" );
$line = __LINE__;
run_kid {
die "An error";
};
( $linea, $lineb ) = ( $line + 2, $line + 3 );
like( $s, qr/^
Unhandled perl error caught at toplevel:
An error
Thrown from: $file:$linea
Full stack trace:
\tmain::__ANON__\(\) called at $file line $linekid
\tmain::run_kid\('?CODE\(0x[0-9a-f]+\)'?\) called at $file line $lineb
$/, "die unterminated STDERR" );
is( $felloffcode, 0, "die unterminated felloffcode" );
$line = __LINE__;
run_kid {
throw Error( -text => "An exception" );
};
( $linea, $lineb ) = ( $line + 2, $line + 3 );
like( $s, qr/^
Unhandled exception of type Error caught at toplevel:
An exception
Thrown from: $file:$linea
Full stack trace:
\tmain::__ANON__\(\) called at $file line $linekid
\tmain::run_kid\('?CODE\(0x[0-9a-f]+\)'?\) called at $file line $lineb
$/, "Error STDOUT" );
is( $felloffcode, 0, "Error felloffcode" );
# Now custom warn and die functions to ensure the :warndie handler respects them
$SIG{__WARN__} = sub { warn "My custom warning here: $_[0]" };
$SIG{__DIE__} = sub { die "My custom death here: $_[0]" };
# First test them
$line = __LINE__;
run_kid {
warn "A warning";
};
$linea = $line + 2;
like( $s, qr/^My custom warning here: A warning at $file line $linea\.?
$/, "Custom warn test STDERR" );
is( $felloffcode, 1, "Custom warn test felloffcode" );
$line = __LINE__;
run_kid {
die "An error";
};
$linea = $line + 2;
like( $s, qr/^My custom death here: An error at $file line $linea\.?
/, "Custom die test STDERR" );
is( $felloffcode, 0, "Custom die test felloffcode" );
# Re-install the :warndie handlers
import Error qw( :warndie );
$line = __LINE__;
run_kid {
warn "A warning\n";
};
( $linea, $lineb ) = ( $line + 2, $line + 3 );
like( $s, qr/^My custom warning here: A warning at $file line $linea\.?:
\tmain::__ANON__\(\) called at $file line $linekid
\tmain::run_kid\('?CODE\(0x[0-9a-f]+\)'?\) called at $file line $lineb
$/, "Custom warn STDERR" );
is( $felloffcode, 1, "Custom warn felloffcode" );
$line = __LINE__;
run_kid {
die "An error";
};
my $WS = ' ';
( $linea, $lineb ) = ( $line + 2, $line + 3 );
like( $s, qr/^My custom death here:$WS
Unhandled perl error caught at toplevel:
An error
Thrown from: $file:$linea
Full stack trace:
\tmain::__ANON__\(\) called at $file line $linekid
\tmain::run_kid\('?CODE\(0x[0-9a-f]+\)'?\) called at $file line $lineb
$/, "Custom die STDERR" );
is( $felloffcode, 0, "Custom die felloffcode" );
# Done

36
t/09dollar-at.t Normal file
View File

@ -0,0 +1,36 @@
#!/usr/bin/perl
use strict;
use warnings;
use Error qw(:try);
use Test::More tests => 8;
my $dollar_at;
my $arg_0;
try {
throw Error::Simple( "message" );
}
catch Error::Simple with {
$arg_0 = shift;
$dollar_at = $@;
};
ok( defined $arg_0, 'defined( $_[0] ) after throw/catch' );
ok( defined $dollar_at, 'defined( $@ ) after throw/catch' );
ok( ref $arg_0 && $arg_0->isa( "Error::Simple" ), '$_[0]->isa( "Error::Simple" ) after throw/catch' );
ok( ref $dollar_at && $dollar_at->isa( "Error::Simple" ), '$@->isa( "Error::Simple" ) after throw/catch' );
try {
throw Error::Simple( "message" );
}
otherwise {
$arg_0 = shift;
$dollar_at = $@;
};
ok( defined $arg_0, 'defined( $_[0] ) after throw/otherwise' );
ok( defined $dollar_at, 'defined( $@ ) after throw/otherwise' );
ok( ref $arg_0 && $arg_0->isa( "Error::Simple" ), '$_[0]->isa( "Error::Simple" ) after throw/otherwise' );
ok( ref $dollar_at && $dollar_at->isa( "Error::Simple" ), '$@->isa( "Error::Simple" ) after throw/otherwise' );

41
t/10throw-in-catch.t Normal file
View File

@ -0,0 +1,41 @@
#!/usr/bin/perl
use strict;
use warnings;
use Error qw(:try);
use Test::More tests => 2;
my ($error);
eval
{
try {
throw Error::Simple( "message" );
}
catch Error::Simple with {
die "A-Lovely-Day";
};
};
$error = $@;
# TEST
ok (scalar($error =~ /^A-Lovely-Day/),
"Error thrown in the catch clause is registered"
);
eval {
try {
throw Error::Simple( "message" );
}
otherwise {
die "Had-the-ancient-greeks";
};
};
$error = $@;
# TEST
ok (scalar($error =~ /^Had-the-ancient/),
"Error thrown in the otherwise clause is registered"
);

61
t/11rethrow.t Normal file
View File

@ -0,0 +1,61 @@
#!/usr/bin/perl
use strict;
use warnings;
use Error qw(:try);
use Test::More tests => 4;
try
{
try { die "inner" }
catch Error::Simple with { die "foobar" };
}
otherwise
{
my $err = shift;
# TEST
ok( scalar( $err =~ /foobar/ ), "Error rethrown" );
};
try
{
try { die "inner" }
catch Error::Simple with { throw Error::Simple "foobar" };
}
otherwise
{
my $err = shift;
# TEST
ok( scalar( "$err" =~ /foobar/ ), "Thrown Error::Simple" );
};
try
{
try { die "inner" }
otherwise { die "foobar" };
}
otherwise
{
my $err = shift;
# TEST
ok( scalar( "$err" =~ /foobar/ ), "die foobar" );
};
try
{
try { die "inner" }
catch Error::Simple with { throw Error::Simple "foobar" };
}
otherwise
{
my $err = shift;
# TEST
ok( scalar( $err =~ /foobar/ ), "throw Error::Simple" );
};
1;

37
t/12wrong-error-var.t Normal file
View File

@ -0,0 +1,37 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 2;
use Error qw(:try);
try {
eval {
throw Error::Simple "This is caught by eval, not by try.";
};
# TEST
ok (($@ && $@ =~ /This is caught by eval, not by try/),
"Checking that eval { ... } is sane"
);
print "# Error::THROWN = $Error::THROWN\n";
die "This is a simple 'die' exception.";
# not reached
}
otherwise {
my $E = shift;
my $t = $Error::THROWN ? "$Error::THROWN" : '';
print "# Error::THROWN = $t\n";
$E ||= '';
print "# E = $E\n";
# TEST
ok ("$E" =~ /This is a simple 'die' exception/,
"Checking that the argument to otherwise is the thrown exception"
);
};

22
t/13except-arg0.t Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/perl
use strict;
use warnings;
use Error qw(:try);
use Test::More tests => 2;
my $arg_0;
try {
throw Error::Simple( "message" );
}
except {
$arg_0 = shift;
return {
'Error::Simple' => sub {},
};
};
ok( defined $arg_0, 'defined( $_[0] ) after throw/except' );
ok( ref $arg_0 && $arg_0->isa( "Error::Simple" ), '$_[0]->isa( "Error::Simple" ) after throw/except' );

View File

@ -0,0 +1,18 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 1;
use vars qw($VERSION);
$VERSION = '0.001';
require Error::Simple;
# TEST
is ($VERSION, '0.001', "Testing that the VERSION was not overrided");
1;

22
t/lib/MyDie.pm Normal file
View File

@ -0,0 +1,22 @@
package MyDie;
use strict;
use warnings;
sub mydie
{
local *I;
open I, "<", "ChangeLog";
my $s = <I>;
die "Hello";
}
1;

1
weaver.ini Normal file
View File

@ -0,0 +1 @@
[@SHLOMIF]

31
xt/author/eol.t Normal file
View File

@ -0,0 +1,31 @@
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19
use Test::More 0.88;
use Test::EOL;
my @files = (
'lib/Error.pm',
'lib/Error/Simple.pm',
't/00-compile.t',
't/01throw.t',
't/02order.t',
't/03throw-non-Error.t',
't/04use-base-Error-Simple.t',
't/05text-errors-with-file-handles.t',
't/06customize-text-throw.t',
't/07try-in-obj-destructor.t',
't/08warndie.t',
't/09dollar-at.t',
't/10throw-in-catch.t',
't/11rethrow.t',
't/12wrong-error-var.t',
't/13except-arg0.t',
't/14Error-Simple-VERSION.t',
't/lib/MyDie.pm'
);
eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files;
done_testing;

31
xt/author/no-tabs.t Normal file
View File

@ -0,0 +1,31 @@
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15
use Test::More 0.88;
use Test::NoTabs;
my @files = (
'lib/Error.pm',
'lib/Error/Simple.pm',
't/00-compile.t',
't/01throw.t',
't/02order.t',
't/03throw-non-Error.t',
't/04use-base-Error-Simple.t',
't/05text-errors-with-file-handles.t',
't/06customize-text-throw.t',
't/07try-in-obj-destructor.t',
't/08warndie.t',
't/09dollar-at.t',
't/10throw-in-catch.t',
't/11rethrow.t',
't/12wrong-error-var.t',
't/13except-arg0.t',
't/14Error-Simple-VERSION.t',
't/lib/MyDie.pm'
);
notabs_ok($_) foreach @files;
done_testing;

7
xt/author/pod-coverage.t Normal file
View File

@ -0,0 +1,7 @@
#!perl
# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
use Test::Pod::Coverage 1.08;
use Pod::Coverage::TrustPod;
all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });

7
xt/author/pod-syntax.t Normal file
View File

@ -0,0 +1,7 @@
#!perl
# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use strict; use warnings;
use Test::More;
use Test::Pod 1.41;
all_pod_files_ok();

10
xt/release/cpan-changes.t Normal file
View File

@ -0,0 +1,10 @@
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.012
use Test::More 0.96 tests => 1;
use Test::CPAN::Changes;
subtest 'changes_ok' => sub {
changes_file_ok('Changes');
};

View File

@ -0,0 +1,30 @@
#!perl
use strict;
use warnings;
use Test::More;
eval "use Test::TrailingSpace";
if ($@)
{
plan skip_all => "Test::TrailingSpace required for trailing space test.";
}
else
{
plan tests => 1;
}
# TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly
# some other stuff.
my $finder = Test::TrailingSpace->new(
{
root => '.',
filename_regex => qr#(?:\.(?:t|pm|pl|xs|c|h|txt|pod|PL)|README|Changes|TODO|LICENSE)\z#,
},
);
# TEST
$finder->no_trailing_space(
"No trailing space was found."
);