NAME
Project::Euler::Lib::Types - Type definitions for Project::Euler
VERSION
Version v0.1.1
SYNOPSIS
use Project::Euler::Lib::Types qw/ (types to import) /;
DESCRIPTION
(Most) all of the types that our modules use are defined here so that they can be reused and tested. This also helps prevent all of the namespace pollution from the global declarations.
SUBTYPES
Create the subtypes that we will use to validate the arguments defined by the extending classes
m_ \A \Qhttp://projecteuler.net/index.php?section=problems&id=\E \d+ \z _xms
Base::prob_name = str && 10 < len < 80
We also tell Moose how to coerce a given string into a DateTime object
ProblemLink
A url pointing to a problem setup on http://projecteuler.net
as Str,
message { "$_ is not a a valid link" },
where { $_ =~ m{
\A
\Qhttp://projecteuler.net/index.php?section=problems&id=\E
\d+
\z
}xms
};
ProblemName
In an effort to limit text runoff, the problem name is limited to 80 characters. Similarly, the length must also be greater than 10 to ensure it is a usefull name.
as Str,
message { qq{'$_' must be a a string between 10 and 80 characters long} },
where {
length $_ > 10 and length $_ < 80;
};
PosInt
An integer greater than 0
as Int,
where {
$_ > 0
}
PosIntArray
An array of PosInts
NegInt
An integer less than 0
as Int,
where {
$_ < 0
}
NegIntArray
An array of NegInts
MyDateTime
A DateTime object parsed using DateTime::Format::DateParse
class_type MyDateTime, { class => 'DateTime' };
coerce MyDateTime,
from Str,
via {
DateTime::Format::DateParse->parse_datetime( $_ );
};
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::Common
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.