- slurp_filename port
Index: lib/Apache/compat.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.22
diff -u -r1.22 compat.pm
--- lib/Apache/compat.pm 2001/10/09 05:42:49 1.22
+++ lib/Apache/compat.pm 2001/10/21 06:54:18
@@ -206,15 +206,6 @@
*log_reason = \&log_error;
-sub slurp_filename {
- my $r = shift;
- open my $fh, $r->filename;
- local $/;
- my $data = <$fh>;
- close $fh;
- return \$data;
-}
-
use constant IOBUFSIZE => 8192;
#XXX: howto convert PerlIO to apr_file_t
Index: src/modules/perl/modperl_util.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
retrieving revision 1.27
diff -u -r1.27 modperl_util.c
--- src/modules/perl/modperl_util.c 2001/10/13 03:32:31 1.27
+++ src/modules/perl/modperl_util.c 2001/10/21 06:54:18
@@ -533,3 +533,20 @@
{
return gv_stashpv(name, FALSE) ? 1 : 0;
}
+
+MP_INLINE SV *mod_perl_slurp_filename(pTHX_ request_rec *r)
+{
+ PerlIO *fp;
+ SV *insv;
+
+ ENTER;
+ save_item(PL_rs);
+ sv_setsv(PL_rs, &PL_sv_undef);
+
+ fp = PerlIO_open(r->filename, "r");
+ insv = newSV(r->finfo.size);
+ sv_gets(insv, fp, 0); /*slurp*/
+ PerlIO_close(fp);
+ LEAVE;
+ return newRV_noinc(insv);
+}
Index: src/modules/perl/modperl_util.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
retrieving revision 1.28
diff -u -r1.28 modperl_util.h
--- src/modules/perl/modperl_util.h 2001/10/21 06:22:45 1.28
+++ src/modules/perl/modperl_util.h 2001/10/21 06:54:18
@@ -101,4 +101,7 @@
MP_INLINE int modperl_perl_module_loaded(pTHX_ const char *name);
+SV *mod_perl_slurp_filename(pTHX_ request_rec *r);
+
+
#endif /* MODPERL_UTIL_H */
Index: todo/api.txt
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
retrieving revision 1.11
diff -u -r1.11 api.txt
--- todo/api.txt 2001/10/09 00:14:10 1.11
+++ todo/api.txt 2001/10/21 06:54:18
@@ -101,10 +101,6 @@
$r->post_connection:
alias not implemented
-$r->slurp_filename:
-optimized version not yet implemented (compat version exists in
-Apache::compat)
-
Apache->unescape_url{_info}:
not yet implemented. should be moved to Apache::Util
Index: xs/Apache/RequestUtil/Apache__RequestUtil.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
retrieving revision 1.7
diff -u -r1.7 Apache__RequestUtil.h
--- xs/Apache/RequestUtil/Apache__RequestUtil.h 2001/09/28 20:11:02 1.7
+++ xs/Apache/RequestUtil/Apache__RequestUtil.h 2001/10/21 06:54:18
@@ -179,3 +179,6 @@
#define mpxs_Apache__RequestRec_dir_config(r, key, sv_val) \
modperl_dir_config(aTHX_ r, r->server, key, sv_val)
+
+#define mpxs_Apache__RequestRec_slurp_filename(r) \
+ mod_perl_slurp_filename(aTHX_ r)
Index: xs/maps/modperl_functions.map
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
retrieving revision 1.24
diff -u -r1.24 modperl_functions.map
--- xs/maps/modperl_functions.map 2001/10/09 18:01:21 1.24
+++ xs/maps/modperl_functions.map 2001/10/21 06:54:18
@@ -20,6 +20,7 @@
PACKAGE=Apache::RequestRec
mpxs_Apache__RequestRec_new | | classname, c, base_pool=NULL
SV *:DEFINE_dir_config | | request_rec *:r, char *:key=NULL, SV *:sv_val=&PL_sv_no
+ SV *:DEFINE_slurp_filename | | request_rec *:r
PACKAGE=Apache
mpxs_Apache_request | | classname, svr=Nullsv
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]