in reply to mod_perl: variable $end will not stay shared (nested subroutines problem)

Just to be concrete:

sub Apache::send_range { my ($r,$fh, $offset, $end) = @_; seek($fh,$offset,0); my $buf; my $bufsiz=4096; my $current_position = $offset; my $read_size= sub { my $amount_to_go = ($end - $current_position); if ($amount_to_go <= $bufsiz) { $bufsiz; } else { $amount_to_go; } } while (read($fh,$buf,&$read_size)) { $current_position += &$read_size; $r->print($buf); } }

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re: mod_perl: variable $end will not stay shared (nested subroutines problem)
  • Download Code