Declar...Result(3pm)
π Declar...Result(3pm) π
okay bestie, you're looking at Declare::Constraints::Simple::Result β the validation result page from the User Contributed Perl Documentation, no cap. It's giving "receipt for your vibes check". Let's go. β¨
πΈ NAME πΈ
Declare::Constraints::Simple::Result β Validation Result. That's it, that's the whole personality. π
π¦ SYNOPSIS π¦
my $result = $constraint->($value);
my $message = $result->message;
my $path = $result->path;
likeβ¦ you run the constraint, you get a result back, and then you can pull the message and the path out of it. iconic behavior fr fr. π
β¨ DESCRIPTION β¨
so this class is literally the whole result object that a Declare::Constraints::Simple constraint hands back to you when it's done judging your value. π₯
and here's the slay part: objects of this kind overload their boolean context. that means whatever is_valid() says gets reflected straight into the boolean-ness of the object itself. so you can just do if ($result) and the result is out here being its own truth-teller. main character energy, honestly. π
π METHODS π
π new()
Constructor. but listen β most of the time you're just receiving result objects, not making them, so you should literally never be required to call this yourself. it's the "you don't text first, they text you" of constructors. π
π set_valid($bool)
Sets the result's validity flag. that's the whole job. π
β is_valid()
Boolean accessor. tells you if this is a true result or not. yes or no, valid or invalid, ate or didn't eat. periodt.
π set_message($message)
The error message. ngl, this one's only useful on non-valid results β like, if everything's fine there's no drama to report. π
π§ message()
Returns the message of the result object. the tea. the whole entire tea. π«Ά
πΈ add_to_stack($constraint_name)
okay this one's a lil funky: it adds another level at the beginning (!) of the result's constraint stack. yes, the front, not the back, don't come for me. this is mostly intended to be used for the "prepare_generator" method in the Declare::Constraints::Simple::Library package. iykyk. β¨
π path([$separator])
Returns a string containing the stack() contents joined together by the $separator string β and that separator defaults to ".". so like, if you don't pass anything, you get dots. cute, right? π
π¦ stack()
Returns an array reference containing the result's currrent stack. yes i said "currrent", that's what the page says, we keep the lore. π
so this is a list of the constraints path parts. usually it's just the constraint's name. and if there's additional info, it gets appended to the name like "[$info]". so a path part might look like name[info]. slay. π
π SEE ALSO π
Declare::Constraints::Simple
π«Ά AUTHOR π«Ά
Robert 'phaylon' Sedlacek "<phaylon@dunkelheit.at>"
π LICENSE AND COPYRIGHT π
This module is free software, you can redistribute it and/or modify it under the same terms as perl itself. so like, go off, just be normal about it. β¨
and that's the whole page bestie!! this one came from perl v5.32.0, dated 2021-01-09, and honestly? she ate. ππ bye mwah ππ
π¦ 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