Acme-PETEK-Testkit
view release on metacpan or search on metacpan
lib/Acme/PETEK/Testkit.pm view on Meta::CPAN
sub incr {
my ($self, $int) = @_;
$int = 1 unless defined($int);
$self->{'_counter'} += $int;
return $self->value;
}
=head2 $kit->decr( $int );
Decrement the counter by 1. If C<$int> is provided, decrement by that.
Returns the current value of the counter.
=cut
sub decr {
my ($self, $int) = @_;
$int = 1 unless defined($int);
$self->{'_counter'} -= $int;
return $self->value;
}
=head2 $kit->value;
Returns the current value of the counter.
=cut
sub value {
my $self = shift;
return $self->{'_counter'};
}
=head2 $kit->sign
Returns "positive" or "negative" based on the value of the counter.
=cut
sub sign {
my $self = shift;
return 'negative' if $self->{'_counter'} < 0;
return 'positive';
}
=head1 CLASS METHODS
=head2 add($int, $int)
Adds the two integers together and returns the result.
=cut
sub add {
my ($int1, $int2) = @_;
return $int1 + $int2;
}
=head2 subtract($int, $int)
Subtracts the second integer from the first and returns the result.
=cut
sub subtract {
my ($int1, $int2) = @_;
return $int1 - $int2;
}
=head1 AUTHOR
Pete Krawczyk, C<< <petek@cpan.org> >>
=head1 BUGS
Fix 'em yourself! :-)
=head1 ALSO SEE
Slides from the presentation are available at L<http://www.bsod.net/~petek/slides/>.
=head1 COPYRIGHT & LICENSE
Copyright 2005 Pete Krawczyk, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
This library has also been released under a Creative Commons license
at the request of the YAPC::NA 2005 organizers. See
L<http://creativecommons.org/licenses/by/2.0/ca/> for more information;
in short, please give credit to the author should you use this code
elsewhere.
=cut
1; # End of Acme::PETEK::Testkit
( run in 1.540 second using v1.01-cache-2.11-cpan-ceb78f64989 )