package SEO::Tests::Head; use strict; package SEO::Tests::Title; sub prepare { my ($class, $self) = @_; $self->info->{title}->{content} = $self->gather_tag( 'title', {} , sub { $_->as_trimmed_text() }); $self->process_keywords($self->info->{title}, 'content'); }; sub describe { "Check Title for length and keywords" }; sub run_tests { my ($class, $self) = @_; return [ { name => 'Title Length', score => length( $self->info->{title}->{content}), meanings => [ [0 , 1, 'bad', 'No Description'], [ 1, 20, 'ok', 'Too short'], [20, 70, 'good', 'Just Right'], [70, 9999, 'bad', 'Too long'], ], }, { name => 'Title Keywords Ratio', score => $self->info->{title}->{keywords}->{ratio}, meanings => [ [0 , 0.25, 'ok', 'Too short'], [.25 , 0.50, 'good', 'Just Right'], [0.50, 9999, 'bad', 'Too many'], ], }, ]; }