Документация
HTML CSS PHP PERL другое

Section 10.17.  Automatic Progress Indicators

 
Previous
Table of Contents
Next

10.17. Automatic Progress Indicators

Consider using the Smart::Comments module to automate your progress indicators.

As an alternative to coding the inline progress indicators or writing utility subroutines (as suggested in the previous guideline), you might prefer to use the Smart::Comments CPAN module, which keeps the comments about phases, and dispenses with the indicator code instead:


    use Smart::Comments;

    for my $possible_config ( @CONFIG_PATHS ) {  
### Initializing...  done
init_from($possible_config); } my $connection; TRY: for my $try (1..$MAX_TRIES) {
### Connecting to server...  done
$connection = connect_to($REMOTE_SERVER, {timeout=>$TIMEOUT}); last TRY if $connection; } croak "Can't contact server ($REMOTE_SERVER)" if not $connection;
# Interactive portion of the program starts here...

Smart::Comments allows you to put a specially marked comment (###) on the same line as any for or while loop. It then uses that comment as a template, from which it builds an automatic progress indicator for the loop. Other useful features of the Smart::Comments module are described under "Semi-Automatic Debugging" in Chapter 18.

    Previous
    Table of Contents
    Next
    © 2000- NIV