valtype::verhoeff(3tcl)
π valtype::verhoeff β the manual, but make it cute π
okay so bestie, you know how we're always like "is this even a real number??" β well this is the page for that. it's valtype::verhoeff, manual page valtype::verhoeff(3tcl), living in the 3tcl section, and it's all about validating a plain number that has a VERHOEFF checkdigit. slay. β¨
πΈ NAME πΈ
valtype::verhoeff β validation for a plain number with a VERHOEFF checkdigit. that's it, that's the whole name. iconic behavior honestly.
π SYNOPSIS π
like, the whole vibe in one block:
package require Tcl 8.5 9
package require snit 2
package require valtype::common
package require valtype::verhoeff ?1.1?
valtype::verhoeff validate value
valtype::verhoeff checkdigit value
β¨ DESCRIPTION β¨
so this package implements a snit validation type for a plain number with a VERHOEFF checkdigit. no cap. π
and if you're like "girl what is a validation type" β okay so a validation type is an object that can be used to validate Tcl values of a particular kind. example: snit::integer, which is a validation type defined by the snit package, and it's used to validate that a Tcl value is an integer. see? it's giving "the vibe check but for values". π¦
every validation type has a validate method, and that method is the one doing the actual validating. it must take a single argument β the value to be validated. and then: it must do nothing if the value is valid, but throw an error if the value is invalid. that's the whole rule bestie:
valtype::verhoeff validate .... ;# Does nothing
valtype::verhoeff validate .... ;# Throws an error (bad verhoeff checkdigit).
the validate method will always return the validated value on success, and throw the -errorcode INVALID on error, possibly with additional elements which provide more details about the problem. so like, it doesn't just say "no", it says "no and here's why". periodt. π
π API π
the API provided by this package satisfies the specification of snit validation types found in the documentation of Snit's Not Incr Tcl. (that's the actual title, we don't make the rules, we just validate them.)
valtype::verhoeff validate valueβ this method validates the value and returns it, possibly in a canonical form, if it passes. if the value does not pass the validation, an error is thrown. simple as. π«Άvaltype::verhoeff checkdigit valueβ this method computes a check digit for the value. but before it does any of that, the value gets validated β except for a checkdigit, obviously, because it doesn't have one yet, that's literally the whole point. and if the value does not pass the validation, no check digit is calculated and an error is thrown instead. so rude but so fair. π
π₯ ERROR CODES π₯
like the package description already said, the errors thrown by the commands of this package in response to input validation failures use the -errorcode INVALID to distinguish themselves from package internal errors. so when you see INVALID, that's the "your input, bestie, not our code" signal. π
and to provide more detailed information about why the validation failed, the -errorCode goes actually beyond that. first, it will contain a code detailing the type itself. here this is VERHOEFF. then that's followed by values detailing the reason for the failure. the full set of -errorCodes which can be thrown by this package are:
INVALID VERHOEFF CHARACTERβ the input value contained one or more bad characters, i.e. characters which must not occur in the input for it to be a plain number with a VERHOEFF checkdigit. not me putting a letter in a number field πINVALID VERHOEFF CHECK-DIGITβ the check digit of the input value is wrong. this usually signals a data-entry error, with digits transposed, forgotten, etc. of course, the input may be an outright fake too. π (yes, the original says "th input" β we keep it real, and we keep the meaning: the input might just be lying to you.)
π BUGS, IDEAS, FEEDBACK π
this document, and the package it describes, will undoubtedly contain bugs and other problems. like, obviously. please report such in the category valtype of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. please also report any ideas for enhancements you may have for either package and/or documentation. we want the feedback fr fr. π«Ά
when proposing code changes, please provide unified diffs, i.e the output of diff -u.
note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. do it that way, it's the move. β¨
β KEYWORDS β
Checking, Testing, Type checking, Validation, Value checking, isA, verhoeff
π¦ CATEGORY π¦
Validation, Type checking
π COPYRIGHT π
Copyright (c) 2011 Andreas Kupries <andreas_kupries@users.sourceforge.net>
and that's the whole page bestie π this was tcllib, version 1.1, manual page valtype::verhoeff(3tcl) β go validate something, you're doing amazing, mwah π
β¨πΈ
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- Copyright (c) 2011 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms