NAME

Project::Euler::Lib::MultipleCheck

VERSION

Version v0.1.0

SYNOPSIS

Module that is used to determine if a number is a multiple of any (or optionally all) numbers in an array

use Project::Euler::Lib::MultipleCheck;
my $multi_check = Project::Euler::Lib::MultipleCheck->new(
    multi_nums => [2, 3, 5],
    check_all  => 0,  # could omit this if you wanted to
);

VARIABLES

The variables that the library needs to solve the problem

multi_nums (ArrayRef[PosInts]) # Numbers to modulo with
check_all  (Boolean)        # Ensure all numbers are divisible instead of just one

FUNCTIONS

check

Function that returns a Boolean if the given number passes the checks

my $check = Project::Euler::Lib::MultipleCheck->new(
    multi_nums => [3, 5],
    check_all  => 0,
);

my $true  = $multi_check->check(9);
my $false = $multi_check->check(11);

$multi_check->check_all(1);
my $true  = $multi_check->check(15);
my $false = $multi_check->check(10);


$dies = $multi_check->multi_nums([0, 1]);  # Multi_nums must all be positive
$dies = $multi_check->multi_nums((2, 9));  # Multi nums must be an array ref

$dies = $multi_check->check('test');  # Can't check a num

AUTHOR

Adam Lesperance, <lespea at cpan.org>

BUGS

Please report any bugs or feature requests to bug-project-euler at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Project-Euler. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Project::Euler::Lib::MultipleCheck

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Adam Lesperance.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.