Re: [O] Re: Yahoo is moving to PHP ??
Franck PORCHER wrote: But for is a lot easier to read and debug, IMHO Is there a significant performance difference in using map instead? My experience is that in most cases, the for construct is used to apply the same treatment to all the elements of an array, whence the map construct. In those cases, the readibility is definitely altered by the index that get in the way. I think you're forgetting that for is just a synonym for foreach. You don't need an index. Of course, this is a quick analysis not taking into account other factors like readibility versus efficiency. In fact, regarding the efficiency of the map construct, I often wondered whether Perl detects map being ran in a void context, so as to give it an iterative interpretation, avoiding to build the output list. It's really not a matter of efficiency, but rather of correctness. Using map in a void context is a mistake. There is a time and place for map: when you want to do something to each element in an array and return the array on the other side. Otherwise, use for, like this: some_function($_) for array;. Even when map is not incorrect, I usually avoid it because it has a tendency to take your code from nice, readable perl to evil hx0r PERL in 3 characters. This is the kind of thing that Yahoo was probably worried about when the decided not to use Perl. - Perrin
Re: MOD_Perl Converter
Hi there, On Fri, 1 Nov 2002, Frank Naude (FJ) wrote: Sorry if this is a FAQ, So read the docs already! :) but, is there any mod_cgi to mod_perl converter available? Have a look at Apache::Registry. 73, Ged.
Re: Should I be coding with mod_perl 2 yet?
Hi there, On 1 Nov 2002, Clinton Gormley wrote: I'm struggling to get anything much working with mod_perl 2. [snip] I have read all of the documentation on perl.apache.org. Are you sure? :) If these things should be working, Well it does say on the home page that it's the Bleeding Edge. where can I find out how to use them? Here. mod_perl for Apache 2.x is still at the development stage, but people are using it. You can more specific help if you ask a more specific question (but you won't get it from me, I haven't even looked at Apache 2.x yet:). 73, Ged.
Re: Novice - Problem with data encoding
I have an XML doc that I generated using XML::LibXML that needs to be included as a hidden form field in a form post. The problem is that the browser is encoding the XML doc. ie. ?xml version=1.0 encoding=UTF-8? !DOCTYPE gtfd SYSTEM http://gftd/schemas/data.dtd; turns into: lt;?xml version=1.0 encoding=UTF-8?gt; lt;DOCTYPE gtfd SYSTEM quot;http://gftd/schemas/data.dtdquot;gt; which blows up in the parsing. If I edit the result and swap back the and it works. How can I prevent the encoding of the XML data? You have probably escaped the xml snippet twice yourself - check the code of the page from your browser. If you see the value of your hidden field as amp;lt;?xml..., you have done double escaping. Just remove one of the escaping passes and it should work. The browser isn't supposed to do any such encoding on its own. If it does you need to change your browser. You aren't using Netscape 4.0, are you? -- Antti Haapala
Re: [O] Re: Yahoo is moving to PHP ??
On Fri, Nov 01, 2002 at 03:10:54AM -0500, Perrin Harkins wrote: There is a time and place for map: when you want to do something to each element in an array and return the array on the other side. Otherwise, use for, like this: some_function($_) for array;. Even when map is not incorrect, I usually avoid it because it has a tendency to take your code from nice, readable perl to evil hx0r PERL in 3 characters. This is the kind of thing that Yahoo was probably worried about when the decided not to use Perl. This statement surprises me somewhat. It sounds like you're saying that you should only use a subset of Perl as some programmers may not understand the other parts of it? I'd say that if this were true the problem is in training the programmers. map and grep are very powerful constructs, and when used correctly lead to much more readable and maintainable code once you understand them: Given: sub square { $_[0] ** 2 } my nums = (1 .. 10); Which would say is more readable and maintainable? 1) my squares; push squares, square($_) for nums; 2) my squares = nums; $_ = square($_) for squares; 3) my squares = map square($_), nums; I'd go for (3) every time. Tony
Re: [OTish] Version Control?
Rob Nagler wrote: Another approach which allows easy sharing between projects is: ~/src/perl/ + Project1/ + Project2/ + Project3/ where Project[123] are root package names. Set PERLLIB=~/src/perl and you can get access to any *.pm in the system, each has a globally unique name. This makes it easy to implement cross-project refactorings. How do you cope with the problem that perl has of running different versions of modules? We have a similiar situation, in that we're running several projects with different sets of perl libraries. We have common code between them. The trouble starts when we're running several sites on the same virtual server. At that point, there's only one copy of the canonical code running, rather than each vhost getting its own copy. I realise that this is usually what's wanted, but it can make life very difficult when you're trying to upgrade one vhost, which needs a new version of one of the shared modules because you might break one of the others by accident. I haven't found a good solution to this yet... -Dom -- | Semantico: creators of major online resources | | URL: http://www.semantico.com/ | | Tel: +44 (1273) 72 | | Address: 33 Bond St., Brighton, Sussex, BN1 1RD, UK. |
Re: Yahoo is moving to PHP ??
On Wed, 2002-10-30 at 17:09, John Saylor wrote: Hi ( 02.10.30 03:22 -0500 ) Perrin Harkins: They didn't make their decision on performance though. They seem to have been most influenced by the idea that perl allows too much flexibility in coding style, although I can't see how PHP is going to help with that. Wow, I'd like what *they* had for lunch! Quasi-seriously, as someone who has had to maintain mountains of bad perl code, I know TMTOWTDI can have a downside; but the openness of the language is what has lead to its greatness ... -- .--- ... Now we're going down to the ugly details of the article :) As Perrin noted they are probably going to use C/C++ to make the fundamentals of the application, like the framework the API, interface whatever, and use PHP as a templating language to iterate over the datastructures etc. I've just converted some totally unmaintainable code from PHP to perl (actually, i've rewritten it because everything was done in the wrong way (tm)). To write big and advanced applications in pure PHP is a big mistake IMHO, but to use it as a templating language doesn't sound as such a bad idea. Yahoo! is moving to open-source! Yahoo! -- Ask Solem Hoel[+4722808579 | +4797962181] ABC Startsiden AS [ http://www.startsiden.no]
Re: Should I be coding with mod_perl 2 yet?
Clinton Gormley wrote: I'm struggling to get anything much working with mod_perl 2. I have installed mod_perl 1.99_07 with Apache 2.0.43. I have read all of the documentation on perl.apache.org. I can get a basic page returned to me with a modperl handler, but as soon as I try to do anything of note (eg Apache-push_handlers() (or should that be Apache2-push_handlers()? - neither works), get query string parameters, etc) I run into a brick wall. I've only started to dabble with mod_perl 2, but I didn't find it too difficult. the real drawback was that whereas mod_perl 1.0 use()d most of the classes for you behind the scenes (like Apache::Table), with mod_perl 2.0 you need to use() them yourself, which means you have to figure out which classes provide which methods. my only work to date can be found here: http://www.modperlcookbook.org/~geoff/modules/experimental/Apache-Clean-2.00b.tar.gz Apache::Clean is a PerlOutputFilterHandler, but the tests include two simple PerlResponseHandlers, and it's pretty well commented, so it should serve as a starting point for which classes you're likely to need. I found all the classes I needed by grep'ing the t/ directory in the mod_perl distribution for the methods in question, adding them one by one, then, when it worked, checking the source for the module in question to learn what was going on... --Geoff
RE: [OTish] Version Control?
Hi Dom -- How do you cope with the problem that perl has of running different versions of modules? We have a similiar situation, in that we're running several projects with different sets of perl libraries. We have common code between them. The trouble starts when we're running several sites on the same virtual server. At that point, there's only one copy of the canonical code running, rather than each vhost getting its own copy. The short answer: PERL5LIB Read my earlier messages in this thread. In one I describe the layout of my site architecture which fully accommodates this reality. In a nutshell, each site has its own modules/ directory in which ALL the modules for a project, including CPAN libraries, are stored. The environment variable PERL5LIB can be set separately for each virtual host (Apache directive SetEnv and PerlSetEnv for mod_perl users), thereby allowing each site to have its OWN versions of libraries. If you isolate your web site from the host operating system you will gain significant freedom and ease of management. Warmest regards, -Jesse- -- Jesse Erlbaum The Erlbaum Group [EMAIL PROTECTED] Phone: 212-684-6161 Fax: 212-684-6226
Re: [OT] Wanted: beginning perl books for poor kids
Hi ( 02.10.31 21:57 -0800 ) Nick Tonkin: I'm excited to get them going in perl, and I want to appeal to the list for donations of books on learning perl. I'd say the best 'books' are all on line. Don't underestimate the [lowly] man pages. Or perldoc [-f]. And there are stories and tutorials and good stuff at perl.apache.org or perlmonks.org or www.perl.org [and so on]. Hopefully, your students [or school] has/have the resources necessary to use the on line resources. Good luck! -- .--- ...
RE: [OTish] Version Control?
At 8:27 AM -0500 11/1/02, Jesse Erlbaum wrote: Hi Dom -- How do you cope with the problem that perl has of running different versions of modules? We have a similiar situation, in that we're running several projects with different sets of perl libraries. We have common code between them. The trouble starts when we're running several sites on the same virtual server. At that point, there's only one copy of the canonical code running, rather than each vhost getting its own copy. The short answer: PERL5LIB Read my earlier messages in this thread. In one I describe the layout of my site architecture which fully accommodates this reality. In a nutshell, each site has its own modules/ directory in which ALL the modules for a project, including CPAN libraries, are stored. The environment variable PERL5LIB can be set separately for each virtual host (Apache directive SetEnv and PerlSetEnv for mod_perl users), thereby allowing each site to have its OWN versions of libraries. Um ... somebody's missing something here ... Jesse are you saying that you have a single apache server running multiple vhosts with different versions of the same module loaded for different vhosts? Is that actually possible? I thought that whenever you first require ModuleX it will use the value of PERL5LIB in that context to load it, but the next time a require happens, even if PERL5LIB is different, it will see that the ModuleX is loaded and won't even try to load the one from a different directory. Right? What I do (with a very limited number of vhosts) is have each vhost proxy to a different backend server which does have its own version of (nearly) everything. -- 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
RE: [OTish] Version Control?
Hi Ray -- Jesse are you saying that you have a single apache server running multiple vhosts with different versions of the same module loaded for different vhosts? Is that actually possible? I thought that whenever you first require ModuleX it will use the value of PERL5LIB in that context to load it, but the next time a require happens, even if PERL5LIB is different, it will see that the ModuleX is loaded and won't even try to load the one from a different directory. Right? What I do (with a very limited number of vhosts) is have each vhost proxy to a different backend server which does have its own version of (nearly) everything. That's very nearly exactly what I do. I prefer to have each site have its own Apache instance because there is some contention in the way mod_perl caches code. Your vhost/reverse-proxy solution is a good one, particularly for places where there is a shortage of IP addresses. TTYL, -Jesse-
[ANNOUNCE] Apache-Clean-2.00b
The URL http://www.modperlcookbook.org/~geoff/modules/experimental/Apache-Clean-2.00b.tar.gz has entered CPAN as file: $CPAN/authors/id/G/GE/GEOFF/Apache-Clean-2.00b.tar.gz size: 4725 bytes md5: a25497718555ef6567bdd38685a6b940 it's still incomplete, but it should be educational at least... --Geoff
Re: Novice - Problem with data encoding
Thats what is wierd. I don't do any escaping. I think it might be embperl doing the escaping because if I do a print of the XML doc string it has no escaping. If I put the string between [+ $content +] then it gets escaped. Thanks for your help, Chris - Original Message - From: Antti Haapala [EMAIL PROTECTED] To: Chris Pizzo [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, November 01, 2002 6:35 AM Subject: Re: Novice - Problem with data encoding I have an XML doc that I generated using XML::LibXML that needs to be included as a hidden form field in a form post. The problem is that the browser is encoding the XML doc. ie. ?xml version=1.0 encoding=UTF-8? !DOCTYPE gtfd SYSTEM http://gftd/schemas/data.dtd; turns into: lt;?xml version=1.0 encoding=UTF-8?gt; lt;DOCTYPE gtfd SYSTEM quot;http://gftd/schemas/data.dtdquot;gt; which blows up in the parsing. If I edit the result and swap back the and it works. How can I prevent the encoding of the XML data? You have probably escaped the xml snippet twice yourself - check the code of the page from your browser. If you see the value of your hidden field as amp;lt;?xml..., you have done double escaping. Just remove one of the escaping passes and it should work. The browser isn't supposed to do any such encoding on its own. If it does you need to change your browser. You aren't using Netscape 4.0, are you? -- Antti Haapala
RE: [OT] Wanted: beginning perl books for poor kids
Me too. (and sorry to for a couple of private replies its early and I haven't had much caffeine this morning). -Original Message- From: Ryan Parr [mailto:ryanparr;precisiontechonline.com] Sent: Friday, November 01, 2002 12:57 AM To: Nick Tonkin; [EMAIL PROTECTED] Subject: Re: [OT] Wanted: beginning perl books for poor kids What open-source geek doesn't understand the importance, and calling, of supporting your community? Count me in. I think it's great that you are donating your time and patience. Teaching isn't easy, but you've got a great cause. Send me your shipping address and I'll send you a Llama book. http://www.rain.org/~artworks/NewATW/students/norma_web/sonar.html is striking. I hope this girl goes on to great things. -- Ryan - Original Message - From: Nick Tonkin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 31, 2002 9:57 PM Subject: [OT] Wanted: beginning perl books for poor kids Hi all, I am going to be working with a small group of disadvantaged youngsters here teaching them how to build web applications with perl and apache. These are mostly Latino kids who have been doing analog and digital art for years and have self-selected into webmastering, html-ing and such. I'm excited to get them going in perl, and I want to appeal to the list for donations of books on learning perl. Of course I'm most hopeful that we can get half a dozen copies of the Llama book and use it as a sort of textbook, but anything will be gratefully accepted. An existing site that shows some of the art these kids make (and also why we need a new one!) can be viewed at http://www.rain.org/~artworks/ A cool project by one of the students is at http://www.rain.org/%7Eartworks/NewATW/students/norma_web/norm a_intro.html Thanks folks, - nick Nick Tonkin {|8^)
RE: [OT] Wanted: beginning perl books for poor kids
Amen. http://www.comp.leeds.ac.uk/Perl/start.html http://archive.ncsa.uiuc.edu/General/Training/PerlIntro/ http://www.ebb.org/PickingUpPerl/ http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.html http://www.lanka.pair.com/techweb/perl/tutor/ oh wait... did you say spanish? http://epq.com.co/~cjara/perl/tutorial.html no? German? http://www.tekromancer.com/perl/inhalt.html Japanese? http://plaza27.mbn.or.jp/~satomii/jdoc/ Perldoc is a challenge if you're new, because the syntax can be hard to pick up. But for a good tutorial, a nice printer would go a long way... Derrick Stone Internet Specialist Web Development Center UVa Health System ICQ# 1464194 -Original Message- From: John Saylor [mailto:johns;worldwinner.com] Sent: Friday, November 01, 2002 9:05 AM To: Nick Tonkin Cc: [EMAIL PROTECTED] Subject: Re: [OT] Wanted: beginning perl books for poor kids Hi ( 02.10.31 21:57 -0800 ) Nick Tonkin: I'm excited to get them going in perl, and I want to appeal to the list for donations of books on learning perl. I'd say the best 'books' are all on line. Don't underestimate the [lowly] man pages. Or perldoc [-f]. And there are stories and tutorials and good stuff at perl.apache.org or perlmonks.org or www.perl.org [and so on]. Hopefully, your students [or school] has/have the resources necessary to use the on line resources. Good luck! -- .--- ...
Re: [OTish] Version Control?
Dominic Mitchell writes: How do you cope with the problem that perl has of running different versions of modules? Actually, we have two problems. One problem is developing with multiple versions and the other is what you mention, running production systems. Sometimes I might be in the middle of some big refactoring, and a customer calls with a problem. I then do: cd mkdir src_bla cd src_bla cvs checkout perl/Bla perl/Bivio where Bivio is our shared code. Then I set PERLLIB to ~/src_bla. We've got a bash command that allows me to switch the configuration and PERLLIB as well. It's very easy to do. Oh, and we *never* (almost :-) put code in programs. The programs invoke a *.pm file's main so we can say bla-some-command and always get the right version. We solve the second problem by buying cheap machines which run Linux just fine. (I just bought 4 x Dell 2300, 2 x Dell 1300, and 2 x white box for $1800. $-) It just isn't worth my time trying to make two sites work on the same machine, although we do this in a couple of cases (e.g. www.bivio.biz and petshop.bivio.biz). When two or more sites do share the same machine, we always run the same version of the infrastructure. This avoids many problems, e.g. running into defects twice and managing multiple versions. We don't tag our CVS. We can backout changes with RPM. We do several releases a week on active applications, and one release a week on applications in maintenance mode. One final reason to avoid multiple versions is with schema changes. The more different database versions you have, the more confusing. On bivio.com we upgraded the schema about 250 times in about two years. It would have been impossible to keep the development, test, and production if these three diverged too much. Rob
RE: [OTish] Version Control?
Hey Rob -- Oh, and we *never* (almost :-) put code in programs. The programs invoke a *.pm file's main so we can say bla-some-command and always get the right version. This is how CGI::Application works, too. You might want to check it out! For the benefit of those who are not yet putting all their code in modules, it really does give you a profound advantage in ease of development and management. TTYL, -Jesse- -- Jesse Erlbaum The Erlbaum Group [EMAIL PROTECTED] Phone: 212-684-6161 Fax: 212-684-6226
Re: Should I be coding with mod_perl 2 yet?
Hi, well I have read all (whatever scanty little available) docs on mod_perl 2 and am pretty disappointed. For example Apache::Request is not ready yet so you need Apache::compat and mod_perl 1 for basic POST request handling and parsing. In my opinion, stay with mod_perl 1. -Sumitro Chowdhury. --- Ged Haywood [EMAIL PROTECTED] wrote: Hi there, On 1 Nov 2002, Clinton Gormley wrote: I'm struggling to get anything much working with mod_perl 2. [snip] I have read all of the documentation on perl.apache.org. Are you sure? :) If these things should be working, Well it does say on the home page that it's the Bleeding Edge. where can I find out how to use them? Here. mod_perl for Apache 2.x is still at the development stage, but people are using it. You can more specific help if you ask a more specific question (but you won't get it from me, I haven't even looked at Apache 2.x yet:). 73, Ged. __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/
RE: [OT] Wanted: beginning perl books for poor kids
I would guess that these kids do not have access to computers outside school. Which makes access to printed material advantageous. I guess a printer would be nice, but by the time the cost of it, paper, ink, and other supplies are factored in, I would guess that books would be cheaper. -Original Message- From: Stone, Derrick J [mailto:DJS6D;hscmail.mcc.virginia.edu] Sent: Friday, November 01, 2002 9:01 AM To: John Saylor; Nick Tonkin Cc: [EMAIL PROTECTED] Subject: RE: [OT] Wanted: beginning perl books for poor kids Amen. http://www.comp.leeds.ac.uk/Perl/start.html http://archive.ncsa.uiuc.edu/General/Training/PerlIntro/ http://www.ebb.org/PickingUpPerl/ http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.html http://www.lanka.pair.com/techweb/perl/tutor/ oh wait... did you say spanish? http://epq.com.co/~cjara/perl/tutorial.html no? German? http://www.tekromancer.com/perl/inhalt.html Japanese? http://plaza27.mbn.or.jp/~satomii/jdoc/ Perldoc is a challenge if you're new, because the syntax can be hard to pick up. But for a good tutorial, a nice printer would go a long way... Derrick Stone Internet Specialist Web Development Center UVa Health System ICQ# 1464194 -Original Message- From: John Saylor [mailto:johns;worldwinner.com] Sent: Friday, November 01, 2002 9:05 AM To: Nick Tonkin Cc: [EMAIL PROTECTED] Subject: Re: [OT] Wanted: beginning perl books for poor kids Hi ( 02.10.31 21:57 -0800 ) Nick Tonkin: I'm excited to get them going in perl, and I want to appeal to the list for donations of books on learning perl. I'd say the best 'books' are all on line. Don't underestimate the [lowly] man pages. Or perldoc [-f]. And there are stories and tutorials and good stuff at perl.apache.org or perlmonks.org or www.perl.org [and so on]. Hopefully, your students [or school] has/have the resources necessary to use the on line resources. Good luck! -- .--- ...
Re: Should I be coding with mod_perl 2 yet?
On Fri, 1 Nov 2002, Sumitro Chowdhury wrote: Hi, well I have read all (whatever scanty little available) docs on mod_perl 2 and am pretty disappointed. Additions, I'm sure, are welcome :) For example Apache::Request is not ready yet so you need Apache::compat and mod_perl 1 for basic POST request handling and parsing. In my opinion, stay with mod_perl 1. They're working on libapreq for Apache2, and as has been pointed out, mod_perl-2 is still in the development stage. For basic form handling, though, you can use my %args = $r-Apache::args; -- best regards, randy kobes
Re: Should I be coding with mod_perl 2 yet?
--- Randy Kobes [EMAIL PROTECTED] wrote: On Fri, 1 Nov 2002, Sumitro Chowdhury wrote: Hi, well I have read all (whatever scanty little available) docs on mod_perl 2 and am pretty disappointed. Additions, I'm sure, are welcome :) For example Apache::Request is not ready yet so you need Apache::compat and mod_perl 1 for basic POST request handling and parsing. In my opinion, stay with mod_perl 1. They're working on libapreq for Apache2, and as has been pointed out, mod_perl-2 is still in the development stage. For basic form handling, though, you can use my %args = $r-Apache::args; H I thought POST request handling needs $r-read($buf,$r-headers_in-{'Content-length'}) and GET request handling needs $r-args(); Thank you, Randy for the quick response. Since I have watched your contribution to the list, I was hoping if you could discuss {setup,should,get}_client_block API for handling POST data on this list. Inspite of all my rantings, I still use mod_perl 2.0 ;-) Thanks again, Sumitro Chowdhury -- best regards, randy kobes __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/
Re: [OTish] Version Control?
Ged Haywood wrote: Hi all, On Thu, 31 Oct 2002, Iain 'Spoon' Truskett wrote: experimenting with perforce [which, so far, appears nicer than CVS] ) Yikes! Josh, you got anything to say about that? Well I have used perforce much more than CVS now, so that is where I'm most comfortable. My basic feeling is that perforce is harder to set up, but more idiot proof while using it, especially for more advance operations like branching integration. CVS however is a breeze to set up, but I feel like its branching tagging is more of a hack ( note I am just starting to use it recently. ) I really like how I do not have to explicitly cvs edit files like I do in perforce before I start working on them. Oh, CVS is free which is always a good thing. :) As for scaling, perforce probably has a better chance to scale with its dbm based storage locking, however at this one company that uses it they get db corruption when developers hammer its with huge media checkins which I suspect CVS never would get. Regards, Josh Josh Chamas, Founder phone:925-552-0128 Chamas Enterprises Inc.http://www.chamas.com NodeWorks Link Checkinghttp://www.nodeworks.com
Re: Should I be coding with mod_perl 2 yet?
On Fri, 1 Nov 2002, Sumitro Chowdhury wrote: H I thought POST request handling needs $r-read($buf,$r-headers_in-{'Content-length'}) and GET request handling needs $r-args(); Sorry about that - I should have read more carefully that you were specifically referring to POSTed data - my %args = $r-Apache::args; is for GET requests. For POST, as is described in the content() method of Apache::compat, for now one can use $r-setup_client_block; # return an error unless $r-should_client_block; my $len = $r-headers_in-get('content-length'); my $buf; $r-get_client_block($buf, $len); my %args = map { s/%([0-9a-fA-F]{2})/pack(c, hex($1))/ge; $_; } split /[=;]/, $buf, -1; Some of the issues regarding, in particular, using the mod_perl-1-ish $r-args and $r-content in an array context are discussed at http://perl.apache.org/docs/2.0/user/compat/compat.html But you do have a point that life will be easier when libapreq is ready :) -- best regards, randy
Re: [OTish] Version Control?
Oh, CVS is free which is always a good thing. :) subversion (http://subversion.tigris.org/) has been gaining lots of momentum lately, and I just saw this link today: http://svnbook.red-bean.com/ some of you might know the folks at red-bean from their other projects, like http://cvsbook.red-bean.com/ and cvs2cl.pl (http://www.red-bean.com/~kfogel/cvs2cl.shtml) HTH --Geoff
Re: [O] Re: Yahoo is moving to PHP ??
Tony Bowden wrote: It sounds like you're saying that you should only use a subset of Perl as some programmers may not understand the other parts of it? That is what I'm saying. I'm aware that this is a controversial opinion in the Perl world. However, I think it's reasonable to know your audience and write for them. That's the good part of More Than One Way. The New York Times writes their articles for a certain reading level, and I do the same with my code. Note that different audiences have different levels. You can expect someone who opens up the code in a module on CPAN to be pretty fearless about advanced Perl ideas. On the other hand, the people in my current office are mostly novices so I try to take it easy on them when writing code for work. I will still use a Schwartzian Transform if I need one, but I'll put in a comment saying this is a Schwartzian Transform, see such and such URL for an explanation. Same deal with things like hash-slices, and I try to avoid using $_ when it isn't necessary. Given: sub square { $_[0] ** 2 } my nums = (1 .. 10); Which would say is more readable and maintainable? 1) my squares; push squares, square($_) for nums; 2) my squares = nums; $_ = square($_) for squares; 3) my squares = map square($_), nums; I'd go for (3) every time. So would I, in that situation. It's not that map is so evil, but rather that I have often seen people overuse it (especially after a first-reading of Effective Perl), and write confusing code with it by jamming too much into the map { some stuff } list form. - Perrin
Re: [O] Re: Yahoo is moving to PHP ??
Hi ( 02.11.01 13:42 -0500 ) Perrin Harkins: It's not that map is so evil, but rather that I have often seen people overuse it (especially after a first-reading of Effective Perl), and write confusing code with it by jamming too much into the map { some stuff } @list form. As a former map addict, I was shown the error of my ways on #[EMAIL PROTECTED] when it was pointed out to me that map returns a value. If you're not going to use that value, just use for[each]. This way the code is easier to read and the extra overhead of the return value [minute as it is] is avoided. -- .--- ...
Re: Novice - Problem with data encoding
Thats what is wierd. I don't do any escaping. I think it might be embperl doing the escaping because if I do a print of the XML doc string it has no escaping. If I put the string between [+ $content +] then it gets escaped. Yes, Embperl escapes your output per default, you can turn it off by using $escmode e.g. [+ do { local $escmode = 0 ; $content } +] Gerald P.S. The do { } is only necessary in Embperl 2.0 - 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 -
mod_perl2: apache.pm vs apache2.pm (CGI.pm)
I've mod_perl running on several machines (apache 1.x) Today I installed a new system with apache2 and ran into deep troubles and questions: I installed perl-5.8.0, apache 2.0.43 and mod_perl 1.99_07 I preload Apache2 and use ModPerl::Registry: LoadModule perl_module modules/mod_perl.so PerlModule Apache2 and for my perl-files: PerlResponseHandler ModPerl::Registry As soon as I try to run a script under mod_perl that uses CGI.pm I get the problem: [Fri Nov 01 23:27:43 2002] [error] 9558: ModPerl::Registry: Can't locate Apache.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.8.0/i686-linux/Apache2 /usr/local/lib/perl5/5.8.0/i686-linux /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/i686-linux /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) at /usr/local/lib/perl5/5.8.0/CGI.pm line 161. Compilation failed in require at /home/htdocs/perl/testgoldfisch.cgi line 4. BEGIN failed--compilation aborted at /home/htdocs/perl/testgoldfisch.cgi line 4. Now I was starting to look around and in fact I have Apache.pm and Apache2.pm on my system. Apache.pm is not in @INC (its in /usr/local/lib/perl5/5.8.0/CGI/Apache.pm where it came from perl-insallation) In @INC I only have Apache2.pm, which comes from the mod_perl Installation. Now I dont know whats going on. Maybe this both two modules have nothing in common but a similar name. Shall I extend my @INC so that Apache.pm is in it (where is best place to change @INC ?). If I use the Compat-mode the problem vanishes. Is the CGI-module incompatible with mod_perl2 ? If yes, is there any alternative that can be used without need to rewrite all our libraries that rely on CGI.pm ? thnx, peter -- mag. peter pilsl IT-Consulting tel: +43-699-1-3574035 fax: +43-699-4-3574035 [EMAIL PROTECTED]
Re: MOD_Perl Converter
Ged Haywood wrote: On Fri, 1 Nov 2002, Frank Naude (FJ) wrote: but, is there any mod_cgi to mod_perl converter available? Have a look at Apache::Registry. And to address the specific problem you mentioned about initializaing variables, look at Apache::PerlRun. - Perrin
Re: mod_perl2: apache.pm vs apache2.pm (CGI.pm)
--- [EMAIL PROTECTED] wrote: I've mod_perl running on several machines (apache 1.x) Today I installed a new system with apache2 and ran into deep troubles and questions: I installed perl-5.8.0, apache 2.0.43 and mod_perl 1.99_07 snip If I use the Compat-mode the problem vanishes. Is the CGI-module incompatible with mod_perl2 ? Yes !! If yes, is there any alternative that can be used without need to rewrite all our libraries that rely on CGI.pm ? Probably not :-( unless you use Apache::compat . Checkout http://perl.apache.org/docs/2.0/api/mod_perl-2.0/Apache/compat.html http://perl.apache.org/docs/2.0/user/compat/compat.html Regards, Sumitro Chowdhury thnx, peter -- mag. peter pilsl IT-Consulting tel: +43-699-1-3574035 fax: +43-699-4-3574035 [EMAIL PROTECTED] __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/
Re: Should I be coding with mod_perl 2 yet?
--- Randy Kobes [EMAIL PROTECTED] wrote: my %args = $r-Apache::args; is for GET requests. For POST, as is described in the content() method of Apache::compat, for now one can use $r-setup_client_block; # return an error unless $r-should_client_block; my $len = $r-headers_in-get('content-length'); my $buf; $r-get_client_block($buf, $len); my %args = map { s/%([0-9a-fA-F]{2})/pack(c, hex($1))/ge; $_; } split /[=;]/, $buf, -1; Just to help real newbies like me , we can also add + substitution so that the above line becomes: my %args = map { s/%([0-9a-fA-F]{2})/pack(c, hex($1))/ge; s/\+/ /g; $_; } split /[=;]/, $buf, -1; Thanks a lot, Randy. Regards, Sumitro Chowdhury. Some of the issues regarding, in particular, using the mod_perl-1-ish $r-args and $r-content in an array context are discussed at http://perl.apache.org/docs/2.0/user/compat/compat.html But you do have a point that life will be easier when libapreq is ready :) -- best regards, randy __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/
apache::ASP
Does this include an AddRotator? john welte
interesting hang...
My apologies if this is a FAQ, I haven't been able to figure it out can't find the answer online anywhere. I have a fairly extensive script I've written to display tables of information about equipment for an online game. For some reason the script is hanging at at least two points: At one point in the code I have it print a link to another page, but passing the same $ENV{'QUERY_STRING'} that was passed in to begin with. I don't know why, but it hangs. There are no unusual characters in the string, I've checked that; I even went so far as to escape the quotes defining the URL in the link, but still no luck. Here's the relevant lines as they are presently written: $pass = /cgi-bin/plaintextresult.cgi?$ENV{'QUERY_STRING'}; #print $passBR\n; print TABLE CELLPADDING='2' CELLSPACING='2' BORDER='2' WIDTH='100%'\n; print TRTD WIDTH='33%' ALIGN='CENTER' BGCOLOR='#22'A HREF='/submitframe.htm'Submit unlisted equipment/A/TD\n; print TD WIDTH='33%' ALIGN='CENTER' BGCOLOR='#22'A HREF=\$pass\ target='printerfriendly'Plain text version/A/TD\n; It's the last line there that hangs. Note that if I uncomment the line that just prints the query string on its own, it doesn't hang. I also have other strange hangs in here, but I haven't yet been able to figure out which exact lines are causing the problem. For the ppl who can figure this stuff out just by install data: I'm running Redhat 8.0, Apache 2.0, on a p3-450. This entire application did work correctly under Redhat 7.3 (Skipjack), Apache 1.3. Unfortunately I upgraded... Thanks, Michael L. Forbes [EMAIL PROTECTED] For those who'd like to see the page in operation, it's at parailtrail.dyndns.biz/cgi-bin/index.cgi
ORACLE_HOME environment variable not set!
I installed a new intranet server a few days ago. My development server is on Windows2000 (notebook) and production is Linux (server). Everything works fine on my notebook but I have problems on my server. Sometimes there is an message ORACLE_HOME environment variable not set! in my error log on server. Only this message! There is nothing about time and origin of that message! And I don't have any problems with the database - all pages are generated properly. Sometimes the browser doesn't get a response (IE is waiting for response endlessly and there's no log entry in the server log) but it's enough to reload the page or click again. I don't have any idea where the error message comes from. Do you know how to fix it? What's the best place to define environment variables for httpd process? I've tried to define it in startup.pl which is the startup script defined in httpd.conf. I've tried to defined the variables in apachectl (and export them of course) which is used to start the server but without success. Well, the variables were used (I'm able to connect to the database) but the strange error message is still appearing. -- Petr Smejkal
Re: mod_perl2: apache.pm vs apache2.pm (CGI.pm)
On Fri, 2002-11-01 at 17:54, [EMAIL PROTECTED] wrote: First, make sure you have the latest version of CGI.pm from CPAN. It has fixes in there to automatically load Apache::Compat for you. Also CGI.pm isn't fully mod_perl2 compatable. so there is that over head unfortunally. Right now for me, I'll deal with the extra overhead, and with time Everything will be mod_perl2.0 aware. DBI.pm, CGI.pm, and Text::Templates would be great if they were to port them to work on mod_perl2 ASAP :) -- Jason Czerak I've mod_perl running on several machines (apache 1.x) Today I installed a new system with apache2 and ran into deep troubles and questions: I installed perl-5.8.0, apache 2.0.43 and mod_perl 1.99_07 I preload Apache2 and use ModPerl::Registry: LoadModule perl_module modules/mod_perl.so PerlModule Apache2 and for my perl-files: PerlResponseHandler ModPerl::Registry As soon as I try to run a script under mod_perl that uses CGI.pm I get the problem: [Fri Nov 01 23:27:43 2002] [error] 9558: ModPerl::Registry: Can't locate Apache.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.8.0/i686-linux/Apache2 /usr/local/lib/perl5/5.8.0/i686-linux /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/i686-linux /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) at /usr/local/lib/perl5/5.8.0/CGI.pm line 161. Compilation failed in require at /home/htdocs/perl/testgoldfisch.cgi line 4. BEGIN failed--compilation aborted at /home/htdocs/perl/testgoldfisch.cgi line 4. Now I was starting to look around and in fact I have Apache.pm and Apache2.pm on my system. Apache.pm is not in @INC (its in /usr/local/lib/perl5/5.8.0/CGI/Apache.pm where it came from perl-insallation) In @INC I only have Apache2.pm, which comes from the mod_perl Installation. Now I dont know whats going on. Maybe this both two modules have nothing in common but a similar name. Shall I extend my @INC so that Apache.pm is in it (where is best place to change @INC ?). If I use the Compat-mode the problem vanishes. Is the CGI-module incompatible with mod_perl2 ? If yes, is there any alternative that can be used without need to rewrite all our libraries that rely on CGI.pm ? thnx, peter -- mag. peter pilsl IT-Consulting tel: +43-699-1-3574035 fax: +43-699-4-3574035 [EMAIL PROTECTED]