in reply to My perl interpreter won't even look at it. It's that bad.

A few issues.

This (in line 176):

return( &generate_form_entry_error_string( "A-Z a-z 0-9" );

Should be:

return( &generate_form_entry_error_string( "A-Z a-z 0-9" ) );

This error is repeated many times. You also have an elseif instead of an elsif.

Last comment: with this error being duplicated so many times, I suspect that you should look into how you can refactor this code.

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil

Replies are listed 'Best First'.
Re: Re: My perl interpreter won't even look at it. It's that bad.
by strider corinth (Friar) on Nov 16, 2002 at 03:40 UTC
    Just an expansion of Ovid's last comment: refactoring this code would (for example) turn this:
    sub generate_extension { my $self = shift; return( &generate_line_form_element( "text", "extension" , $self- +>{extension}, $self->{extension} , "4" , "4" ); } sub generate_email_address { my $self = shift; return( &generate_line_form_element( "text", "email_address" , $s +elf->{email_address}, $self->{email_address} , "30 +" , "50" ); }

    ... into this:
    sub generate_stuff { my $self = shift; my $what = shift; my @numbers = @_; return( &generate_line_form_element( "text", $stuff , $self->{$st +uff}, $self->{$stuff} , @numbers ) +; }

    ... and calling it would look like this:
    generate_stuff( 'extension', 4, 4 ); # this is what a generate_stuff( 'email_address', 30, 50 ); # call would look like

    If you see a lot of code that looks the same structurally, it's usually better to consolidate it into something smaller and less repetetive. That way, if you have an error (or just a change you want to make), you only have to fix it in one place, and you can be certain that all of your similar functions will work the same way. In a situation of significant redundancy, consolidation can save a lot of space.
    --
    Love justice; desire mercy.