SQL::Tr...::Error(3)
okay so bestie, welcome to SQL::Tr...::Error(3) β it's part of the User Contributed Perl Documentation crowd, and it's here to teach you the error setter/getter vibe for objects and classes. π
πΈ NAME πΈ
SQL::Translator::Role::Error β the error setter/getter for objects and classes. no cap, that's literally the whole job. β¨
β¨ SYNOPSIS β¨
In the class that's consuming the role, it looks like this:
package Foo;
use Moo;
with qw(SQL::Translator::Role::Error);
sub foo {
...
return $self->error("Something failed")
unless $some_condition;
...
}
And in code that's using the class, you can do either of these:
Foo->foo or die Foo->error;
# or
$foo->foo or die $foo->error;
π DESCRIPTION π
This Moo::Role provides a method for getting and setting error on a class or object. That's the whole main character energy of this page. π
π METHODS π
π
$object_or_class->error([$message]) π
If you call it with an argument, it sets the error message and returns undef. If you call it without an argument, it returns the message. Slay. π«Ά
As an implementation detail β and yes, for compatibility with Class::Base β the message is stored in $object->{_ERROR} or $Class::ERROR, depending on whether the invocant is an object. iykyk. π§
π¦ SEE ALSO π¦
- βError Handlingβ in
Class::Baseβ the related read, bestie. π
this page is from perl v5.42.0, dated 2024-12-12. mwah, go handle those errors bestie πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-SQL-Translator 1.660.0-bp160.1.11 Β· (Artistic-1.0 OR GPL-1.0-or-later) AND GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms