NAME

Wordsmith::Claude::Blog::Result - Result object for blog generation

SYNOPSIS

my $result = Wordsmith::Claude::Blog::Result->new(
    topic    => 'AI in Perl',
    title    => 'Building AI Tools with Perl',
    text     => '# Building AI Tools...',
    style    => 'technical',
    tone     => 'enthusiastic',
    metadata => { word_count => 1234 },
);

print $result->title;
print $result->word_count;
print $result->reading_time, " minutes\n";

if ($result->is_success) {
    print $result->as_markdown;
}

DESCRIPTION

Result object returned by the blog() function containing the generated blog post and metadata.

ATTRIBUTES

  • topic - The original topic requested

  • title - The generated title for the blog post

  • text - The full generated blog text (markdown)

  • style - The style used (technical, tutorial, etc.)

  • tone - The tone used (professional, friendly, etc.)

  • length - The length preset used (short, medium, long)

  • sections - ArrayRef of parsed sections (optional)

  • metadata - HashRef of metadata (word_count, etc.)

  • error - Error message if generation failed

METHODS

is_success

if ($result->is_success) { ... }

Returns true if the blog was generated successfully (no error).

is_error

if ($result->is_error) { ... }

Returns true if an error occurred.

word_count

my $count = $result->word_count;

Returns the word count of the generated text.

reading_time

my $minutes = $result->reading_time;

Returns estimated reading time in minutes (assuming 200 words/minute).

as_markdown

print $result->as_markdown;

Returns the blog post as markdown (same as text, but ensures proper formatting).

as_html

print $result->as_html;

Returns the blog post converted to basic HTML.

section_count

my $count = $result->section_count;

Returns the number of sections in the blog post.

get_section

my $section = $result->get_section(0);
print $section->{heading}, "\n", $section->{content};

Returns a specific section by index.

to_hash

my $hash = $result->to_hash;

Returns a hashref representation of the result.

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)