Re: caching questions
Sorry to step in here, but could I use any of the caching modules you mentionned in mod_perl2? thx tom Am Mon, 2003-07-21 um 21.45 schrieb Perrin Harkins: > On Sun, 2003-07-20 at 15:47, Patrick Galbraith wrote: > > One thing that my code does is check to see if it's cache has been > > updated to the db, which I wish I could really have some sort of cache > > that's in one place in memory (as opposed to each child process). > > Well, you can't, unless you use threads. > > > I know there's IPC, and also memcached. I've used IPC::Shareable before, > > but don't know if that's the route I'd wanna go. > > It's not. IPC::Shareable is very slow. If you want to share data, use > Cache::FileCache, Cache::Mmap, MLDBM::Sync, or IPC::MM. > > > Has anyone implemented a good caching system that sets up a global cache > > that you don't have to check constantly because you happen to have been > > served out by a child that doesn't have the latest cache from DB? One > > single memory object? > > The systems I listed above all use a shared cache that will have the > same data regardless of which process accesses it. > > - Perrin >
ANNOUNCE: Apache::Dynagzip 0.11
This version is a bug-fix: Content-Type header prepared by another filtering handler on earlier stage of the content generation phase could be overwritten by Dynagzip to default Content-Type: text/html. It is fixed now. Since the recent version Dynagzip provides the default Content-Type only in case of absence of any other value. Thanks to John Siracusa, who brought this to my attention. The uploaded file Apache-Dynagzip-0.11.tar.gz has entered CPAN as file: $CPAN/authors/id/S/SL/SLAVA/Apache-Dynagzip-0.11.tar.gz size: 31136 bytes md5: d58519b144c6ab89cc01171235b2b32c Thanks, Slava
Re: Variables
Dennis Stout wrote: So in startup.perl put my %queue_list = list_queues; my %tech_list = list_techs; and so on? Then each process would get a copy of the hash? No, those are lexicals, not globals. Something like this: package MyCompany::Globals; use vars qw(%queue_list %tech_list); %queue_list = list_queues; %tech_list = list_techs; Then from other code you can use them as %MyCompany::Globals::queue_list. After reading the perldoc for MLDBM, and reviewing my deadline for the project of "today", I think I'll just use globals for now. MLDBM::Sync is really easy to use, but if its okay for the data to be out of date then the globals thing is fine. I suggest you avoid shenanigans with killing off processes quickly, since your performance would be terrible. Instead, create a cleanup handler which runs after each request. Keep a timestamp (a global variable that will persist) in each handler of how long it's been since you last updated the data. If it's longer than 5 minutes, refresh the data. The cleanup handler runs after the client is disconnected, so it doesn't matter if it takes a few seconds. - Perrin
Re: Variables
> > Is there a way I could get these variables populated on server start and never > > loaded again unless the database was changed? So in my subroutine for posting > > an event that changed it I could call "repopulate_queue_hash" and have it redo > > the hash, so changes still happened without a restart, but the hash itself is > > just passed from the root apache process to the children? > > You can load it into globals at startup and their values will be shared > by all children until you write to them. You could also load it So in startup.perl put my %queue_list = list_queues; my %tech_list = list_techs; and so on? Then each process would get a copy of the hash? > separately in each child process in the init hook. However, you'd If I did that, then I'd want a few children processes at a time and also with a few amount of requests per child... Boy am I ever glad this'll be moved off my box once it's finsihed ;) > probably be better off using MLDBM::Sync, so that all changes are shared > immediately. It's quite fast, and since it uses a tied interface it > would be easy to switch your code to use globals if it turns out not be > fast enough. After reading the perldoc for MLDBM, and reviewing my deadline for the project of "today", I think I'll just use globals for now. But once I meet get the management satisified, I'll be moved into a "enhancment" phase of hte project, instead of a devel phase, and I'll implement it then to see how well it works. Thanks :)
Re: Variables
Dennis Stout wrote: Is there a way I could get these variables populated on server start and never loaded again unless the database was changed? So in my subroutine for posting an event that changed it I could call "repopulate_queue_hash" and have it redo the hash, so changes still happened without a restart, but the hash itself is just passed from the root apache process to the children? You can load it into globals at startup and their values will be shared by all children until you write to them. You could also load it separately in each child process in the init hook. However, you'd probably be better off using MLDBM::Sync, so that all changes are shared immediately. It's quite fast, and since it uses a tied interface it would be easy to switch your code to use globals if it turns out not be fast enough. - Perrin
Variables
In this project I'm making (database), I have several variables with a potential for a large amount of information to be held in them. They're all hashes. Some are hashes of hashes... There is a tech_list, which holds information about each technician. There is a queue_list which holds an ID and a queue name (to interact with a db) There is a list of ISP's (we're the help desk for 3, and constantly looking for more) There is a list of service plans (dialup, 256k/512k/768k dsl..) There is a list of operating systems.. A list of browsers... All the lists have an ID component and a name component, so it's used in the context of $list{$_} (where $_ is the current iteration of a foreach loop and everything in the option tags is created as it iterates...) Is there a way I could get these variables populated on server start and never loaded again unless the database was changed? So in my subroutine for posting an event that changed it I could call "repopulate_queue_hash" and have it redo the hash, so changes still happened without a restart, but the hash itself is just passed from the root apache process to the children? I know this means that each child would retain the old hash util it died and another one respawned, meaning some people would see the change and others wouldn't until it fully propogated, but I can make that happen easily enough by decreasing the number of requests per child... I know that happens at some performance loss, but I think the loss of performance in Apache would be less than the loss of performance generating the same hash over and over again, which will grow to be huge after time. Consider 350 users using this thing for a solid 16 hours a day, and a hundred or so using it the other 8. Thanks Dennis
RE: templating system opinions
> > Just wondering what the best templating system is to use > > and/or learn. > > I'm just wondering why no one recommended Embperl. Like Mason, it's more > than a templating system, but I find it's inheritance features great. I too have found template inheritance to be pretty important - especially the ability to override enclosing templates. At Turbo10 we went for a strict 'no functional elements' in the template approach. But how do you do things like for displaying rows in a report? The content management system models a HTML page (e.g., Object -> Master Template -> Page -> Form -> Subform). A presentation script is responsible for inserting the rows into the page and master template. Attributes (e.g., bgcolor) of an enclosing object (e.g., page) are inherited (or overridden) by an enclosed object (e.g., form). Each object is stored in an XMLish file, slurped into a hash, and the keys are merged. Typically a DBI row hash is also merged as there is a 1-1 correspondence between database column names and form attributes. I think the question of templating solution depends on the plan for the content management system ... NIge -- 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: Values of an array..
On Mon, Jul 21, 2003 at 02:38:20PM -0700, Andrew Hurst wrote: > At 01:22 PM 7/21/2003 -0800, Dennis Stout wrote: > >> >"Dennis Stout" wrote ... > >> > my %user_list = get_users($where); > >> > > >> > foreach (keys %user_list) { > >> > my $user = $_; > >> > foreach (@{$user_list{$user}{DOMAIN}}) { > >> > $user_list{$user}{DOMAINS} .= > >> >"$user_list{$user}{DOMAIN}[$_],"; > >> > } > >> > chop($user_list{$user}{DOMAINS}); > >> >... > >> > >> >$user_list{$user}{DOMAINS} .= "$user_list{$user}{DOMAIN}[$_],"; > >> > >> That line is the culprit. $_ contains each domain name as a text > >> string. Which evaluates to 0 when used as an integer, which then gives > >the > >> first entry in the array. Thus you get the first entry in the array as > >> many times as you have entries in the array. Try changing that to a > >> regular (indexed) for loop and that should fix it. > > > >Good eye, I was too busy thinking of hashes and things. > > > >I hate array's. > > > >Should just be $user_list{$user}{DOMAINS} .= "$_,"; huh? > > Yep. After I sent the last email I realized that suggesting an indexed > for loop was more effort than just deleting part of the string already > there, like you just suggested. This would be a good place for a join (perldoc -f join): $user_list{$user}{DOMAINS} = join ',', @{$user_list{$user}{DOMAIN}}; which lets you do away with the trailing chop() as well. Since this has nothing to do with mod_perl, if you must reply, please do it off-list. Eric
Re: Values of an array..
At 01:22 PM 7/21/2003 -0800, Dennis Stout wrote: > >"Dennis Stout" wrote ... > > my %user_list = get_users($where); > > > > foreach (keys %user_list) { > > my $user = $_; > > foreach (@{$user_list{$user}{DOMAIN}}) { > > $user_list{$user}{DOMAINS} .= > >"$user_list{$user}{DOMAIN}[$_],"; > > } > > chop($user_list{$user}{DOMAINS}); > >... > > >$user_list{$user}{DOMAINS} .= "$user_list{$user}{DOMAIN}[$_],"; > > That line is the culprit. $_ contains each domain name as a text > string. Which evaluates to 0 when used as an integer, which then gives the > first entry in the array. Thus you get the first entry in the array as > many times as you have entries in the array. Try changing that to a > regular (indexed) for loop and that should fix it. Good eye, I was too busy thinking of hashes and things. I hate array's. Should just be $user_list{$user}{DOMAINS} .= "$_,"; huh? Yep. After I sent the last email I realized that suggesting an indexed for loop was more effort than just deleting part of the string already there, like you just suggested. Thanks No problem. -Andrew Dennis
Re: Values of an array..
> >"Dennis Stout" wrote ... > > my %user_list = get_users($where); > > > > foreach (keys %user_list) { > > my $user = $_; > > foreach (@{$user_list{$user}{DOMAIN}}) { > > $user_list{$user}{DOMAINS} .= > >"$user_list{$user}{DOMAIN}[$_],"; > > } > > chop($user_list{$user}{DOMAINS}); > >... > > >$user_list{$user}{DOMAINS} .= "$user_list{$user}{DOMAIN}[$_],"; > > That line is the culprit. $_ contains each domain name as a text > string. Which evaluates to 0 when used as an integer, which then gives the > first entry in the array. Thus you get the first entry in the array as > many times as you have entries in the array. Try changing that to a > regular (indexed) for loop and that should fix it. Good eye, I was too busy thinking of hashes and things. I hate array's. Should just be $user_list{$user}{DOMAINS .= "$_,"; huh? Thanks Dennis
Re: Values of an array..
> shouldnt 'my $user' be outside the foreach loop? No, it's supposed to be changed each iteration through the loop. Basically it saves $_ to something else, so the next foreach loop doesn't overwrite it, since I need it's value as a key for the hash the next loop creates. Dennis
Re: Values of an array..
shouldnt 'my $user' be outside the foreach loop? I had a similar coding problem this weekend - completely unrelated to mod_perl. I was using www::mechanize (greatest module ever) to parse xml and generate files. If i had 18 user sections, it was writing the last member to disk 18 times. I changed the scope of my vars slightly and all worked just fine. -- gedanken
Re: Values of an array..
"Dennis Stout" wrote ... my %user_list = get_users($where); foreach (keys %user_list) { my $user = $_; foreach (@{$user_list{$user}{DOMAIN}}) { $user_list{$user}{DOMAINS} .= "$user_list{$user}{DOMAIN}[$_],"; } chop($user_list{$user}{DOMAINS}); ... $user_list{$user}{DOMAINS} .= "$user_list{$user}{DOMAIN}[$_],"; That line is the culprit. $_ contains each domain name as a text string. Which evaluates to 0 when used as an integer, which then gives the first entry in the array. Thus you get the first entry in the array as many times as you have entries in the array. Try changing that to a regular (indexed) for loop and that should fix it. Hope that helps. -Andrew
Values of an array..
I dunno if it's an array or a reference ot an array anymore, heh. Whats happening, is instead of this thing pulling all 3 of my domains from a database, it's pulling the first domain in the list as many times as I have domains for. So when I only had 2 domains in the db for myself, it listed hte first twice. I added a 3rd ot test the theory, and behold, I get hte first one 3 times. Here is some massive subroutinage.. sub post_search_form { my $state = shift; my %args = $state->{q}; $state->{template} = 'generic.tmpl'; $state->{title} = "User Search"; my $blah = ""; my $where; my %search; $search{USER} = $state->{q}{user} if $state->{q}{user}; $search{ISP} = $state->{q}{isp} if $state->{q}{isp}; $search{PWORD} = $state->{q}{pword} if $state->{q}{pword}; if ($state->{q}{name}) { ($search{FIRST}, $search{LAST}) = split(" ",$state->{q}{name}); } $search{H_PHONE} = $search{W_PHONE} = $search{D_PHONE} = $search{C_PHONE} = $state->{q}{phone} if $state->{q}{phone}; $search{EMAIL1} = $search{EMAIL2} = $search{EMAIL3} = $search{EMAIL4} = $state->{q}{email} if $state->{q}{email}; $search{STATICIP} = $state->{q}{staticip} if $state->{q}{staticip}; $search{DOMAIN} = $state->{q}{domain} if $state->{q}{domain}; $search{ACCNUM} = $state->{q}{accnum} if $state->{q}{accnum}; foreach (keys %search) { if ($_ eq "DOMAIN") { $where .= "domain.$_ LIKE \"\%$search{$_}\%\" AND "; } elsif ($_ eq m/PHONE/) { $where =~ s/ AND $/ OR /; $where .= "users.$_ LIKE \"\%$search{$_}\%\" OR "; } else { $where .= "users.$_ LIKE \"\%$search{$_}\%\" AND "; } } $where =~ s/ OR $//; $where =~ s/ AND $//; my %user_list = get_users($where); foreach (keys %user_list) { my $user = $_; foreach (@{$user_list{$user}{DOMAIN}}) { $user_list{$user}{DOMAINS} .= "$user_list{$user}{DOMAIN}[$_],"; } chop($user_list{$user}{DOMAINS}); $blah .= "$_$user_list{$_}{ISP}$user_list{$_}{PWORD}$user_list{$_}{FIRST} $user_list{$_}{LAST}$user_list{$_}{H_PHONE},$user_list{$_}{W_PHONE} ,$user_list{$_}{C_PHONE},$user_list{$_}{D_PHONE}$user_list{$_}{EMAI L1},$user_list{$_}{EMAIL2},$user_list{$_}{EMAIL3},$user_list{$_}{EMAIL4}$user_list{$_}{STATICIP}$user_list{$_}{DOMAINS}$user_ list{$_}{ACCNUM}"; } $args{body} =< userisppasswordnamephoneemail static ipdomainservice number $blah EOF return output_html($state, %args); } sub get_users { my $where = shift; my %search; my %user_list; my $sth = $Sql->select("ISP,USER,PWORD,FIRST,LAST,H_PHONE,W_PHONE,C_PHONE,D_PHONE,EMAI L1,EMAIL2,EMAIL3,EMAIL4,STATICIP,ACCNUM","users","$where"); while (my $row = $sth->fetchrow_hashref) { $user_list{$row->{USER}} = { ISP => $row->{ISP}, PWORD => $row->{PWORD}, FIRST => $row->{FIRST}, LAST=> $row->{LAST}, H_PHONE => $row->{H_PHONE}, W_PHONE => $row->{W_PHONE}, C_PHONE => $row->{C_PHONE}, D_PHONE => $row->{D_PHONE}, EMAIL => $row->{EMAIL}, STATICIP=> $row->{STATICIP}, ACCNUM => $row->{ACCNUM}, }; } foreach my $user (keys %user_list) { $sth = $Sql->select("DOMAIN","domain","USER='$user'"); while (my $row = $sth->fetchrow_hashref) { push @{$user_list{$user}{DOMAIN}}, $row->{DOMAIN}; warn "$row->{DOMAIN}"; } } return %user_list; } That warn statement in sub get_users generates this in my error_log file www.blah.org at /home/httpd/ttms/perl/SQLCrap.pm line 145. www.boop.com at /home/httpd/ttms/perl/SQLCrap.pm line 145. www.fucker.com at /home/httpd/ttms/perl/SQLCrap.pm line 145. And yet displayed on the webpage is www.blah.org,www.blah.org,www.blah.org So uh... what am I doing wrong? Dennis
Re: templating system opinions
Perrin Harkins wrote: The one thing about TT was that I don't know if I really liked how it had a different syntax than perl. Plus, as far as performance, we did some specific coding to make it faster for Slash so our templates would be in the DB. That's an anti-optimization. Filesystems are faster than databases when all you want is to fetch a single item with a specific name. It's also a pain in the ass to edit things that are in a database, as opposed to just files. I agree -- filesystems have all these great new remote access protocols like ftp and scp. That's why I took this option (storing templates in the database) out of OpenInteract. Well, actually you can still do it, I just make it really tough :-) Chris -- Chris Winters ([EMAIL PROTECTED]) Building enterprise-capable snack solutions since 1988.
Re: templating system opinions
On Fri, 2003-07-18 at 18:37, Patrick Galbraith wrote: > The one thing about TT was that I don't know if I really liked how it > had a different syntax than perl. Plus, as far as performance, we did > some specific coding to make it faster for Slash so our templates would > be in the DB. That's an anti-optimization. Filesystems are faster than databases when all you want is to fetch a single item with a specific name. It's also a pain in the ass to edit things that are in a database, as opposed to just files. - Perrin
Re: caching questions
On Sun, 2003-07-20 at 15:47, Patrick Galbraith wrote: > One thing that my code does is check to see if it's cache has been > updated to the db, which I wish I could really have some sort of cache > that's in one place in memory (as opposed to each child process). Well, you can't, unless you use threads. > I know there's IPC, and also memcached. I've used IPC::Shareable before, > but don't know if that's the route I'd wanna go. It's not. IPC::Shareable is very slow. If you want to share data, use Cache::FileCache, Cache::Mmap, MLDBM::Sync, or IPC::MM. > Has anyone implemented a good caching system that sets up a global cache > that you don't have to check constantly because you happen to have been > served out by a child that doesn't have the latest cache from DB? One > single memory object? The systems I listed above all use a shared cache that will have the same data regardless of which process accesses it. - Perrin
Re: templating system opinions
On Mon, 21 Jul 2003, Sam Tregar wrote: > My impression is that Mason doesn't get much advantage from clients > that only use part of the Mason system. I imagine that one of the > reasons that the Mason workalike I built for Bricolage is faster than > Mason is that it only implements the functionality actually needed by > Bricolage. Following this line of thinking it might be possible to > modify Mason to only use/load the slower/bigger pieces when they are > actually needed. Of course, I'm no authority on why Mason is slow or > how it could be fixed. It's not the loading of things that's slow, it's the execution path for a request. We do have some ideas on how we can speed this up, but it'll probably involve the user choosing an optimized, less feature-ful or flexible class for something (like resolving URLs to components), rather than Mason itself trying to figure out what to optimize dynamically. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: templating system opinions
Perrin Harkins wrote: On Mon, 2003-07-21 at 12:22, Kip Hampton wrote: Why choose one when you can have 'em all? :-) Well, no offense to AxKit, but having multiple templating systems in a single project is something that I specifically work to avoid. It complicates things and typically hurts performance. Developer time is always more costly than bigger iron so I prefer environments that let people use the tools that they know and can be nore rapidly productive with. AxKit lets me choose, and If I don't need it, I don't use it (or load it) but if I do, then its available. If I had an Apache::ASP app and wanted to use XSLT, I would just use the built-in support for it. If I had a Mason app, I would use XML::libXSLT directly. Certainly, and you wouldn't be wrong to do so. However, the instant you want to start applying different styles to content based on environemental conditions, or setting up chains of transformations, then you begin duplicating logic in your app code that AxKit already does well behind the scenes by adding a directive or two to your httpd.conf. "Horses for courses" as the saying goes; personally, I prefer having more choices. -kip
Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)
> Well, the problem is that I get this error in my error_log: > > [Mon Jul 21 14:18:55 2003] [error] 4297: ModPerl::RegistryBB: 20014:Error > string not specified yet at /var/www/perl/test.pl line 6. > > Also, more important, the script seems to be terminating and/or any output > following the 'print ""' is not sent to the client as far as I can tell. This is another story! You have a problem with ModPerl::RegistryBB. HTTP log can't help if ModPerl::RegistryBB aborts at that point. From my point of view it is supposed to be a warning (or debug/warning) instead of the error in ModPerl::RegistryBB, because it could be necessary sometimes to flush empty string (for example, to overwrite the default chunking behavior of core Apache). Unfortunately, I can't look into the sources of Apache-2 now. Can somebody help to patch this problem on Bill's machine first in order to let us to go ahead with this research? Thanks, Slava
Re: Calling a mod_perl method from whithin a CGI script
On Sun, 2003-07-20 at 17:15, Eric Ricardo Anton wrote: > Since I can't port the scripts from mod_cgi to mod_perl, how can I make > a CGI script call a mod_perl method? You can't. When you run a script under mod_cgi, mod_perl functions are not available. However, you could try running your scripts under Apache::Registry, and then you'd be able to use the mod_perl API. - Perrin
RE: Need help, Global Hash corruption under mod_perl in perl5.8.0!?!
On Mon, 2003-07-21 at 02:41, Влад Сафронов wrote: > I'm using only Apache::ePerl which allows me use Perl in the the way > like > PHP, since I don't need Mason or EmbPerl html features for small WAP > resources. I think you should consider using a system that is actually supported. Embperl, Apache::ASP, Text::Template, and Mason all have similar syntax to ePerl. There are lots of other things on CPAN that might be even closer in syntax, but are not as widely used and well supported. > I just can't understand where the Apache::ePerl > bug can be -- > it so simple and so clear module.. and it worked on older perl! You should go through the change log for Perl 5.8 then, since something that changed between 5.6 and 5.8 must be causing problems for you. > where is all community? it's so silent in the conference. what the > language > perl programmers migrated to? JSP, PHP? :( Are you asking why more people aren't responding to your question? Probably because almost no one uses ePerl any more. - Perrin
RE: Need help, Global Hash corruption under mod_perl in perl5.8.0!?!
On Mon, 2003-07-21 at 02:51, Влад Сафронов wrote: > I have done code deparsing of eperl scripts saved in Cache > all started with > > package Parse::ePerl; > use strict 'refs'; > print(qq[\n]); > > so they all have the same package name. Can it cause a bug? > Ap::Registry keeps different package name for every script.. It means that all globals and subs are shared between all of your scripts. It could cause a bug if you use the same names for globals or subs in multiple scripts. - Perrin
Re: Question to mod_perl gurus. Take 1 minute. Just choose rightanswer from list!
On Mon, 2003-07-21 at 07:31, Влад Сафронов wrote: > so the question: > which sub "main_deck" will be executed? > > 1. Hi, it's SCRIPT_1! > 2. Bye, it was SCRIPT_2! I think #2, because it was the last one eval'ed, and you can only have one sub with a given name in one package namespace. Apache::ePerl does not really support the use of in-line subs. You have to put them in a separate module. - Perrin
Re: templating system opinions
On Mon, 21 Jul 2003, Dave Rolsky wrote: > On Mon, 21 Jul 2003, Sam Tregar wrote: > > > I wouldn't be too sure. I implemented a lot of that stuff to add > > HTML::Template support to Bricolage and it's still much faster than > > Mason. > > "A lot" as in _all_ of it, or a "lot" as in autohandlers and dhandlers? "A lot" as in everything that was needed to get HTML::Template to fill the role of Mason in Bricolage's publish process. I'd certainly be a fool to claim I'd implemented all of Mason! I doubt I could even list all the stuff that Mason does. > In other words, I don't think one could do all of the same stuff, or > even most, and achieve a huge speed increase. There would have to > be something sacrificed. My impression is that Mason doesn't get much advantage from clients that only use part of the Mason system. I imagine that one of the reasons that the Mason workalike I built for Bricolage is faster than Mason is that it only implements the functionality actually needed by Bricolage. Following this line of thinking it might be possible to modify Mason to only use/load the slower/bigger pieces when they are actually needed. Of course, I'm no authority on why Mason is slow or how it could be fixed. I have plans to go a similar route with HTML::Template in the future. I'd like to build a system that dynamically assembles itself based on the usage pattern of the program. That way if the programmer sticks to the basics they get a smaller, faster system. If they need the big guns then the more complete systems can be loaded at some moderate penalty. -sam
Re: templating system opinions (axkit?)
On Mon, 2003-07-21 at 12:14, Patrick Galbraith wrote: > I get so tired of Java types talking about how "perl is just a scripting > language.. it's not an application platform/server like > Dynamo/WebSpere/". I even tried to crack > a particular Orielly java book and was turned off on a statement like > "Perl is good for proto-typing but not a full application server". Yes, > there are a lot of prototypes getting millions of pageviews a day and > generating signicifican revenue. > > I'd like to see perl/mod_perl reclaim some of the lost ground. Yahoo and Amazon both use perl much more than they use Java. eBay is going Java (from C++), but it's costing them millions and taking years. Ticket Master and CitySearch are both Perl. It looks to me like there is very little evidence to support the claim that Java is in any way better for building high-volume sites. - Perrin
Re: templating system opinions
On Mon, 2003-07-21 at 12:22, Kip Hampton wrote: > And don't forget that, with AxKit, you can use Apache::ASP, Mason, or > any Apache::Filter-aware handler to provide content for AxKit to > transform and TT2 as a transformational language. Oh, and there's > XPathScript, too, which, although its only one part of AxKit, is really > a novel "templating/trasformation" language all on its own... > > Why choose one when you can have 'em all? :-) Well, no offense to AxKit, but having multiple templating systems in a single project is something that I specifically work to avoid. It complicates things and typically hurts performance. If I had an Apache::ASP app and wanted to use XSLT, I would just use the built-in support for it. If I had a Mason app, I would use XML::libXSLT directly. - Perrin
Re: templating system opinions (axkit?)
"Jesse Erlbaum" <[EMAIL PROTECTED]> wrote: >It's mostly hype in my experience. And not even very useful hype, like >Java or PHP, which are actually real things which people might want to >use. > >XSLT seems to be XML geeks' answer to CSS+templating. As if CSS wasn't >very successful, as if the world needed another templating system, XSLT >seems to have been invented to take the creative work of designing web >sites out of the hands of HTML designers, and put it in the hands of >XPath programmers. You know. Programmers who are really good at both >creative design and communicating with human beings. Not. > >Alright, pretty smarmy. But unless you just happen to have thousands of >XML documents sitting around on your hard drive, XSLT is a solution in >search of a problem. Most of my data is in a RDBMS -- not XML. To >enhance the *need* for XSLT, some databases will now return XML. That's >an interesting idea. Instead of using a mature language like >Perl|Java|PHP, let's use something like XSLT to turn my data into a web >page! It's new, shiny, and will solve the problem of TOO MANY people >knowing the other aforementioned languages. D'oh! > >Too cynical? Maybe. The fact that XSLT is still discussed in serious >company just bugs me. ;-) This is a bit disorganized, but I'm trying to explain why different things have their place, at least in the work I'm doing. I am working on a project with the following simplified pipeline in an MVC environment: TT2 -> HTML::Mason -> AxKit -> Client I use each of these for their strengths. I don't expect each one to do everything I need. We want the people that know our customers the best to be the ones that provide the content for the site. These same people are not programmers. They do not like programming. They don't like being near code for fear they will mess something up. I will let them edit TT2 templates. Since they don't like the Unix editors or CVS, I will provide (initially) a web interface for editing and a revision-controlled repository (Gestinanna::POF::Repository). The templates will produce XML so the author can concentrate on content and not worry about presentation. We want others who understand the processes a customer can understand to be the ones writing the controllers. These are XML documents that define a state machine (StateMachine::Gestinanna) that walk a customer through a process to get something done (and applying the right XSLT can create the documentation for the state machine). But these same documents do not expose the full Perl language or the server in the hope of having one less security hole to worry about. In fact, the applications can usually be prototyped without invoking the model or having any code run on a state/edge transition. Once the process flow is finalized, the model can be tied in. These are run in HTML::Mason and determine which template will be used to produce the XML. The model is written as a set of Perl modules (e.g., Gestinanna::POF). The authors of these modules are trusted, usually the same people that are responsible for system security and operation. They can have full access to the server. The modules provide an OO interface to most business operations controlled by the controller. The XML produced by the template is processed by AxKit to produce HTML, WML, or some other format usable by the customer's client. The other benefit of XSLT is that like content is treated in a consistent manner in the end document. Customers can always expect a particular content type to be in a particular format for a given document type without the person writing the content having to constantly check their work against a style sheet. If the person responsible for the layout and look of the site changes something, only the XSLT and CSS have to be changed. Usually, only the CSS has to be changed unless there are major structural changes to the site. The look and layout of the site is done in Photoshop, not in IE. This allows someone that does know XSLT to go in and make sure the resulting HTML matches for a wide range of browsers what was done in Photoshop. We also tend to stick with the W3C recommendations instead of relying on proprietary features/bugs. Of course, we're also a state institution under certain legal restrictions regarding what we can do on the web. So I'm using TT2, HTML::Mason and AxKit to work on a site using XML and XSLT. Each has its role based on personnel constraints that are outside the technical requirements of the project. Even so, it results in a highly customizable application that requires little effort at any particular point. I'm working on throwing SOAP and Jabber into the mix as well. I haven't done any performance tuning yet. The primary focus of the application is security, then maintainability, then usability. -- James Smith <[EMAIL PROTECTED]>, 979-862-3725 Texas A&M CIS Operating Systems Group, Unix
Re: templating system opinions (axkit?)
Anyone on this list use AxKit? I'm curious how it pans out. I used it for http://www.nikki-site.com (sorry, Japanese-only site). This site uses exactly 4 pure-mod_perl handlers, and everything else eventually goes through AxKit (excuse the site design, as far as development goes that is a one-man show, and I'm a programmer, not a designer ;) I was keen on leveraging XSLT precisely because I knew that I'd be transforming a data source through mod_perl + in a cron job, AND I wanted to avoid using Perl on the cronjobs because of the resource constraints (puny server). When a user requests data, AxKit uses a stylesheet to transform it to HTML. Meanwhile the same data source is preprocessed a couple of times behind the scenes to create derivative data, which is later available for users to fetch from Apache. The "preprocessing" is done using the same stylesheet as the one that AxKit, but it is run via multiple calls to xsltproc instead of going though Perl. So I get the speed of a C-based app using the same stylesheet as mod_perl. I like that ;) (note for nit-pickers: I admit I didn't do an extensive comparison of how it would have faired to use optimized Perl, but the previous incarnation of www.nikki-site.com used to take about 3 minutes processing the same data -- xsltproc does it in about 13 seconds) I also like the way AxKit applies transformation. I conceptually think of it as a set of filters, and that just fits my mental model. YMMV. XSP is also very convenient, but I must admit I haven't harnessed its entire functionality. On the other hand I must say that debugging problems on AxKit is pretty harsh on beginners. I went in with the mindset that if it was broken I was going to make it work, so I didn't have much problem, but that may or may not work for you. Overall I find AxKit to be god-sent for my particular application. Things became much easier for me to add to the site, but if you're not already familiar with the workings of XML/XSLT, you may need a little patience. --d
Re: templating system opinions
On Mon, 21 Jul 2003, Sam Tregar wrote: > On Sun, 20 Jul 2003, Dave Rolsky wrote: > > > OTOH, if you were to try to replicate some of Mason's more powerful > > features with H::T, like autohandlers, inheritance, etc., then I'm > > sure that'd bring H::T's speed down to Mason's level ;) > > I wouldn't be too sure. I implemented a lot of that stuff to add > HTML::Template support to Bricolage and it's still much faster than > Mason. "A lot" as in _all_ of it, or a "lot" as in autohandlers and dhandlers? I'll believe it when I see it. There's nothing about Mason that's particularly slow except the code that implements the features. In other words, I don't think one could do all of the same stuff, or even most, and achieve a huge speed increase. There would have to be something sacrificed. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: problems with Perl under windows, apache
On Mon, 2003-07-21 at 12:22, Erik Browaldh wrote: > I have a script under windows with apache that doesnt seems to work. Are you running it under mod_perl? If so, please tell us if it's mod_perl 1 or 2, and include the info listed at the "report problems" link on http://perl.apache.org/. We really can't guess much without seeing your code. - Perrin
Re: templating system opinions
On Sun, 20 Jul 2003, Dave Rolsky wrote: > OTOH, if you were to try to replicate some of Mason's more powerful > features with H::T, like autohandlers, inheritance, etc., then I'm > sure that'd bring H::T's speed down to Mason's level ;) I wouldn't be too sure. I implemented a lot of that stuff to add HTML::Template support to Bricolage and it's still much faster than Mason. > In other words, you generally get what you pay for. The most powerful and > flexible systems are generally slower and more RAM-hungry. One exception > to this might be Embperl, which has large chunks written in C. In that > case, the cost is paid for in development time. HTML::Template::JIT also trades development time (mine) for run-time speed. Right now it doesn't support all of HTML::Template's functionality, but it comes pretty close. The upside is that it's between four and eight times faster than HTML::Template, which makes it the fastest templating system by a large margin. -sam
Re: templating system opinions (axkit?)
Jesse Erlbaum wrote: Hi Patrick -- I like the idea of XSLT/XML, though I find myself trying to read between the lines of hype vs. something that's actually very useful. I don't know, so I don't have any opinions. I do know I'd like to use XSLT/XML so as to have a project to use it for, hence learn it. It's mostly hype in my experience. And not even very useful hype, like Java or PHP, which are actually real things which people might want to use. I don't quite understand what isn't "real" about XML or XSLT. XML really is a way to structure your data, XSLT really is a way to transform that structured data. But unless you just happen to have thousands of XML documents sitting around on your hard drive, XSLT is a solution in search of a problem. Most of my data is in a RDBMS -- not XML. Or, if you have thousands of XML documents sitting around on your hard drive, XSLT is an efficient way to translate them into XHTML and deliver them to a browser. You do make a good point that XSLT probably isn't for folks who store the all data they are delivering in a RDBMS. Adding layers onto your RDBMS to make it return XML, and then transforming that newly generated XML using XSLT may not be the best solution. But if folks are storing indexed XML documents on their filesystem (a la XML::Comma or a similar framework) XSLT can be quite handy. Too cynical? Maybe. The fact that XSLT is still discussed in serious company just bugs me. ;-) Well, I've always considered myself to be pretty light-hearted. Sometimes bordering on straight goofy ;-) TTYL, -Jesse- -- Douglas
Re: templating system opinions
On Mon, 21 Jul 2003, Patrick Galbraith wrote: > I'm guessing they use it for IMDB, although they may have other > projects as well that use it. I do know that their core app is > C++/apache, with some sort of perl glue to talk to the app. I believe IMDB uses mod_perl, but I don't know about Mason. I know Amazon is using Mason for _Amazon_, not things they've bought. They're using it for the their apparel shop, among other things. I don't want to say too much more because I'm hoping for a bigger announcement from more reputable sources, but I can't promise anything ;) -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)
We can see that mod_cgi bufferizes the output and sends it with Content-Length HTTP header (to mod_deflate). Indeed mod_perl generates chunked response. Finally we have the same result. I don't see any problem at this moment. Well, the problem is that I get this error in my error_log: [Mon Jul 21 14:18:55 2003] [error] 4297: ModPerl::RegistryBB: 20014:Error string not specified yet at /var/www/perl/test.pl line 6. Also, more important, the script seems to be terminating and/or any output following the 'print ""' is not sent to the client as far as I can tell. You would probably wish to append your script with additional output after the empty string? Something like: #!/usr/bin/perl $|=1; print "Content-Type: text/html\n\n"; print "hello world"; # This line causes the error (?) print ""; print "hello again"; --- When I do this, the mod_perl variant of the script fails to print "hello again". mod_cgi prints everything just fine and gets no errors. I changed my test script to print a bunch of `date`'s http://shevek.kenyonhill.com/cgi/test.pl http://shevek.kenyonhill.com/perl/test.pl It may cause a problem for chunked output if mod_deflate does not care to keep internal buffer and check its size when flushing... I may not be understanding the output you sent or what you're saying, but I still don't follow why this would be a mod_deflate bug if mod_cgi with the same script has no problem.
[OT] XSLT [Formerly: templating system opinions (axkit?)]
I recently found one good use for not bashing XSLT right away. We were using JUnit and JUnitReport to do unit testing and reporting for our java using the Ant build tool. JUnit runs tests and can generate the output to xml. JUnitReport uses xslt to transform them to websites. I simply hacked up Test::Harness with XML::DOM to generate a report for all my perl tests. Every night we run a few thousand perl and java tests, JUnitReport picks them both up without knowing or caring about the difference ... and generates an easy to browse report. I acutally found it VERY cool. Writing the test harness we pretty easy too. It only took me about 2 hrs to translate all the java harnesses. On the other hand, I tried to make one small change in the xslt, and having never done it before, I found it very, very annoying to follow. By the way, I had never done java before either. In summary, XSLT was fast, and worked with both languages without a problem so long as I used valid xml. > Alright, pretty smarmy. But unless you just happen to have > thousands of > XML documents sitting around on your hard drive, XSLT is a > solution in > search of a problem. Most of my data is in a RDBMS -- not XML. To > enhance the *need* for XSLT, some databases will now return XML. > That'san interesting idea. Instead of using a mature language like > Perl|Java|PHP, let's use something like XSLT to turn my data into > a web > page! It's new, shiny, and will solve the problem of TOO MANY people > knowing the other aforementioned languages. D'oh!
small doc typo...
Hi! Just perusing: http://perl.apache.org/docs/2.0/devel/core/apache_integration.html#The_Link_Between_mod_perl_and_httpd and found a small typo. "STANDARD20_MODULE_STUFF is a standard macro defined in httpd-2.0/include/http_config.h. Currently its main use *if* for attaching Apache version magic numbers," Probably mean, "Currently its main use *is *for..." thanks, speeves cws
RE: templating system opinions (axkit?)
Hi Patrick -- > I like the idea of XSLT/XML, though I find myself trying to > read between > the lines of hype vs. something that's actually very useful. > I don't know, > so I don't have any opinions. I do know I'd like to use > XSLT/XML so as to > have a project to use it for, hence learn it. It's mostly hype in my experience. And not even very useful hype, like Java or PHP, which are actually real things which people might want to use. XSLT seems to be XML geeks' answer to CSS+templating. As if CSS wasn't very successful, as if the world needed another templating system, XSLT seems to have been invented to take the creative work of designing web sites out of the hands of HTML designers, and put it in the hands of XPath programmers. You know. Programmers who are really good at both creative design and communicating with human beings. Not. Alright, pretty smarmy. But unless you just happen to have thousands of XML documents sitting around on your hard drive, XSLT is a solution in search of a problem. Most of my data is in a RDBMS -- not XML. To enhance the *need* for XSLT, some databases will now return XML. That's an interesting idea. Instead of using a mature language like Perl|Java|PHP, let's use something like XSLT to turn my data into a web page! It's new, shiny, and will solve the problem of TOO MANY people knowing the other aforementioned languages. D'oh! Too cynical? Maybe. The fact that XSLT is still discussed in serious company just bugs me. ;-) > Not just that, but what about SOAP... Net RPC... I'd like to > know where > those fit in as well. Fantastic, useful stuff. > I get so tired of Java types talking about how "perl is just > a scripting > language.. it's not an application platform/server like > Dynamo/WebSpere/". I even > tried to crack > a particular Orielly java book and was turned off on a statement like > "Perl is good for proto-typing but not a full application > server". Yes, > there are a lot of prototypes getting millions of pageviews a day and > generating signicifican revenue. You hit the nail on the head there: "Prototype" in Perl, and then just keep using it! A strategy for the NEW "New Economy". TTYL, -Jesse- -- Jesse Erlbaum The Erlbaum Group [EMAIL PROTECTED] Phone: 212-684-6161 Fax: 212-684-6226
Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)
Well, let's see: ==> (93.530) Outgoing Request http://shevek.kenyonhill.com/cgi/test.pl HTTP/1.1> C05 --> S06 GET /cgi/test.pl HTTP/1.1 C05 --> S06 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/msword, */* C05 --> S06 Accept-Language: en-us C05 --> S06 Accept-Encoding: gzip, deflate C05 --> S06 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) C05 --> S06 Host: shevek.kenyonhill.com C05 --> S06 Accept-Charset: ISO-8859-1 == Body was 0 bytes == C05 <-- S06 HTTP/1.1 200 OK C05 <-- S06 Date: Mon, 21 Jul 2003 16:30:59 GMT C05 <-- S06 Server: Apache C05 <-- S06 Vary: Accept-Encoding,User-Agent C05 <-- S06 Content-Encoding: gzip C05 <-- S06 Content-Length: 34 C05 <-- S06 Connection: close C05 <-- S06 Content-Type: text/html; charset=ISO-8859-1 C05 <-- S06 == Incoming Body was 34 bytes == == real URL = http://shevek.kenyonhill.com/cgi/test.pl == == Transmission: text gzip == == (93.640) Response 200 to http://shevek.kenyonhill.com/cgi/test.pl HTTP/1.1> == Latency = 0.110 seconds, Extra Delay = 0.000 seconds == Restored Body was 14 bytes == == Content Begin: == hello world == Content End == ==> (164.770) Outgoing Request http://shevek.kenyonhill.com/perl/test.pl HTTP/1.1> C05 --> S06 GET /perl/test.pl HTTP/1.1 C05 --> S06 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/msword, */* C05 --> S06 Accept-Language: en-us C05 --> S06 Accept-Encoding: gzip, deflate C05 --> S06 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) C05 --> S06 Host: shevek.kenyonhill.com C05 --> S06 Accept-Charset: ISO-8859-1 == Body was 0 bytes == C05 <-- S06 HTTP/1.1 200 OK C05 <-- S06 Date: Mon, 21 Jul 2003 16:32:11 GMT C05 <-- S06 Server: Apache C05 <-- S06 Vary: Accept-Encoding,User-Agent C05 <-- S06 Content-Encoding: gzip C05 <-- S06 Connection: close C05 <-- S06 Transfer-Encoding: chunked C05 <-- S06 Content-Type: text/html; charset=ISO-8859-1 C05 <-- S06 == Incoming Body was 629 bytes == == real URL = http://shevek.kenyonhill.com/perl/test.pl == == Transmission: text gzip chunked == == Chunk Log == 1e (hex) = 30 (dec) 245 (hex) = 581 (dec) 0 (hex) = 0 (dec) == (164.880) Response 200 to http://shevek.kenyonhill.com/perl/test.pl HTTP/1.1> == Latency = 0.110 seconds, Extra Delay = 0.000 seconds == Restored Body was 14 bytes == == Content Begin: == hello world == Content End == We can see that mod_cgi bufferizes the output and sends it with Content-Length HTTP header (to mod_deflate). Indeed mod_perl generates chunked response. Finally we have the same result. I don't see any problem at this moment. You would probably wish to append your script with additional output after the empty string? Something like: #!/usr/bin/perl $|=1; print "Content-Type: text/html\n\n"; print "hello world"; # This line causes the error (?) print ""; print "hello again"; --- It may cause a problem for chunked output if mod_deflate does not care to keep internal buffer and check its size when flushing... Thanks, Slava - Original Message - From: "Bill Marrs" <[EMAIL PROTECTED]> To: "Slava Bizyayev" <[EMAIL PROTECTED]>; "Stas Bekman" <[EMAIL PROTECTED]>; "Philippe M. Chiasson" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, July 21, 2003 6:49 AM Subject: Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified) > > >I can measure it myself if you can provide me with URLs to your resources > >and identify them in terms of which one is mod_CGI and which is mod_perl. > > This is the mod_cgi one that works fine, no errors: > http://shevek.kenyonhill.com/cgi/test.pl > > This is the mod_perl one (same script) that generates the "20014:Error" in > the error_log. Also, the page doesn't display correctly (it seems to erase > itself): > > http://shevek.kenyonhill.com/perl/test.pl > > This is the contents of test.pl: > > --- > #!/usr/bin/perl > $|=1; > print "Content-Type: text/html\n\n"; > print "hello world"; > # This line causes the error > print ""; > --- > > Let me know if you need anything more. > >
Re: templating system opinions (axkit?)
Anyone on this list use AxKit? I'm curious how it pans out. I like the idea of XSLT/XML, though I find myself trying to read between the lines of hype vs. something that's actually very useful. I don't know, so I don't have any opinions. I do know I'd like to use XSLT/XML so as to have a project to use it for, hence learn it. Not just that, but what about SOAP... Net RPC... I'd like to know where those fit in as well. I get so tired of Java types talking about how "perl is just a scripting language.. it's not an application platform/server like Dynamo/WebSpere/". I even tried to crack a particular Orielly java book and was turned off on a statement like "Perl is good for proto-typing but not a full application server". Yes, there are a lot of prototypes getting millions of pageviews a day and generating signicifican revenue. I'd like to see perl/mod_perl reclaim some of the lost ground. On Sun, 20 Jul 2003, Dave Rolsky wrote: > On Sun, 20 Jul 2003, Patrick Galbraith wrote: > > > I've been working at Classmates.com for a couple months contracting, and > > they use Text::Forge. > > > > I've been impressed by the performance, and wish it was a big player. > > Part of the reason it isn't is guys like me should contribute to it and > > make it a bigger player. > > I'd say the big reason it's not a big player is that it doesn't offer > anything new. It also doesn't seem to be very actively developed and has > very little documentation. > > > I really like the syntax - it looks a lot like JSP. > > Yeah, just like Apache::ASP ;) > > > All of this said, what is the most commonly used system out there? > > The biggest players are Mason and Template Toolkit, judging from "big > companies" that have used them, as well as job posting. HTML::Template, > Embperl, and Apache::ASP all seem to have reasonably active user bases as > well. > > > -dave > > /*=== > House Absolute Consulting > www.houseabsolute.com > ===*/ > -- Patrick Galbraith Senior Software Developer [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
Re: templating system opinions
I'm guessing they use it for IMDB, although they may have other projects as well that use it. I do know that their core app is C++/apache, with some sort of perl glue to talk to the app. Nice that they are such an apache/perl/OS house considering they're here in Seattle, mere miles from Redmond ;) They're also not one of several places who think jumping on the java bandwagon is the path to enlightenment. Ehem. On Mon, 21 Jul 2003, Dave Rolsky wrote: > On Mon, 21 Jul 2003, Drew Taylor wrote: > > > I personally have not seen an "official" announcement, but if you look > > at all their postings on jobs.perl.org you'll notice that nearly every > > one of them mentions Mason. I'm sure Dave will have more to say on the > > subject... :-) > > Not too much more. But hopefully more will be forthcoming from people > closer to Amazon than I. > > > -dave > > /*=== > House Absolute Consulting > www.houseabsolute.com > ===*/ > -- Patrick Galbraith Senior Software Developer [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
Re: templating system opinions
On Mon, 21 Jul 2003, Drew Taylor wrote: > I personally have not seen an "official" announcement, but if you look > at all their postings on jobs.perl.org you'll notice that nearly every > one of them mentions Mason. I'm sure Dave will have more to say on the > subject... :-) Not too much more. But hopefully more will be forthcoming from people closer to Amazon than I. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
problems with Perl under windows, apache
Hello! I have a script under windows with apache that doesnt seems to work. The script is reading a log-file and writing new information. But when trying it over internet, my skript does not do any changes to the log-file. (ie its only replacing the last entry instead of increasing the list) By now I have to say that when trying my script under unix, apache as localhost, the script is working perfectly. Perhaps these may be clues...: the perl-skript is executed under: C:/WEB/Apache//perl/log.pl (the logfile is r/w from this DIR aswell) chmod is already set for more users. and Im using file-lock when reading the file and later on writing in it. I use a refresh-function, called every 5th min. use POSIX 'strftime'; $delay = 300; .. print "Refresh: ", $delay, "\n"; Maybe the cache is used for updating the log-file instead of taking updates from the html-formula? but why and how do I change that? any configurationhelp or hints are welcome! Erik
Re: templating system opinions
Matt Sergeant wrote: (you can of course use XSLT in AxKit :-) And don't forget that, with AxKit, you can use Apache::ASP, Mason, or any Apache::Filter-aware handler to provide content for AxKit to transform and TT2 as a transformational language. Oh, and there's XPathScript, too, which, although its only one part of AxKit, is really a novel "templating/trasformation" language all on its own... Why choose one when you can have 'em all? :-) -kip
Re: ANNOUNCE: Apache::Dynagzip 0.10
Yes John, I understand. I'm working on this now. Slava - Original Message - From: "John Siracusa" <[EMAIL PROTECTED]> To: "Mod Perl Mailing List" <[EMAIL PROTECTED]> Sent: Monday, July 21, 2003 11:03 AM Subject: Re: ANNOUNCE: Apache::Dynagzip 0.10 > On 7/21/03 9:47 AM, John Siracusa wrote: > > On 7/20/03 11:12 PM, Slava Bizyayev wrote: > >> Your own content-type is supposed to be overwritten only in case of the use > >> of > >> > >> PerlSetVar UseCGIHeadersFromScript Off > >> > >> in your configuration file. You might wish to comment this line in your > >> configuration file when your script generates correct header line in > >> accordance with CGI/1.0 and/or CGI/1.1. > > > > I don't have that line in my config. I'm setting the content type using > > $r->content_type() in my apache module. I'm not using CGI/registry scripts, > > and I'm not doing print "Content-Type: ..." anywhere. > > ...and in case this reply wasn't clear, I'd like a way to tell > Apache::Dynagzip to "never set the outgoing content type header, no matter > what." Anyone with an apache module in the filter chain who sets the > outgoing content type header will need this feature. > > -John > >
Re: ANNOUNCE: Apache::Dynagzip 0.10
On 7/21/03 9:47 AM, John Siracusa wrote: > On 7/20/03 11:12 PM, Slava Bizyayev wrote: >> Your own content-type is supposed to be overwritten only in case of the use >> of >> >> PerlSetVar UseCGIHeadersFromScript Off >> >> in your configuration file. You might wish to comment this line in your >> configuration file when your script generates correct header line in >> accordance with CGI/1.0 and/or CGI/1.1. > > I don't have that line in my config. I'm setting the content type using > $r->content_type() in my apache module. I'm not using CGI/registry scripts, > and I'm not doing print "Content-Type: ..." anywhere. ...and in case this reply wasn't clear, I'd like a way to tell Apache::Dynagzip to "never set the outgoing content type header, no matter what." Anyone with an apache module in the filter chain who sets the outgoing content type header will need this feature. -John
Re: Content compression FAQ
Thank you Igor, I will patch FAQ with this shortly. Slava - Original Message - From: "Igor Sysoev" <[EMAIL PROTECTED]> To: "Slava Bizyayev" <[EMAIL PROTECTED]> Cc: "Stas Bekman" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, July 21, 2003 5:19 AM Subject: Re: Content compression FAQ > On Sat, 19 Jul 2003, Slava Bizyayev wrote: > > Here is small correction to Web Content Compression FAQ. > What does HTTP/1.0 only support mean in this answer: > > > Q: Are there any content compression solutions for vanilla Apache 1.3.X? > > A: Yes, There are two compression modules written in C that are available > for vanilla Apache 1.3.X: > > * mod_deflate > an Apache handler written in C by Igor Sysoev (Russia). > > * mod_gzip > an Apache handler written in C. Original author: Kevin Kiley, > Remote Communications, Inc. (U.S.) > > Both of these modules support HTTP/1.0 only. > > > mod_deflate does not care about chunks at all - Apache does it. > If Apache's responses is HTTP/1.1 then Apache send it in chunks > because mod_deflate always deletes "Content-Length" header. > > mod_deflate compresses content using 8K buffer. When the buffer > is filled mod_deflate passes the compressed data to Apache. > If an upstream module calls ap_bflush() to flush a pending data > then mod_deflate asks zlib to flush a compressed stream and > then passes a partially filled buffer to Apache. Since flushing > a compressed stream descreases a compression ratio so mod_deflate has > "DeflateIgnoreFlush" to ignore the ap_bflush() calls of an upstream module. > It can be used for example with Chili!Soft ASP that calls ap_bflush() > after any output even after an output of several bytes. > > So mod_deflate as well as "Apache::Dynagzip are the only handlers > to date that begins transmission of compressed data as soon as > the initial uncompressed pieces of data arrive from their source, > at a time when the source process may not even have completed > generating the full document it is sending. Transmission can therefore > be taking place concurrent with creation of later document content". > > > Igor Sysoev > http://sysoev.ru/en/ > >
Re: templating system opinions
I wanted to add that you *can* use Mason for MVC type programming. I do that on my current big project, www.better-investing.org, in the admin areas. I have a controller index.html page which chooses what component to run based on a run mode, just like CGI::Application, but then gives me all of the other stuff like autohandlers for the display. I'm using Template Toolkit and Apache Handlers (which work like CGI::Application) for another project. I'm not sure which I like better at the moment. I'm much faster in Mason still. -- Barry Hoggard Tristan Media LLC e: [EMAIL PROTECTED] w: www.tristanmedia.com aim: hoggardb
RE: templating system opinions
> In a good OO system with objects > representing the > data model, I found it exhausting to use H::T when I could > just to this > in TT: > > [% user.name %] > > > Am I just being stupid, or are there better ways of doing > these things > in H::T? I'm a little late to the dance but I generally unplug over the weekend. We use H::T here and I too got annoyed with the need to flatten all of my objects. However, with so much invested in H::T by that time, we just wrote a toHash() method which is inherited by all of our objects. It predictably takes the object attributes and churns out a hash (and is smart enough to do a recursive descent if need be). It also take an optional "prefix" so that you could pass in a prefix of "user." and then be able to if you wanted. It was an easy way to reduce the pain of H::T and yet not reinvent the wheel. A simple $tmpl->param($myObj->toHash(prefix => 'user.')) works fairly well in most cases. I'm sure there's a better/more robust way to do it (yeah, switch to TT ;-) but we found that this was sufficient to reduce the annoyance factor enough to allow us to get on with it. Also, we use HTML::Template::Expr to cheat liberally where appropriate. :-) Separation of HTML and logic is a good thing, but like most good things, there are exceptions. Since our controllers were starting to get really cluttered with a lot of "if this simple thing is true then pass this boolean to the template since the template itself can't ask whether this simple thing is true" code, which HTML::Template::Expr helps ease. Hope that helps. I really like H::T for it's simplicity and ease of understanding and picking up for new folks, and didn't want to toss that away unless I had to. -Fran
Re: [QUESTION] Can't read out verified username (auth)
On Mon, Jul 21, 2003 at 12:36:55PM +0200, Fatih Gey wrote: > > On Mon, Jul 21, 2003 at 01:05:58AM +0200, Fatih Gey wrote: > > > > > > i was writing my own AuthHandler with modperl v2 (v1.99_09). > > > > [...] > > > > > After having entered user/pass via html-form, this authentification > > > does his job well, but on the following request (on same browser) > > > $obj->user doesnt seem to return any value.. so this handler tries > > > to compare http post data ( which arent present this time) with > > > userdata in mysql-table.. resulting in an Auth_Required error. > > > > Well, how do you suppose that the browser should know how and what > > credentials to send? > > > > Unless you (a) create a session-cookie, (b) encode a session-kei into > > each url or (c) use the simple but proper Basic Authentication scheme, > > there is no way to accomplish this. And from what I gather you are not > > doing any of that? > > > > I supposed the browser to resend always an unique "bowser session > id", which is used by apache to save certain values, like > $ENV{'REMOTE_USER'} (similiar to a session-cookie with uid and > serverbased $vars) .. Isn't this the way Basic Authentication > scheme works ? .. Nope. When the browser gets a 401 response from the server, it will (most likely) pop up a dialog asking the user for name and password. These credentials gets mangled into an Authorization header which gets sent with the next request once the user klicks OK in the dialog. Now, you can perform your authen-code as you like. Cookies and forms' got nothing to do with it, really. Read more here: http://www.faqs.org/rfcs/rfc2617.html
Re: [QUESTION] Can't read out verified username (auth)
Hi! On Mon, Jul 21, 2003 at 12:36:55 +0200, Fatih Gey wrote: > I supposed the browser to resend always an unique "bowser session id", which > is used by apache to save certain values, like $ENV{'REMOTE_USER'} > (similiar to a session-cookie with uid and serverbased $vars) .. > Isn't this the way Basic Authentication scheme works ? .. I do not know how much Auth stuff changed in Apache 2.0/mod_perl 2, but you seem to mix up checking user credentials in the response phase (as done in CGI or PHP) with writing you own Auth Handlers that replace the standard Apache ones. If you get the user credentials via a web form, you are usually NOT using BASIC Auth but your own scheme (or something like Apache::AuthCookie). Thus, $r->connection->user is not set. Take a look at: * Chapter 6 of the Eagel book, available online at: http://modperl.com:9000/book/chapters/ch6.html * Chapter 13.7 of the mod_perl Cookbook * Apache::AuthCookie At least that's how it works with mod_perl 1.x ... -- #!/usr/bin/perl http://domm.zsi.at for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
Re: templating system opinions
Jesse Erlbaum wrote: Dave Rolsky writes: Sure, amazon.com among them. Amazon.com uses Mason? Why have I not heard of this before? I personally have not seen an "official" announcement, but if you look at all their postings on jobs.perl.org you'll notice that nearly every one of them mentions Mason. I'm sure Dave will have more to say on the subject... :-) -- - Drew Taylor * Web app development & consulting [EMAIL PROTECTED] * Site implementation & hosting www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres -
Re: ANNOUNCE: Apache::Dynagzip 0.10
On 7/20/03 11:12 PM, Slava Bizyayev wrote: > Your own content-type is supposed to be overwritten only in case of the use > of > > PerlSetVar UseCGIHeadersFromScript Off > > in your configuration file. You might wish to comment this line in your > configuration file when your script generates correct header line in > accordance with CGI/1.0 and/or CGI/1.1. I don't have that line in my config. I'm setting the content type using $r->content_type() in my apache module. I'm not using CGI/registry scripts, and I'm not doing print "Content-Type: ..." anywhere. -John
RE: templating system opinions
Hi Dave -- Dave Rolsky writes: > > Mason isn't fast. It is, however, fast enough for high > volume sites - > > that I will assert. > > Sure, amazon.com among them. Amazon.com uses Mason? Why have I not heard of this before? -Jesse-
Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)
I can measure it myself if you can provide me with URLs to your resources and identify them in terms of which one is mod_CGI and which is mod_perl. This is the mod_cgi one that works fine, no errors: http://shevek.kenyonhill.com/cgi/test.pl This is the mod_perl one (same script) that generates the "20014:Error" in the error_log. Also, the page doesn't display correctly (it seems to erase itself): http://shevek.kenyonhill.com/perl/test.pl This is the contents of test.pl: --- #!/usr/bin/perl $|=1; print "Content-Type: text/html\n\n"; print "hello world"; # This line causes the error print ""; --- Let me know if you need anything more.
Question to mod_perl gurus. Take 1 minute. Just choose right answer from list!
Hi, recently I got in trouble with old Apache::ePerl module (I know there a lot of better html toolkits, but this one is suits for my WAP-related tasks) so the question: we have package, handler for *.perl-embed files package Apache::ePerl; use vars qw ($Cache); $Cache = {}; sub handler { my ($r) = @_; my ($filename, $func); send some content type header if (CALL_SCRIPT_1) { # if not precompiled yet if (!$Cache{SCRIPT_1}) { eval { $func = sub { package Apache::ePerlCache; }; } $Cache{SCRIPT_1} = $func; } else { $func = $Cache{SCRIPT_1}; } eval &{$func}; } elsif (EVAL_SCRIPT_2) { # if not precompiled if (!$Cache{SCRIPT_2}) { eval { $func = sub { package Apache::ePerlCache; }; } $Cache{SCRIPT_2} = $func; } else { $func = $Cache{SCRIPT_2}; } eval &{$func}; } return OK; } === SCRIPT_1 print "some header" # the main code main_deck(); sub main_deck { print "Hi, it's SCRIPT_1!"; } =end === SCRIPT_2 print "some header" # the main code main_deck(); # the same name! sub main_deck { print "Bye, it was SCRIPT_2!"; } =end now we call: CALL_SCRIPT_1 CALL_SCRIPT_2 got all scripts in Cache: and now call CALL_SCRIPT_1 again so the question: which sub "main_deck" will be executed? 1. Hi, it's SCRIPT_1! 2. Bye, it was SCRIPT_2! -vlad
Re: [QUESTION] Can't read out verified username (auth)
> On Mon, Jul 21, 2003 at 01:05:58AM +0200, Fatih Gey wrote: > > > > i was writing my own AuthHandler with modperl v2 (v1.99_09). > > [...] > > > After having entered user/pass via html-form, this authentification > > does his job well, but on the following request (on same browser) > > $obj->user doesnt seem to return any value.. so this handler tries > > to compare http post data ( which arent present this time) with > > userdata in mysql-table.. resulting in an Auth_Required error. > > Well, how do you suppose that the browser should know how and what > credentials to send? > > Unless you (a) create a session-cookie, (b) encode a session-kei into > each url or (c) use the simple but proper Basic Authentication scheme, > there is no way to accomplish this. And from what I gather you are not > doing any of that? > I supposed the browser to resend always an unique "bowser session id", which is used by apache to save certain values, like $ENV{'REMOTE_USER'} (similiar to a session-cookie with uid and serverbased $vars) .. Isn't this the way Basic Authentication scheme works ? ..
Re: Content compression FAQ
On Sat, 19 Jul 2003, Slava Bizyayev wrote: Here is small correction to Web Content Compression FAQ. What does HTTP/1.0 only support mean in this answer: Q: Are there any content compression solutions for vanilla Apache 1.3.X? A: Yes, There are two compression modules written in C that are available for vanilla Apache 1.3.X: * mod_deflate an Apache handler written in C by Igor Sysoev (Russia). * mod_gzip an Apache handler written in C. Original author: Kevin Kiley, Remote Communications, Inc. (U.S.) Both of these modules support HTTP/1.0 only. mod_deflate does not care about chunks at all - Apache does it. If Apache's responses is HTTP/1.1 then Apache send it in chunks because mod_deflate always deletes "Content-Length" header. mod_deflate compresses content using 8K buffer. When the buffer is filled mod_deflate passes the compressed data to Apache. If an upstream module calls ap_bflush() to flush a pending data then mod_deflate asks zlib to flush a compressed stream and then passes a partially filled buffer to Apache. Since flushing a compressed stream descreases a compression ratio so mod_deflate has "DeflateIgnoreFlush" to ignore the ap_bflush() calls of an upstream module. It can be used for example with Chili!Soft ASP that calls ap_bflush() after any output even after an output of several bytes. So mod_deflate as well as "Apache::Dynagzip are the only handlers to date that begins transmission of compressed data as soon as the initial uncompressed pieces of data arrive from their source, at a time when the source process may not even have completed generating the full document it is sending. Transmission can therefore be taking place concurrent with creation of later document content". Igor Sysoev http://sysoev.ru/en/
MP2 Redirection
What would be the best way to redirect in MP2? How would I set the Location in the header? something like this? my $r = Apache->request; # docs say $r->header_out and family are now deceased. $r->headers_out(Location => '/some/place.html'); return Apache::DECLINED; Jamie Krasnoo
Re: [QUESTION] Can't read out verified username (auth)
On Mon, Jul 21, 2003 at 01:05:58AM +0200, Fatih Gey wrote: > > i was writing my own AuthHandler with modperl v2 (v1.99_09). [...] > After having entered user/pass via html-form, this authentification > does his job well, but on the following request (on same browser) > $obj->user doesnt seem to return any value.. so this handler tries > to compare http post data ( which arent present this time) with > userdata in mysql-table.. resulting in an Auth_Required error. Well, how do you suppose that the browser should know how and what credentials to send? Unless you (a) create a session-cookie, (b) encode a session-kei into each url or (c) use the simple but proper Basic Authentication scheme, there is no way to accomplish this. And from what I gather you are not doing any of that?
Re: templating system opinions
On Monday, Jul 21, 2003, at 02:23 Europe/London, Dave Rolsky wrote: All of this said, what is the most commonly used system out there? The biggest players are Mason and Template Toolkit, judging from "big companies" that have used them, as well as job posting. HTML::Template, Embperl, and Apache::ASP all seem to have reasonably active user bases as well. And lets not forget XML templating solutions too, like XSLT, which probably out scores them all in job postings terms (although not all that work is perl related). Matt. (you can of course use XSLT in AxKit :-)