Object-Destroyer-2.02/0000775000175000017500000000000014254065717015340 5ustar simbabquesimbabqueObject-Destroyer-2.02/lib/0000775000175000017500000000000014254065717016106 5ustar simbabquesimbabqueObject-Destroyer-2.02/lib/Object/0000775000175000017500000000000014254065717017314 5ustar simbabquesimbabqueObject-Destroyer-2.02/lib/Object/Destroyer.pm0000644000175000017500000003263514254065717021641 0ustar simbabquesimbabquepackage Object::Destroyer; # See POD at end for details use 5.006; use strict; use warnings; use Carp (); ##use Scalar::Util (); our $VERSION = '2.02'; if ( eval { require Scalar::Util } ) { Scalar::Util->import('blessed'); } else { *blessed = sub { my $ref = ref($_[0]); return $ref if $ref && ($ref ne 'SCALAR') && ($ref ne 'ARRAY') && ($ref ne 'HASH') && ($ref ne 'CODE') && ($ref ne 'REF') && ($ref ne 'GLOB') && ($ref ne 'LVALUE'); return; } } sub new { if ( ref $_[0] ) { # This is a method called on an existing # Destroyer, and should actually be passed through # to the encased object via the AUTOLOAD $Object::Destroyer::AUTOLOAD = '::new'; goto &AUTOLOAD; } # *ahem*... where were we... my $destroyer = shift; my $ref = shift || ''; my $self = {}; if ( ref($ref) eq 'CODE' ) { ## ## Object::Destroyer->new( sub {...} ) ## $self->{code} = $ref; } elsif ( my $class = blessed($ref) ) { ## ## Object::Destroyer->new( $object, 'optional_method' ) ## my $method = shift || 'DESTROY'; Carp::croak("Second argument to constructor must be a method name") if ref($method); Carp::croak("Object::Destroyer requires that $class has a $method method") unless $class->can($method); $self->{object} = $ref; $self->{method} = $method; } else { ## ## And what is this? ## Carp::croak("You should pass an object or code reference to constructor"); } Carp::croak("Extra arguments to constructor") if @_; return bless $self, $destroyer; } # Hand off general method calls to the encased object. # Rather than just doing a $self->{object}->$method(@_), which # would leave us in the call stack, find the actual subroutine # that will be executed, and goto that directly. sub AUTOLOAD { my $self = shift; my ($method) = $Object::Destroyer::AUTOLOAD =~ /^.*::(.*)$/; if (my $object = $self->{object}) { if (my $function = $object->can($method)) { ## ## Rearrange stack - instead of ## $object_destroy->method(@params) ## make it look like ## $underlying_object->method(@params) ## unshift @_, $object; goto &$function; } elsif ( $object->can("AUTOLOAD") ) { ## ## We can't just goto to AUTOLOAD method in unknown ## package (it may be in base class of $object). ## We have to preserve the method's name. ## if (wantarray) { ## List context return $object->$method(@_); } elsif ( defined wantarray ) { ## Scalar context return scalar $object->$method(@_); } else { ## Void context $object->$method(@_); return; } } else { ## ## Probably this is a caller's error ## my $package = ref $self->{object}; Carp::croak(qq[Can't locate object method "$method" via package "$package"]); } } ## ## No object at all. Either we have a $coderef instead of object ## or DESTROY has been called already. ## Carp::croak("Can't locate object to call method '$method'"); } sub dismiss{ $_[0]->{dismissed} = 1; } ## ## Use our automatically triggered DESTROY to call the ## non-automatically triggered clean-up method of the encased object ## sub DESTROY { my $self = shift; if ( $self->{dismissed} ) { ## do nothing } elsif ( $self->{code} ) { $self->{code}->(); } elsif ( my $object = $self->{object} ) { my $method = $self->{method}; $object->$method(); } %$self = (); } ## ## Catch a couple of specific cases that would be handled by UNIVERSAL ## before our AUTOLOAD got a chance to dispatch it. ## ## We are both 'Object::Destroyer' (or it's derived class) ## and underlying object's class ## sub isa { my $self = shift; my $class = shift; return $class eq __PACKAGE__ || ($self->{object} && $self->{object}->isa($class)); } sub can { my $self = shift; return $self->{object}->can(@_) if $self->{object}; } 1; __END__ =pod =head1 NAME Object::Destroyer - Make objects with circular references DESTROY normally =head1 SYNOPSIS use Object::Destroyer; ## Use a standalone destroyer to release something ## when it falls out of scope BLOCK: { my $tree = HTML::TreeBuilder->new_from_file('somefile.html'); my $sentry = Object::Destroyer->new( $tree, 'delete' ); ## Here you can safely die, return, call last BLOCK or next BLOCK. ## The tree will be deleted automatically } ## Use it to break circular references { my $var; $var = \$var; my $sentry = Object::Destroyer->new( sub {undef $var} ); ## No more memory leaks! ## $var will be released when $sentry leaves the block } ## Destroyer can be used as a nearly transparent wrapper ## that will pass on method calls normally. { my $Mess = Big::Custy::Mess->new; print $Mess->hello; } package Big::Crusty::Mess; sub new { my $self = bless {}, shift; $self->populate; return Object::Destroyer->new( $self, 'release' ); } sub hello { "Hello World!" } sub release { ...actual code to clean-up the memory... } =head1 DESCRIPTION One of the biggest problem with working with large, nested object trees is implementing a way for a child node to see its parent. The easiest way to do this is to add a reference to the child back to its parent. This results in a "circular" reference, where A refers to B refers to A. Unfortunately, the garbage collector perl uses during runtime is not capable of knowing whether or not something ELSE is referring to these circular references. In practical terms, this means that object trees in lexically scoped variable ( e.g. Cnew> ) will not be cleaned up when they fall out of scope, like normal variables. This results in a memory leak for the life of the process, which is a bad thing when using mod_perl or other processes that live for a long time. Object::Destroyer allows for the creation of "Destroy" handles. The handle is "attached" to the circular relationship, but is not a part of it. When the destroy handle falls out of scope, it will be cleaned up correctly, and while being cleaned up, it will also force the data structure it is attached to to be destroyed as well. Object::Destroyer can call a specified release method on an object (or method C by default). Alternatively, it can execute an arbitrary user code passed to constructor as a code reference. =head2 Use as a Standalone Handle The simplest way to use the class is to create a standalone destroyer, preferably in the same lexical content. ( i.e. immediately after creating the object to be destroyed) sub plagiarise { # Parse in a large nested document my $filename = shift; my $document = My::XML::Tree->open($filename); # Create the Object::Destroyer to clean it up as needed my $sentry = Object::Destroyer->new( $document, 'release' ); # Continue with the Document as normal if ($document->author == $me) { # Normally this would have leaked the document return new Error("You already own the Document"); } $document->change_author($me); $document->save; # We don't have to $Document->DESTROY here return 1; } When the C<$sentry> falls out of scope at the end of the sub, it will force the cirularly linked C<$Document> to be cleaned up at the same time, rather than being forced to manually call C<$Document-release> at each and every location that the sub could possible return. Using the Object::Destroyer object to force garbage collection to work properly allows you to neatly sidestep the inadequecies of the perl garbage collector and work the way you normally would, even with big objects. =head2 Use to clean-up data structures If a data structure with circular refereces has no method to release memory, you can create an C object that will do the job. Pass a code reference (most probably created by an anonymous subrotine block) to the constructor of the sentry object, and this code will be called upon leaving the scope. { $params{other} = \%other_params; $other_params{params} = \%params; my $sentry = Object::Destroyer->new( sub {undef $params{other}} ); ## ## From now on, memory of %params will be ## safely released when block is exited. ## ... code with return, next or last ... } =head2 Use as a Transparent Wrapper For situations where a class is always going to produce circular references, you may wish to build this improved clean up directly into the class itself, and with a few exceptions everything will just work the same. Take the following example class package My::Tree; use strict; use Object::Destroyer; sub new { my $self = bless {}, shift; $self->init; ## assume that circular references are made ## Return the Object::Destroyer, with ourself inside it my $wrapper = Object::Destroyer->new( $self, 'release' ); return $wrapper; } sub release { my $self = shift; foreach (values %$self) { $_->DESTROY if ref $_ eq 'My::Tree::Node'; } %$self = (); } We might use the class in something like this sub process_file { # Create a new tree my $tree = My::Tree->new( source => shift ); # Process the Tree if ($tree->comments) { $tree->remove_comments or return; } else { return 1; # Nothing to do } my $filename = $tree->param('target') or return; $tree->write($filename) or return; return 1; } We were able to work with the data, and at no point did we know that we were working with a Object::Destroyer object, rather than the My::Tree object itself. =head2 Resource Usage To implement the transparency, there is a slight CPU penalty when a method is called on the wrapper to allow it to pass the method through to the encased object correctly, and without appearing in the C information. Once the method is called on the underlying object, you can make further method calls with no penalty and access the internals of the object normally. =head2 Problems with Wrappers and ref or UNIVERSAL::isa Although it may ACT exactly like what's inside it, is isn't really it. Calling C or C will return C<'Object::Destroyer'>, and not the class of the object inside it. Likewise, calling C or C directly as functions will also not work. The two alternatives to this are to either use C<$Wrapper-Eisa> or C<$wrapper-Ecan>, which will be caught and treated normally, or simple don't use a wrapper and just use the standalone cleaners. =head1 METHODS =over =item new my $sentry = Object::Destroyer->new( $object ); my $sentry = Object::Destroyer->new( $object, 'method_name' ); my $sentry = Object::Destroyer->new( $code_reference ); The C constructor takes as arguments either a single blessed object with an optional name of the method to be called, or a refernce to code to be executed. If the method name is not specified, the C method is assumed. The constructor will die if the object passed to it does not have the specified method. =item DESTROY $sentry->DESTROY; undef $sentry; You may explicitly C the Destroyer at any time you wish. This will also C the encased object at the same. This can allow for legacy cases relating to Wrappers, where a user expects to have to manually C an object even though it is not needed. The C call will be accepted and dealt with as it is called on the encased object. =item dismiss $sentry->dismiss; If you have changed your mind and you don't want Destroyer object to do its job, dismiss it. You may continue to use it as a wrapper, though. =back =head1 SEE ALSO Another option for dealing with circular references are I (stable since Perl 5.8.0, see L). See also L and L for monitoring memory leaks. The latter module contains a discussion on object desing with weak references. For lexically scoped resource management, see also L, L and L. =head1 KNOWN ISSUES There is a compatibility issue with L. You cannot extend an object wrapped by Object::Destroyer because our custom C method needs to be called on an instance, but Test::MockObject::Extends calls it on the class, and will error. =head1 SUPPORT Bugs and other issues should be reported via GitHub at L. =head1 AUTHORS =over 4 =item * Adam Kennedy Eadamk@cpan.orgE =item * Igor Gariev Egariev@hotmail.comE =item * Julien Fiegehenn Esimbabque@cpan.orgE =back =head1 COPYRIGHT Copyright 2004 - 2022 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =cut Object-Destroyer-2.02/dist.ini0000644000175000017500000000267714254065717017016 0ustar simbabquesimbabquename = Object-Destroyer author = Adam Kennedy license = Perl_5 copyright_holder = Adam Kennedy copyright_year = 2004 [Git::GatherDir] exclude_filename = LICENSE exclude_filename = META.json exclude_filename = README.md [MetaConfig] [MetaNoIndex] directory = t directory = xt [MetaYAML] [MetaJSON] [MakeMaker] [Git::Contributors] [GithubMeta] issues = 1 user = simbabque [Manifest] [PruneCruft] [License] [MojibakeTests] [Test::Version] [Test::ReportPrereqs] [Test::EOL] [Test::ChangesHasContent] [Test::MinimumVersion] [PodSyntaxTests] [RunExtraTests] [Prereqs::FromCPANfile] [Git::Check] allow_dirty= [CheckStrictVersion] decimal_only = 1 [CheckChangeLog] [CheckChangesHasContent] [TestRelease] [ReadmeAnyFromPod / Markdown_Readme] source_filename = lib/Object/Destroyer.pm type = markdown filename = README.md location = root phase = build [CopyFilesFromRelease] filename = META.json filename = LICENSE ; The distribution version is read from lib/Object/Destroyer.pm's $VERSION. ; At release, all versions are bumped. ; To change the version at release time, you can either edit Destroyer.pm's ; $VERSION, or set the V environment variable, e.g. V=1.23 dzil release [@Git::VersionManager] commit_files_after_release = META.json commit_files_after_release = LICENSE commit_files_after_release = README.md [Git::Push] ; listed late, to allow all other plugins which do BeforeRelease checks to run first. [ConfirmRelease] [UploadToCPAN]Object-Destroyer-2.02/LICENSE0000644000175000017500000004365014254065717016353 0ustar simbabquesimbabqueThis software is copyright (c) 2004 by Adam Kennedy. 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) 2004 by Adam Kennedy. 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) 2004 by Adam Kennedy. 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Object-Destroyer-2.02/META.yml0000644000175000017500000002457314254065717016622 0ustar simbabquesimbabque--- abstract: 'Make objects with circular references DESTROY normally' author: - 'Adam Kennedy ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' Test::More: '0.88' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.025, 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: Object-Destroyer no_index: directory: - t - xt requires: Carp: '0' perl: '5.006' strict: '0' warnings: '0' resources: bugtracker: https://github.com/simbabque/Object-Destroyer/issues homepage: https://github.com/simbabque/Object-Destroyer repository: https://github.com/simbabque/Object-Destroyer.git version: '2.02' x_Dist_Zilla: perl: version: '5.028000' plugins: - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - LICENSE - META.json - README.md exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: Git::GatherDir version: '2.048' - class: Dist::Zilla::Plugin::MetaConfig name: MetaConfig version: '6.025' - class: Dist::Zilla::Plugin::MetaNoIndex name: MetaNoIndex version: '6.025' - class: Dist::Zilla::Plugin::MetaYAML name: MetaYAML version: '6.025' - class: Dist::Zilla::Plugin::MetaJSON name: MetaJSON version: '6.025' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: MakeMaker version: '6.025' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.34.1 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: Git::Contributors version: '0.036' - class: Dist::Zilla::Plugin::GithubMeta name: GithubMeta version: '0.58' - class: Dist::Zilla::Plugin::Manifest name: Manifest version: '6.025' - class: Dist::Zilla::Plugin::PruneCruft name: PruneCruft version: '6.025' - class: Dist::Zilla::Plugin::License name: License version: '6.025' - class: Dist::Zilla::Plugin::MojibakeTests name: MojibakeTests version: '0.8' - class: Dist::Zilla::Plugin::Test::Version name: Test::Version version: '1.09' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: Test::ReportPrereqs version: '0.028' - 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: Test::EOL version: '0.19' - class: Dist::Zilla::Plugin::Test::ChangesHasContent name: Test::ChangesHasContent version: '0.011' - class: Dist::Zilla::Plugin::Test::MinimumVersion config: Dist::Zilla::Plugin::Test::MinimumVersion: max_target_perl: ~ name: Test::MinimumVersion version: '2.000010' - class: Dist::Zilla::Plugin::PodSyntaxTests name: PodSyntaxTests version: '6.025' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: RunExtraTests version: '0.029' - class: Dist::Zilla::Plugin::Prereqs::FromCPANfile name: Prereqs::FromCPANfile version: '0.08' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: [] allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.34.1 repo_root: . name: Git::Check version: '2.048' - class: Dist::Zilla::Plugin::CheckStrictVersion name: CheckStrictVersion version: '0.001' - class: Dist::Zilla::Plugin::CheckChangeLog name: CheckChangeLog version: '0.05' - class: Dist::Zilla::Plugin::CheckChangesHasContent name: CheckChangesHasContent version: '0.011' - class: Dist::Zilla::Plugin::TestRelease name: TestRelease version: '6.025' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: Markdown_Readme version: '0.163250' - class: Dist::Zilla::Plugin::CopyFilesFromRelease config: Dist::Zilla::Plugin::CopyFilesFromRelease: filename: - LICENSE - META.json match: [] name: CopyFilesFromRelease version: '0.007' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: recommends name: '@Git::VersionManager/pluginbundle version' version: '6.025' - class: Dist::Zilla::Plugin::RewriteVersion::Transitional config: Dist::Zilla::Plugin::RewriteVersion: add_tarball_name: 0 finders: - ':ExecFiles' - ':InstallModules' global: 0 skip_version_provider: 0 Dist::Zilla::Plugin::RewriteVersion::Transitional: {} name: '@Git::VersionManager/RewriteVersion::Transitional' version: '0.009' - class: Dist::Zilla::Plugin::MetaProvides::Update name: '@Git::VersionManager/MetaProvides::Update' version: '0.007' - class: Dist::Zilla::Plugin::CopyFilesFromRelease config: Dist::Zilla::Plugin::CopyFilesFromRelease: filename: - Changes match: [] name: '@Git::VersionManager/CopyFilesFromRelease' version: '0.007' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%V%n%n%c signoff: '0' Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - LICENSE - META.json - README.md allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.34.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Git::VersionManager/release snapshot' version: '2.048' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: v2.02 tag_format: v%V tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: 2.34.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Git::VersionManager/Git::Tag' version: '2.048' - class: Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional config: Dist::Zilla::Plugin::BumpVersionAfterRelease: finders: - ':ExecFiles' - ':InstallModules' global: 0 munge_makefile_pl: 1 Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional: {} name: '@Git::VersionManager/BumpVersionAfterRelease::Transitional' version: '0.009' - class: Dist::Zilla::Plugin::NextRelease name: '@Git::VersionManager/NextRelease' version: '6.025' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: 'increment $VERSION after %v release' signoff: '0' Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Build.PL - Changes - Makefile.PL allow_dirty_match: - (?^:^lib/.*\.pm$) changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.34.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Git::VersionManager/post-release commit' version: '2.048' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.34.1 repo_root: . name: Git::Push version: '2.048' - class: Dist::Zilla::Plugin::ConfirmRelease name: ConfirmRelease version: '6.025' - class: Dist::Zilla::Plugin::UploadToCPAN name: UploadToCPAN version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.025' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.025' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.025' x_contributors: - 'Adam Kennedy ' - 'Igor Gariev ' - 'Julien Fiegehenn ' x_generated_by_perl: v5.28.0 x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' Object-Destroyer-2.02/META.json0000644000175000017500000004111314254065717016757 0ustar simbabquesimbabque{ "abstract" : "Make objects with circular references DESTROY normally", "author" : [ "Adam Kennedy " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.025, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Object-Destroyer", "no_index" : { "directory" : [ "t", "xt" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "recommends" : { "Dist::Zilla::PluginBundle::Git::VersionManager" : "0.007" }, "requires" : { "Test::EOL" : "0", "Test::MinimumVersion" : "0", "Test::Mojibake" : "0", "Test::More" : "0.88", "Test::Pod" : "1.41", "Test::Version" : "1" } }, "runtime" : { "requires" : { "Carp" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" }, "suggests" : { "Scalar::Util" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "Test::More" : "0.88" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/simbabque/Object-Destroyer/issues" }, "homepage" : "https://github.com/simbabque/Object-Destroyer", "repository" : { "type" : "git", "url" : "https://github.com/simbabque/Object-Destroyer.git", "web" : "https://github.com/simbabque/Object-Destroyer" } }, "version" : "2.02", "x_Dist_Zilla" : { "perl" : { "version" : "5.028000" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [ "LICENSE", "META.json", "README.md" ], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "Git::GatherDir", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "MetaConfig", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::MetaNoIndex", "name" : "MetaNoIndex", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "MetaYAML", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "MetaJSON", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "MakeMaker", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.34.1", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "Git::Contributors", "version" : "0.036" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "GithubMeta", "version" : "0.58" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "Manifest", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "PruneCruft", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "License", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::MojibakeTests", "name" : "MojibakeTests", "version" : "0.8" }, { "class" : "Dist::Zilla::Plugin::Test::Version", "name" : "Test::Version", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "Test::ReportPrereqs", "version" : "0.028" }, { "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" : "Test::EOL", "version" : "0.19" }, { "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", "name" : "Test::ChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::Test::MinimumVersion", "config" : { "Dist::Zilla::Plugin::Test::MinimumVersion" : { "max_target_perl" : null } }, "name" : "Test::MinimumVersion", "version" : "2.000010" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "PodSyntaxTests", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "RunExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::Prereqs::FromCPANfile", "name" : "Prereqs::FromCPANfile", "version" : "0.08" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.34.1", "repo_root" : "." } }, "name" : "Git::Check", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::CheckStrictVersion", "name" : "CheckStrictVersion", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::CheckChangeLog", "name" : "CheckChangeLog", "version" : "0.05" }, { "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", "name" : "CheckChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "TestRelease", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "config" : { "Dist::Zilla::Role::FileWatcher" : { "version" : "0.006" } }, "name" : "Markdown_Readme", "version" : "0.163250" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromRelease", "config" : { "Dist::Zilla::Plugin::CopyFilesFromRelease" : { "filename" : [ "LICENSE", "META.json" ], "match" : [] } }, "name" : "CopyFilesFromRelease", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "recommends" } }, "name" : "@Git::VersionManager/pluginbundle version", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::RewriteVersion::Transitional", "config" : { "Dist::Zilla::Plugin::RewriteVersion" : { "add_tarball_name" : 0, "finders" : [ ":ExecFiles", ":InstallModules" ], "global" : 0, "skip_version_provider" : 0 }, "Dist::Zilla::Plugin::RewriteVersion::Transitional" : {} }, "name" : "@Git::VersionManager/RewriteVersion::Transitional", "version" : "0.009" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Update", "name" : "@Git::VersionManager/MetaProvides::Update", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromRelease", "config" : { "Dist::Zilla::Plugin::CopyFilesFromRelease" : { "filename" : [ "Changes" ], "match" : [] } }, "name" : "@Git::VersionManager/CopyFilesFromRelease", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%V%n%n%c", "signoff" : 0 }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "LICENSE", "META.json", "README.md" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.34.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Git::VersionManager/release snapshot", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "v2.02", "tag_format" : "v%V", "tag_message" : "v%V" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.34.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Git::VersionManager/Git::Tag", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional", "config" : { "Dist::Zilla::Plugin::BumpVersionAfterRelease" : { "finders" : [ ":ExecFiles", ":InstallModules" ], "global" : 0, "munge_makefile_pl" : 1 }, "Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional" : {} }, "name" : "@Git::VersionManager/BumpVersionAfterRelease::Transitional", "version" : "0.009" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@Git::VersionManager/NextRelease", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "increment $VERSION after %v release", "signoff" : 0 }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Build.PL", "Changes", "Makefile.PL" ], "allow_dirty_match" : [ "(?^:^lib/.*\\.pm$)" ], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.34.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Git::VersionManager/post-release commit", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.34.1", "repo_root" : "." } }, "name" : "Git::Push", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "ConfirmRelease", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "UploadToCPAN", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.025" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.025" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.025" } }, "x_contributors" : [ "Adam Kennedy ", "Igor Gariev ", "Julien Fiegehenn " ], "x_generated_by_perl" : "v5.28.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.04", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } Object-Destroyer-2.02/Changes0000644000175000017500000000177014254065717016636 0ustar simbabquesimbabqueRevision history for Perl extension Object::Destroyer 2.02 2022-06-20 12:45:01Z - Turn on warnings - Modernise test suite code - Bump Test::More dependency to 0.88 - Fix croaking AUTOLOAD in void context (RT 30835) - Move to github - Move to Dist::Zilla 2.01 Thu 24 Mar 2011 - Updating to Module::Install::DSL 1.00 - Bump perl version to 5.006 to keep the minimum version test happy 2.00 Wed Dec 6 2006 - Added support for missing void context for wrapper - Removed obligatory requirement for Scalar::Util - Added new method - dismiss - to cancel the Destroyer 1.99 Tue Oct 17 2006 - Complete overhaul by Igor Gariev to expand its functionality - Added support for explicit clean-up method name - Added support for clean-up code by code reference - Added support for AUTOLOAD'ed methods of wrapped objects 1.02 Fri 6 Oct 2006 - Moving to new SVN repository - Cleaning up tests - Updating to Module::Install 0.64 - Moving to production version 0.1 Sun Jan 11 2004 - original version Object-Destroyer-2.02/xt/0000775000175000017500000000000014254065717015773 5ustar simbabquesimbabqueObject-Destroyer-2.02/xt/release/0000775000175000017500000000000014254065717017413 5ustar simbabquesimbabqueObject-Destroyer-2.02/xt/release/changes_has_content.t0000644000175000017500000000210014254065717023564 0ustar simbabquesimbabqueuse Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; my $newver = '2.02'; my $trial_token = '-TRIAL'; my $encoding = 'UTF-8'; SKIP: { ok(-e $changes_file, "$changes_file file exists") or skip 'Changes is missing', 1; ok(_get_changes($newver), "$changes_file has content for $newver"); } done_testing; sub _get_changes { my $newver = shift; # parse changelog to find commit message open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; my $changelog = join('', <$fh>); if ($encoding) { require Encode; $changelog = Encode::decode($encoding, $changelog, Encode::FB_CROAK()); } close $fh; my @content = grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented split /\n/, $changelog; shift @content; # drop the version line # drop unindented last line and trailing blank lines pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); # return number of non-blank lines return scalar @content; } Object-Destroyer-2.02/xt/author/0000775000175000017500000000000014254065717017275 5ustar simbabquesimbabqueObject-Destroyer-2.02/xt/author/eol.t0000644000175000017500000000064514254065717020244 0ustar simbabquesimbabqueuse 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/Object/Destroyer.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/01_compile.t', 't/02_new.t', 't/03_destroy.t', 't/04_wrapper.t', 't/05_dismiss.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; Object-Destroyer-2.02/xt/author/pod-syntax.t0000644000175000017500000000025214254065717021565 0ustar simbabquesimbabque#!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(); Object-Destroyer-2.02/xt/author/mojibake.t0000644000175000017500000000015114254065717021236 0ustar simbabquesimbabque#!perl use strict; use warnings qw(all); use Test::More; use Test::Mojibake; all_files_encoding_ok(); Object-Destroyer-2.02/xt/author/minimum-version.t0000644000175000017500000000015414254065717022616 0ustar simbabquesimbabqueuse strict; use warnings; use Test::More; use Test::MinimumVersion; all_minimum_version_from_metayml_ok(); Object-Destroyer-2.02/xt/author/test-version.t0000644000175000017500000000063714254065717022130 0ustar simbabquesimbabqueuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 0, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Object-Destroyer-2.02/t/0000775000175000017500000000000014254065717015603 5ustar simbabquesimbabqueObject-Destroyer-2.02/t/00-report-prereqs.t0000644000175000017500000001345214254065717021202 0ustar simbabquesimbabque#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.028 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass('Reported prereqs'); # vim: ts=4 sts=4 sw=4 et: Object-Destroyer-2.02/t/03_destroy.t0000644000175000017500000001134414254065717017764 0ustar simbabquesimbabque#!/usr/bin/perl ## ## Tests of main functionality of Object::Destroyer - ## i.e. destruction of objects - are here. ## use strict; use warnings; use Test::More; use Object::Destroyer; ## ## Make sure a Foo object behaves as expected ## is( $Foo::destroy_counter, 0, 'Start value' ); SCOPE: { ## ## This object will not be destroyed automatically ## my $foo = Foo->new; is( $Foo::destroy_counter, 0, 'No auto destroy of Foo objects' ); } SCOPE: { ## ## This $foo is destroyed manually ## my $foo = Foo->new; $foo->DESTROY; is( $Foo::destroy_counter, 1, 'Manually called DESTROY' ); } is( $Foo::destroy_counter, 2, 'Auto called DESTROY after leaving the scope' ); ## ## Foo objects are OK, let's start testing our Object::Destroyer ## ## ## Test of default 'DESTROY' method ## It's called twice - 1st by Object::Destroyer, 2nd by Perl gc! ## SCOPE: { my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo); @Foo::called_method = (); } is( $Foo::destroy_counter, 4, 'DESTROY called by Object::Destroyer' ); is_deeply( \@Foo::called_method, ['DESTROY', 'DESTROY'] ); ## ## Test that the specified method is called indeed ## SCOPE: { my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo, 'release'); @Foo::called_method = (); } is( $Foo::destroy_counter, 5, 'release called by Object::Destroyer' ); is_deeply( \@Foo::called_method, ['release', 'DESTROY'] ); SCOPE: { my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo, 'delete'); @Foo::called_method = (); } is( $Foo::destroy_counter, 6, 'delete called by Object::Destroyer' ); is_deeply( \@Foo::called_method, ['delete', 'DESTROY'] ); ## ## Test manual clean-up of the enclosed object ## by $sentry->DESTROY or undef($sentry) ## SCOPE: { my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo); is( $Foo::destroy_counter, 6, 'nothing changed' ); $sentry->DESTROY; is( $Foo::destroy_counter, 7, 'Foo->DESTROY by Object::Destroyer' ); } is( $Foo::destroy_counter, 8, 'Foo->DESTROY by Perl gc' ); SCOPE: { my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo, 'release'); is( $Foo::destroy_counter, 8, 'nothing changed' ); $sentry->DESTROY; is( $Foo::destroy_counter, 8, 'Foo->release (not DESTROY) has not been called' ); } is( $Foo::destroy_counter, 9, 'Foo->DESTROY by Perl gc' ); SCOPE: { my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo); is( $Foo::destroy_counter, 9, 'nothing changed' ); undef $sentry; is( $Foo::destroy_counter, 10, 'Foo->DESTROY by Object::Destroyer' ); } is( $Foo::destroy_counter, 11, 'Foo->DESTROY by Perl gc' ); SCOPE: { my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo, 'release'); is( $Foo::destroy_counter, 11, 'nothing changed' ); undef $sentry; is( $Foo::destroy_counter, 11, 'Foo->release' ); } is( $Foo::destroy_counter, 12, 'Foo->DESTROY by Perl gc' ); ## ## Test anonymous subrotine calls ## SCOPE: { my $test = 0; SCOPE: { my $sentry = Object::Destroyer->new( sub{$test=1} ); is($test, 0); } is($test, 1); for ( 1 .. 10 ) { my $sentry = Object::Destroyer->new( sub{$test++} ); } is($test, 11); } ## ## Anonymous subrotine destroys an object not capable of auto-destroy ## is( $Bar::count, 0 ); for (0..9) { my $bar = Bar->new; } is( $Bar::count, 10 ); for (0..9) { my $bar = Bar->new; my $sentry = Object::Destroyer->new( sub{undef $bar->{self}} ); } is( $Bar::count, 10 ); ## ## Test objects that use Object::Destroy in their constructors ## is( $Buzz::count, 0 ); { my $bar = Buzz->new; is( $Buzz::count, 1 ); } is( $Buzz::count, 0 ); done_testing; ##################################################################### # Test Classes package Foo; use vars qw{$destroy_counter @called_method}; BEGIN { $destroy_counter = 0 } sub new { my $class = shift; my $self = {}; $self->{self} = $self; ## circular reference return bless $self, ref $class || $class; } sub delete{ my $self = shift; undef $self->{self}; push @called_method, 'delete'; } sub release { my $self = shift; undef $self->{self}; push @called_method, 'release'; } sub DESTROY { my $self = shift; $destroy_counter++; undef $self->{self}; push @called_method, 'DESTROY'; } ## ## Object of class Bar has no clean-up method at all ## package Bar; use vars '$count'; BEGIN { $count = 0; } sub new{ my $class = shift; $count++; my $self = {}; $self->{self} = $self; return bless $self, ref $class || $class; } sub DESTROY{ $count--; } ## ## Constructor of Buzz returns itself in a wrapper ## package Buzz; use vars '$count'; BEGIN { $count = 0 }; sub new{ my $class = shift; $count++; my $self = bless {}, ref $class || $class; $self->{self} = $self; return Object::Destroyer->new($self, 'release'); } sub release{ my $self = shift; undef $self->{self}; } sub DESTROY{ my $self = shift; $count--; } 1; Object-Destroyer-2.02/t/05_dismiss.t0000644000175000017500000000252214254065717017746 0ustar simbabquesimbabque#!/usr/bin/perl ## ## Test for wrapping abilities of Object::Destroyer ## use strict; use warnings; use Test::More; use Object::Destroyer; SCOPE: { my $foo = Foo->new; } is($Foo::destroy_counter, 0, 'Foo must not be destroyed'); SCOPE: { my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo, 'release'); is($Foo::destroy_counter, 0, 'Pre-check'); ok( $sentry->self_test, 'Wrapper is ok'); } is($Foo::destroy_counter, 1, 'Foo must be destroyed'); $Foo::destroy_counter = 0; SCOPE: { my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo, 'release'); is($Foo::destroy_counter, 0, 'Pre-check'); ok( $sentry->self_test, 'Wrapper is ok' ); $sentry->dismiss; ok( $sentry->self_test, 'Wrapper is still ok'); } is($Foo::destroy_counter, 0, 'Foo must not ve destroyed'); done_testing; ##################################################################### # Test Classes package Foo; use vars qw{$destroy_counter @ISA}; BEGIN { $destroy_counter = 0; }; sub new { my $class = ref $_[0] ? ref shift : shift; my $self = bless {}, $class; $self->{self} = $self; ## This is a circular reference return $self; } sub self_test{ my $self = shift; return $self==$self->{self}; } sub DESTROY { $destroy_counter++; } sub release{ my $self = shift; undef $self->{self}; } Object-Destroyer-2.02/t/01_compile.t0000644000175000017500000000022014254065717017710 0ustar simbabquesimbabque#!/usr/bin/perl # Load testing for Object::Destroyer use strict; use warnings; use Test::More; use_ok( 'Object::Destroyer' ); done_testing;Object-Destroyer-2.02/t/04_wrapper.t0000644000175000017500000000715114254065717017755 0ustar simbabquesimbabque#!/usr/bin/perl ## ## Test for wrapping abilities of Object::Destroyer ## use strict; use warnings; use Test::More; use Object::Destroyer; my $foo = Foo->new; my $sentry = Object::Destroyer->new($foo, 'release'); ## ## isa tests ## isa_ok( $foo, 'Foo' ); isa_ok( $foo, 'Bar' ); isa_ok( $sentry, 'Foo' ); isa_ok( $sentry, 'Bar' ); isa_ok( $sentry, 'Object::Destroyer' ); ok(!$sentry->isa('BAZ')); ## ## can tests ## can_ok($foo, 'hello'); can_ok($foo, 'bar'); can_ok($sentry, 'hello'); can_ok($sentry, 'release'); can_ok($sentry, 'self_test'); can_ok($sentry, 'params_count'); can_ok($sentry, 'bar'); ok(!$sentry->can('impossible')); ## ## Check that arguments are passed normally ## ok( $foo->self_test ); ok( $sentry->self_test ); is( $foo->params_count(1,1,1), 3); is( $sentry->params_count(1,1,1), 3); ## ## Check that results are returned correctly ## is( $foo->hello, 'Hello World!', 'Foo->hello returns as expected' ); is( $sentry->hello, 'Hello World!' ); is( $foo->hello('Bob'), 'Hello Bob!', 'Foo->hello(args) returns as expected' ); is( $sentry->hello('Bob'), 'Hello Bob!'); is(scalar($foo->test_context), -1); is(scalar($sentry->test_context), -1); is_deeply([$foo->test_context], [1, 2]); is_deeply([$sentry->test_context], [1, 2]); $_ = 0; $foo->test_context; ## void context is($_, 1); ## ## Test that $sentry->new will pass to Foo->new ## my $new = $sentry->new; is(ref $new, 'Foo'); ## ## Test that AUTOLOAD handles errors correctly ## eval { $sentry->impossible }; like( $@, qr/Can't locate object method "impossible"/, 'AUTOLOAD handles errors correctly' ); eval { $sentry->DESTROY; $sentry->impossible; }; like( $@, qr/Can't locate object to call method 'impossible'/, 'AUTOLOAD cannot find method after DESTROY' ); $sentry = Object::Destroyer->new(sub { 123; }); eval { $sentry->impossible }; like( $@, qr/Can't locate object to call method 'impossible'/, 'AUTOLOAD cannot find method when there is no object' ); isnt( ref($sentry->can('foo')), 'CODE', 'can does not pass through without object' ); ## ## Test for AUTOLOAD'ed methods ## my $buzz = Buzz->new(); $sentry = Object::Destroyer->new($buzz); is( scalar($sentry->test(1)), "test"); is( scalar($sentry->foo), "foofoo"); is( scalar($sentry->bar(3)), "barbarbar"); is_deeply( [$sentry->bar], ["bar", "bar"]); is_deeply( [$sentry->foo(1)], ["foo"]); is_deeply( [$sentry->t(3)], [qw/t t t/]); eval { $sentry->void; return; }; ok !$@, 'AUTOLOAD in void context works'; done_testing; ##################################################################### # Test Classes package Foo; use vars qw{$destroy_counter @ISA}; BEGIN { $destroy_counter = 0; @ISA = 'Bar' }; sub new { my $class = ref $_[0] ? ref shift : shift; my $self = bless {}, $class; $self->{self} = $self; ## This is a circular reference return $self; } sub self_test{ my $self = shift; return $self==$self->{self}; } sub params_count{ my $self = shift; return scalar(@_); } sub hello { shift; return (@_) ? "Hello $_[0]!" : "Hello World!" } sub test_context{ return (wantarray) ? (1, 2) : (defined wantarray) ? -1 : ++$_; } sub DESTROY { $destroy_counter++; } sub release{ my $self = shift; undef $self->{self}; } package Bar; sub bar {} package Buzz; sub new{ my $class = shift; return bless {}, ref $class || $class; } use vars '$AUTOLOAD'; sub AUTOLOAD{ my $self = shift; my $repeat_number = shift || 2; my ($method) = $AUTOLOAD =~ /.*::(.*)$/; return (wantarray) ? ($method) x $repeat_number : $method x $repeat_number; } sub DESTROY{ } 1;Object-Destroyer-2.02/t/00-report-prereqs.dd0000644000175000017500000000342214254065717021322 0ustar simbabquesimbabquedo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0' } }, 'develop' => { 'recommends' => { 'Dist::Zilla::PluginBundle::Git::VersionManager' => '0.007' }, 'requires' => { 'Test::EOL' => '0', 'Test::MinimumVersion' => '0', 'Test::Mojibake' => '0', 'Test::More' => '0.88', 'Test::Pod' => '1.41', 'Test::Version' => '1' } }, 'runtime' => { 'requires' => { 'Carp' => '0', 'perl' => '5.006', 'strict' => '0', 'warnings' => '0' }, 'suggests' => { 'Scalar::Util' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'Test::More' => '0.88' } } }; $x; }Object-Destroyer-2.02/t/02_new.t0000644000175000017500000000373614254065717017071 0ustar simbabquesimbabque#!/usr/bin/perl ## ## Test for constructor of Object::Destroyer ## use strict; use warnings; use Test::More; use Object::Destroyer; my $foo = Foo->new; my $bar = Bar->new; ## ## Object::destroyer->new($object) ## $object must have 'DESTROY' method ## ok( Object::Destroyer->new($foo) ); ok( !eval{ Object::Destroyer->new($bar); 1; } ); like( $@, qr/Object::Destroyer requires that Bar has a DESTROY method at.*/ ); ## ## Object::Destroyer->new($object, $method) ## $object must have method $method ## ok( Object::Destroyer->new($foo, 'hello') ); ok( Object::Destroyer->new($foo, 'DESTROY') ); ok( Object::Destroyer->new($foo, 'release') ); ok( Object::Destroyer->new($bar, 'delete') ); ## ## Negative tests: non-existent methods, extra params to constructor ## and no method names ## ok( !eval{ Object::Destroyer->new($foo, 'BAZ'); 1; } ); like( $@, qr/^Object::Destroyer requires that Foo has a BAZ method at.*/ ); ok( !eval{ Object::Destroyer->new($foo, 'hello', 'hello'); 1; } ); like( $@, qr/^Extra arguments to constructor at.*/ ); ok( !eval{ Object::Destroyer->new($foo, $foo); 1; } ); like( $@, qr/^Second argument to constructor must be a method name*/ ); ## ## Object::Destroyer->new($codereference); ## ok( Object::Destroyer->new(sub {}) ); ok( Object::Destroyer->new(\&Foo::hello) ); ## ## Negative tests - extra params lead to die() ## ok( !eval{ Object::Destroyer->new(sub {}, 'extra'); 1;} ); like( $@, qr/^Extra arguments to constructor at.*/ ); ## ## Unknown arguments to constructor leads to die ## ok( !eval{ Object::Destroyer->new('extra'); 1;} ); like( $@, qr/^You should pass an object or code reference to constructor at .*/ ); done_testing; ##################################################################### # Test Classes package Foo; sub new { my $self = shift; return bless {}, ref $self || $self; } sub hello { } sub release { } sub DESTROY { } package Bar; sub new { my $self = shift; return bless {}, ref $self || $self; } sub delete { } 1; Object-Destroyer-2.02/Makefile.PL0000644000175000017500000000233014254065717017306 0ustar simbabquesimbabque# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.025. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Make objects with circular references DESTROY normally", "AUTHOR" => "Adam Kennedy ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Object-Destroyer", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "Object::Destroyer", "PREREQ_PM" => { "Carp" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::More" => "0.88" }, "VERSION" => "2.02", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::More" => "0.88", "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Object-Destroyer-2.02/MANIFEST0000644000175000017500000000067114254065717016473 0ustar simbabquesimbabque# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.025. Changes LICENSE MANIFEST META.json META.yml Makefile.PL cpanfile dist.ini lib/Object/Destroyer.pm t/00-report-prereqs.dd t/00-report-prereqs.t t/01_compile.t t/02_new.t t/03_destroy.t t/04_wrapper.t t/05_dismiss.t xt/author/eol.t xt/author/minimum-version.t xt/author/mojibake.t xt/author/pod-syntax.t xt/author/test-version.t xt/release/changes_has_content.t Object-Destroyer-2.02/cpanfile0000644000175000017500000000046114254065717017043 0ustar simbabquesimbabqueuse strict; use warnings; on 'configure' => sub { requires 'ExtUtils::MakeMaker'; }; on 'runtime' => sub { requires 'perl' => '5.006'; requires 'strict'; requires 'warnings'; requires 'Carp'; suggests 'Scalar::Util'; }; on 'test' => sub { requires 'Test::More' => '0.88'; };