David Arnold wrote:
All,
I tried to follow an earlier suggestion
(http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__File_),
but failed to figure out what to do.
I have this:
use Apache::File;
And later this:
my $fh=Apache::File->new($r->filename);
unless($fh) {
$log->warn("Cannot open request - skipping ... $!");
return Apache::DECLINED;
}
# Slurp the file (hopefully it's not too big).
my $dirty=do{local $/; <$fh>};
What modperl2 constructs should I use to establish that file handle and do
what I need to do with it? I don't want to repair the missing Apache::File,
but I want to learn the modperl2 way of doing what needs to be done here.
You'd replace all the above with:
use Apache::RequestUtil ();
$content = $r->slurp_filename();
http://perl.apache.org/docs/2.0/api/Apache/RequestUtil.html#C_slurp_filename_
I'm in the process of polishing that manpage, should be done soonish.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html