| CPANPLUS-Dist-Gentoo documentation | Contained in the CPANPLUS-Dist-Gentoo distribution. |
CPANPLUS::Dist::Gentoo::Guard - Scope guard object.
Version 0.11
This is a scope guard object helper for CPANPLUS::Dist::Gentoo.
new $coderefCreates a new CPANPLUS::Dist::Gentoo::Guard object that will call $coderef when destroyed.
unarmTells the object not to call the stored callback on destruction.
DESTROYCalls the stored callback if the guard object is still armed.
Vincent Pit, <perl at profvince.com>, http://www.profvince.com.
You can contact me by mail or on irc.perl.org (vincent).
Please report any bugs or feature requests to bug-cpanplus-dist-gentoo at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPANPLUS-Dist-Gentoo.
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc CPANPLUS::Dist::Gentoo
Copyright 2009,2010 Vincent Pit, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| CPANPLUS-Dist-Gentoo documentation | Contained in the CPANPLUS-Dist-Gentoo distribution. |
package CPANPLUS::Dist::Gentoo::Guard; use strict; use warnings;
our $VERSION = '0.11';
sub new { my ($class, $code) = @_; $class = ref($class) || $class; bless { code => $code, armed => 1, }, $class; }
sub unarm { $_[0]->{armed} = 0 }
sub DESTROY { my ($self) = @_; $self->{code}->() if $self->{armed}; $self->unarm; return; }
1; # End of CPANPLUS::Dist::Gentoo::Guard