>     undef $/;           # enable "slurp" mode

I think the "local" is pretty important, especially in mod_perl:

    local $/;

This has the same effect (the "undef" is unnecessary).  It's also a
good idea to enclose the code in a subroutine with error checking:

    sub read_file {
        my($file) = @_;
        open(FH, "< $file") || die("error opening $file: $!");
        local($/);
        my($content) = <FH>;
        close(FH) && defined($content) || die("error reading $file: $!");
        return \$content;
    }

Rob


Reply via email to