#!/usr/local/bin/perl -w use CGI; use Fcntl qw(:DEFAULT :flock); my $data; my $hook_called; my $cgi = CGI->new(\&_hook, $data); sub _hook { my ($filename, $buffer, $bytes_read, $data) = @_; if (not $hook_called) { print $cgi->header(); $hook_called=1; } else { print "Read $bytes_read bytes of filename\n"; } $hook_called += $bytes_read; } ####