in reply to Re: strict isn't everything
in thread strict isn't everything

I guess I don't need to add too much commentary as most of the posts have it fairly well. However, you asked about the rest of the code:

Print: my $template_data; if ( $params ) { my @required = qw/ file_size file_type /; $template_data = { errors => \%errors, required_fields => \@required, # more stuff here } print $query->header; $template->process( 'info_request_emp.tmpl', $template_data ) or d +ie $template->error(); exit; }

The only use of the goto is to skip some code. An else would have been preferred.

As for $file_name and $_file_name, this is a "sometimes" convention used here. When reading form parameters, the variable with the tainted data begins with an underscore and the untainted one drops the underscore. Obviously, if no untainting occurs, this is useless. Personally, I don't like this ad hoc approach.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: strict isn't everything
by Abigail-II (Bishop) on Jun 13, 2002 at 09:12 UTC
    The only use of the goto is to skip some code. An else would have been preferred.

    Hmmm. An else is a typical solution, but it's not something that makes me jump with joy either. It means there's a large block of code that will be indented. And would you have more such cases, the code crawls to the right hand margin.

    A continue might solve this:

    if (CONDITION) {{ # Note the *double* opening brace. ... some code ... next if SOME_CONDITION; ... more code ... next if OTHER_CONDITION; ... even more code ... } continue { ... end stuff ... } }
    And if you do last instead of next, the continue won't be executed.

    Abigail