So I want to optomize our company website to at least follow the general recommendations for making sites search engine friendly. I don't want to try and stuff it full of keywords or anything, just test to see what changes should be made to my design in order to make it better. So I started with a base modules SEO::Tests (no the names are not good or permanent, just have to start somewhere) which has plugins in the SEO::Tests::* name space. It uses Module::Pluggable to find, load and enumerate plugins. Each plugin then has three methods, prepare, describe, run_tests. My problem starts here with the tests. I want each name space to be able to have numerous tests it can run and all tests return their status in a defined mannor so that the main program can choose to display how to print out the results. I also want each test to be able to return all score meanings, so that someone can tell if it scored a 5 and it was only 'ok' how close they were to getting a 'good'. Well in the interest of trying to keep it short i'll just post the plugin code here ( and i can provide the full code if it turns out to be needed.) This first plugin runs two tests, one on the length of the title and the other on the keyword density of the title.

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'], ], }, ]; }

You can see that currently this structure results in a layer of nested array refs and hash refs. Does anyone see a clearer way to do this? Perhaps registering each test inside the the plugins. I almost want to do plugins inside the plugins, but that realy seems insane. So in short: I want a way for the plugin to register multiple tests and have each of those tests called individualy where they will return the name, the score and a meaning matrix so that different output methods can be used on the same data. If I havn't confused everyone with this i will be overjoyed! lol.


___________
Eric Hodges

In reply to Plugin Design for SEO Test suite by eric256

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.