NAME
Wordsmith::Claude::Result - Result object for rewritten text
SYNOPSIS
my $result = rewrite(text => $input, mode => 'eli5', loop => $loop)->get;
# Get the rewritten text
print $result->text;
# Check for errors
if ($result->has_error) {
die "Rewrite failed: " . $result->error;
}
# Access original
print "Original: ", $result->original, "\n";
print "Rewritten: ", $result->text, "\n";
# With variations
my $result = rewrite(
text => $input,
mode => 'casual',
variations => 3,
loop => $loop,
)->get;
for my $var ($result->all_variations) {
print "- $var\n";
}
DESCRIPTION
Result object returned by the rewrite() function containing the rewritten text and metadata.
ATTRIBUTES
original
The original input text.
text
The rewritten text. If variations were requested, this is the first variation.
mode
The mode used for rewriting (if a preset mode was used).
variations
ArrayRef of all variations if multiple were requested.
error
Error message if the rewrite failed.
METHODS
all_variations
my @vars = $result->all_variations;
Returns all variations as a list. If no variations were requested, returns the single rewritten text.
variation
my $text = $result->variation(0); # First variation
my $text = $result->variation(2); # Third variation
Get a specific variation by index (0-based).
variation_count
my $count = $result->variation_count;
Returns the number of variations available.
is_success
if ($result->is_success) { ... }
Returns true if the rewrite succeeded (no error).
is_error
if ($result->is_error) { ... }
Returns true if the rewrite failed.
AUTHOR
LNATION, <email at lnation.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)