richter 00/07/08 06:06:49
Modified: . Embperl.xs EmbperlObject.pm MANIFEST ep.h epmain.c
test.pl
Added: test/cmp eponotfound.htm
test/html/EmbperlObject epofallback.htm
Log:
- import base, *, setup ISA
Revision Changes Path
1.27 +14 -0 embperl/Embperl.xs
Index: Embperl.xs
===================================================================
RCS file: /home/cvs/embperl/Embperl.xs,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Embperl.xs 2000/03/28 19:46:04 1.26
+++ Embperl.xs 2000/07/08 13:06:42 1.27
@@ -170,6 +170,20 @@
void
+embperl_GetPackageOfFile(sSourcefile, sPackage, mtime)
+ char * sSourcefile
+ char * sPackage
+ double mtime
+PPCODE:
+ tFile * pFile = GetFileData (sSourcefile, sPackage, mtime) ;
+ EXTEND(SP,2) ;
+ PUSHs(sv_2mortal(newSViv(pFile -> mtime == -1?1:0))) ;
+ PUSHs(sv_2mortal(newSVpv(pFile -> sCurrPackage, pFile -> nCurrPackage))) ;
+
+
+
+
+void
embperl_logerror(code, sText, pApacheReqSV=NULL)
int code
char * sText
1.30 +34 -1 embperl/EmbperlObject.pm
Index: EmbperlObject.pm
===================================================================
RCS file: /home/cvs/embperl/EmbperlObject.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- EmbperlObject.pm 2000/07/07 21:55:57 1.29
+++ EmbperlObject.pm 2000/07/08 13:06:42 1.30
@@ -10,7 +10,7 @@
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: EmbperlObject.pm,v 1.29 2000/07/07 21:55:57 richter Exp $
+# $Id: EmbperlObject.pm,v 1.30 2000/07/08 13:06:42 richter Exp $
#
###################################################################################
@@ -170,12 +170,45 @@
{
print HTML::Embperl::LOG "[$$]EmbperlObject Found Base: $fn\n" if ($debug);
print HTML::Embperl::LOG "[$$]EmbperlObject path: $searchpath\n" if
($debug);
+ my ($basenew, $basepackage) = HTML::Embperl::GetPackageOfFile ($fn,
$ENV{EMBPERL_PACKAGE} || '', -M _) ;
if (!-f $filename && exists $ENV{EMBPERL_OBJECT_FALLBACK})
{
$filename = $ENV{EMBPERL_OBJECT_FALLBACK} ;
- print HTML::Embperl::LOG "[$$]EmbperlObject use fallback: $filename\n"
if ($debug);
+ if (-f $filename)
+ {
+ print HTML::Embperl::LOG "[$$]EmbperlObject use fallback:
$filename\n" if ($debug);
+ }
+ else
+ {
+ print HTML::Embperl::LOG "[$$]EmbperlObject fallback $filename not
found\n" if ($debug);
+ }
$r -> notes ('EMBPERL_orgfilename', $filename) ;
+ }
+
+
+ my ($new, $package) = HTML::Embperl::GetPackageOfFile ($filename,
$ENV{EMBPERL_PACKAGE} || '', -M _) ;
+
+ if ($basenew)
+ {
+ print HTML::Embperl::LOG "[$$]EmbperlObject new Base: $fn, package =
$basepackage\n" if ($debug);
+
+ HTML::Embperl::Execute ({inputfile => $fn, import => 0 }) ;
+
+ no strict ;
+ @{"$basepackage\:\:ISA"} = ($ENV{EMBPERL_OBJECT_HANDLER_CLASS} ||
'HTML::Embperl::Req') ;
+ use strict ;
+ }
+
+ if ($new)
+ {
+ print HTML::Embperl::LOG "[$$]EmbperlObject new file: $filename,
package = $package\n" if ($debug);
+
+ HTML::Embperl::Execute ({inputfile => $filename, import => 0 }) ;
+
+ no strict ;
+ @{"$package\:\:ISA"} = ($basepackage) ;
+ use strict ;
}
return HTML::Embperl::handler ($r) ;
1.42 +2 -0 embperl/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /home/cvs/embperl/MANIFEST,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- MANIFEST 2000/05/02 06:47:10 1.41
+++ MANIFEST 2000/07/08 13:06:45 1.42
@@ -137,6 +137,7 @@
test/html/EmbperlObject/epopage1.htm
test/html/EmbperlObject/sub/epohead.htm
test/html/EmbperlObject/sub/epopage2.htm
+test/html/EmbperlObject/epofallback.htm
test/cmp/ascii
test/cmp/pure.htm
test/cmp/plain.htm
@@ -206,6 +207,7 @@
test/cmp/clearsess.htm
test/cmp/epopage1.htm
test/cmp/epopage2.htm
+test/cmp/epofallback.htm
test/conf/httpd.conf.src
test/conf/startup.pl
test/conf/startup_dso.pl
1.24 +5 -0 embperl/ep.h
Index: ep.h
===================================================================
RCS file: /home/cvs/embperl/ep.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ep.h 2000/04/22 20:18:02 1.23
+++ ep.h 2000/07/08 13:06:45 1.24
@@ -200,6 +200,11 @@
/*in*/ int nFirstLine,
/*in*/ tConf * pConf) ;
+tFile * GetFileData (/*in*/ char * sSourcefile,
+ /*in*/ char * sPackage,
+ /*in*/ double mtime) ;
+
+
tConf * SetupConfData (/*in*/ HV * pReqInfo,
/*in*/ SV * pOpcodeMask) ;
1.66 +83 -1 embperl/epmain.c
Index: epmain.c
===================================================================
RCS file: /home/cvs/embperl/epmain.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- epmain.c 2000/05/02 04:41:37 1.65
+++ epmain.c 2000/07/08 13:06:45 1.66
@@ -1612,7 +1612,6 @@
free (pConf) ;
}
-
/* ---------------------------------------------------------------------------- */
/* */
/* Setup File specficy data */
@@ -1703,6 +1702,89 @@
lprintf (r, "[%d]MEM: Load %s in %s\n", r -> nPid, sSourcefile, f ->
sCurrPackage) ;
}
_free(r,cache_key);
+
+ return f ;
+ }
+
+/* ---------------------------------------------------------------------------- */
+/* */
+/* Get file data from filename; preset if not present */
+/* */
+/* ---------------------------------------------------------------------------- */
+
+
+tFile * GetFileData (/*in*/ char * sSourcefile,
+ /*in*/ char * sPackage,
+ /*in*/ double mtime)
+
+ {
+ SV * * ppSV ;
+ tFile * f ;
+ char txt [sizeof (sDefaultPackageName) + 50] ;
+ char * cache_key;
+ int cache_key_len;
+
+ EPENTRY (GetFileData) ;
+
+ /* Have we seen this sourcefile/package already ? */
+ cache_key_len = strlen( sSourcefile ) ;
+ if ( sPackage && *sPackage)
+ cache_key_len += strlen( sPackage );
+
+ cache_key = malloc(cache_key_len + 1 );
+ strcpy( cache_key, sSourcefile );
+ if ( sPackage && *sPackage)
+ strcat( cache_key, sPackage );
+ ppSV = hv_fetch(pCacheHash, cache_key, cache_key_len, 0);
+
+ if (ppSV && *ppSV)
+ {
+ f = (tFile *)SvIV((SV*)SvRV(*ppSV)) ;
+
+ if (mtime == 0 || f -> mtime != mtime)
+ {
+ hv_clear (f -> pCacheHash) ;
+
+ f -> mtime = -1 ; /* reset last modification time of file */
+ if (f -> pExportHash)
+ {
+ SvREFCNT_dec (f -> pExportHash) ;
+ f -> pExportHash = NULL ;
+ }
+ }
+ }
+ else
+ { /* create new file structure */
+ if ((f = malloc (sizeof (*f))) == NULL)
+ {
+ free(cache_key);
+ return NULL ;
+ }
+
+ f -> sSourcefile = sstrdup (sSourcefile) ; /* Name of sourcefile */
+ f -> mtime = -1 ; /* last modification time of file */
+ f -> nFilesize = 0 ; /* size of File */
+ f -> pBufSV = NULL ;
+ f -> pNext2Free = NULL ;
+ f -> bKeep = 0 ;
+ f -> pExportHash = NULL ;
+ f -> nFirstLine = 0 ;
+
+ f -> pCacheHash = newHV () ; /* Hash containing CVs to precompiled subs
*/
+
+ if ( sPackage && *sPackage)
+ f -> sCurrPackage = strdup (sPackage) ; /* Package of file */
+ else
+ {
+ sprintf (txt, sDefaultPackageName, nPackNo++ ) ;
+ f -> sCurrPackage = strdup (txt) ; /* Package of file */
+ }
+ f -> nCurrPackage = strlen (f -> sCurrPackage); /* Package of file (length)
*/
+
+ hv_store(pCacheHash, cache_key, cache_key_len, newRV_noinc (newSViv
((IV)f)), 0) ;
+
+ }
+ free(cache_key);
return f ;
}
1.59 +2 -1 embperl/test.pl
Index: test.pl
===================================================================
RCS file: /home/cvs/embperl/test.pl,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- test.pl 2000/07/07 21:55:57 1.58
+++ test.pl 2000/07/08 13:06:45 1.59
@@ -96,6 +96,7 @@
'clearsess.htm',
'EmbperlObject/epopage1.htm',
'EmbperlObject/sub/epopage2.htm',
+ 'EmbperlObject/sub/epopage2.htm',
'EmbperlObject/sub/eponotfound.htm',
) ;
@@ -1239,7 +1240,7 @@
$content = "Hi there!" ;
}
- if (!$EPWIN32 && $loc eq $embploc && $file ne 'notfound.htm')
+ if (!$EPWIN32 && $loc eq $embploc && !($file =~ /notfound\.htm/))
{
print "ERROR: Missing read permission for file $inpath/$file\n" if
(!-r "$inpath/$file") ;
local $> = $httpduid ;
1.1 embperl/test/cmp/eponotfound.htm
Index: eponotfound.htm
===================================================================
<html>
<head>
<title>Example</title>
</head>
<body>
<h1>another head from sub</h1>
Fallback PAGE
<hr> Footer <hr>
</body>
</html>
1.1 embperl/test/html/EmbperlObject/epofallback.htm
Index: epofallback.htm
===================================================================
Fallback PAGE
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]