cvs commit: modperl-2.0/lib/ModPerl WrapXS.pm
dougm 2002/06/11 09:27:57 Modified:lib/ModPerl WrapXS.pm Log: be better prepared for GvUNIQUE support Revision ChangesPath 1.46 +3 -3 modperl-2.0/lib/ModPerl/WrapXS.pm Index: WrapXS.pm === RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- WrapXS.pm 29 May 2002 16:31:44 - 1.45 +++ WrapXS.pm 11 Jun 2002 16:27:57 - 1.46 -3,7 +3,7 use strict; use warnings FATAL = 'all'; -use constant GvSHARED = 0; #$^V gt v5.7.0; +use constant GvUNIQUE = 0; #$] = 5.008; use Apache::TestTrace; use Apache::Build (); use ModPerl::Code (); -409,7 +409,7 my($self, $name) = _; my $str = ; return $str if $name =~ /$notshared$/o; -$str = ATTRS: shared\n if GvSHARED; +$str = ATTRS: unique\n if GvUNIQUE; $str; } -471,7 +471,7 if (my $newxs = $self-{newXS}-{$module}) { for my $xs ($newxs) { print $fh qq{ cv = newXS($xs-[0], $xs-[1], __FILE__);\n}; -print $fh qq{ GvSHARED_on(CvGV(cv));\n} if GvSHARED; +print $fh qq{ GvUNIQUE_on(CvGV(cv));\n} if GvUNIQUE; } }
Re: Logging under CGI
On Mon, 10 Jun 2002, Bill Moseley wrote: You are correct to worry. You should use flock() to prevent your log file from becoming corrupted. See perldoc -f flock() for more details. Maybe it's a matter of volume. Or size of string written to the log. But I don't flock, and I keep the log file open between requests and only reopen if stat() shows that the file was renamed. So far been lucky. Nope, just plain luck. Keep it running long enough without locking and you will eventually have a corrupted log file. -sam
Re: separating C from V in MVC
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 10 June 2002 11:23 pm, Vuillemot, Ward W wrote: : Really interesting, xml : appears to be : the final destination for most of us, even if now i : prefer objects. : : Ciao, Valerio That is my big question. Is XML/XSLT really the right solution? Using SAX along with having tags call handlers seems like a pretty powerful way to get a very cool tool to build powerful templating services. I haven't decided if XSLT really is worth the effort as it just seems like a glorified XML (yes; it is indeed) -- what I mean to say, does XSLT really have any real value since everything it does can be done in Perl. If I got make handlers for XSLT, too -- then why even use XSLT? Just go back to plain XML and do it all on my own, no? There's quite a few things that are a lot harder to do with XML in plain perl (especially in SAX) than they are in XSLT. It's really hard to explain this to anyone who hasn't yet learned XSLT's template model, but the simplest thing to describe is that looping back to previous tags is really hard with SAX (you have to use some sort of node caching technique). One thing a lot of people will argue is that XSLT is verbose and ugly. And I totally agree. But get over it. Perl is ugly too. But once you start using XSLT for any length of time you start to realise just why it is designed like it is, and you start to appreciate that design (and this is from someone who has so far designed *two* alternatives to XSLT!). - -- :-get a SMart net/:- -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9BZcbVBc71ct6OywRAv81AKDMDkWvAOhwY3A0vDlxxHSK7Y6qOACgm3ni VRLe9kmR9i3tDcMJAKr8d7s= =2Xpn -END PGP SIGNATURE-
Re: Logging under CGI
On Mon, 10 Jun 2002, Tom Brown wrote: ?? AFAIK, Files opened in append mode, and written to without buffering, should _not_ get corrupted in any manner that flock would prevent. (basically small writes should be atomic.) Right, and does Perl write with buffering when you call print()? Yes, it does! that should be pretty universal for most UNIXs I've actually never heard this before. I've been taught that if you have multiple processes writing to one file you must use flock() or another equivalent mechanism to prevent overwrites. Do you have a source where I could learn about guaranteed atomic file writes without locking under UNIX? -sam
Re: Logging under CGI
On Tue, 11 Jun 2002, Sam Tregar wrote: On Mon, 10 Jun 2002, Tom Brown wrote: ?? AFAIK, Files opened in append mode, and written to without buffering, should _not_ get corrupted in any manner that flock would prevent. (basically small writes should be atomic.) Right, and does Perl write with buffering when you call print()? Yes, it does! huh? That's what $| is all about, and $|++ is a pretty common line of code. that should be pretty universal for most UNIXs I've actually never heard this before. I've been taught that if you have multiple processes writing to one file you must use flock() or another equivalent mechanism to prevent overwrites. Do you have a source where I could learn about guaranteed atomic file writes without locking under UNIX? man(2) open. see the O_APPEND option... the only footnote is that it doesn't work properly via NFS... This doesn't cover why small writes are atomic though. And man(2) write doesn't seem to either, but the open man page on my system says O_APPEND The file is opened in append mode. Initially, and before each write, the file pointer is positioned at the end of the file, as if with lseek. O_APPEND may lead to corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not supAD port appending to a file, so the client kernel has to simulate it, which can't be done without a race condition. which certainly implies that you can expect local files _not_ to get corrupted. p.s. I'm not the only one who considers it impolite to have off-list messages taken back onto the list... I generally don't post AFAIK comments to lists, prefering to keep the signal to noise ratio higher. -sam -- [EMAIL PROTECTED] | Courage is doing what you're afraid to do. http://BareMetal.com/ | There can be no courage unless you're scared. | - Eddie Rickenbacker
Re: Logging under CGI
On Tue, 11 Jun 2002, Tom Brown wrote: Right, and does Perl write with buffering when you call print()? Yes, it does! huh? That's what $| is all about, and $|++ is a pretty common line of code. A pretty common line of code that wasn't in the example shown! And that only unbuffers the currently selected filehandle. His example showed a print to a named filehandle, so a simple $|++ isn't even enough. Your advice to skip the flock() without explaining any extra steps has a pretty decent chance of resulting in a corrupt logfile given enough time. man(2) open. see the O_APPEND option... the only footnote is that it doesn't work properly via NFS... Interesting stuff. But are you sure it works with Perl? Does it work with PerlIO, which is the new default IO scheme in 5.8.0? p.s. I'm not the only one who considers it impolite to have off-list messages taken back onto the list... I generally don't post AFAIK comments to lists, prefering to keep the signal to noise ratio higher. My apologies. I assumed you omitted the mod_perl address from the CC: by accident. I actually think this discussion is still mostly signal. I would like to make sure your advice is either correct for the situation given or taken back publicly to avoid potential harm. Either outcome would be fine with me, actually. -sam
SEGV in bleadperl@17165 under mod_perl
PAUSE is suffering from a SEGV since I installed RC1. After I upgraded yesterday to snapshot 17165 I finally caught the following within gdb. I'd appreciate further instructions where to go from here. Program received signal SIGSEGV, Segmentation fault. 0x400d05ff in _IO_fflush (fp=0x89e4178) at iofflush.c:41 41 iofflush.c: No such file or directory. (gdb) bt #0 0x400d05ff in _IO_fflush (fp=0x89e4178) at iofflush.c:41 #1 0x820ed73 in PerlIOStdio_flush (my_perl=0x82ffcc8, f=0x8306d30) at perlio.c:2728 #2 0x820cefb in Perl_PerlIO_flush (my_perl=0x82ffcc8, f=0x8306d30) at perlio.c:1449 #3 0x820cfc5 in Perl_PerlIO_flush (my_perl=0x82ffcc8, f=0x8306d30) at perlio.c:1477 #4 0x816fc96 in Perl_my_popen (my_perl=0x82ffcc8, cmd=0x8a073f1 -, mode=0xb828 w) at util.c:2080 #5 0x81e5875 in Perl_do_openn (my_perl=0x82ffcc8, gv=0x8a4b104, name=0x8a073f1 -, len=1, as_raw=0, rawmode=0, rawperm=0, supplied_fp=0x0, svp=0x8592824, num_svs=0) at doio.c:282 #6 0x81cee63 in Perl_pp_open (my_perl=0x82ffcc8) at pp_sys.c:542 #7 0x816ab3e in Perl_runops_debug (my_perl=0x82ffcc8) at dump.c:1398 #8 0x81133dc in S_call_body (my_perl=0x82ffcc8, myop=0xba00, is_eval=0) at perl.c:2039 #9 0x8112f27 in Perl_call_sv (my_perl=0x82ffcc8, sv=0x8504644, flags=4) at perl.c:1957 #10 0x809f5a0 in perl_call_handler (sv=0x8504644, r=0x890984c, args=0x0) at mod_perl.c:1658 #11 0x809e616 in perl_run_stacked_handlers (hook=0x82978b9 PerlHandler, r=0x890984c, handlers=0x843426c) at mod_perl.c:1371 #12 0x809b482 in perl_handler (r=0x890984c) at mod_perl.c:897 #13 0x80e39f3 in ap_invoke_handler (r=0x890984c) at http_config.c:537 #14 0x80f8219 in process_request_internal (r=0x890984c) at http_request.c:1308 #15 0x80f827c in ap_process_request (r=0x890984c) at http_request.c:1324 #16 0x80ef61c in child_main (child_num_arg=0) at http_main.c:4596 #17 0x80ef7b0 in make_child (s=0x82f470c, slot=0, now=1023774076) at http_main.c:4711 #18 0x80ef909 in startup_children (number_to_start=2) at http_main.c:4793 #19 0x80eff66 in standalone_main (argc=5, argv=0xbc64) at http_main.c:5098 #20 0x80f0723 in main (argc=5, argv=0xbc64) at http_main.c:5443 # /usr/local/perl-5.7.3@17165/bin/perl -V Summary of my perl5 (revision 5.0 version 8 subversion 0 patch 17164) configuration: Platform: osname=linux, osvers=2.2.18pre15, archname=i686-linux-multi uname='linux pause.perl.org 2.2.18pre15 #5 fri oct 13 21:59:16 cest 2000 i686 unknown ' config_args='-Dprefix=/usr/local/perl-5.7.3@17165 -Dinstallusrbinperl=n -Uversiononly -Doptimize=-g -des -Dusedevel -Dusemultiplicity' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-g', cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil libc=/lib/libc-2.1.3.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.1.3' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Locally applied patches: DEVEL17164 Built under linux Compiled at Jun 10 2002 17:27:08 INC: /usr/local/perl-5.7.3@17165/lib/5.8.0/i686-linux-multi /usr/local/perl-5.7.3@17165/lib/5.8.0 /usr/local/perl-5.7.3@17165/lib/site_perl/5.8.0/i686-linux-multi /usr/local/perl-5.7.3@17165/lib/site_perl/5.8.0 /usr/local/perl-5.7.3@17165/lib/site_perl -- andreas
Re: Perl_Tstack_sp_ptr
Paul G. Weiss wrote: Sorry if this has been covered - I searched to no avail. I'm getting the following error when trying to start an Apache 2.0.36 with ModPerl::Registry: /usr/libexec/ld-elf.so.1: /usr/lib/perl5/site_perl/5.6.1/i386-freebsd-thread-multi/auto/Apache/Request Rec/RequestRec.so: Undefined symbol Perl_Tstack_sp_ptr All relevant build info is below. Has anyone seen and conquered this? Confirmed, I've a similar problem on linux with 5.6.1 /home/stas/httpd/prefork/bin/httpd: relocation error: /home/stas/apache.org/mp-5.6.1-prefork/ModPerl-Registry/t/../../blib/arch/Apache2/auto/Apache/RequestIO/RequestIO.so: undefined symbol: Perl_sv_2pv it happens when I run the test suite in: ModPerl-Registry: and I've traced it down to: print exists $ENV{QUERY_STRING} $ENV{QUERY_STRING}; Though I don't understand why there is relocation error, the libperl.so lib includes the symbol: nm /home/stas/perl/5.6.1-ithread/lib/5.6.1/i686-linux-thread-multi/CORE/libperl.so | grep Perl_sv_2pv 0009ae10 T Perl_sv_2pv and mod_perl is linked against it: ldd src/modules/perl/mod_perl.so libperl.so = /home/stas/perl/5.6.1-ithread/lib/5.6.1/i686-linux-thread-multi/CORE/libperl.so (0x40023000) __ Stas BekmanJAm_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
RE: separating C from V in MVC
From: Rob Nagler [mailto:[EMAIL PROTECTED]] Sent: 10 June 2002 20:41 ... a Facade is the front face of the web site which includes colors, text, URLs, etc. All the other MVC components talk to the currently selected Facade when they need these values. The controller calls Bivio::UI::Task-parse_uri, which strips the *facade from the URL (if there) and sets the facade before parsing the rest of the URL. The default Facade is www.bivio.biz, which is why we don't need a rewrite. The links are generated by the Facade component Bivio::UI::Task. Sounds interesting, can you briefly describe the MVCF parts, and what their responsibilities are? Have you split the View into View + Facade? What are the differences between your MVCF and the MVP pattern? This allows the Facade to pick its own URLs. ... URLs are part of your user interface, not your controller. I think I like this, though the w3 might not 8-) We rarely change the controller except to add new function. Query and form values are parsed by the Models after they are translated to key/value format by the controller. I definitely like this - small number of relatively generic Controllers seems to me to be a desirable goal of an MVC arch. abstracted the concept of paging and drill down in our ListModel and Table classes. I find that the mix of business object e.g. Bank Account and presentation objects, e.g. Table can lead to confusion - are your Table objects just a way of organising data, or do they contain presentation style hints -e.g. dynamic width indication etc? Do you have something similar to a Bank Account object with some primary properties and containing a collection of current Transaction objects? Or do you focus on the presentation style objects - Tables, nested Tables, Lists etc? I looked over your site and code, compact and impressive - probably a stupid question, but are there any higher-level overviews of your approach / framework? TIA Jeff
Re: OSC early bird and mod_perl T-Shirts
On Tuesday, 2002-06-11 at 10:44:26 +0100, Leon Brocard wrote: Yup, I have a designer here who is willing to come up with something. Constructive ideas welcome offlist. Better slogans than modperl: the only way to fly, modperl: obey your thirst etc. very welcome too ;-) SCNR: Quetzalcoatl: The Feathered Snake mod_perl: The Feathered Camel Profound excuses, Lupe Christoph -- | [EMAIL PROTECTED] | http://www.lupe-christoph.de/ | | I have challenged the entire ISO-9000 quality assurance team to a | | Bat-Leth contest on the holodeck. They will not concern us again. | | http://public.logica.com/~stepneys/joke/klingon.htm|
RE: OSC early bird and mod_perl T-Shirts
mod_perl: The camel with wings John -Original Message- From: Lupe Christoph [mailto:[EMAIL PROTECTED]] Sent: 11 June 2002 11:51 To: Leon Brocard Cc: mod_perl list Subject: Re: OSC early bird and mod_perl T-Shirts On Tuesday, 2002-06-11 at 10:44:26 +0100, Leon Brocard wrote: Yup, I have a designer here who is willing to come up with something. Constructive ideas welcome offlist. Better slogans than modperl: the only way to fly, modperl: obey your thirst etc. very welcome too ;-) SCNR: Quetzalcoatl: The Feathered Snake mod_perl: The Feathered Camel Profound excuses, Lupe Christoph -- | [EMAIL PROTECTED] | http://www.lupe-christoph.de/ | | I have challenged the entire ISO-9000 quality assurance team to a | | Bat-Leth contest on the holodeck. They will not concern us again. | | http://public.logica.com/~stepneys/joke/klingon.htm |
Header weirdness under mod_perl
Hi. I've set up my system to move gradually over to mod_perl and been clearing hurdles for several weeks now -- things like Apache::DBI cached connections to mysql never timing out and eventually running mysql out of connections, strange sudden bogging-down of the server, and so on, and I've worked my way past them. To implement this, I set up my server to treat scripts ending in .cgi as normal cgi scripts, and to treat scripts ending in .mp as mod_perl CGIs. Now, however, I've hit a really annoying weirdness. I received reports from several users that they suddenly couldn't login. After some frustrating grilling of them (it's almost impossible to get useful information out of a user -- it always starts with 'Why is it broke?!?!' and helpful things like OS, browser, etc are like pulling teeth). I found out that they seemed almost universally to be using Netscrape or WebTV, with a Mozilla here and there and a single Opera. No IE users reported an error, which is why it apparently took weeks for me to know about this (I'd tested web design against multiple browsers but had no reason to suspect that HTTP header interpretation would work differently). Well, it seems that there are strange headers being passed out with mod_perl, and mixed into them come carriage returns. This is, of course, bad. Technically, IE is parsing the headers wrong, because it's sweeping mast the CRLFs like there's nothing wrong with them. NS and other browsers are parsing them correctly, and as a result, the Cookie information I'm setting up comes out in the body of the response, not the headers. I'm not sure what to do about this, or why it's happening. Below, I am including the headers both from the .mp mod_perl and the .cgi standard CGI. There is NO difference between these -- as a matter of fact, they even sharre teh same inode as rather thasn copying the file I simply hard linked it. I've used c-style comments in this below. Such comments are not part of the headers, but are included to provide a clear delimiter between the two sets of headers and to add necessary comments. The 2\n\n\n\n15f\n part is particularly weird, but doesn't do anything because of the extra CRLF after the Client-Response-Num header. BTW I have PerlSendHeader specifically set to off. /* response headers from mod_perl -- sessionID has been altered for security purposes */ Client-Date: Sat, 08 Jun 2002 21:02:11 GMT Client-Response-Num: 1 Cookie: session=d1af22bd5dd71c2585be72b86e119212; domain=.gothic-classifieds.com; path=/; expires=Sat, 08-Jun-2002 22:02:11 GMTbr HTTP/1.1 200 OK Date: Sat, 08 Jun 2002 21:02:11 GMT Server: Apache/1.3.19 (Unix) mod_perl/1.25 Set-Cookie: session=d1af22bd5dd71c2585be72b86e119212; domain=.gothic-classifieds.com; path=/; expires=Sat, 08-Jun-2002 22:02:11 GMT Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=ISO-8859-1 2 15f /* response headers from standard CGI */ Connection: close Date: Sat, 08 Jun 2002 21:02:54 GMT Server: Apache/1.3.19 (Unix) mod_perl/1.25 Content-Type: text/html; charset=ISO-8859-1 Client-Date: Sat, 08 Jun 2002 21:02:55 GMT Client-Response-Num: 1 Client-Transfer-Encoding: chunked Cookie: session=d1af22bd5dd71c2585be72b86e119212; domain=.gothic-classifieds.com; path=/; expires=Sat, 08-Jun-2002 22:02:55 GMTbr Link: css/gc.css; rel=stylesheet Set-Cookie: session=d1af22bd5dd71c2585be72b86e119212; domain=.gothic-classifieds.com; path=/; expires=Sat, 08-Jun-2002 22:02:55 GMT Title: GC Login Successful: Redirecting /* end examples */
RE: OSC early bird and mod_perl T-Shirts
Maybe this year Randal Schwartz can get his idea implemented. I think he had suggested a motto last year that people seemed OK with but then the T-Shirts never got done in the end... Ah, the annual motto vote... :) Just re-read the same thread in the archives last year. Later, Gunther At 06:55 PM 6/11/2002, John Bass wrote: mod_perl: The camel with wings John -Original Message- From: Lupe Christoph [mailto:[EMAIL PROTECTED]] Sent: 11 June 2002 11:51 To: Leon Brocard Cc: mod_perl list Subject: Re: OSC early bird and mod_perl T-Shirts On Tuesday, 2002-06-11 at 10:44:26 +0100, Leon Brocard wrote: Yup, I have a designer here who is willing to come up with something. Constructive ideas welcome offlist. Better slogans than modperl: the only way to fly, modperl: obey your thirst etc. very welcome too ;-) SCNR: Quetzalcoatl: The Feathered Snake mod_perl: The Feathered Camel Profound excuses, Lupe Christoph -- | [EMAIL PROTECTED] | http://www.lupe-christoph.de/ | | I have challenged the entire ISO-9000 quality assurance team to a | | Bat-Leth contest on the holodeck. They will not concern us again. | | http://public.logica.com/~stepneys/joke/klingon.htm | __ Gunther Birznieks ([EMAIL PROTECTED]) eXtropia - The Open Web Technology Company http://www.eXtropia.com/ Office: (65) 64791172 Mobile: (65) 96218290
Re: separating C from V in MVC
On Mon, 2002-06-10 at 13:29, Ray Zimmerman wrote: So how is everybody else handling URL mapping? Do others group this kind of data together with fonts, colors, etc? And where do you define it? As Perrin mentioned, OpenInteract does this by allowing individual packages (distributable applications) to define the handlers they support. A package does this by defining actions which at server startup get collected into a data structure called the action table. A single mod_perl handler catches all requests, looks up the URL in the action table and dispatches the request to the appropriate handler. That handler is free to pass on the request to other actions as well, since every part of the system is able to lookup actions based on a key. Entries in the action table can also be used as components -- displayable items that don't stand by themselves but contribute to a full page. Examples include boxes, common search forms, dependent object listings, etc. Currently, here's what an action looks like, as found in the 'base_user' package distibuted with OpenInteract: $action = { 'user'= { 'class'= 'OpenInteract::Handler::User', 'security' = 'no', }, 'newuser' = { 'class'= 'OpenInteract::Handler::NewUser', 'error'= [ 'OpenInteract::Error::User' ], 'security' = 'no', }, }; All information is available through a lookup to the action table. One of the modifications I'm working on now will allow you to add more information to the action and have it available in an object that is instantiated by the dispatcher which then tells the object to run itself. Chris -- Chris Winters ([EMAIL PROTECTED]) Building enterprise-capable snack solutions since 1988.
The T in MVC?
I have some questions for users of Templating... we currently, (in another language) have a set of standard functions for things like printing data tables, so in our HTML page outlines, we just insert a call to printDataTable( table = $table, user = $user, data = $data, layout = layout ); parameters: * $table = optional ref to hash containing table title, any unusual table properties etc. * $user = ref to hash of user preferences * $data = ref to array of hash * $layout = ref to array of field names This standard routine combines these details and produces an HTML table containing the data. The use of standard routines ensures consistency throughout the entire site. Our printDataTable() function references site specific configuration data so that all the tables within a website are consistent, but that different sites can have their own skins applied. How is something like this best accomplished with the templating tools like TT? I guess I am asking how the template world achieves intra/extra site reuse and ensures consistency? Tia Jeff
Re: separating C from V in MVC
On Tuesday, June 11, 2002, at 01:37 PM, Chris Winters wrote: On Mon, 2002-06-10 at 13:29, Ray Zimmerman wrote: So how is everybody else handling URL mapping? Do others group this kind of data together with fonts, colors, etc? And where do you define it? A single mod_perl handler catches all requests, looks up the URL in the action table and dispatches the request to the appropriate handler. That handler is free to pass on the request to other actions as well, since every part of the system is able to lookup actions based on a key. Currently OpenFrame does something similar. We have a slot which dispatches to an application based on the URL. However, I think for future versions applications will be 'slots', and they can just do something or nothing depending on the URL, which allows multiple applications to run on the same request, which fixes my 'how the heck do I make subrequests work' nightmare. We're also going to provide a 'forced' mvc style Application type in the next version[0] which will be a container that has a model, a view, and a controller. The data that each of the MVC elements provides will simply be passed from one to the other inside the container. As what may be a departure from the norm, in OpenFrame templates, or a templating system is *not* the view part of MVC. Templates simply decide where to place the data on the screen - the view class does all the formatting and prep work. Regards, James. [0] of course this is the next version that has been being written for the last 3 months and not gotten anywhere. Sooner or later I will get around to turning thought into code, and then all will be right and good in the world[1]. [1] or at least in my world
RE: Perl_Tstack_sp_ptr
I should also mention -- my perl is patched with the patch to DynaLoader.pm that Doug MacEachern posted in this list. -P -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 4:06 AM To: Paul G. Weiss Cc: [EMAIL PROTECTED] Subject: Re: Perl_Tstack_sp_ptr Paul G. Weiss wrote: Sorry if this has been covered - I searched to no avail. I'm getting the following error when trying to start an Apache 2.0.36 with ModPerl::Registry: /usr/libexec/ld-elf.so.1: /usr/lib/perl5/site_perl/5.6.1/i386-freebsd-thread-multi/auto/ Apache/Request Rec/RequestRec.so: Undefined symbol Perl_Tstack_sp_ptr All relevant build info is below. Has anyone seen and conquered this? Confirmed, I've a similar problem on linux with 5.6.1 /home/stas/httpd/prefork/bin/httpd: relocation error: /home/stas/apache.org/mp-5.6.1-prefork/ModPerl-Registry/t/../. ./blib/arch/Apache2/auto/Apache/RequestIO/RequestIO.so: undefined symbol: Perl_sv_2pv it happens when I run the test suite in: ModPerl-Registry: and I've traced it down to: print exists $ENV{QUERY_STRING} $ENV{QUERY_STRING}; Though I don't understand why there is relocation error, the libperl.so lib includes the symbol: nm /home/stas/perl/5.6.1-ithread/lib/5.6.1/i686-linux-thread-mult i/CORE/libperl.so | grep Perl_sv_2pv 0009ae10 T Perl_sv_2pv and mod_perl is linked against it: ldd src/modules/perl/mod_perl.so libperl.so = /home/stas/perl/5.6.1-ithread/lib/5.6.1/i686-linux-thread-mult i/CORE/libperl.so (0x40023000) __ Stas BekmanJAm_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
sub init() ... does this have any special purpose?
I was once told that in order for mod_perl CGI code to work properly all functionality/logic needed to reside in a function named init(). Now that I'm pouring over mod_perl documentation getting things running, I haven't found any mention of this. So ... is there any special purpose w/in mod_perl for sub init? or is it just a common naming convention? or is it baloney? Example: -- #!/usr/local/bin/perl use CGI; use HTML::Template; use DButils;# custom DB wrapper mod use strict; use vars qw($cgi, $dbh); $cgi = new CGI; $dbh = DButils::loginDB; init(); DButils::logoutDB($dbh); sub init { my $template = HTML::Template-new(filename = template.html, global_vars = 1, cache = 1); # ... blah, blah, blah ... print $cgi-header; print $template-output; return 1; } -- Thanks, - Mark www.fantasycup.com
Re: separating C from V in MVC
I know we are straying WOT, but I would love to get a better feel for XML, XSLT and AxKit. There are a lot of different systems out there. . .and part of me wants to just do it my way (in large part to learn), but I also realize that I really want to get to the business of also being productive. Per the below, I would imagine some would say XML in and of itself is not worth considering as a contender for being the basis for our C of MVC. AxKit bills itself as an XML application. Would ppl suggest just using an XSLT parser. . .or is it worth looking at AxKit. If anyone is willing to share their experiences, knowledge, insight -- off the ML is okay, too -- I would _really_ appreciate it! Thanks, Ward -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 10 June 2002 11:23 pm, Vuillemot, Ward W wrote: : Really interesting, xml : appears to be : the final destination for most of us, even if now i : prefer objects. : : Ciao, Valerio That is my big question. Is XML/XSLT really the right solution? Using SAX along with having tags call handlers seems like a pretty powerful way to get a very cool tool to build powerful templating services. I haven't decided if XSLT really is worth the effort as it just seems like a glorified XML (yes; it is indeed) -- what I mean to say, does XSLT really have any real value since everything it does can be done in Perl. If I got make handlers for XSLT, too -- then why even use XSLT? Just go back to plain XML and do it all on my own, no? There's quite a few things that are a lot harder to do with XML in plain perl (especially in SAX) than they are in XSLT. It's really hard to explain this to anyone who hasn't yet learned XSLT's template model, but the simplest thing to describe is that looping back to previous tags is really hard with SAX (you have to use some sort of node caching technique). One thing a lot of people will argue is that XSLT is verbose and ugly. And I totally agree. But get over it. Perl is ugly too. But once you start using XSLT for any length of time you start to realise just why it is designed like it is, and you start to appreciate that design (and this is from someone who has so far designed *two* alternatives to XSLT!). - -- :-get a SMart net/:- -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9BZcbVBc71ct6OywRAv81AKDMDkWvAOhwY3A0vDlxxHSK7Y6qOACgm3ni VRLe9kmR9i3tDcMJAKr8d7s= =2Xpn -END PGP SIGNATURE- -- Ward W. Vuillemot [EMAIL PROTECTED]
Re: separating C from V in MVC
On Tue, 11 Jun 2002, Ward Vuillemot wrote: I know we are straying WOT, but I would love to get a better feel for XML, XSLT and AxKit. There are a lot of different systems out there. . .and part of me wants to just do it my way (in large part to learn), but I also realize that I really want to get to the business of also being productive. Per the below, I would imagine some would say XML in and of itself is not worth considering as a contender for being the basis for our C of MVC. AxKit bills itself as an XML application. Would ppl suggest just using an XSLT parser. . .or is it worth looking at AxKit. If anyone is willing to share their experiences, knowledge, insight -- off the ML is okay, too -- I would _really_ appreciate it! A while ago (couple of months I think) on the AxKit-Dahut IRC channel Eric Cholet was raving about how he had discovered how cool XML was. What really happened was that Eric discovered that XML isn't about the Syntax, which seems to be what everybody focuses on (especially perl people I find). The beauty of XML is in the tools. Things like SAX, which allow you to build a pipeline of specialised tools for munging data, are really why XML is so great. I really can't put it as well as Eric did at the time. I only hope by using his name out loud here I can prompt him to post something ;-) Basically I would just suggest that the set of tools for manipulating XML are better than most of the other tools you currently use for munging data about. Taken a step further, while perl is cool at munging text, most of us don't just deal with text - we deal with trees, records, etc. So by combining Perl and XML you get the best of both those worlds. The XML solutions I've seen tend to be the least hacked looking systems I've seen in my relatively few years of experience. I know that's not specifically about AxKit. What AxKit does offer is a mature stable system for bringing these tools together, plus it offers nice ways to deliver the same content in different formats. -- !-- Matt -- :-Get a smart net/:-
Re: separating C from V in MVC
Ward Vuillemot wrote: I know we are straying WOT, but I would love to get a better feel for XML, XSLT and AxKit. Barrie Slaymaker has written a couple of articles on perl.com that serve as a good intro to AxKit. - Perrin
Re: sub init() ... does this have any special purpose?
Mark Korey wrote: I was once told that in order for mod_perl CGI code to work properly all functionality/logic needed to reside in a function named init(). Now that I'm pouring over mod_perl documentation getting things running, I haven't found any mention of this. So ... is there any special purpose w/in mod_perl for sub init? or is it just a common naming convention? or is it baloney? There is nothing special about init(). Are you talking about initializing globals? or the closure effect with registry? That's two possible issues people may talk about a sub whose name can be init() or else. In your example there is no need for init(). __ Stas BekmanJAm_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
requesting feedback on MVC implementation
All this MVC discussion has been very helpful. There are obviously many ways to do MVC web apps and I'd love to get a bit of feedback on the approach we are currently planning for ours before we jump into coding. Our app is a platform for running econ experiments, each of which is structured a bit like a multi-player game. We already have a pretty well developed Model containing the application logic, and for the web UI we're planning to use Mason for a number of reasons which I won't get into here. The only reason I mention it is that our approach does use Mason specific features like autohandlers/dhandlers. The directory structure looks something like ... /C /autohandler /login /register_action /login_action /E /Game1 /autohandler /submit_decision_action /display_results_action /Game2 /autohandler /submit_decision_action /display_results_action /V /autohandler /login /E /Game1 /autohandler /decision_submission_view /results_view /Game2 /autohandler /decision_submission_view /results_view ... where the stuff under /C makes up the Controller(s) and the stuff under /V the Views. The C components and corresponding autohandlers are pure Perl (no HTML output) and the V components and autohandlers are simple templates with minimal code (presentation-related only). URLs would always point to some action component under /C which would then call the appropriate view component under /V using the new sub-request mechanism in Mason 1.1. This would allow us to use autohandlers as a directory based inheritance mechanism for sharing Controller code. And we can also use autohandlers as a directory based inheritance for templates for wrapping page content. So a Controller would consist of an action component and all of its autohandlers, and a View would consist of the view component and its autohandlers. In order to avoid hard coding paths URLs, we would use something like the action table Chris Winters mentioned. This would be a Perl object with action key to component path mappings, as well as view name to component path mappings. We'd probably put this action table as well as some of the font/color type of data together into some UIConfig class, similar to what Rob Nagler is doing with his Facade. The appropriate sub-class of UIConfig to use for a given request would be specified in the autohandlers under /C, with /C/autohandler providing a default, which could be overridden by /C/E/Gamen/autohandler. One nice feature of this architecture is that it should allow us to easily create a new Game3 which inherits all actions and views from Game2. Overriding an action or view could be done by creating a new UIConfig sub-class which inherits from the one used by Game2 and overrides the corresponding entry in the action table. I'm sure there are details that I haven't thought about yet, but any comments on this structure? Tear it apart! :-) -- Ray Zimmerman / e-mail: [EMAIL PROTECTED] / 428-B Phillips Hall Sr Research / phone: (607) 255-9645 / Cornell University Associate / FAX: (815) 377-3932 / Ithaca, NY 14853
mod_perl2 Web Application Standard?
Hi, All this talk of MVC and a universal despatch mechanism has started me thinking about Java Web Applications and how they are bundled into a standard configuration (e.g., Java's Servlet standard 2.3) Would such a standard (albeit optional) be useful for mod_perl2? Generally standards run contrary to the TMTOWTDI approach of Perl but there are some advantages in a 'minimal' mod_perl web application standard: * ISP's could install mod_perl applications in a uniform/consistent way - (e.g., the standard should prevent name space collisions etc.) * A subset of mod_perl methods could be selected as a basis for the standard allowing other 'container' servers besides Apache (e.g., like http://jetty.mortbay.org - except in Perl not Java) * Software companies (not sure who) could provide replication/clustered/load balanced solutions based on this standard * Application configuration/management tools could be used to administer mod_perl application(s) on the same server(s) * We could share 'mod_perl' applications on CPAN more easily/quickly Ideally, I'd like to download a single mod_perl archive file (e.g., application.mod) place it in a 'standard' application directory and then point my browser to the new application. Is this something that could be considered with the next release of modperl2? I'm thinking of something that is really 'lite', not too prescriptive, but achieves the objectives above. Nigel Ward Vuillemot wrote: I know we are straying WOT, but I would love to get a better feel for XML, XSLT and AxKit. Barrie Slaymaker has written a couple of articles on perl.com that serve as a good intro to AxKit. - Perrin -- Nigel Hamilton Turbo10 Metasearch Engine email: [EMAIL PROTECTED] tel:+44 (0) 207 987 5460 fax:+44 (0) 207 987 5468 http://turbo10.com Search Deeper. Browse Faster.
RE: Perl_Tstack_sp_ptr
On Tue, 11 Jun 2002, Paul G. Weiss wrote: I had already thought of that. Strace shows that the correct libperl.so is the one that is being loaded. Just to make sure I deleted all others and did ln -s /usr/lib/perl5/5.6.1/i386-freebsd-thread-multi/CORE /usr/lib but strace tells me that it is still directly loading the correct one, probably because of the -Wl,-R/usr/lib/perl5/5.6.1/i386-freebsd-thread-multi/CORE used in linking mod_perl.so. ok. That being said I tried the LoadFile directive as you suggested. This indeed lets the system start, but now it can serve no pages ( not even static ones ). This is true even when all mod_perl configuration directive are removed from the conf file (except the LoadFile and the LoadModule). However, when I do httpd -X, it works - I can even serve mod_perl content. But regular httpd just hangs. The strace output of an httpd process shows this: accept(5, {sin_family=AF_INET6, sin6_port=htons(1303), inet_pton(AF_INET6, :::65.204.1.133, sin6_addr), sin6_flowinfo=0}, [28]) = 20 could this be a version of freebsd with broken threads support? i've heard many cases of that. chances are if you rebuild perl without -Dusethreads and apache with the prefork mpm, this problem won't be there.
Re: separating C from V in MVC
John Hurst wrote: Still, I don't think that replacing this: Location /search SetHandler perl-script PerlHandler Controller::Search /Location with this: [% Ctrl.Search() %] makes Controller::Search any less a controller. You're right. It just looks kind of odd to me, invoking a template for something that is not a display-related task. It looks like the way people typically do MVC in Mason or Embperl, with a first template that doesn't do anything but invoke a module to take over the processing. Obviously, the stand-alone dynamic pages are not MVC at all. They exist because there are often 'glue' pages that don't warrant the comlexity of MVC (those that don't need M and have very simple VC needs). I agree that there is often a need for some quick and dirty internal-use pages (admin or reporting usually) that don't require the extra baggage. - Perrin
Re: mod_perl 1.99-02 cgi_header_out
On Mon, 10 Jun 2002, John Bass wrote: Hello, Does anyone have a solution for the cgi_header_out function within mod_perl 2. I have found it is used by Apache:Session, and would like to use this module. i was going to ask, why on earth would Apache::Session use cgi_header_out, but then i downloaded 1.54 and see that it does not. what version are you using? you will need to have 'PerlModule Apache::compat' configured for the header_{in,out} methods.
Re: separating C from V in MVC
On 6/11/02 12:46 PM, Perrin Harkins wrote: John Hurst wrote: Still, I don't think that replacing this: Location /search SetHandler perl-script PerlHandler Controller::Search /Location with this: [% Ctrl.Search() %] makes Controller::Search any less a controller. You're right. It just looks kind of odd to me, invoking a template for something that is not a display-related task. It looks like the way people typically do MVC in Mason or Embperl, with a first template that doesn't do anything but invoke a module to take over the processing. ...but it has several advantages. I particularly appreciate being able to add to or change parameters or behaviors before passing things off to the controller, for example. I can have several variants of the same controller living at different URLs, all pointing back to a single controller object. Don't think of it as invoking a template. Just think off it as an inverted dispatch mechanism: the actions camp out at their locations, as opposed to having their locations (in the httpd.conf) pointing at the controller modules. Or something... :) -John
Re: Perl_Tstack_sp_ptr
could this be a version of freebsd with broken threads support? i've heard many cases of that. chances are if you rebuild perl without -Dusethreads and apache with the prefork mpm, this problem won't be there. so the problem that I see on linux is unrelated? this tested with prefork Apache cvs and perl built as: ./Configure -des -Dprefix=/home/stas/perl/5.6.1-ithread \ -Dusethreads -Doptimize='-g' -Duseshrplib -Dusedevel Stas Bekman wrote: Paul G. Weiss wrote: Sorry if this has been covered - I searched to no avail. I'm getting the following error when trying to start an Apache 2.0.36 with ModPerl::Registry: /usr/libexec/ld-elf.so.1: /usr/lib/perl5/site_perl/5.6.1/i386-freebsd-thread-multi/auto/Apache/Request Rec/RequestRec.so: Undefined symbol Perl_Tstack_sp_ptr All relevant build info is below. Has anyone seen and conquered this? Confirmed, I've a similar problem on linux with 5.6.1 /home/stas/httpd/prefork/bin/httpd: relocation error: /home/stas/apache.org/mp-5.6.1-prefork/ModPerl-Registry/t/../../blib/arch/Apache2/auto/Apache/RequestIO/RequestIO.so: undefined symbol: Perl_sv_2pv it happens when I run the test suite in: ModPerl-Registry: and I've traced it down to: print exists $ENV{QUERY_STRING} $ENV{QUERY_STRING}; Though I don't understand why there is relocation error, the libperl.so lib includes the symbol: nm /home/stas/perl/5.6.1-ithread/lib/5.6.1/i686-linux-thread-multi/CORE/libperl.so | grep Perl_sv_2pv 0009ae10 T Perl_sv_2pv and mod_perl is linked against it: ldd src/modules/perl/mod_perl.so libperl.so = /home/stas/perl/5.6.1-ithread/lib/5.6.1/i686-linux-thread-multi/CORE/libperl.so (0x40023000) __ Stas BekmanJAm_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 -- __ Stas BekmanJAm_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
RE: AuthenNTLM, IE, KeepAlives, Post?
Hi there, On Tue, 11 Jun 2002, Harnish, Joe wrote: Does anyone know of issues with mod_perl and post? Here's one. 73, Ged. From [EMAIL PROTECTED] Tue Jun 11 18:16:11 2002 Date: Wed, 20 Mar 2002 19:20:29 + (GMT) From: Ged Haywood [EMAIL PROTECTED] To: Stas Bekman [EMAIL PROTECTED] Subject: Re: mod_perl does not see multipart POSTs -- SOLVED Hi Stas, On Thu, 21 Mar 2002, Stas Bekman wrote: Vuillemot, Ward W wrote: Using the POST2GET snippet was interferring. I kept trying to tell him that... Ward, Ernest, can you please send the me the required changes If you look in CGI.pm you'll see that the file upload code won't get called if the request is GET, so POST2GET guarantees that it will fail for CGI.pm. Here's a snippet from the modified CGI.pm that I sent to him and which it seems he never bothered to try out. -- # Process multipart postings, but only if the initializer is # not defined. # debugging... --GWH-- my $tempEnvContentType = $ENV{'CONTENT_TYPE'}; print STDERR CGI.pm: \$ENV{'CONTENT_TYPE'}=[$tempEnvContentType]\n; print STDERR CGI.pm: \$meth=[$meth]\n; if ($meth eq 'POST' defined($ENV{'CONTENT_TYPE'}) $ENV{'CONTENT_TYPE'}=~m|^multipart/form-data| !defined($initializer) ) { my($boundary) = $ENV{'CONTENT_TYPE'} =~ /boundary=\?([^\;,]+)\?/; $self-read_multipart($boundary,$content_length); last METHOD; } -- 73, Ged.
Re: Perl_Tstack_sp_ptr
On Wed, 12 Jun 2002, Stas Bekman wrote: so the problem that I see on linux is unrelated? dunno, i built with -Duseshrplib and seems ok linkage wise. tho some ModPerl-Registry are tests failing with the same problem in special_blocks: # testing : ModPerl::Registry is not running BEGIN blocks on the second req # expected: '' # received: undef not ok 6
Re: separating C from V in MVC
On Tue, 11 Jun 2002, John Siracusa wrote: You're right. It just looks kind of odd to me, invoking a template for something that is not a display-related task. It looks like the way people typically do MVC in Mason or Embperl, with a first template that doesn't do anything but invoke a module to take over the processing. ...but it has several advantages. I particularly appreciate being able to add to or change parameters or behaviors before passing things off to the controller, for example. I can have several variants of the same controller living at different URLs, all pointing back to a single controller object. I think that it is also more manageable by people who doesn't want to understand configurations; designers who worked with me found this approach handy. Don't think of it as invoking a template. Just think off it as an inverted dispatch mechanism: the actions camp out at their locations, as opposed to having their locations (in the httpd.conf) pointing at the controller modules. Or something... :) And it is a sort of grid layout, mentioned by someone in a previous message; but it still remains an impure approach :( Ciao, Valerio Valerio Paolini, http://130.136.3.200/~paolini -- what is open-source about? Learn, and then give back
RE: AuthenNTLM, IE, KeepAlives, Post?
Title: RE: AuthenNTLM, IE, KeepAlives, Post? Ged, Will this help even when I am not up loading files? Here is the test.pl script I am using. #!/usr/bin/perl require CGI; use strict; my $q = new CGI; print $q-header; print EODUMP; html body form method=post input type=text name=foobr input type=submit value=submit /form br EODUMP print $q-param('foo'); print /body/html; this works fine with a get method but a post doesn't. It runs the first time but the second it repeats the original request. Thanks Joe -Original Message- From: Ged Haywood [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 1:18 PM To: Harnish, Joe Cc: '[EMAIL PROTECTED]' Subject: RE: AuthenNTLM, IE, KeepAlives, Post? Hi there, On Tue, 11 Jun 2002, Harnish, Joe wrote: Does anyone know of issues with mod_perl and post? Here's one. 73, Ged. From [EMAIL PROTECTED] Tue Jun 11 18:16:11 2002 Date: Wed, 20 Mar 2002 19:20:29 + (GMT) From: Ged Haywood [EMAIL PROTECTED] To: Stas Bekman [EMAIL PROTECTED] Subject: Re: mod_perl does not see multipart POSTs -- SOLVED Hi Stas, On Thu, 21 Mar 2002, Stas Bekman wrote: Vuillemot, Ward W wrote: Using the POST2GET snippet was interferring. I kept trying to tell him that... Ward, Ernest, can you please send the me the required changes If you look in CGI.pm you'll see that the file upload code won't get called if the request is GET, so POST2GET guarantees that it will fail for CGI.pm. Here's a snippet from the modified CGI.pm that I sent to him and which it seems he never bothered to try out. -- # Process multipart postings, but only if the initializer is # not defined. # debugging... --GWH-- my $tempEnvContentType = $ENV{'CONTENT_TYPE'}; print STDERR CGI.pm: \$ENV{'CONTENT_TYPE'}=[$tempEnvContentType]\n; print STDERR CGI.pm: \$meth=[$meth]\n; if ($meth eq 'POST' defined($ENV{'CONTENT_TYPE'}) $ENV{'CONTENT_TYPE'}=~m|^multipart/form-data| !defined($initializer) ) { my($boundary) = $ENV{'CONTENT_TYPE'} =~ /boundary=\?([^\;,]+)\?/; $self-read_multipart($boundary,$content_length); last METHOD; } -- 73, Ged.
Re: separating C from V in MVC
At 01:01 PM 06/11/02 -0400, John Siracusa wrote: On 6/11/02 12:46 PM, Perrin Harkins wrote: John Hurst wrote: Still, I don't think that replacing this: Location /search SetHandler perl-script PerlHandler Controller::Search /Location with this: [% Ctrl.Search() %] makes Controller::Search any less a controller. You're right. It just looks kind of odd to me, invoking a template for something that is not a display-related task. It looks like the way people typically do MVC in Mason or Embperl, with a first template that doesn't do anything but invoke a module to take over the processing. ...but it has several advantages. I particularly appreciate being able to add to or change parameters or behaviors before passing things off to the controller, for example. I can have several variants of the same controller living at different URLs, all pointing back to a single controller object. This is how CGI::Application works, but instead of calling a template page, it calls a script. The script is tiny -- defines a run mode, and perhaps parameters -- then calls the main script that does the heavy lifting, which in turn instantiates standard modules that provide standard functionality. I was intrigued by it, because at the time I was using a different approach with shopping software: each link or form action called the same script, which would figure out what needed to be done. Kind of like the tail wags the dog instead of the other way around. This is outside of MVC, but is nonetheless intriguing. I'm wondering if, in another 2-3 years, after the authors of the several Perl application frameworks have had more time to refine their designs, there will be convergence of issues like this. Am I wrong, or is this field of web applications a developing field for which there is no textbook principles of how to do it? Perl has enabled several people to take different approaches to it, whereas Microsoft's ASP is just one approach, PHP is just one approach, and I don't know if Java has multiple approaches or what. Will the various Perl approaches converge toward a common set of principles, and/or reveal as yet undiscerned patterns and architectures? Or maybe I'm imagining too much here... Ron Don't think of it as invoking a template. Just think off it as an inverted dispatch mechanism: the actions camp out at their locations, as opposed to having their locations (in the httpd.conf) pointing at the controller modules. Or something... :) -John
Re: separating C from V in MVC
[% Ctrl.Search() %] makes Controller::Search any less a controller. You're right. It just looks kind of odd to me, invoking a template for something that is not a display-related task. It looks like the way people typically do MVC in Mason or Embperl, with a first template that doesn't do anything but invoke a module to take over the processing. Embperl 2.0 can invoke such a controller (it's called application object there) after it has setup it's request parameters (GET/POST data, session data, etc.) and before any templates are get a chance to run. So this application object is able to do the necessary processing and give back parameters to Embperl so the right templates will be displayed, according to the result of the controllers processing. This approach has the benefit that Embperl does the tasks that need to be done for every request, so you don't have to care about it and can concentrate on the real controller functions. Additionaly it implements an object orientated approach, so you can get addtional benefits by spliting up your controllers functionality in different application objects, which inherit from each other. (same inherence schema can be used for templates) Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925131 WWW:http://www.ecos.de Fax: +49 6133 925152 -
Apache Error Log
Hey people.. Wondering if someone could help me with this... I recently started using modperl2/apache2. Everything seems to work ok except for Apache's error logging. I don't seem to get my apache stderr untill I shutdown/restart the server. Thenit prints out the whole thing in one big batch. I read somewhere that modperl possibly takes over the logging handler for apache but I tried a PerlOptions -Log in the conf file and that doesn't seem to help. I posted my configuration along with this.. i don't really know what I'm doing when it comes to modperl2 so any help is appreciated.. thanks VirtualHost ErrorLog /home/webroot/sites/logs/www-error.log Alias /cgi-bin/ /home/webroot/sites/www/perl/ Alias perl/ /perl/ PerlModule Apache::Reload PerlModule ModPerl::Registry PerlSwitches -w PerlSwitches -T PerlOptions -Log Location /perl PerlOptions -ParseHeaders SetHandler perl-script PerlResponseHandler ModPerl::Registry Options ExecCGI allow from all /Location PerlRequire /home/webroot/sites/conf/perl_conf/startup.pl /VirtualHost
mod perl and RecDescent module error
Hi I have the simplest test case of a mod perl module which is using Rec::Descent module to parse some string. I can run the script on command line so there is no problem with the script but when run via web server as a mod_perl module, I get an error in the error_log : [Tue Jun 11 14:25:27 2002] [error] Unknown starting rule (Parse::RecDescent::0::Replace) called at /home/praveen/temp/mod_perl_expr.pm line 9 The web server is running as 'praveen' - the same user which can also run the script from command line to test out 'mod_perl_expr.pm' module. The relevant portion in httpd.conf : Location /mod_perl_expr SetHandler perl-script PerlHandler mod_perl_expr /Location The mod_perl module is given : package mod_perl_expr; use strict; use Parse::RecDescent; sub handler { my $r=shift; my $p=Parse::RecDescent-new(grammar()); my $result = 0; eval { $result = $p-expr(3+4) }; $r-send_http_header; printEOJ; htmlbodyH3RESULT - $result/h3/body/html EOJ } sub grammar { return'GRAMMAR'; expr : number '+' number {$return=$item[1]+$item[3]; } number : /\d+/ GRAMMAR } 1; = - Praveen __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
FreeBSD Apache/mod_perl/OpenSRS/expat problem + solution
(Apologies if you see this twice -- I sent it from an unsubscribed email address first.) Hi folks, I just ran down a problem that was somewhat hard to find, and I didn't see any mention of anything like it in the archives anywhere. I thought it might be helpful to mention the details in case someone else is ever in the same situation. I'm running FreeBSD 4.5, with perl 5.6.1 and Apache 1.3.24. I had a working installation of the regular OpenSRS perl code via cgi-bin, but I thought I'd get it running under Apache::Registry in mod_perl. To my surprise, the Apache daemons would dump core whenever I tried to log in with manage.cgi. It turns out that the current FreeBSD port of Apache uses it's own internal version of expat, which is an XML library of some kind. This internal version doesn't connect up well with the version that XML::Parser is expecting to find. Turning this off in the Apache build fixed the problem, and the OpenSRS code runs very nicely under mod_perl now. At this point, I don't understand what functionality I've lost by not having the expat code built into the Apache binary. The configure option to leave out expat is --disable-rule=EXPAT. In the FreeBSD port, that's easily added to the CONFIGURE_ARGS variable in the Makefile. I don't know if this applies to any other platform. My guess is that it could, since I think the default for Apache is to use the internal version of expat. Hope this helps someone! -- Bill O'Hanlon [EMAIL PROTECTED] Professional Network Services, Inc. 612-379-3958 http://www.pro-ns.net
Fw: Apache Error Log
- Original Message - From: steve To: [EMAIL PROTECTED] Sent: Sunday, June 09, 2002 7:42 AM Subject: Apache Error Log Hey people.. Wondering if someone could help me with this... I recently started using modperl2/apache2. Everything seems to work ok except for Apache's error logging. I don't seem to get my apache stderr untill I shutdown/restart the server. Thenit prints out the whole thing in one big batch. I read somewhere that modperl possibly takes over the logging handler for apache but I tried a PerlOptions -Log in the conf file and that doesn't seem to help. I posted my configuration along with this.. i don't really know what I'm doing when it comes to modperl2 so any help is appreciated.. thanks VirtualHost ErrorLog /home/webroot/sites/logs/www-error.log Alias /cgi-bin/ /home/webroot/sites/www/perl/ Alias perl/ /perl/ PerlModule Apache::Reload PerlModule ModPerl::Registry PerlSwitches -w PerlSwitches -T PerlOptions -Log Location /perl PerlOptions -ParseHeaders SetHandler perl-script PerlResponseHandler ModPerl::Registry Options ExecCGI allow from all /Location PerlRequire /home/webroot/sites/conf/perl_conf/startup.pl /VirtualHost
installation problems
I am trying to install mod perl as part of Apache-ASP and am stuck at the following error: Apache.exe -k start Can't locate Cwd.pm in INC (INC contains: .) at (eval 1) line 1. I've searched the web and haven't found any solutions. I have checked the perl INC using 'perl -V' and the path to Cwd.pm is there: INC: C:/Perl/lib C:/Perl/site/lib . but it only seems to actually be looking at the current directory. Not sure what to do next, or where to change these paths. I'm wondering if I need \s instead of /s? thanks for any help? will
2 New Books Needed (was MVC soup, separating C from V in MVC)
Two good books could be written on these subjects: * Mastering Design Patterns with Perl (I understand that Mastering Algorithms with Perl sells quite well) * Rapid Web Application Development with Perl The second one would describe the various application frameworks available, and related tools. Perhaps an expansion of what is at http://perl.apache.org/release/docs/tutorials. It would describe what is available in order to help people decide what to use, it would demonstrate principles of application development, with model code. And, it could help unify the efforts that are out there -- if two systems are extremely similar, why not combine them. It would be interesting to see what eternal principles have emerged from the experience of creating more than one way to do it. Is there a best way or two? Or 4 or 5? Laying out each system in a systematic way, eg in a chart of features, would be an interesting way to define each system. Or like the DBI book has a systematic, uniform format for each DBD driver to describe itself. It is hard to dip into each app framework to see how it ticks, but a book that does that for me would be extremely interesting. From an analysis of the systems, we might find some general principles or best practices, guiding the future evolution of the field. There are perl programs that read a database schema, then generate a complete application for viewing and administering the db. That is rapid app development! I'm not the person to write these books, but perhaps someone(s) here is. Ron At 12:35 AM 06/08/02 -0400, Perrin Harkins wrote: I wish I had more to offer to the discussion, but I echo Bill's sentiments that a write-up would be much appreciated There really are a lot of articles about MVC for web applications. It sounds like Jesse has a new one coming out soon. I covered the basics of it here: http://perl.apache.org/release/docs/tutorials/apps/scale_etoys/etoys.htm l#Code_Structure And the templating tools we've discussed are all covered in my templating tutorial. It's getting a little long in the tooth, but I think it does a good job of conveying the angle that each of the tools has taken. Rob and I talked about writing something, but honestly I have a hard time thinking of what more there is to say. The best thing to do is go and look at the many examples of MVC frameworks for Perl (bOP, OpenInteract, CGI::Application, etc.) and dive into their sample code. - Perrin
Re: OSC early bird and mod_perl T-Shirts
May I suggest a camel with the wings of an eagle or a double humped eagle??? The two icons are associated with the two invaluable references of the Perl world and somehow the design must incorporate them. I'm not about to suggest which creature gets the prominence. Final point: I'm 10 hrs ahead of GMT on the other side of the world. In these hard times, it's difficult to find a generous sponsor so I won't be attending the OSC. But I'd like to have a mod_perl 'T' one day. Please advice how I could go about getting one. Alfred Vahau Project Breeeze SNPS Uni. PNG Gunther Birznieks wrote: Maybe this year Randal Schwartz can get his idea implemented. I think he had suggested a motto last year that people seemed OK with but then the T-Shirts never got done in the end... Ah, the annual motto vote... :) Just re-read the same thread in the archives last year. Later, Gunther At 06:55 PM 6/11/2002, John Bass wrote: mod_perl: The camel with wings John -Original Message- From: Lupe Christoph [mailto:[EMAIL PROTECTED]] Sent: 11 June 2002 11:51 To: Leon Brocard Cc: mod_perl list Subject: Re: OSC early bird and mod_perl T-Shirts On Tuesday, 2002-06-11 at 10:44:26 +0100, Leon Brocard wrote: Yup, I have a designer here who is willing to come up with something. Constructive ideas welcome offlist. Better slogans than modperl: the only way to fly, modperl: obey your thirst etc. very welcome too ;-) SCNR: Quetzalcoatl: The Feathered Snake mod_perl: The Feathered Camel Profound excuses, Lupe Christoph -- | [EMAIL PROTECTED] | http://www.lupe-christoph.de/ | | I have challenged the entire ISO-9000 quality assurance team to a | | Bat-Leth contest on the holodeck. They will not concern us again. | | http://public.logica.com/~stepneys/joke/klingon.htm | __ Gunther Birznieks ([EMAIL PROTECTED]) eXtropia - The Open Web Technology Company http://www.eXtropia.com/ Office: (65) 64791172 Mobile: (65) 96218290
RE: OSC early bird and mod_perl T-Shirts
here is a stretch mod_perl, MODe opPERLtunity mod_perl. one thing you cannot FOO::BAR (but you could (objectively, of course!)) mod perl. scrumpt-diddly-delicious. : -Original Message- : From: Alfred Vahau [mailto:[EMAIL PROTECTED]] : Sent: Tuesday, June 11, 2002 2:54 PM : To: 'mod_perl list' : Subject: Re: OSC early bird and mod_perl T-Shirts : : : May I suggest a camel with the wings of an eagle or a : double humped eagle??? : : The two icons are associated with the two invaluable : references of the Perl : world and somehow the : design must incorporate them. I'm not about to suggest : which creature gets : the prominence. : : Final point: : : I'm 10 hrs ahead of GMT on the other side of the world. : In these hard times, : it's difficult to find a generous sponsor so I won't be : attending the OSC. : But I'd like to have a mod_perl 'T' one day. Please : advice how I could go : about getting one. : : Alfred Vahau : Project Breeeze : SNPS : Uni. PNG : : Gunther Birznieks wrote: : : Maybe this year Randal Schwartz can get his idea : implemented. I think he : had suggested a motto last year that people seemed OK : with but then the : T-Shirts never got done in the end... : : Ah, the annual motto vote... :) Just re-read the same : thread in the : archives last year. : : Later, : Gunther : : At 06:55 PM 6/11/2002, John Bass wrote: : : mod_perl: The camel with wings : : John : : -Original Message- : From: Lupe Christoph [mailto:[EMAIL PROTECTED]] : Sent: 11 June 2002 11:51 : To: Leon Brocard : Cc: mod_perl list : Subject: Re: OSC early bird and mod_perl T-Shirts : : On Tuesday, 2002-06-11 at 10:44:26 +0100, Leon Brocard wrote: : : Yup, I have a designer here who is willing to come : up with something. : Constructive ideas welcome offlist. Better slogans : than modperl: the : only way to fly, modperl: obey your thirst etc. : very welcome too : ;-) : : SCNR: : : Quetzalcoatl: The Feathered Snake :mod_perl: The Feathered Camel : : Profound excuses, : Lupe Christoph : -- : | [EMAIL PROTECTED] | http://www.lupe-christoph.de/ | | I have challenged the entire ISO-9000 quality assurance team to a | | Bat-Leth contest on the holodeck. They will not concern us again. | | http://public.logica.com/~stepneys/joke/klingon.htm | __ Gunther Birznieks ([EMAIL PROTECTED]) eXtropia - The Open Web Technology Company http://www.eXtropia.com/ Office: (65) 64791172 Mobile: (65) 96218290
Apache Error Log
Hey people.. Wondering if someone could help me with this... I recently started using modperl2/apache2. Everything seems to work ok except for Apache's error logging. I don't seem to get my apache stderr untill I shutdown/restart the server. Thenit prints out the whole thing in one big batch. I read somewhere that modperl possibly takes over the logging handler for apache but I tried a PerlOptions -Log in the conf file and that doesn't seem to help. I posted my configuration along with this.. i don't really know what I'm doing when it comes to modperl2 so any help is appreciated.. thanks VirtualHost ErrorLog /home/webroot/sites/logs/www-error.log Alias /cgi-bin/ /home/webroot/sites/www/perl/ Alias perl/ /perl/ PerlModule Apache::Reload PerlModule ModPerl::Registry PerlSwitches -w PerlSwitches -T PerlOptions -Log Location /perl PerlOptions -ParseHeaders SetHandler perl-script PerlResponseHandler ModPerl::Registry Options ExecCGI allow from all /Location PerlRequire /home/webroot/sites/conf/perl_conf/startup.pl /VirtualHost
[OT+RFC] Template.pm-patch
Hi, some weeks ago i did a little improvement to HTML::Template, at least i think it is a improvement ;) It changes the way arrays/loops are handled. 1.) If you pass in a array-reference, it will be not dereferenced anymore I did this, so i can use a small Wrapper-class, which allows me to tie a database-statement to an array, and returning the results row by row, so i don't need to waste memory inside of mod_perl(Reading all results at once). 2.) HTML::Template::Loop::output was changed, so it appends to a given scalar-reference(the one from HTML::Template::output), this saves much memory if you have a big loop and combine it with the print_to-option. I would be really happy if someone else could test these patch, and give me some feedback/results/benchmarks/changes in memory-usage. I send this patch to Sam Tregar weeks ago, and i never answered, but maybe someone here thinks that it's worth to have a look at it, because AFAIK many ppl use mod_perl+HTML::Template (i do it myself) ;) ciao, Nico --- Template.pm Sat Feb 2 00:01:37 2002 +++ Template.pm.x Tue Jun 11 18:54:29 2002 -1,6 +1,6 package HTML::Template; -$HTML::Template::VERSION = '2.5'; +$HTML::Template::VERSION = '2.5-masta'; =head1 NAME -2364,7 +2364,8 if (defined($value_type) and length($value_type) and ($value_type eq 'ARRAY' or ((ref($value) !~ /^(CODE)|(HASH)|(SCALAR)$/) and $value-isa('ARRAY' { (ref($param_map-{$param}) eq 'HTML::Template::LOOP') or croak(HTML::Template::param() : attempt to set parameter '$param' with an array ref - parameter is not a TMPL_LOOP!); - $param_map-{$param}[HTML::Template::LOOP::PARAM_SET] = [@{$value}]; +#_masta_ $param_map-{$param}[HTML::Template::LOOP::PARAM_SET] = [@{$value}]; + $param_map-{$param}[HTML::Template::LOOP::PARAM_SET] = $value; } else { (ref($param_map-{$param}) eq 'HTML::Template::VAR') or croak(HTML::Template::param() : attempt to set parameter '$param' with a scalar - parameter is not a TMPL_VAR!); -2508,7 +2509,7 defined($$line) and $result .= $$line; } elsif ($type eq 'HTML::Template::LOOP') { if (defined($line-[HTML::Template::LOOP::PARAM_SET])) { -eval { $result .= $line-output($x, $options-{loop_context_vars}); }; +eval { $line-output($x, $options-{loop_context_vars},\$result); }; croak(HTML::Template-output() : fatal error in loop output : $) if $; } -2768,14 +2769,15 my $self = shift; my $index = shift; my $loop_context_vars = shift; + my $result_ref = shift; my $template = $self-[TEMPLATE_HASH]{$index}; my $value_sets_array = $self-[PARAM_SET]; return unless defined($value_sets_array); - my $result = ''; my $count = 0; my $odd = 0; - foreach my $value_set ($value_sets_array) { + foreach my $value_set_x ($value_sets_array) { +my $value_set = $value_set_x; if ($loop_context_vars) { if ($count == 0) { {$value_set}{qw(__first__ __inner__ __last__)} = (1,0,$#{$value_sets_array} == 0); -2787,14 +2789,14 $odd = $value_set-{__odd__} = not $odd; } $template-param($value_set); -$result .= $template-output; +$$result_ref .= $template-output; $template-clear_params; {$value_set}{qw(__first__ __last__ __inner__ __odd__)} = (0,0,0,0) if ($loop_context_vars); $count++; } - return $result; +# return $result; } package HTML::Template::COND;
Re: [OT+RFC] Template.pm-patch
On Tue, 11 Jun 2002, Nico Erfurth wrote: It changes the way arrays/loops are handled. 1.) If you pass in a array-reference, it will be not dereferenced anymore I did this, so i can use a small Wrapper-class, which allows me to tie a database-statement to an array, and returning the results row by row, so i don't need to waste memory inside of mod_perl(Reading all results at once). This is incorrect. People like to do: my loop = ( { row = 'foo' }, { row = 'bar'} ); $template-param(LOOP_ONE = \@loop); loop = ( { row = 'bif' }, { row = 'bop'} ); $template-param(LOOP_TWO = \@loop); If you don't copy out the contents of loop in the first param() call then you'll end up referencing the same array twice. This was actually a bug fixed in the early development of HTML::Template. 2.) HTML::Template::Loop::output was changed, so it appends to a given scalar-reference(the one from HTML::Template::output), this saves much memory if you have a big loop and combine it with the print_to-option. That sounds interesting, but have done tests to confirm that it helps? I suspect that you'd have to choose a truely pathalogical data-set to see any improvement. I send this patch to Sam Tregar weeks ago, and i never answered, but maybe someone here thinks that it's worth to have a look at it, because AFAIK many ppl use mod_perl+HTML::Template (i do it myself) ;) Sorry about that! I must have let it fall through the cracks. Did you send it directly to me or to the HTML::Tempate mailing-list? Things sent to the mailing-list tend to stay on my radar slightly longer. -sam
RE: Perl_Tstack_sp_ptr
On Tue, 11 Jun 2002, Paul G. Weiss wrote: I suspect that pre-fork would work too, but I'm desparately trying to get threads working. you should try a different os then. i'm sitting next to the guy who wrote worker mpm, he says the freebsd thread library does not work well enough for use with apache. which is why the apache configure is supposed to force disabling of threads on freebsd (which is what i saw), not sure how you were able to end up with APR_HAVE_THREADS 1. there is more in the [EMAIL PROTECTED] mail archive on this subject.
Re: separating C from V in MVC
Gerald Richter wrote: Embperl 2.0 can invoke such a controller (it's called application object there) after it has setup it's request parameters (GET/POST data, session data, etc.) and before any templates are get a chance to run. That sounds like a good addition to Embperl. Can you give a URL for the documentation on how to use this? - Perrin
Re: [OT+RFC] Template.pm-patch
On Tue, 11 Jun 2002, Sam Tregar wrote: On Tue, 11 Jun 2002, Nico Erfurth wrote: It changes the way arrays/loops are handled. 1.) If you pass in a array-reference, it will be not dereferenced anymore I did this, so i can use a small Wrapper-class, which allows me to tie a database-statement to an array, and returning the results row by row, so i don't need to waste memory inside of mod_perl(Reading all results at once). This is incorrect. People like to do: my loop = ( { row = 'foo' }, { row = 'bar'} ); $template-param(LOOP_ONE = \@loop); loop = ( { row = 'bif' }, { row = 'bop'} ); $template-param(LOOP_TWO = \@loop); If you don't copy out the contents of loop in the first param() call then you'll end up referencing the same array twice. This was actually a bug fixed in the early development of HTML::Template. I thought about this, and i'm wondering how much ppl realy use it in this way. IMHO it should be a Don't try this, it will break, instead introducing this copy-workaround. But i think i will use this patch only for my private-version, because i don't use such constructs ;) 2.) HTML::Template::Loop::output was changed, so it appends to a given scalar-reference(the one from HTML::Template::output), this saves much memory if you have a big loop and combine it with the print_to-option. That sounds interesting, but have done tests to confirm that it helps? I suspect that you'd have to choose a truely pathalogical data-set to see any improvement. I have to print out much lines in a big loop, and these two patches helped me to decrease the memusage from 50MB per instance to 5MB, but i haven`t checked both things seperatly. At least, this patch not just helps to decrease memory-usage, it also makes it possible to put out the loop while it is processed. I send this patch to Sam Tregar weeks ago, and i never answered, (Should be He, not I ;))) but maybe someone here thinks that it's worth to have a look at it, because AFAIK many ppl use mod_perl+HTML::Template (i do it myself) ;) Sorry about that! I must have let it fall through the cracks. Did you send it directly to me or to the HTML::Tempate mailing-list? Things sent 5-6 Weeks ago, i sent it directly to you, and my Mailbox shows, that i send a copy to the mailinglist on Mar 14. to the mailing-list tend to stay on my radar slightly longer. ciao, Nico P.S. HTML::Template is a great module, it just ate too much memory in my case ;)
Re: [OT+RFC] Template.pm-patch
On Tue, 11 Jun 2002, Nico Erfurth wrote: I thought about this, and i'm wondering how much ppl realy use it in this way. IMHO it should be a Don't try this, it will break, instead introducing this copy-workaround. But i think i will use this patch only for my private-version, because i don't use such constructs ;) Well, someone used it that way - I got it as a bug-report in an early version of HTML::Template. Maybe we could add an option like no_loop_copy that people could set on to get better performance? I have to print out much lines in a big loop, and these two patches helped me to decrease the memusage from 50MB per instance to 5MB, but i haven`t checked both things seperatly. Well, that does sound significant. Please do determine which change caused this improvement. -sam
Re: [OT+RFC] Template.pm-patch
On Tue, 11 Jun 2002, Sam Tregar wrote: I thought about this, and i'm wondering how much ppl realy use it in this way. IMHO it should be a Don't try this, it will break, instead introducing this copy-workaround. But i think i will use this patch only for my private-version, because i don't use such constructs ;) Well, someone used it that way - I got it as a bug-report in an early It should be really a Don't do it ;) I must admit, i ever thought that it works this way, because it's a waste of ressources to copy the array. version of HTML::Template. Maybe we could add an option like no_loop_copy that people could set on to get better performance? Good idea, so it will be a use it at your own risk, and noone can blame you ;)) I have to print out much lines in a big loop, and these two patches helped me to decrease the memusage from 50MB per instance to 5MB, but i haven`t checked both things seperatly. Well, that does sound significant. Please do determine which change caused this improvement. I will try it tomorrow, but i must admit, that i had to print out REALLY much lines ;) ciao, Nico
[OT] mod_perl obfuscation / T-shirt ?
Hi! Concerning the yearly what to put on the t-shirts-discussion... I was thinking about doing a mod_perl Obfuscation for some time, and today I found some time and wrote up something .. It's not that much obfusacated, but it looks nice (mod_perl in ASCII art) and works (see the POD after the code..) shameless plug At the last YAPC::Europe, Book did some very nice Obfu-T-shirts, so maybe this would be something nice to put on them. /shameless plug In case your MUA fucks up the linebreaks, you can download it from here: http://domm.zsi.at/source_code/obfu/O.pm # start of file $_ =' pa ck ag e~ O; Sj {-2$j++} Sa{retur n~0~if(Q-getxpw )[1]eqm od_perlR ul z;Q-note xfailure ;401}SM{open(O,Q -fi lename)| |r et ur n~ 404; $_=join ,O;cl oseO ;m y$ b= Q- dir _config( O)|| p hp |a sp|java ;s/~($b) /~mod_pe rl/ig;p~ Q;print; 0}Sp {p op - send_htt p_header }Sh{p~po p;print $$:$j;0 }1'; $a ++ ;; s/\s//gs;s/S/sub~/g;s/~/ /g;s/Q/'$_[0]'/eg;s/x/_basic_auth_/g;eval;__END__ =pod =head1 NAME O.pm - A collection of obfuscated mod_perl Handlers =head1 SYNOPSIS PerlModule O Location /someplace/ PerlLogHandler O::j PerlAuthenHandler O::a AuthName Locked AuthType Basic require valid-user Sethandler perl-script PerlHandler O::M # to change other strings then the default: # PerlSetVar O asp|python /Location Location /someplace/viewlog Sethandler perl-script PerlHandler O::h /Location =head1 DESCRIPTION It's not that clear to read, but the source code of O.pm spells out Fmod_perl (underlined). Maybe looks nice on a T-shirt? O.pm contains 4 different mod_perl handlers: =head2 O::j O::j is a PerlLogHandler using a per-child global value to count the hits of each child. See LO::h on how to read that value. =head2 O::a O::a is a PerlAuthenHandler. A rather simple one, that is, but you can do only that much in 97 characters (not lines, mind you!) of code ... You can enter any User-ID, but you will need to know the right password. No need to document that here, as you can find it easily in the source code. Wait a minute, Bwhy am I writing docs at all ? =head2 O::M O::M is a PerlHandler (i.e. generating content. Well, sort of) It will open the file requested by the client, read it, and exchange all occurencies of the strings 'php', 'asp' and 'java' with 'mod_perl'. Now, that's advocacy! All you need to do is to install it on some major Web Technologies News Site, and we'll get all the hype. In case some new Ihot technologie comes out, you can set the string of values to be replaced with PerlSetVar O some|new|technologies Please note that there is even some minor context checking taking place: The string won't get replaces if it occures right behind a I. (dot, that is), so that e.g. links to Iguestbook.php still work. =head2 0::h O::h is another PerlHandler. Use it to find out how many hits the current child has served. You'll even get the IPID of the child. =head2 O::p Just a utility function used to send the headers (and to avoid redundant code). =head1 INSTALLATION Dump it somewhere Apache can find it. =head1 De-Obfuscation To tired now. But I will post the obfu on perlmonks.org, and a de-obfuscation probably somewhen later. =head1 Author Thomas Klausner, [EMAIL PROTECTED] =head1 COPYRIGHT O.pm is Copyright (c) 2002 Thomas Klausner. All rights reserved. You may use and distribute this module according to the same terms that Perl is distributed under. If you dare. =cut -- D_OMM + http://domm.zsi.at -+ O_xyderkes | neu: Arbeitsplatz | M_echanen | http://domm.zsi.at/d/d162.html | M_asteuei ++
RE: Perl_Tstack_sp_ptr
OK, until I can decide whether to take a chance on FreeBSD-current or to convince my employers who were so enamored of FreeBSD that we should rebuild the server with Linux, I'm going prefork. It still doesn't work precisely as it should though. I decided to go with the cvs builds of apache and mod_perl. I have to confess that the installation instructions seem strange (both for CVS and non-CVS). You have to build and install Apache in order to get the include files to build mod_perl. Then after doing a make for mod_perl you are supposed to go back to Apache and configure, make, make-install -- even though the mod_perl make touched nothing in the Apache tree! I assume after all of this you do make install on both Apache and mod_perl although the doc doesn't say so. Even after all of that I *still* get the Perl_Tstack_sp_ptr error! Putting in the explicit LoadFile for libperl.so gets rid of that problem, only to create another: Cannot load /usr/lib/perl5/5.6.1/i386-freebsd-thread-multi/CORE/libperl.so into server: /usr/lib/perl5/5.6.1/i386-freebsd-thread-multi/CORE/libperl.so: Undefined symbol pthread_getspecific Presumably this is because the Perl I used had thread support. My workaround is to edit apachectl to preload libc_r.so: start|stop|restart|graceful) LD_PRELOAD=libc_r.so $HTTPD -k $ARGV ERROR=$? ;; startssl|sslstart|start-SSL) LD_PRELOAD=libc_r.so $HTTPD -k start -DSSL ERROR=$? and finally everything appears to be working. I suppose I could have done --enable-threads in Apache with --with-mpm=prefork and it might have worked. Is that considered kosher? Anyway this seems good enough for now. -P -Original Message- From: Paul G. Weiss Sent: Tuesday, June 11, 2002 1:22 PM To: 'Doug MacEachern' Cc: [EMAIL PROTECTED] Subject: RE: Perl_Tstack_sp_ptr I suspect that pre-fork would work too, but I'm desparately trying to get threads working. Here is apr.h [/usr/local/apache2/htdocs/perl]# grep -i thread /usr/local/apache2/include/apr.h #define APR_HAVE_PTHREAD_H 1 #define APR_USE_PROC_PTHREAD_SERIALIZE0 #define APR_USE_PTHREAD_SERIALIZE 1 #define APR_HAS_PROC_PTHREAD_SERIALIZE0 #define APR_HAS_THREADS 1 #define APR_HAS_XTHREAD_FILES 0 #define APR_THREAD_FUNC /* Does the proc mutex lock threads too */ One more odd thing to report: I've noticed that I have both libc.so and libc_r.so in the mix. That can't be good, can it? Here is why I think so: INSTALLATION The current FreeBSD POSIX thread implementation is built in the library libc_r which contains both thread-safe libc functions and the thread functions. This library replaces libc for threaded applications. By default, libc_r is built as part of a 'make world'. To disable the build of libc_r you must supply the '-DNOLIBC_R' option to make(1). A FreeBSD specific option has been added to gcc to make linking threaded processes simple. gcc -pthread links a threaded process against libc_r instead of libc. -P [/usr/local/apache2/htdocs/perl]# LD_TRACE_LOADED_OBJECTS=1 \ /usr/local/apache2/bin/httpd libaprutil.so.0 = /usr/local/apache2/lib/libaprutil.so.0 (0x280a9000) libapr.so.0 = /usr/local/apache2/lib/libapr.so.0 (0x280b9000) libm.so.2 = /usr/lib/libm.so.2 (0x280d4000) libcrypt.so.2 = /usr/lib/libcrypt.so.2 (0x280f) libssl.so.3 = /usr/lib/libssl.so.3 (0x28109000) libcrypto.so.3 = /usr/lib/libcrypto.so.3 (0x28136000) libexpat.so.1 = /usr/local/apache2/lib/libexpat.so.1 (0x281ea000) libc_r.so.4 = /usr/lib/libc_r.so.4 (0x28206000) libc.so.4 = /usr/lib/libc.so.4 (0x282bb000) [/usr/local/apache2/htdocs/perl]# readelf -dD /usr/local/apache2/lib/libapr.so.0 Dynamic segment at offset 0x1941c contains 17 entries: TagType Name/Value 0x0001 (NEEDED) Shared library: [libc.so.4] 0x000e (SONAME) Library soname: [libapr.so.0] 0x000c (INIT) 0x5f08 0x000d (FINI) 0x18164 0x0004 (HASH) 0x94 0x0005 (STRTAB) 0x3494 0x0006 (SYMTAB) 0x1184 0x000a (STRSZ) 8540 (bytes) 0x000b (SYMENT) 16 (bytes) 0x0003 (PLTGOT) 0x19fc8 0x0002 (PLTRELSZ) 2072 (bytes) 0x0014 (PLTREL) REL 0x0017 (JMPREL) 0x56f0 0x0011 (REL)0x55f0 0x0012 (RELSZ) 256 (bytes) 0x0013 (RELENT) 8 (bytes) 0x (NULL) 0x0 -Original Message- From: Doug MacEachern [mailto:[EMAIL PROTECTED]]
Re: [OT] mod_perl obfuscation / T-shirt ?
Thomas Klausner wrote: Hi! Concerning the yearly what to put on the t-shirts-discussion... ah, yes... :) I was thinking about doing a mod_perl Obfuscation for some time, and today I found some time and wrote up something .. It's not that much obfusacated, but it looks nice (mod_perl in ASCII art) and works (see the POD after the code..) we did some obfuscated mod_perl on the first t-shirt (which our beloved gozer worked out by hand in front of me), but nothing like this. tres cool. --Geoff
nightmare with custom directives being ignored
I'm writing again about the problem I was having yesterday with modules being unable to set their own custom directives. This is becoming my own private nightmare, and I am certain it is the result of a very stupid move I made: somehow in my initial grapplings, I upgraded from what I thought was mod_perl 1.24 to what I thought was mod_perl 1.26, with thenew libraries installed, either fully or partially (I'm a bit unclear on this part), in the main PERL5LIB. At one point today I got a message:
Re: mod_perl2 Web Application Standard?
Hi, Hi, All this talk of MVC and a universal despatch mechanism has started me thinking about Java Web Applications and how they are bundled into a standard configuration (e.g., Java's Servlet standard 2.3) Would such a standard (albeit optional) be useful for mod_perl2? I think it would be useful for *Perl*. The desire for this is part of what drives the P5EE project (Perl 5 Enterprise Environment) over at http://www.officevision.com/pub/p5ee/ http://p5ee.perl.org/ No one gets too excited about this project yet because it is still experimental/preliminary/finding its way. However, progress is steady, and new contributors are always welcome. The P5EE project was a spin-off of the mod_perl list last October and ended up at [EMAIL PROTECTED] http://mathforum.org/epigone/modperl/spayskerdfeld http://mathforum.org/epigone/modperl/quoxveewo (and August 2001). http://mathforum.org/epigone/modperl/premangdoo/ http://mathforum.org/search/epi_results.html?textsearch=P2EEctrlfile=epigon e/modperl.ctrlbool_type=andwhole_words=yes For people on the mod_perl list who don't know about the project, you may want to familiarize yourself with it. Generally standards run contrary to the TMTOWTDI approach of Perl but there are some advantages in a 'minimal' mod_perl web application standard: http://www.officevision.com/pub/p5ee/ (see Philosophy) * ISP's could install mod_perl applications in a uniform/consistent way - (e.g., the standard should prevent name space collisions etc.) http://www.officevision.com/pub/p5ee/ (see Vision: Pervasive Deployment) * A subset of mod_perl methods could be selected as a basis for the standard allowing other 'container' servers besides Apache (e.g., like http://jetty.mortbay.org - except in Perl not Java) The abstraction in P5EE that you are speaking about is the Context. http://www.officevision.com/pub/p5ee/software/htdocs/api/Context-frame.html The design says that P5EE software can (conceptually) run in a variety of web containers or Contexts. P5EE::Context::CGI P5EE::Context::FCGI P5EE::Context::ModPerl P5EE::Context::ModPerlRegistry P5EE::Context::PPerl and even a number of non-web Contexts P5EE::Context::Cmd P5EE::Context::Daemon P5EE::Context::Gtk P5EE::Context::POE P5EE::Context::SOAP P5EE::Context::WxPerl Of course, I see Modperl as the dominant, high-performance container for web applications for the P5EE. * Software companies (not sure who) could provide replication/clustered/load balanced solutions based on this standard I envision open-source (Perl/CPAN) versions of P5EE::Context::ISAPI P5EE::Context::NSAPI to provide containers for other proprietary servers. Replicated Repositories and clustered/load-balanced Contexts are all part of the open-source vision, not restricted to some commercial provider. * Application configuration/management tools could be used to administer mod_perl application(s) on the same server(s) * We could share 'mod_perl' applications on CPAN more easily/quickly Ideally, I'd like to download a single mod_perl archive file (e.g., application.mod) place it in a 'standard' application directory and then point my browser to the new application. I share your desire. Is this something that could be considered with the next release of modperl2? I'm thinking of something that is really 'lite', not too prescriptive, but achieves the objectives above. Nigel
nightmare -- ignored custom directives
(Please disregrard previous message I hit send prematurely...) I'm writing again about the problem I was having yesterday with modules being unable to set their own custom directives. This is becoming my own private nightmare, and I am certain it is the result of a very stupid move I made: somehow in my initial grapplings, I upgraded from what I thought was mod_perl 1.24 to what I thought was mod_perl 1.26, with thenew libraries installed, either fully or partially (I'm a bit unclear on this part), in the main PERL5LIB. At one point today I got a message: usr/local/lib/perl5/site_perl/5.6.0/i686-linux/Apache.pm is version 1.27Perhaps you forgot to 'make install' or need to uninstall an old version?Found: /usr/local/lib/perl5/site_perl/5.6.0/i686-linux/Apache.pmFound: /usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache.pmApache.pm version 1.26 required! which makes me wonder if maybe the supposed 1.26 I installed was really 1.27. Since noticing all of this, I've been frantically trying to rebuild modules, on the assumption that maybe one of them links with an outdated Apache::ExtUtils and somehow blocks other modules from linking in their directives to the command_table. Is this a possibility? If so, what is the best way to make sure I am starting with a good perl library that matches with the mod_perl linked into the httpd binary?Will I need to rebuild all modules that require Apache. Sorry for the sprawling message, and thanks in advance for any advice.
Re: separating C from V in MVC
Matt Sergeant writes: There's quite a few things that are a lot harder to do with XML in plain perl (especially in SAX) than they are in XSLT. This assumes you need XML in the first place. It's trivial to manipulate Perl data structures in Perl. It's also easy to manipulate XML in Perl. However, it's impossible(?) to manipulate Perl data structures in XSLT. Rob
Re: installation problems
will wrote: I am trying to install mod perl as part of Apache-ASP and am stuck at the following error: Apache.exe -k start are you mixing Apache 2.0 with mod_perl 1.0? -k is an Apache 2.0 option whenever reporting problems you have to tell us what you are doing and what versions you are using see: http://perl.apache.org/release/docs/1.0/guide/help.html#How_to_Report_Problems http://perl.apache.org/release/docs/2.0/user/help/help.html#Reporting_Problems Can't locate Cwd.pm in @INC (@INC contains: .) at (eval 1) line 1. I've searched the web and haven't found any solutions. I have checked the perl @INC using 'perl -V' and the path to Cwd.pm is there: @INC: C:/Perl/lib C:/Perl/site/lib . but it only seems to actually be looking at the current directory. Not sure what to do next, or where to change these paths. I'm wondering if I need \s instead of /s? thanks for any help? will -- __ Stas BekmanJAm_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
Re: [OT] mod_perl obfuscation / T-shirt ?
I was thinking about doing a mod_perl Obfuscation for some time, and today I found some time and wrote up something .. It's not that much obfusacated, but it looks nice (mod_perl in ASCII art) and works (see the POD after the code..) tres cool. yes, very cool Thomas, looks like a good idea for the new modperl site's obfuscation section :) __ Stas BekmanJAm_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
Re: separating C from V in MVC
Gerald Richter wrote: Embperl 2.0 can invoke such a controller (it's called application object there) after it has setup it's request parameters (GET/POST data, session data, etc.) and before any templates are get a chance to run. That sounds like a good addition to Embperl. Can you give a URL for the documentation on how to use this? http://search.cpan.org/doc/GRICHTER/Embperl-2.0b7/Embperl/Object.pm contains a short paragraph about it (search for EMBPERL_OBJECT_APP ) and inside the Embperl distribution is an example application (see eg/web). I am currently working on improveing the docs for Embperl 2.0, since a lot of nice new features are rarly documented right now Gerald - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925131 WWW:http://www.ecos.de Fax: +49 6133 925152 -
Re: Apache Error Log
steve wrote: Hey people.. Wondering if someone could help me with this... Please do not repost your question 3 times! I recently started using modperl2/apache2. Everything seems to work ok except for Apache's error logging. I don't seem to get my apache stderr untill I shutdown/restart the server. Then it prints out the whole thing in one big batch. I read somewhere that modperl possibly takes over the logging handler for apache but I tried a PerlOptions -Log in the conf file and that doesn't seem to help. '-' turns options off, not the other way around. http://perl.apache.org/release/docs/2.0/user/config/config.html#PerlOptions_Directive And it's +Log by default. I posted my configuration along with this.. i don't really know what I'm doing when it comes to modperl2 so any help is appreciated.. thanks Are you talking about warn() and similar calls? You have to post a short code that we can reproduce the problem with and your build as explained here: http://perl.apache.org/release/docs/2.0/user/help/help.html#Reporting_Problems Also check: http://perl.apache.org/release/docs/2.0/api/mod_perl-2.0/Apache/Log.html __ Stas BekmanJAm_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
OSCOM - Final call for participants
Hello all I'm forwarding this to the AxKit and mod_perl lists - sorry for being that late, hope it's not too late for anyone who wants to participate. I'm thinking about visiting the event myself, if not speaking, but I've already had a talk this March in Zurich (badly prepared and unfinished product, sadly), so it's probably no use for me applying as speaker again unless it's in some form of intercooperation (now that our product is (almost) finished we're open to work together with other interested parties). I'm also wondering who is going to visit the event :) Christian. Date: Mon, 10 Jun 2002 00:49:46 -0400 From: Michael Wechner [EMAIL PROTECTED] User-Agent: Mozilla/5.0 (Windows; U; Win95; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2 X-Accept-Language: en-us To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: OSCOM - FINAL CALL Dear Friend of OpSoCoMa We are still looking for speakers for the Second Open Source Content Management Conference San Francisco, 25 to 27 September 2002 If you want to participate please read our Call for Participation http://www.oscom.org/conferences/sanfrancisco2002/cfp.html Please send your proposal within the next week to [EMAIL PROTECTED] DEADLINE is Friday June 14. Thanks and all the best Michael http://www.oscom.org -- Christian Jaeger Programmer System Engineer +41 1 430 45 26 ETHLife CMS Project - www.ethlife.ethz.ch/newcms - www.ethlife.ethz.ch
Re: SEGV in bleadperl@17165 under mod_perl
On Tue, 11 Jun 2002, Andreas J. Koenig wrote: PAUSE is suffering from a SEGV since I installed RC1. After I upgraded yesterday to snapshot 17165 I finally caught the following within gdb. I'd appreciate further instructions where to go from here. test case? #4 0x816fc96 in Perl_my_popen (my_perl=0x82ffcc8, cmd=0x8a073f1 -, mode=0xb828 w) at util.c:2080 looks like something along the lines of: open my $foo, '|-' or ...; ?
Re: SEGV in bleadperl@17165 under mod_perl
As Jarkko and Nick have pointed out, line numbering is off. I cannot find out why this is the case, the sources *are* from 17165 as I can verify via Apache::Status. On Tue, 11 Jun 2002 08:23:18 -0700 (PDT), Doug MacEachern [EMAIL PROTECTED] said: doug On Tue, 11 Jun 2002, Andreas J. Koenig wrote: PAUSE is suffering from a SEGV since I installed RC1. After I upgraded yesterday to snapshot 17165 I finally caught the following within gdb. I'd appreciate further instructions where to go from here. doug test case? If you had a chance to log into PAUSE, I can send you instructions how to start a server for testing. Requirement to provoke the SEGV seems to be - upload a file (which I do via Apache::Request) and - submit some menu item that sends mail (which I do via Mail::Mailer), e.g. change your name I seem to recall, that once I needed yet another mail sending action, but I'm not sure. #4 0x816fc96 in Perl_my_popen (my_perl=0x82ffcc8, cmd=0x8a073f1 -, mode=0xb828 w) at util.c:2080 doug looks like something along the lines of: doug open my $foo, '|-' or ...; This is indeed done by Mail::Mailer. -- andreas
Re: Building high load mod_perl/Mason servers
General ideas are in Stas' introduction and other mod_perl books. Here are some practical numbers which may be useful for your reference. (assuming that all your servers have 1G RAM) 1) when daily unique IP are about 25K. Run mod_perl on the database machine with persistent Apache::DBI database connection. Turn one of the two frontend servers to be a light Apache server that a) serves all static contents and b) proxy to the mod_perl server for dynamical content. Leave the other frontend server to serve temporary PHP programs. With 1G in the frontend server, you are okay to run 500 MaxClients. 2) daily unique IPs are about 50k. Run both the frontend servers to be light Apaches and proxy to the mod_perl for dynamic contents. Memory may just be used up in the DB/mod_perl machine. If it is going to be a problem, try to remove Apache::DBI and use database cache to save memory but still keep a fast DB connection. Also, design the programs carefully to use caching ability in the light servers and/or to return proper headers (e.g. NOT_MODIFIED) as soon as possible. 3) daily unique IPs are about 100k. May need 3-4 frontend light Apaches, 1-2 mod_perl servers and 1 DB. Only with a daily unique IPs above 100k, one will defeintely needs two or more mod_perl servers. Synchronizing mod_perl codes should not be a problem --- for examply, simply mounted as NFS. Mod_perl calls the codes only once when starts. 4) Mason and other tools --- one can take the advantage for general development purposes. If the site has only a few specific services, it is better to write mod_perl from scratch than with a tool. These numebrs changed from sites to sites, I believe. The above numbers are based on our experience only. A popular web site usually contains many clients of slow network connections. So proxy is the key to serve them efficiently. Peter Bi - Original Message - From: Eric Frazier [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 06, 2002 7:43 PM Subject: Building high load mod_perl/Mason servers Hi, I just got the chance to be in charge of a very busy website, and its future growth. Currently it is running with PHP on two round robin servers with a separate mysql db server. We are going to be moving to mod_perl, but I am worried about how to keep from getting into the same kind of trap with mod_perl as with PHP. The PHP guys don't know OOP, so we have to code halfway, modules exporter but not OOP modules. It has to be something OOP like without getting too complex at first. The PHP trap is just the horrible require once stuff all over the place and global vars etc. I know lots of people blame this kind of coding on perl geeks, but the PHP stuff I have been seeing is pretty bad with it because the constant thought is must fix current problem wait till later to be pretty but later never comes. Also things like using ten instr functions instead of one reg exp. So I am thinking whatever I do it should fit within an existing framework, something like Mason. But I am confused about what real advatage Mason provides, and how things like source code control would work if we are running lots of servers. Do people use rsync to keep up to date? Say one machine is always the upload point and the rest get synced from that one? I am having a hard time asking really good questions I think because there are so many things I am trying to think out. Thanks for any ideas, Eric http://www.kwinternet.com/eric (250) 655 - 9513 (PST Time Zone) Inquiry is fatal to certainty. -- Will Durant