You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl-cvs@perl.apache.org by ri...@apache.org on 2005/08/06 23:47:38 UTC
cvs commit: embperl/test/html subempty.htm
richter 2005/08/06 14:47:38
Modified: . Changes.pod DOM.xs Embperl.pod Intro.pod MANIFEST
Old.xs epcomp.c epdat2.h epdom.c test.pl
Added: test/cmp subempty.htm
test/html subempty.htm
Log:
- Fixed unresolved symbol when compiling under SuSE 9.3 (because SuSE
compiles Apache 2 in maintainer mode)
- Fixed strange output when Perl code inside of [$ sub $] returns
before any output.
- Documentation cleanup
Revision Changes Path
1.274 +10 -0 embperl/Changes.pod
Index: Changes.pod
===================================================================
RCS file: /home/cvs/embperl/Changes.pod,v
retrieving revision 1.273
retrieving revision 1.274
diff -u -r1.273 -r1.274
--- Changes.pod 19 Jun 2005 08:52:25 -0000 1.273
+++ Changes.pod 6 Aug 2005 21:47:37 -0000 1.274
@@ -1,5 +1,14 @@
=pod
+
+=head4 2.0.rc5
+
+ - Fixed unresolved symbol when compiling under SuSE 9.3 (because SuSE
+ compiles Apache 2 in maintainer mode)
+ - Fixed strange output when Perl code inside of [$ sub $] returns
+ before any output.
+ - Documentation cleanup
+
=head4 2.0.rc4 19. Juni 2005
- Adapted to new mod_perl namespace. Embperl now works correctly
@@ -9,6 +18,7 @@
set in mod_perl config.
- use gmtime_r instead of gmtime for time calculation to be thread safe
+
=head1 2.0rc3 14. March 2005
- Handle warnings the same way under Embperl and Embperl::Object, so they
1.12 +4 -1 embperl/DOM.xs
Index: DOM.xs
===================================================================
RCS file: /home/cvs/embperl/DOM.xs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DOM.xs 16 Aug 2004 07:36:13 -0000 1.11
+++ DOM.xs 6 Aug 2005 21:47:37 -0000 1.12
@@ -104,6 +104,7 @@
tReq * r = CurrReq ;
PPCODE:
RETVAL = NULL ; /* avoid warning */
+ r -> Component.bSubNotEmpty = 1 ;
SvGETMAGIC_P4(sText) ;
s = SV2String (sText, l) ;
Node_replaceChildWithCDATA (r -> pApp, DomTree_self(r -> Component.xCurrDomTree), xOldChild, r -> Component.nCurrRepeatLevel, s, l, (r -> Component.nCurrEscMode & 11)== 3?1 + (r -> Component.nCurrEscMode & 4):r -> Component.nCurrEscMode, 0) ;
@@ -123,6 +124,7 @@
const char * s ;
tReq * r = CurrReq ;
PPCODE:
+ r -> Component.bSubNotEmpty = 1 ;
s = embperl_GetText (r, sId) ;
l = strlen (s) ;
Node_replaceChildWithCDATA (r -> pApp, DomTree_self(r -> Component.xCurrDomTree), xOldChild, r -> Component.nCurrRepeatLevel, s, l, (r -> Component.nCurrEscMode & 11)== 3?1 + (r -> Component.nCurrEscMode & 4):r -> Component.nCurrEscMode, 0) ;
@@ -155,6 +157,7 @@
tReq * r = CurrReq ;
PPCODE:
RETVAL = NULL ; /* avoid warning */
+ r -> Component.bSubNotEmpty = 1 ;
SvGETMAGIC_P4(sText) ;
sRet = Node_replaceChildWithUrlDATA (r, r -> Component.xCurrDomTree, xOldChild, r -> Component.nCurrRepeatLevel, sText) ;
1.92 +4 -45 embperl/Embperl.pod
Index: Embperl.pod
===================================================================
RCS file: /home/cvs/embperl/Embperl.pod,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- Embperl.pod 12 Mar 2005 13:46:07 -0000 1.91
+++ Embperl.pod 6 Aug 2005 21:47:37 -0000 1.92
@@ -57,19 +57,6 @@
line breaks or formatting into your Embperl commands where you don't
want them.
-B<VERY IMPORTANT NOTE:> If you do use an ASCII editor to write your HTML documents,
-you should set the option B<optRawInput> so that Embperl does not
-preprocess your source. You can also HTML-escape your code
-(i.e. write `<' instead of `<'), to avoid ambiguity. In most cases
-it will also work without the optRawInput and HTML-escaping, but in
-some cases Embperl will detect an HTML tag were there isn't one.
-
-B<If you have any trouble with your code, especially with HTML tags or filehandles
-in your Perl code, be sure to understand input- and output- escaping and
-unescaping. Read the section
-L<"Inside Embperl"|"Inside Embperl - How the embedded Perl code is actually processed">
-to see what's going on!!>
-
All Embperl commands start with a `[' and end with a `]'. To get a
real `[' you must enter `[['.
@@ -234,15 +221,13 @@
Example: (see eg/x/loop.htm)
[- $i = 0; @k = keys %ENV -]
- [$ while ($i < $#k) $]
+ [$ while ($i < $#k) $]
[+ $k[$i] +] = [+ $ENV{$k[$i]} +]<BR>
[- $i++ -]
[$ endwhile $]
This will send a list of all environment variables to the client.
-NOTE: The `<' is translated to `<' before calling Perl eval,
-unless optRawInput is set.
=item B<do>, B<until>
@@ -896,46 +881,20 @@
=head2 $optXXX $dbgXXX
All options (see L<"EMBPERL_OPTIONS">) and all debugging flags (see L<"EMBPERL_DEBUG">) can
-be read and set by the corresponding variables.
+be read and most of them can be set by the corresponding variables. See L<"perldoc Config"|"Config.pod">.
Example:
- [- $optRawInput = 1 -] # Turn the RawInput option on
+ [- $dbgInput = 1 -]
- Now write something here
- [- $optRawInput = 0 -] # Turn the RawInput option off again
+ [- $dbgInput = 0 -]
[+ $dbgCmd +] # Output the state of the dbgCmd flag
-There are a few exceptions, where the variables can only be read. Setting of such options
-must be done via the config-files. Read-only variables are:
-
-=over 4
-
-=item $optDisableVarCleanup
-
-=item $optSafeNamespace
-
-=item $optOpcodeMask
-
-=item $optDisableChdir
-=item $optEarlyHttpHeader
-
-=item $optDisableFormData
-
-=item $optAllFormData
-
-=item $optRedirectStdout
-
-=item $optAllowZeroFilesize
-
-=item $optKeepSrcInMemory
-
-=back
=head2 %CLEANUP
1.8 +56 -38 embperl/Intro.pod
Index: Intro.pod
===================================================================
RCS file: /home/cvs/embperl/Intro.pod,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Intro.pod 16 Aug 2004 07:36:13 -0000 1.7
+++ Intro.pod 6 Aug 2005 21:47:37 -0000 1.8
@@ -60,8 +60,7 @@
Due to this modularization, it is now possible, to replace Embperl parser
by an XML parser and to do XML processing, for example by pluging in
an XSLT processer in the processing pipeline.
-Embperl 2.0 will soon come with modules to use the Apache XERCES C++
-XML Parser and XALAN C++ XSLT processor.
+Embperl 2.0 can utilize libxml2 and libxslt for XML and XSLT processing.
All versions of Embperl can be used offline (as a normal CGI script or as a module
from other Perl code), but its real power comes when running under
@@ -81,9 +80,9 @@
programmer discover, they need more features and that other people
in the same situation has already build a soltuion for their problems.
At the moment there are five widely used Perl modules for generating
-dynamic web content (HTML::Embperl, Apache::ASP, HTML::Mason,
+dynamic web content (Embperl, Apache::ASP, HTML::Mason,
Template::Toolkit and AxKit). All of these have their special strength.
-So why to use Embperl? We believe that Embperl, especialy the upcomming
+So why to use Embperl? We believe that Embperl, especialy the
version 2.0, covers all of the aspects of these modules and integrates them
in one module with addtionaly benefits that are unique to Embperl.
Addtionaly Embperl is the fastes of these solutions, because it's engine
@@ -496,6 +495,10 @@
=item Source
+=item Parsing
+
+=item Compiling
+
=item Environment
=item Form data
@@ -508,21 +511,14 @@
=item HTTP headers
+=item and more
+
=back
-=head2 Embperl log file can be viewed via the browser
-For debugging, you can tell Embperl to display a link at the top of
-each page to your log file. If you follow the link, Embperl will show
-the portion of the log file corresponding to that request. The log
-file lines are displayed in different colors to give a better
-overview.
-
-=head2 Embperl error page contains links to the log file
-
-If you have enabled links to the log file, every error displayed in an
-error page is a link to the corresponding position in the logfile, so
-you can easily find the place where something is going wrong.
+Addtional you can write your own debug informtion to the Embperl
+logfile by writing to the special filehandle C<LOG> which is
+opend by Embperl.
=head1 Database access
@@ -641,37 +637,59 @@
every other application. Embperl maintains a separate namespace for
every document, which is enough to avoid accidentally overwriting
other applications data, but there is no real security. You can access
-anything you like if you explicitly specify a package name.
+any data from any other application that runs on the same server process
+under mod_perl if you explicitly specify a package name.
+This is not a problem of Embperl itself, but caused by the design of
+Apache and mod_perl.
-=head2 Safe namespaces
-
-Therefore, Embperl incorporates Safe.pm, which will make it impossible
-to access any packages other than your own. This can be used, for
-example, to calculate something in a Perl module and then pass the
-results to an Embperl document. If the Embperl document runs in a safe
-namespace, it can access the data it has received from the browser,
-but can't access outside itself. Therefore, it's safe to let
-different people create the layouts for Embperl pages.
-
-=head2 Operator restrictions
-
-Safe.pm also permits the administrator to disable every Perl
-opcode. If you use this, you are able to decide which Perl opcodes are
-permitted to be used by the page creators.
=head1 Escaping/Unescaping
=head2 Input: unescaping
-(disable via optRawInput)
+Embperl is able to unescape the source it reads. That is usfull
+when you use a high level HTML editor, which might add unwanted html tags
+like <BR> into your Perl code.
+
+This feature if off by default in Embperl 2.0 and can be turned on with the
+configuration directive EMBPERL_INPUT_ESCMODE.
+
+When turned on it does
-- convert HTML escapes to characters (e.g. < to <)
-- remove HTML tags from Perl code (e.g. <br> insert by high level
+=over 4
+
+=item convert HTML escapes to characters (e.g. < to <)
+
+=item remove HTML tags from Perl code (e.g. <br> insert by high level
editor)
+=back
+
=head2 Output: escaping
-(disable via escmode)
-convert special characters to HTML (e.g. < to
-<)
+It's very important to do a correct escing of your HTML output, to avoid
+security problems like cross-site-scripting. Therefor Embperl escapes all
+output that comes from Perl. This escaping is context sensitv and uses
+HTML or URL escaping, depending on the context. It's also possible to
+use XML escaping.
+
+
+The output escaping can be configured by the configuration directive
+C<EMBPERL_ESCMODE> or changed anytime inside any page by setting C<$escmode>
+
+=head1 How to continue
+
+
+There are two addtionaly introduction documents:
+
+L<"perldoc IntroEmbperlObject"|"IntroEmbperlObject.pod"> gives you an
+tutorial about how to build an object-oriented website.
+
+L<"perldoc IntroEmbperl2"|"IntroEmbperl2.pod"> describes the advanced
+features of Embperl 2
+
+For a full documenation read L<"perldoc Embperl"|"Embperl.pod"> and
+L<"perldoc Config"|"Config.pod">.
+
+You find additional informations on http://perl.apache.org/embperl
1.104 +2 -0 embperl/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /home/cvs/embperl/MANIFEST,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- MANIFEST 3 Mar 2005 07:37:05 -0000 1.103
+++ MANIFEST 6 Aug 2005 21:47:37 -0000 1.104
@@ -350,6 +350,7 @@
test/cmp/ssiep.htm
test/cmp/stdout.htm
test/cmp/sub.htm
+test/cmp/subempty.htm
test/cmp/subout.htm
test/cmp/subreq.htm
test/cmp/subtab.htm
@@ -551,6 +552,7 @@
test/html/spaces.htm
test/html/stdout/stdout.htm
test/html/sub.htm
+test/html/subempty.htm
test/html/subexec.htm
test/html/subimp.htm
test/html/subimp.pm
1.12 +2 -0 embperl/Old.xs
Index: Old.xs
===================================================================
RCS file: /home/cvs/embperl/Old.xs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Old.xs 16 Jan 2005 13:31:13 -0000 1.11
+++ Old.xs 6 Aug 2005 21:47:37 -0000 1.12
@@ -97,6 +97,7 @@
tReq * r = CurrReq ;
CODE:
{
+ r -> Component.bSubNotEmpty = 1 ;
/*
tNode xChild ;
*/
@@ -238,6 +239,7 @@
tReq * r
char * sText
CODE:
+ r -> Component.bSubNotEmpty = 1 ;
OutputToHtml (r,sText) ;
1.20 +13 -25 embperl/epcomp.c
Index: epcomp.c
===================================================================
RCS file: /home/cvs/embperl/epcomp.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- epcomp.c 25 Feb 2005 08:42:00 -0000 1.19
+++ epcomp.c 6 Aug 2005 21:47:37 -0000 1.20
@@ -2007,28 +2007,11 @@
return 0 ;
}
- #if 0
- if (SvIOK (pDomTreeSV))
- if (xOrgDomTree = SvIVX (pDomTreeSV))
- {
- if (r -> Component.xCurrDomTree == xOrgDomTree)
- return xOrgDomTree ;
-
- /*
- av_push (pSaveAV, newSViv (r -> Component.xCurrDomTree)) ;
- av_push (pSaveAV, newSViv (r -> Component.xCurrNode)) ;
- av_push (pSaveAV, newSViv (ArrayGetSize (r -> pApp, DomTree_self (xOrgDomTree) -> pOrder))) ;
-
- if (r -> Component.Config.bDebug & dbgCompile)
- lprintf (r -> pApp, "[%d]SUB: Enter from DomTree=%d into DomTree=%d, Source DomTree=%d \n", r -> pThread -> nPid, r -> Component.xCurrDomTree, xOrgDomTree, xDomTree) ;
- return r -> Component.xCurrDomTree = xOrgDomTree ;*/ /* DomTree already cloned */
- }
-#endif
-
av_push (pSaveAV, newSViv (r -> Component.xCurrDomTree)) ;
av_push (pSaveAV, newSViv (r -> Component.xCurrNode)) ;
av_push (pSaveAV, newSViv (r -> Component.nCurrRepeatLevel)) ;
av_push (pSaveAV, newSViv (r -> Component.nCurrCheckpoint)) ;
+ av_push (pSaveAV, newSViv (r -> Component.bSubNotEmpty)) ;
pDomTree = DomTree_self (xDomTree) ;
@@ -2037,9 +2020,11 @@
if (!(r -> Component.xCurrDomTree = DomTree_clone (r -> pApp, pDomTree, &pCurrDomTree, 1)))
return 0 ;
ArrayNewZero (r -> pApp, &pCurrDomTree -> pCheckpointStatus, ArrayGetSize (r -> pApp, pCurrDomTree -> pCheckpoints), sizeof(tDomTreeCheckpointStatus)) ;
- r -> Component.nCurrCheckpoint = 1 ;
+ r -> Component.nCurrCheckpoint = 1 ;
r -> Component.nCurrRepeatLevel = 0 ;
- pCurrDomTree -> xDocument = 0 ; /* set by first checkpoint */
+ r -> Component.xCurrNode = 0 ;
+ r -> Component.bSubNotEmpty = 0 ;
+ pCurrDomTree -> xDocument = 0 ; /* set by first checkpoint */
av_push (r -> pDomTreeAV, pCurrDomTree -> pDomTreeSV) ;
av_push (r -> pCleanupAV, newRV_inc (pDomTreeSV)) ;
@@ -2071,26 +2056,29 @@
epTHX_
tIndex xSubDomTree = r -> Component.xCurrDomTree ;
tIndex xDocFraq ;
+ int bSubNotEmpty = r -> Component.bSubNotEmpty ;
tDomTree * pCallerDomTree ;
tDomTree * pSubDomTree = DomTree_self (xSubDomTree) ;
if (AvFILL (pSaveAV) < 1)
return ok ;
+ if (r -> Component.xCurrNode == 0)
+ bSubNotEmpty = 1 ;
+
ArrayFree (r -> pApp, &pSubDomTree -> pCheckpointStatus) ;
- /* DomTree_checkpoint (r, -1) ; */
r -> Component.xCurrDomTree = SvIV (* av_fetch (pSaveAV, 0, 0)) ;
r -> Component.xCurrNode = SvIV (* av_fetch (pSaveAV, 1, 0)) ;
r -> Component.nCurrRepeatLevel = (tRepeatLevel)SvIV (* av_fetch (pSaveAV, 2, 0)) ;
r -> Component.nCurrCheckpoint = SvIV (* av_fetch (pSaveAV, 3, 0)) ;
+ r -> Component.bSubNotEmpty = SvIV (* av_fetch (pSaveAV, 4, 0)) + bSubNotEmpty;
sv_setiv (pDomTreeSV, r -> Component.xCurrDomTree) ;
pCallerDomTree = DomTree_self (r -> Component.xCurrDomTree) ;
- /* xDocFraq = Node_replaceChildWithNode (pSubDomTree, pSubDomTree -> xDocument, pCallerDomTree, r -> Component.xCurrNode) ; */
- r -> Component.xCurrNode = xDocFraq = Node_insertAfter (r -> pApp, pSubDomTree, pSubDomTree -> xDocument, 0, pCallerDomTree, r -> Component.xCurrNode, r -> Component.nCurrRepeatLevel) ;
- /* Element_selfSetAttribut (pCallerDomTree, Node_self (pCallerDomTree, xDocFraq), NULL, xOrderIndexAttr, NULL, nOrderNdx, 0) ; */
+ if (bSubNotEmpty)
+ r -> Component.xCurrNode = xDocFraq = Node_insertAfter (r -> pApp, pSubDomTree, pSubDomTree -> xDocument, 0, pCallerDomTree, r -> Component.xCurrNode, r -> Component.nCurrRepeatLevel) ;
if (r -> Component.Config.bDebug & dbgRun)
lprintf (r -> pApp, "[%d]SUB: Leave from DomTree=%d back to DomTree=%d RepeatLevel=%d\n", r -> pThread -> nPid, xSubDomTree, r -> Component.xCurrDomTree, r -> Component.nCurrRepeatLevel) ;
1.10 +2 -1 embperl/epdat2.h
Index: epdat2.h
===================================================================
RCS file: /home/cvs/embperl/epdat2.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- epdat2.h 27 Feb 2005 22:16:41 -0000 1.9
+++ epdat2.h 6 Aug 2005 21:47:38 -0000 1.10
@@ -280,6 +280,7 @@
bool bReqRunning ; /* we are inside of a request */
bool bSubReq ; /* This is a sub request (called inside an Embperl page) */
int nInsideSub ; /* Are we inside of a sub? */
+ int bSubNotEmpty ; /* Sub has some output */
int bExit ; /* We should exit the page */
int nPathNdx ; /* gives the index in the path where the current file is found */
char * sCWD ; /**< Current working directory */
1.27 +7 -2 embperl/epdom.c
Index: epdom.c
===================================================================
RCS file: /home/cvs/embperl/epdom.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- epdom.c 15 Jan 2005 20:17:26 -0000 1.26
+++ epdom.c 6 Aug 2005 21:47:38 -0000 1.27
@@ -1637,9 +1637,13 @@
if (!pDomTree -> xDocument)
{
+ /* first checkpoint in sub -> set xDocument */
tNodeData * pDocument ;
tAttrData * pAttr ;
+ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
+ lprintf (a, "[%d]Checkpoint: Start Sub DomTree=%d xx -> %d SVs=%d\n", a -> pThread -> nPid, r -> Component.xCurrDomTree, nRunCheckpoint, sv_count) ;
+
pDomTree -> xDocument = pCheckpoints[nRunCheckpoint].xNode ;
pDocument = Node_self (pDomTree, pDomTree -> xDocument) ;
@@ -1654,12 +1658,13 @@
NdxStringRefcntInc (a, xDocumentFraq) ;
}
-
r -> Component.nCurrCheckpoint = nRunCheckpoint+1 ;
r -> Component.nCurrRepeatLevel = 0 ;
return ;
}
+ r -> Component.bSubNotEmpty = 1 ;
+
pCheckpointStatus -> nRepeatLevel = r -> Component.nCurrRepeatLevel ;
pCheckpointStatus -> nCompileCheckpoint = nCompileCheckpoint ;
pCheckpointStatus -> xJumpFromNode = 0 ;
1.158 +3 -1 embperl/test.pl
Index: test.pl
===================================================================
RCS file: /home/cvs/embperl/test.pl,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -r1.157 -r1.158
--- test.pl 17 Jun 2005 21:14:28 -0000 1.157
+++ test.pl 6 Aug 2005 21:47:38 -0000 1.158
@@ -417,6 +417,8 @@
'subouttab.htm' => {
'repeat' => 2,
},
+ 'subempty.htm' => {
+ },
'executesub.htm' => {
'version' => 2,
'repeat' => 2,
1.1 embperl/test/cmp/subempty.htm
Index: subempty.htm
===================================================================
not undef
blablabla
1.1 embperl/test/html/subempty.htm
Index: subempty.htm
===================================================================
[$sub entry $]
[*
my ($obj) = @_ ;
return if (!$obj) ;
*]
[+ $obj +]
[$endsub $]
[$sub txt $]
blablabla
[$endsub$]
[-
entry (undef) ;
entry ('not undef') ;
txt ;
-]
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-cvs-help@perl.apache.org