in reply to code review for a WebTest Plugin module.
If I may be so bold as to suggest that you check out one of my modules, HTML::TokeParser::Simple. I am looking at the following and I think you can make it clearer:
my $tag = @{$tagstruct}[0]; if ($tag =~ m!/!) { #print "endtag"; next; } my %attrhash= %{@{$tagstruct}[1]}; my @attrarr = @{@{$tagstruct}[2]};
With the "simple" version of TokeParser, the array structure remains exactly the same. This ensures that you can use the same interface, but gradually upgrade to something more legible:
if ($tagstruct->is_end_tag) { #print "endtag"; next; } my %attrhash= %{$tagstruct->return_attr}; my @attrarr = @{$tagstruct->return_attrseq};
I am a big fan of self-documenting code and with this module, you no longer have to try and memorize array indices.
Cheers,
Ovid
New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)
|
|---|