perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barrie Slaymaker <barr...@slaysys.com>
Subject [1.3b2] Silent death, noisy death; CMS extensions
Date Fri, 31 Mar 2000 18:46:09 GMT
I am porting my source code archive browser presentation system, Safari,
to be able to use Embperl.  I like it: it took all of 10 lines of code to
make a filter out of it.  Safari now uses it for building it's "header"
and "footer" html, and it can be used to process source files before 
display.  <BRAG>Both uses are seen in this little test case:

http://slaysys.com/saf_dev/-/embperl/index.epl

Here, the output of the Embperl filter that processed index.epl is sent
through a syntax highlighter:

http://slaysys.com/saf_dev/s/embperl/index.epl
</BRAG>


1. Silent death

In so doing, I inserted some perl code containing '[*]' in a [! ... !]
block.  It was in the middle of several hundred lines, and I didn't notice
it :-(.

Anyway, I suddenly got "document contained no data", rather than some form
of warning or error.  Would it be possible to generate an error in this case?

Just stick a '[*]' (quotes optional) in a [!...!] block and you should be
able to reproduce it.  Here's the backtrace, FWIW:

(gdb) bt
#0  0x400ed8a7 in memcpy (dstpp=0x87d2c04, srcpp=0x87b69a3, len=4294967295) at ../sysdeps/generic/memcpy.c:55
#1  0x401cc0aa in EMBPERL_owrite ()
#2  0x401d17f6 in EMBPERL_EvalMain ()
#3  0x401cafb6 in ProcessFile ()
#4  0x401cb6a7 in EMBPERL_ExecuteReq ()
#5  0x401c4f97 in XS_HTML__Embperl__Req_ExecuteReq ()
#6  0x80872d6 in Perl_pp_entersub ()
#7  0x80b114d in Perl_runops_standard ()
#8  0x8059308 in perl_run ()
#9  0x805789f in main ()


2. Noisy death

I still didn't see the problem after a reread, so I reached behind my seat
for the shotgun and added "debug => 0xFFFF," to 
HTML::Embperl::Execute( { ... } ) to see what might be going on.

After removing enough chunks of code that I found my [*] and [[*]]ed it,
Embperl then coughed up this:

   Usage: HTML::Embperl::logevalerr(r,sText) at /usr/lib/perl5/site_perl/5.005/i686-linux/HTML/Embperl.pm
line 409.


3. CMS extensions

On another topic, a couple of things that might make it nicer for
embedding in Content Management Systems (a la Zope, or the Perlian
Iajutsu (uses Wardley's toolkit, Jellybeans, Safari: building Perlish
CMSs is quite popular right now).  Please forgive me if these already
exist and I missed them in the docs or the sources.

A. Being able to flush the output half way through when an output_func is
defined.  When creating a really large bolus of HTML, or when about to
embark on a time consuming query, it'd be nice to be able to send what's
accumulated so far to the output_func.  I looked at the source code with
an eye toward patching, but this seemed a bit non trivial, and I'm not
at all sure how it would interact with the commit/rollback code in the
io module.

B. An easy way to export variables and functions to the package containing
a page, so that I could export Safari's $context object in to a page's
namespace easily without having to add code to the page.  Currently I can
import things in to the page and pass things in via @param, but that means
all such pages need that extra little bit of boilerplate.

C. Access to %udat and %mdat from outside the pages.

D. Some way of implementing inheritence on %mdat and perhaps %udat.
The idea here being able to implement attribute inheritence that kicks
in when a key doesn't exist in the hash.  Whether this would be better
done in Embperl.pm or EmbperlObject.pm, I haven't figured out.

Anyway, thanks for a great module && keep up the good work!

- Barrie

Mime
View raw message