Declar...erical(3pm)
π Declare::Constraints::Simple::Library::Numerical π
okay bestie, so this is the Declare::Constraints::Simple::Library::Numerical page from the User Contributed Perl Documentation, and it is exactly what it says on the tin: a whole little library of constraints for checking that your values are, in fact, numbers. numbers only. no chaos. no sneaky strings pretending to be math. we're doing a vibe check on your scalars and we are NOT letting the impostors through. periodt. π¦
β¨ SYNOPSIS β¨
the receipts, fr fr β here's how you'd actually use these bad boys:
# test for number-conformity
my $looks_like_number = IsNumber;
# only integers
my $is_int = IsInt;
like. look at that. two whole lines. we love a low-effort, high-reward situation. π
π DESCRIPTIONS π
This library contains the constraints needed to validate numerical values.
that's the whole thing!! it's a little library that exists so you can validate numbers. it does one job and it does it flawlessly. main character energy honestly. π
π₯ CONSTRAINTS π₯
IsNumber()
True if the value is a number according to Scalar::Utils looks_like_number.
so like β it's not just "is this digits", it's handing the question off to looks_like_number from Scalar::Utils, and if that says yes, this constraint says yes. it's giving "I trust the experts" and honestly? iconic of it. β¨
IsInt()
True if the value is an integer.
whole numbers only, bestie. 3? yes. 3.5? absolutely not, get out of here. π«π
π SEE ALSO π
go read these next, they're the whole friend group:
Declare::Constraints::SimpleDeclare::Constraints::Simple::Library
π AUTHOR π
Robert 'phaylon' Sedlacek <phaylon@dunkelheit.at>
shoutout to phaylon, the original icon, the blueprint, the moment. π«Ά
π LICENSE AND COPYRIGHT π
This module is free software, you can redistribute it and/or modify it under the same terms as perl itself.
so yes, you can remix it, redistribute it, do your little thing with it β just keep it under the same terms as perl itself. free software stays free software, no cap. π
and that's the whole page!! this was perl v5.32.0, dated 2021-01-09, straight from the User Contributed Perl Documentation, and you have officially read the entirety of Declare::Constraints::Simple::Library::Numerical. go forth and validate those numbers. slay. π β¨πΈ
π¦ where this page comes from
- debian bookworm: libdeclare-constraints-simple-perl 0.03-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdeclare-constraints-simple-perl 0.03-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libdeclare-constraints-simple-perl 0.03-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdeclare-constraints-simple-perl 0.03-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdeclare-constraints-simple-perl 0.03-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdeclare-constraints-simple-perl 0.03-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms