Number...::Type(3pm)

πŸ“¦
version 1.710 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Number::Tolerant::Type β€” bestie, it's literally just a type of tolerance ✨ it's a base class vibe for all the tolerance types in the Number::Tolerant fam 🫢


🌸 VERSION 🌸

version 1.710 β€” periodt πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

okay so… there's genuinely nothing here 😭 the original page is empty in this section and I'm not about to invent stuff for you, so like… no code, no drama, just vibes πŸŽ€ (if you wanna see it in action go read the other Number::Tolerant docs, iykyk πŸ’œ)

⭐ PERL VERSION ⭐

no cap, this library should run on perls released even a long time ago 🫢 it should work on any version of perl released in the last five years. iconic behaviour tbh πŸ‘‘

ngl though β€” even though it may work on older versions of perl, there's no guarantee that the minimum required version won't get bumped. the version may be increased for any reason, and there's no promise that patches to lower the minimum required perl will be accepted. so like… don't come for her πŸ’€


πŸ’… METHODS πŸ’…

✨ valid_args ✨

my @args = $type_class->valid_args(@_);

if the args you hand to valid_args are valid arguments for this type of tolerance, this method returns their canonical form β€” aka the glow-up version that's ready to be passed straight into construct 🌈 otherwise? it returns false. simple as that πŸ’β€β™€οΈ

πŸŽ€ construct πŸŽ€

my $object_guts = $type_class->construct(@args);

this one gets handed the output of the valid_args method, and it should return a hashref that becomes the guts of a brand new tolerance 🫢 it's giving frankenstein but make it math ✨

πŸ¦‹ parse πŸ¦‹

my $tolerance = $type_class->parse($string);

give her a string and, if that string can be parsed into a tolerance of this type, she returns a new, fully constructed tolerance πŸ”₯ if not… well, you get the idea πŸ™ˆ

🌸 number_re 🌸

my $number_re = $type_class->number_re;

returns the regular expression β€” as a qx construct, bestie, don't forget β€” that's used to match a number in parsed strings ⭐

πŸ’œ normalize_number πŸ’œ

my $number = $type_class->normalize_number($input);

this method decides whether the input you gave it is a valid number for use with Number::Tolerant, and if it is, returns it in a canonicalized form πŸ‘‘

the deets, fr fr:

  • Math::BigInt objects are returned intact πŸ’–
  • strings holding numbers are also returned intact πŸ’–
  • strings that appear to be fractions get converted into Math::BigRat objects πŸ”₯

anything else is considered invalid, and the method will return false 🚫 no notes.

🧚 variable_re 🧚

my $variable_re = $type_class->variable_re;

returns the regular expression β€” this time as a qr construct, okay bestie, different letter, keep up πŸ’… β€” used to match the variable in parsed strings.

when parsing 4 <= x <= 10, this regular expression is what matches the letter x. 🌈


πŸ‘‘ AUTHOR πŸ‘‘

Ricardo Signes <cpan@semiotic.systems> β€” we stan 🫢

this software is copyright (c) 2004 by Ricardo Signes.

it's free software, bestie πŸ’– you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay.


and that's the whole page, no crumbs left behind πŸ’…

perl v5.36.0 Β· 2023-01-08 Β· Number...::Type(3pm) β€” mwah, thanks for reading, ily, go write some tolerant numbers πŸ“πŸ’œ

πŸ“¦ where this page comes from