Hi Rick,

The first thing I'd do is try to run this snippet from the command-line and
see how long it takes.

On a Linux box, something like:

$ time ./test.pl

Andrew

On Wed, Oct 31, 2018 at 8:11 PM Rick T <p...@reason.net> wrote:

> This is not exactly a perl question, but perl may be implicated. The code
> below writes files to my server, one for each element of @ course_file_list.
> The files are small and the processing is simple and should go quickly. It
> works if the array has only a couple of elements; but with a longer list my
> browser times out saying the server is not responding. When I look on the
> server, all expected files are present. The die line near the end was to
> test whether the loop finished, but I never saw a die statement (Fatals to
> Browser). It’s possible that the server timed out before the die statement
> was reached, but I don’t know if I can make the brewers wait longer; and
> even if I could, the processing should not take this long. Being a newbie,
> I have quickly run out of ideas to check. Any suggestions would be
> appreciated! — Rick Triplett
>
>
>
> . . . SNIP (first hundred lines not shown)
> foreach my $course_file (@course_file_list){
>
>     # maybe this course has already been registered
>     if ( already_exists($course_file) ){
>         $reg_exists .= display($course_file);
>         next;   # Skip to next $course_file if any
>     }
>
>     # try to add 3 data to this progress file and count them to be sure
>     my $assignments =   # counts the number of assignments - better be 3!
>        ( $pf{n_max},
>          $pf{course_name},
>          $pf{effort_report_list}
>        ) = course_found($course_file); # assign found data to %pf
>
>     # flag and skip if not all assignments are available (likely never)
>     if ( $assignments != 3 ){
>         $reg_unknown  .= display($course_file);
>         next;   # Skip to next $course_file if any
>     }
>
>     # things are looking good, so write progress file
>     if ( write_progress_file($course_file) ){    # successful write
>         $reg_yes .= display($course_file);
>         next;   # Skip to next $course_file if any
>     }
>     else {                                       # unsuccessful write
>         $reg_no .= display($course_file);
>         next;   # Skip to next $course_file if any
>     }
>
> }
> die "got to line 85";
> # serve registration status to browser
> report_registrations( $reg_exists,
>                       $reg_unknown,
>                       $reg_yes,
>                       $reg_no,
>                     );
>
> exit;
>
>

-- 
Andrew Solomon

Perl Trainer, Geekuni http://geekuni.com/
and...@geekuni.com // +44 7931 946 062

Reply via email to