Re: Compress::Zlib problem
On Wed, Apr 04, 2001 at 03:47:47PM -0400, Robert Landrum wrote: One of my developers is looking for a way to take records output from a database and compress them into a gzip file on the fly, without using a file on disk. To do this, he's using Compress::Zlib and passing \*STDOUT as the output file. Since this is mod_perl, STDOUT is blessed to Apache, and appears to be missing Apache::TELL. # $fh is \*STDOUT my $gz = gzopen($fh, 'wb'); $gz-gzwrite($line); # $line is from db. He's also played with deflating the content on his own, but is unable to get the checksum correct on the output. Has anyone ever compressed something like this on the fly with Compress::Zlib. As I understand it, Apache::Compress creates seperate files, which is not acceptable in this case. I used I logic like the following in one of my packages: # implement a gzipped file handle via the Compress:Zlib compression # library. sub MAGIC1() { 0x1f } sub MAGIC2() { 0x8b } sub OSCODE() { 3} sub TIEHANDLE { my ($class, $out) = @_; my ($d) = Compress::Zlib::deflateInit(-Level = Compress::Zlib::Z_BEST_COMPRESSION(), -WindowBits = -Compress::Zlib::MAX_WBITS()) or return undef; my ($o) = { handle = $out, dh = $d, crc = 0, len = 0, }; my ($header) = pack("c10", MAGIC1, MAGIC2, Compress::Zlib::Z_DEFLATED(), 0,0,0,0,0,0, OSCODE); print {$o-{handle}} $header; return bless($o, $class); } sub PRINT { my ($o) = shift; my ($buf) = join(defined $, ? $, : "",@_); my ($len) = length($buf); my ($compressed, $status) = $o-{dh}-deflate($buf); print {$o-{handle}} $compressed if defined($compressed); $o-{crc} = Compress::Zlib::crc32($buf, $o-{crc}); $o-{len} += $len; return $len; } sub PRINTF { my ($o) = shift; my ($fmt) = shift; my ($buf) = sprintf($fmt, @_); my ($len) = length($buf); my ($compressed, $status) = $o-{dh}-deflate($buf); print {$o-{handle}} $compressed if defined($compressed); $o-{crc} = Compress::Zlib::crc32($buf, $o-{crc}); $o-{len} += $len; return $len; } sub WRITE { my ($o, $buf, $len, $off) = @_; my ($compressed, $status) = $o-{dh}-deflate(substr($buf, 0, $len)); print {$o-{handle}} $compressed if defined($compressed); $o-{crc} = Compress::Zlib::crc32(substr($buf, 0, $len), $o-{crc}); $o-{len} += $len; return $len; } sub CLOSE { my ($o) = @_; return if !defined( $o-{dh}); my ($buf) = $o-{dh}-flush(); $buf .= pack("V V", $o-{crc}, $o-{len}); print {$o-{handle}} $buf; undef $o-{dh}; } sub DESTROY { my ($o) = @_; CLOSE($o); } -- Jens-Uwe Mager HELIOS Software GmbH Steinriede 3 30827 Garbsen Germany Phone: +49 5131 709320 FAX:+49 5131 709325 Internet: [EMAIL PROTECTED]
Re: [OT] Fast DB access
Hi, Cees has found a bug in our benchmark. We were using rtrim in our select statement while doing the benchmark and this was forcing postgres to perform a table scan. We've corrected the code for this bug. We are reposting results without rtrim (creating the tables with varchar). In fact with postgres even ignores the trailing blanks with 'char' datatype. When we ran these benchmarks at 40 seconds, we could not make out any difference in the results. Instead we increased the number of selects to 2000. Here are the new results between only postgres(6.5.3) and mldbm postgres 18 wallclock secs ( 1.88 usr + 0.18 sys = 2.06 CPU) mldbm 3 wallclock secs ( 1.77 usr + 0.21 sys = 1.98 CPU) Results still compare favourably towards MLDBM. Summary of our learning from the benchmarks and these discussions a) We have to use PG 7.1. It is a major improvement over 6.5.3 b) When we need a completely read-only high-performance data structure, MLDBM is a good option against postgres. This is provided we are able to cast our database in MLDBM style datastructures. c) Generic benchmarks may not be useful for most applications we need to device our own benchmark which represents critical processing requirements and try out various options. Thanks to all of you who have contributed to this thread. Regards, V Murali S Muthu Ganesh Differentiated Software Solutions Pvt. Ltd., 90, 3rd Cross,2nd Main, Ganga Nagar, Bangalore - 560 032 Phone : 91 80 3631445, 3431470 Visit us at www.diffsoft.com - Original Message - From: Cees Hek [EMAIL PROTECTED] To: Murali V [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, April 20, 2001 1:45 AM Subject: [OT] Re: Fast DB access On Thu, 19 Apr 2001, Murali V wrote: Hi, If you read the code more deeply, you'll find that the timeit is only wrapped around select and not around insert. We've written the insert code so that in the first round you can populate the database. You comment out the insert code after the first round and run the benchmark several times. This would only do select and time select. Hi Murali, OK, to start off, I was not specifically aiming my rant at you, I was replying to someone who had modified your code and was now comparing MySQL and PostgreSQL, and he was implying that the timings were for inserts and selects. I took this at face value, and didn't check the code close enough which I really should have done in the first place. Connecting this error to an axiom that "Benchmarks are useless" is bad indeed. Shouldn't we be ironing out errors and runing benchmarks which are good. Perhaps I should have said published benchmarks. In your case, you are using benchmarks for exactly what they are intended for... Creating a system that closely resembles your application and putting it through it's paces. What I find dangerous about publishing benchmarks, is that they are almost always heavily swayed to a specific application, and most of the time they show what the user wants them to show. In your original message, you clain to have a bias against Postgres, and your benchmark shows that bias. I however am a happy user of postgres, and am therefore biased towards it. I modified your benchmark script slightly, and I got the following results (I have include a diff of my changes at the bottom): postgres 0 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU) postgres 0 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU) Whereas if I run it with your version I get the following: postgres 27 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU) postgres 27 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU) So what does that tell you about the benchmark? that the postgres part of this benchmark is useless... It may have given you the answer that you wanted, but it is misleading to anyone else out there. This is why there are always flame wars about benchmarking databases (by the way I think this whole thread has been very civilized and i hope is stays that way). Invariably the benchmark has missed some critical idea or optimization which drastically skew the results. Your recommendation is to pick a DB best suited to your app. But How ?? a) Either by hiring a guru who has seen all kinds of apps with different DBs who can give you the answer with which we can run b) Run a benchmark on critical programs which represent you app across databases and find what performs best. I've read too much literature on DB features. All DBs have all features (except MySQL which does not have commit ) You can't make a thing out of DB literature. What I would recommend is exactly what you have done in this case. Get access to any and all the systems that you feel may do the job for you , and try them out. Browse the web for other users experiences, but don't use other peoples benchmarks, because the odds are good that they are wrong... Create your own, or modify an existing one,
modperl/ASP and MVC design pattern
an interestingfeature of JSP is the possibility to use the MVC design pattern (INPUT/OUTPUT/LOGIC separation) This is obtainedwith the "forward" instruction. How the MVC design pattern can be implemented in the mod_perl (and specifically Apache::ASP)architecture ? Thanks Francesco
Mod Perl for Apache
Sirs, I am trying to build mod perl for Apache but it fails on the final make as follows: The system is AIX 4.3.2, Perl 5.6.1, Apache 3.1.19, Mod Perl 1.25 Using the flexible way of installing this,when I run the final make on the Apache build I am getting the following error messages: Target "all" is up to date. === src/modules/standard === src/modules/perl Target "all" is up to date. === src/modules/perl Target "default" is up to date. === src/modules cc -c -I./os/unix -I./include -DAIX=43 -DUSE_PTHREAD_SERIALIZED_ACCEc cc -c -I./os/unix -I./include -DAIX=43 -DUSE_PTHREAD_SERIALIZED_ACCEc cc -DAIX=43 -DUSE_PTHREAD_SERIALIZED_ACCEPT -U__STR__ -DAIX_BIND_PROCE ld: 0711-317 ERROR: Undefined symbol: .Perl_form ld: 0711-317 ERROR: Undefined symbol: .perl_get_cv ld: 0711-317 ERROR: Undefined symbol: .Perl_push_scope ld: 0711-317 ERROR: Undefined symbol: PL_curstash ld: 0711-317 ERROR: Undefined symbol: .Perl_save_hptr ld: 0711-317 ERROR: Undefined symbol: .Perl_gv_stashpv . . . ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. make: 1254-004 The error code from the last command is 8. Stop. make: 1254-004 The error code from the last command is 2. Can you advise me as to what I may have missed. Thanks. Regards, Jim ___ BTcd Information Systems Engineering CORES Infrastructure Support * 0131-662 4724 * * [EMAIL PROTECTED] *pp HWP186 PO Box 234 (HOM-EH) Edinburgh Midlothian , EH12 9UR ___
Extracting required files
Hi, Does anyone know of a perl command/or a simple way that would extract all .pm and .pl that a perl script needs in order to run? Thanks __ Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/
RE: Extracting required files
cd /toplevel dir of app grep -Hrn use * -Original Message- From: F.H [mailto:[EMAIL PROTECTED]] Sent: Friday, April 20, 2001 10:01 To: [EMAIL PROTECTED] Subject: Extracting required files Hi, Does anyone know of a perl command/or a simple way that would extract all .pm and .pl that a perl script needs in order to run? Thanks __ Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/
RE: Extracting required files
I think the question being asked is , how to resolve ALL dependencies , not just the first level given in the app. For example , I may use some libs that in turn use others , and so on in multiple levels of nesting. Sri -Original Message- From: Brendan McAdams [SMTP:[EMAIL PROTECTED]] Sent: Friday,April 20,2001 9:16 AM To: F.H; [EMAIL PROTECTED] Subject: RE: Extracting required files cd /toplevel dir of app grep -Hrn use * -Original Message- From: F.H [mailto:[EMAIL PROTECTED]] Sent: Friday, April 20, 2001 10:01 To: [EMAIL PROTECTED] Subject: Extracting required files Hi, Does anyone know of a perl command/or a simple way that would extract all .pm and .pl that a perl script needs in order to run? Thanks __ Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/
Re: modperl/ASP and MVC design pattern
On Fri, 20 Apr 2001, Francesco Pasqualini wrote: an interesting feature of JSP is the possibility to use the MVC design pattern (INPUT/OUTPUT/LOGIC separation) This is obtained with the "forward" instruction. How the MVC design pattern can be implemented in the mod_perl (and specifically Apache::ASP) architecture ? MVC isn't dependent on any particular language, it's a top level design for your application. I have used something similar to the MVC model using just CGI.pm DBI/DBD. The basic idea is to decouple your data model from the display of that data. It's probably not textbook accurate MVC, but it borrows heavily from the architecture. I created a wrapper class for by database functionality (didn't sub-class DBI, but encapsulated it and the specifics of my data retrieval in the class). This class had hogh-level methods like $data-get_id, $data-list_ids, etc. I have used this same class with both PostgreSQL and MySQL, and the top-level interface didn't have to change, even though the underlying data structures did because of differences between PostgreSQL and MySQL (for instance, I could't use views or referential integrity contraints in MySQL). Then I created a display class that handled displaying stuff on the browser -- also encapsulating the CGI module in high-level methods like $disp-registration_form, $disp-error_page, etc. Again, here, I used this class where I had a newer version of CGI, but had to retrofit the class to a system that used an older version of CGI, so I had to recode a couple of methods using raw HTML and here docs, since the older system didn't have CGI methods available in the newer version. Finally, my top-level layer was a simple script (this wasn't a class per se) that was a 'driver' for the everything else -- I actually use a modified form of Recipe 19.12 in the Perl cookbook. I maintain state between page access through a single state variable, and have a hash that manages my data class and the display class, and the state variable is used to determine what 'page' to display, and handles top-level error handling. -- Brett http://www.chapelperilous.net/btfwk/ genealogy, n.: An account of one's descent from an ancestor who did not particularly care to trace his own. -- Ambrose Bierce
Re: modperl/ASP and MVC design pattern
- Original Message -From: "Brett W. McCoy" [EMAIL PROTECTED]To: "Francesco Pasqualini" [EMAIL PROTECTED]Cc: [EMAIL PROTECTED]Sent: Friday, April 20, 2001 5:32 PMSubject: Re: modperl/ASP and MVC design pattern On Fri, 20 Apr 2001, Francesco Pasqualini wrote: an interesting feature of JSP is the possibility to use the MVC design pattern (INPUT/OUTPUT/LOGIC separation) This is obtained with the "forward" instruction. How the MVC design pattern can be implemented in the mod_perl (and specifically Apache::ASP) architecture ?[...] Finally, my top-level layer was a simple script (this wasn't a class per se) that was a 'driver' for the everything else -- I actually use a modified form of Recipe 19.12 in the Perl cookbook. I maintain state between page access through a single state variable, and have a hash that manages my data class and the display class, and the state variable is used to determine what 'page' to display, and handles top-level error handling.this is very interesting ... and another good reason to buy thePerlCookBook.But are there in the mod_perl architecture some guidelines and/or frameworksthat encourages the MVC design patern ?I think that Apache::ASP could be (for example) the right tool, adding the"forward" feature. http://java.oreilly.com/news/jsptips_1100.html (explanation of the"forward" action)ThanksFrancesco -- Brett http://www.chapelperilous.net/btfwk/ genealogy, n.: An account of one's descent from an ancestor who did not particularly care to trace his own. -- Ambrose Bierce
Re: modperl/ASP and MVC design pattern
But are there in the mod_perl architecture some guidelines and/or frameworks that encourages the MVC design patern ? Apache::PageKit is a MVC based framework. You can find it on CPAN here: http://cpan2.org/Asset/display?dist=Apache-PageKit I wrote an article on it for take23: http://take23.org/articles/2001/01/04/pagekit.xml
RE: Extracting required files
Hello, FHDoes anyone know of a perl command/or a simple way that would extract FHall .pm and .pl that a perl script needs in order to run? SLI think the question being asked is , how to resolve ALL dependencies , SLnot just the first level given in the app. For example , I may use some SLlibs that in turn use others , and so on in multiple levels of nesting. If the program actually runs (e.g. all the dependencies are already there) then you can just use Data::Dumper or simple Perl to print out the contents of %INC. This will tell you what has loaded. There's probably more correct ways using -D or one of the Devel:: modules, but printing out %INC is pretty easy. If it doesn't actually run (e.g. you're missing some dependencies) then it's more difficult--in fact you can't figure out your dependencies because your missing dependencies may require other modules you don't have. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
RE: Extracting required files
On Fri, 20 Apr 2001, Andrew Ho wrote: Hello, FHDoes anyone know of a perl command/or a simple way that would extract FHall .pm and .pl that a perl script needs in order to run? SLI think the question being asked is , how to resolve ALL dependencies , SLnot just the first level given in the app. For example , I may use some SLlibs that in turn use others , and so on in multiple levels of nesting. As others have mentioned already, it's virtually impossible to know about all modules that are being used, since some of those are written on the flight (and not required/used at all). It'd help if you tell us why do you want to do that. If I understand you correctly, you want to make sure that the production machine is in sync with the development machine. Use CPAN.pm's bundle() function to make a snapshot of all modules that you have on your dev machine and then use the bundle to replicate it on any other machine of your choice. See the CPAN man page for more information. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://logilune.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: modperl/ASP and MVC design pattern
On Fri, 20 Apr 2001, Francesco Pasqualini wrote: But are there in the mod_perl architecture some guidelines and/or frameworks that encourages the MVC design patern ? I think that Apache::ASP could be (for example) the right tool, adding the "forward" feature. The forward feature looks like an ordinary include to me. Is there any real difference between that and the Apache::ASP version? $Response-Include("filename.inc", @args); In addition to Apache::PageKit, you might want to check out the documentation for Template Toolkit, especially http://www.template-toolkit.org/docs/default/index.html. - Perrin
Re: modperl/ASP and MVC design pattern
Francesco Pasqualini wrote: an interesting feature of JSP is the possibility to use the MVC design pattern (INPUT/OUTPUT/LOGIC separation) This is obtained with the "forward" instruction. How the MVC design pattern can be implemented in the mod_perl (and specifically Apache::ASP) architecture ? I don't know about MVC design patterns, but Apache;:ASP has these features which may help, of which $Server-Transfer() is probably your closest match to the forward instruction: $Server-Transfer($file) Transfer control to another script for execution with current script context including current $Session $Application, etc. my $data_ref = $Response-TrapInclude($file, @args) print/$Response-Write() output of script does not go straight to client browser, instead returns output in a scalar reference that you may post process as you like $Response-Include($file, @args) Like !--#include file=$file--, but @args are available in script in @_ $Server-Execute() is an alias for $Response-Include() Script_OnStart, Script_OnEnd, Script_OnFlush events Various events called, if defined in your global.asa, during the life of the script execution. Script_OnStart can be used to set globals available to scripts, or manage things such as site wide authentication control Script_OnFlush is useful for post processing data going to the client browser in a global way. XMLSubs Ability to create XML tags which are handled by perl code execution. The nice thing is that embedded tags pass their output as an argument to parent XMLSubs, for example: my:form action=basename($0) my:input type="button" / /my:form The my::input sub would execute then return its HTML to the my::form sub in a calling structure like: my::form(\%args, $html = my::input(\%other_args)); -- Josh _ Joshua Chamas Chamas Enterprises Inc. NodeWorks free web link monitoring Huntington Beach, CA USA http://www.nodeworks.com1-714-625-4051
Re: modperl/ASP and MVC design pattern
You can (I have) accomplish this with mod_perl and HTML::Mason, Mason's root level autohandler can play the role of the JSP model 2 "controller servlet": dispatching logic processing to Perl objects (er, beans) and "forwarding" to a view (with the Mason $m-call_next or $m-comp mechanisms). I think the Apache::Dispatch stuff can also perform this role (haven't played with it to say for certain). I'll qualify this by saying MVC is not a end in itself, there are a lot of modern requirements for flexible branding, client form factor appropriate and locale specific presentations that require the view/controller part to be a lot smarter than the traditional concepts of MVC that I've seen call for. I've been referring to these needs in my own engineering discussions as (yikes) MVC++ :) On Fri, 20 Apr 2001, Francesco Pasqualini wrote: an interesting feature of JSP is the possibility to use the MVC design pattern (INPUT/OUTPUT/LOGIC separation) This is obtained with the "forward" instruction. How the MVC design pattern can be implemented in the mod_perl (and specifically Apache::ASP) architecture ? cheers, -Ian -- Ian Kallen [EMAIL PROTECTED] | AIM: iankallen
Re: RE: Extracting required files
Thanks you guys for your replies. The purpose of knowing a program dependencies is to help troubleshoot any problems that may occur once you install your script on a different machine or a a different OS such as from NT to UNIX and vice versa where different version of Perl may be installed. It's good to know just for the heck of it.. to know all the details about your script. using print @INC doesn't help it just points you to the lib dir in your path. But I know when you use perl2exe it prints on the screen all your script dependencies. So I hoped that perl.exe had a command line argument that would extract those files. Regards F.H Stas Bekman [EMAIL PROTECTED] wrote: On Fri, 20 Apr 2001, Andrew Ho wrote: Hello, FHDoes anyone know of a perl command/or a simple way that would extract FHall .pm and .pl that a perl script needs in order to run? SLI think the question being asked is , how to resolve ALL dependencies , SLnot just the first level given in the app. For example , I may use some SLlibs that in turn use others , and so on in multiple levels of nesting. As others have mentioned already, it's virtually impossible to know about all modules that are being used, since some of those are written on the flight (and not required/used at all). It'd help if you tell us why do you want to do that. If I understand you correctly, you want to make sure that the production machine is in sync with the development machine. Use CPAN.pm's bundle() function to make a snapshot of all modules that you have on your dev machine and then use the bundle to replicate it on any other machine of your choice. See the CPAN man page for more information. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://logilune.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/ __ Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/
Re: Extracting required files
On Fri, Apr 20, 2001 at 04:05:22PM -0400, F.H wrote: using print @INC doesn't help it just points you to the lib dir in your path. The suggestion was to investigate %INC at some appropriate point (not @INC), but note that in general this problem is not soluable. Did I hear someone mutter "halting problem"? What modules does this program use? $ perl -ne 'chomp; require' -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net
How to tell if scripts are mod_perl ?
Hi there, I'm trying to roll out some software by one of our 3rd party developers. I'm trying to find out if the scripts will actually be run through mod_perl and not as cgi's. The only config changes that they have specified to my Apache config is as follows : Alias /cgi-bin/ /real/path/to/perl-scripts/ Location /cgi-bin SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI /Location They have not requested any settings like PerlWarn On PerlTaintCheck On There are also no use statements being required (eg use Apache::Registry() ) in the config. Is there any way to check that the scripts are being run through mod_perl and not as cgi's ? Thanks, -- --Wayne-- The time for action is passed. | [EMAIL PROTECTED] Now is the time for sensless| www.penguinpowered.org.uk bickering. |
Re: How to tell if scripts are mod_perl ?
You can check the MOD_PERL envirement variable. Something like: if ($ENV{MOD_PERL}) { # We're under mod_perl } else { # strait perl here } -- Chris Reinhardt [EMAIL PROTECTED] Webmaster Dynamic DNS Network Services http://www.dyndns.org/ On 20 Apr 2001, Wayne Pascoe wrote: Hi there, I'm trying to roll out some software by one of our 3rd party developers. I'm trying to find out if the scripts will actually be run through mod_perl and not as cgi's. The only config changes that they have specified to my Apache config is as follows : Alias /cgi-bin/ /real/path/to/perl-scripts/ Location /cgi-bin SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI /Location They have not requested any settings like PerlWarn On PerlTaintCheck On There are also no use statements being required (eg use Apache::Registry() ) in the config. Is there any way to check that the scripts are being run through mod_perl and not as cgi's ? Thanks, -- --Wayne-- The time for action is passed. | [EMAIL PROTECTED] Now is the time for sensless| www.penguinpowered.org.uk bickering. |
Re: How to tell if scripts are mod_perl ?
Hi there, On 20 Apr 2001, Wayne Pascoe wrote: I'm trying to find out if the scripts will actually be run through mod_perl and not as cgi's. http://perl.apache.org/guide 73, Ged.
Re: modperl/ASP and MVC design pattern
At 15:44 20.04.2001 +0200, you wrote: an interesting feature of JSP is the possibility to use the MVC design pattern (INPUT/OUTPUT/LOGIC separation) This is obtained with the "forward" instruction. How the MVC design pattern can be implemented in the mod_perl (and specifically Apache::ASP) architecture ? http://www.catstep.de/zobel/post2redirect.html The essence is if you respect GET/POST semantics: All scripts that process POST requests must always end up doing redirects. Joachim -- "... ein Geschlecht erfinderischer Zwerge, die fuer alles gemietet werden koennen."- Bertolt Brecht - Leben des Galilei
deprecated our() indicated in perldoc of Getopt::Std
I upgraded to v5.6.1 of perl and viewed the documentation for the Getopt::Std as I wasn't familiar with its use for command line arguments on a new install function I was building. The docs indicate use of our( $opt_foo, $opt_bar ) should 'use strict vars' be in use. I wasn't familiar with this deprecated version of global variable definitions but I used it.. much to my chagrin when the install was actually performed on a perl v5.05003 equipped machine. How did an older version of Getopt::Std get installed with a later version of perl? -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Alan E. Derhaag N2H2, Creators of Bess and Searchopolis phone: 206-336-2972 900 Fourth Avenue, Suite 3600 email: [EMAIL PROTECTED],[EMAIL PROTECTED]Seattle, WA 98164 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Re: deprecated our() indicated in perldoc of Getopt::Std
On Fri, Apr 20, 2001 at 02:36:32PM -0700, Alan E. Derhaag wrote: I upgraded to v5.6.1 of perl and viewed the documentation for the Getopt::Std as I wasn't familiar with its use for command line arguments on a new install function I was building. The docs indicate use of our( $opt_foo, $opt_bar ) should 'use strict vars' be in use. I wasn't familiar with this deprecated version of global variable definitions but I used it.. much to my chagrin when the install was actually performed on a perl v5.05003 equipped machine. This hasn't got much to do with modperl, but You installed 5.6.1, read the docs, used "our" and found it didn't work on 5.00503, right? That's because it's new with 5.6. From where did you get the idea that it is deprecated? Quite the opposite is the case. How did an older version of Getopt::Std get installed with a later version of perl? I don't think it did. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net
Re: deprecated our() indicated in perldoc of Getopt::Std
1) 'our' is not deprecated. it is new. i know it was in 5.6.0, not sure if it was in earlier than that. u can check the CHANGES file to see exactly when it was added. 2) this is really a perl question, not a mod_perl question. next time try one of the following for perl related help: http://www.perlmonks.org/ news://comp.lang.perl.moderated news://comp.lang.perl.misc -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/ "Alan E. Derhaag" wrote: I upgraded to v5.6.1 of perl and viewed the documentation for the Getopt::Std as I wasn't familiar with its use for command line arguments on a new install function I was building. The docs indicate use of our( $opt_foo, $opt_bar ) should 'use strict vars' be in use. I wasn't familiar with this deprecated version of global variable definitions but I used it.. much to my chagrin when the install was actually performed on a perl v5.05003 equipped machine. How did an older version of Getopt::Std get installed with a later version of perl?
Re: deprecated our() indicated in perldoc of Getopt::Std
Paul Johnson [EMAIL PROTECTED] writes: On Fri, Apr 20, 2001 at 02:36:32PM -0700, Alan E. Derhaag wrote: I upgraded to v5.6.1 of perl and viewed the documentation for the Getopt::Std as I wasn't familiar with its use for command line arguments on a new install function I was building. The docs indicate use of our( $opt_foo, $opt_bar ) should 'use strict vars' be in use. I wasn't familiar with this deprecated version of global variable definitions but I used it.. much to my chagrin when the install was actually performed on a perl v5.05003 equipped machine. This hasn't got much to do with modperl, but Oops, quite right.. it was from a helper function to install on a modperl server machine.. You installed 5.6.1, read the docs, used "our" and found it didn't work on 5.00503, right? That's because it's new with 5.6. From where did you get the idea that it is deprecated? Quite the opposite is the case. Could have fooled me! I thought it was a term I'd never learned.. especially since the perl 5.00503 execution indicated that it was deprecated with: Use of reserved word "our" is deprecated at /tmp/initcatsrch.pl line 26. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Alan E. Derhaag N2H2, Creators of Bess and Searchopolis phone: 206-336-2972 900 Fourth Avenue, Suite 3600 email: [EMAIL PROTECTED],[EMAIL PROTECTED]Seattle, WA 98164 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Re: modperl/ASP and MVC design pattern
At 10:01 AM 4/20/01 -0700, Perrin Harkins wrote: On Fri, 20 Apr 2001, Francesco Pasqualini wrote: But are there in the mod_perl architecture some guidelines and/or frameworks that encourages the MVC design patern ? I think that Apache::ASP could be (for example) the right tool, adding the "forward" feature. The forward feature looks like an ordinary include to me. Is there any real difference between that and the Apache::ASP version? $Response-Include("filename.inc", @args); I don't know what Apache::ASP is doing in this case, but the Forward in JSPs is not a simple include. A forward is literally forwarding the request from one JSP to another JSP page. As long as the previous JSP page has not output any data (and is pure model/controller code) then the forward can be made to any JSP page that has its own content-type and data to display. This is how a pure JSP app can be made MVC. You write beans which represent the model, one JSP for the main app controller which dynamically determines the actual full display JSP (the view) to forward to. A simple include would not care, for example, if the content-type or a header in the first page had already been output. In the case of JSP, if the content gets commited in one page, forward is a directive that will no longer work I believe. Later, Gunther
Re: How to tell if scripts are mod_perl ?
On 20 Apr 2001, Wayne Pascoe wrote: Hi there, I'm trying to roll out some software by one of our 3rd party developers. I'm trying to find out if the scripts will actually be run through mod_perl and not as cgi's. The only config changes that they have specified to my Apache config is as follows : Alias /cgi-bin/ /real/path/to/perl-scripts/ Looks like mod_perl to me Location /cgi-bin SetHandler perl-script - This right here tells Apache to use mod_perl for scripts in /cgi-bin, which is really /real/path/to/perl-scripts/ PerlHandler Apache::Registry - And this tells mod_perl to use Apache::Registry as the handler for scripts located in /cgi-bin Options +ExecCGI /Location They have not requested any settings like PerlWarn On PerlTaintCheck On There are also no use statements being required (eg use Apache::Registry() ) in the config. You're not seeing anything in the config file that says use Apache::Registry because it's being stated in the bit above... Is there any way to check that the scripts are being run through mod_perl and not as cgi's ? Thanks, Hope that helps, Sean
Re: deprecated our() indicated in perldoc of Getopt::Std
On Fri, Apr 20, 2001 at 03:01:25PM -0700, Alan E. Derhaag wrote: Paul Johnson [EMAIL PROTECTED] writes: You installed 5.6.1, read the docs, used "our" and found it didn't work on 5.00503, right? That's because it's new with 5.6. From where did you get the idea that it is deprecated? Quite the opposite is the case. Could have fooled me! I thought it was a term I'd never learned.. especially since the perl 5.00503 execution indicated that it was deprecated with: Use of reserved word "our" is deprecated at /tmp/initcatsrch.pl line 26. At he risk of prolonging a discussion which doesn't belong here, let me try to draw it to a close. Quoting perldiag from 5.00503: =item Use of reserved word "%s" is deprecated (D) The indicated bareword is a reserved word. Future versions of perl may use it as a keyword, so you're better off either explicitly quoting the word in a manner appropriate for its context of use, or using a different name altogether. The warning can be suppressed for subroutine names by either adding a C prefix, or using a package qualifier, e.g. Cour(), or CFoo::our(). I agree that in this situation the message which was intended to be helpful fell somewhat short of its mark. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net
Re: modperl/ASP and MVC design pattern
Quoting Joshua Chamas [EMAIL PROTECTED]: Francesco Pasqualini wrote: an interesting feature of JSP is the possibility to use the MVC design pattern (INPUT/OUTPUT/LOGIC separation) This is obtained with the "forward" instruction. How the MVC design pattern can be implemented in the mod_perl (and specifically Apache::ASP) architecture ? If you do use Apache::ASP in this way, how are you doing it. I don't know much about what you are going after, so it would be neat to hear how you accomplish it. ...mmh... Developing an Apache::ASP application I encountered the problem/feature that it is not possible to use global variables inside subs in a page. For example: page test.asp $name='default name'; ... HelloWord(); sub HelloWord{ print $name; ## WRONG using global var is incosistent in mod_perl } The correct approach if you have sub in a asp Page is to pass it everything it need: page test.asp $name='default name'; ... HelloWord($name); sub HelloWord{ my $name = shift; #OK print $name; ## OK $name is not global } To avoid passing many parameters to the subs I become using a $cx (cx stand for context) global hash containig everything the subs needed, passed to each sub. page test.asp $cx = {}; $cx-{'name'} = 'default name'; $cx-{'age'} = 30; ... HelloWord($cx); ... sub HelloWord{ my $cx = shift; my $name = $cx-{'name'}; #OK print $name; ## OK $name is not global } ...at the end of the work I realized that the idea of such a context is exactly what it is used in MVC tools like: - JSP templates, - www.webmacro.org, - jakarta.apache.org/velocity, - www.freemarker.org. But in such a way I've done a MVC architecture in a single page, where a part of the page is the View and a part is the Controller(logic). If Apache::ASP will support the 'forward' directive we could start developing MVC application in a way similar to the JSP world. Useful Links to MVC documentations are in: http://jakarta.apache.org/velocity/ymtd/ymtd.html JSP Specification: http://java.sun.com/aboutJava/communityprocess/first/jsr053/jsp12.pdf Francesco --Josh _ Joshua Chamas Chamas Enterprises Inc. NodeWorks free web link monitoring Huntington Beach, CA USA http://www.nodeworks.com1-714-625-4051 --- This mail sent through the IMP demo site: demo.horde.org Find out more at http://www.horde.org/imp/
Re: modperl/ASP and MVC design pattern
[EMAIL PROTECTED] wrote: To avoid passing many parameters to the subs I become using a $cx (cx stand for context) global hash containig everything the subs needed, passed to each sub. page test.asp $cx = {}; $cx-{'name'} = 'default name'; $cx-{'age'} = 30; ... Try this, # in global.asa use vars qw($cx); # set up $cx for global use sub Script_OnStart { $cx = {}; # initialize per request } # in script sub HelloWorld { $cx-{name} = 'hello'; } This will work, but I'd recommend you move your subs to global.asa, which is your central module for your scripts. And then you can use $Server-Transfer() to change the file executing midstream. --Josh
cvs commit: modperl-2.0/util config.pl
dougm 01/04/20 10:07:49 Added: util config.pl Log: add util/config.pl script to report configuration Revision ChangesPath 1.1 modperl-2.0/util/config.pl Index: config.pl === use lib qw(lib); use lib qw(Apache-Test/lib); use Apache::Build (); use Apache::TestConfig (); my $build_config = Apache::Build-build_config; print "using $INC{'Apache/BuildConfig.pm'}\n"; print "Makefile.PL options:\n"; for (sort keys %$build_config) { next unless /^MP_/; printf "%-20s = %s\n", $_, $build_config-{$_}; } my $test_config = Apache::TestConfig-new; my $httpd = $test_config-{vars}-{httpd}; print "\n$httpd -V:\n"; system "$httpd -V"; my $perl = $build_config-{MODPERL_PERLPATH}; print "\n$perl -V:\n"; system "$perl -V";
cvs commit: modperl-2.0/lib/Apache Build.pm
dougm 01/04/20 10:09:20 Modified:lib/Apache Build.pm Log: prevent warning Revision ChangesPath 1.42 +1 -0 modperl-2.0/lib/Apache/Build.pm Index: Build.pm === RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Build.pm 2001/04/10 22:52:36 1.41 +++ Build.pm 2001/04/20 17:09:16 1.42 @@ -440,6 +440,7 @@ $self-default_dir, '../httpd-2.0') { + next unless $src_dir; next unless (-d $src_dir || -l $src_dir); next if $seen{$src_dir}++; push @dirs, $src_dir;
cvs commit: modperl-2.0/lib/ModPerl Config.pm
sbekman 01/04/20 11:25:49 Modified:lib/ModPerl Config.pm Log: use strict Revision ChangesPath 1.2 +2 -1 modperl-2.0/lib/ModPerl/Config.pm Index: Config.pm === RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Config.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Config.pm 2001/04/20 18:08:03 1.1 +++ Config.pm 2001/04/20 18:25:45 1.2 @@ -1,5 +1,6 @@ package ModPerl::Config; +use strict; use lib qw(Apache-Test/lib); use Apache::Build (); @@ -19,7 +20,7 @@ my $test_config = Apache::TestConfig-new; my $httpd = $test_config-{vars}-{httpd}; -$command = "$httpd -v"; +my $command = "$httpd -v"; $cfg .= "\n\n*** $command\n"; $cfg .= qx{$command};
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm
dougm 01/04/20 09:46:52 Modified:Apache-Test/lib/Apache TestConfig.pm Log: deal properly with args Revision ChangesPath 1.10 +5 -2 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- TestConfig.pm 2001/04/19 21:21:16 1.9 +++ TestConfig.pm 2001/04/20 16:46:50 1.10 @@ -74,9 +74,12 @@ } sub new { -my($class, $args) = @_; +my $class = shift; +my $args; -$args = ($args and ref($args)) ? {%$args} : {@_}; #copy +$args = shift if $_[0] and ref $_[0]; + +$args = $args ? {%$args} : {@_}; #copy my $thaw = {};
cvs commit: modperl-2.0/util config.pl
dougm 01/04/20 09:50:57 Modified:pod modperl_dev.pod Added: util config.pl Log: add util/config.pl script to report configuration Revision ChangesPath No revision No revision
cvs commit: modperl-2.0 Makefile.PL
dougm 01/04/20 10:43:04 Modified:.Makefile.PL Log: need to push tables_dir into @INC when xs is not generated Revision ChangesPath 1.34 +11 -5 modperl-2.0/Makefile.PL Index: Makefile.PL === RCS file: /home/cvs/modperl-2.0/Makefile.PL,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- Makefile.PL 2001/04/12 16:03:55 1.33 +++ Makefile.PL 2001/04/20 17:42:57 1.34 @@ -73,7 +73,14 @@ generate_script($_); } -generate_xs($httpd_version) if $build-{MP_GENERATE_XS}; +my $tables_dir = tables_dir($httpd_version); + +unshift @INC, $tables_dir; + +if ($build-{MP_GENERATE_XS}) { +print "generating XS code using $tables_dir...\n"; +generate_xs($httpd_version); +} } sub post_configure { @@ -97,7 +104,7 @@ $build-save; } -sub generate_xs { +sub tables_dir { my $httpd_version = shift; my $tables_version = 'current'; @@ -105,10 +112,9 @@ #$httpd_version =~ /-dev$/ ? 'current' : $httpd_version; my $tables_dir = "xs/tables/$tables_version"; -unshift @INC, $tables_dir; - -print "generating XS code using $tables_dir...\n"; +} +sub generate_xs { require ModPerl::WrapXS; my $xs = ModPerl::WrapXS-new;
cvs commit: modperl-2.0/lib/ModPerl WrapXS.pm
dougm 01/04/20 11:03:49 Modified:lib/ModPerl WrapXS.pm Log: use thr corrent lib path Revision ChangesPath 1.8 +1 -1 modperl-2.0/lib/ModPerl/WrapXS.pm Index: WrapXS.pm === RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- WrapXS.pm 2001/04/20 03:07:53 1.7 +++ WrapXS.pm 2001/04/20 18:03:45 1.8 @@ -283,7 +283,7 @@ print $fh EOF; $self-{noedit_warning_hash} -use lib qw(../../lib); #for Apache::BuildConfig +use lib qw(../../../lib); #for Apache::BuildConfig use ModPerl::MM (); ModPerl::MM::WriteMakefile(
cvs commit: modperl-2.0/util bugreport.pl config.pl
sbekman 01/04/20 11:08:09 Modified:util config.pl Added: lib/ModPerl Config.pm util bugreport.pl Log: * moving the code from util/config.pl into a new lib/ModPerl/Config.pm * now util/config.pl uses lib/ModPerl/Config.pm * a new bugreport util uses lib/ModPerl/Config.pm Revision ChangesPath 1.1 modperl-2.0/lib/ModPerl/Config.pm Index: Config.pm === package ModPerl::Config; use lib qw(Apache-Test/lib); use Apache::Build (); use Apache::TestConfig (); sub config_as_str{ my $build_config = Apache::Build-build_config; my $cfg = ''; $cfg .= "*** using $INC{'Apache/BuildConfig.pm'}\n"; $cfg .= "*** Makefile.PL options:\n"; $cfg .= join '', map {sprintf "%-20s = %s\n", $_, $build_config-{$_}} grep /^MP_/, sort keys %$build_config; my $test_config = Apache::TestConfig-new; my $httpd = $test_config-{vars}-{httpd}; $command = "$httpd -v"; $cfg .= "\n\n*** $command\n"; $cfg .= qx{$command}; my $perl = $build_config-{MODPERL_PERLPATH}; $command = "$perl -V"; $cfg .= "\n\n*** $command\n"; $cfg .= qx{$command}; return $cfg; } 1; __END__ =pod =head1 NAME - ModPerl::Config =head1 DESCRIPTION Functions to retrieve mod_perl specific env information. =cut 1.2 +6 -24 modperl-2.0/util/config.pl Index: config.pl === RCS file: /home/cvs/modperl-2.0/util/config.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- config.pl 2001/04/20 17:07:47 1.1 +++ config.pl 2001/04/20 18:08:06 1.2 @@ -1,27 +1,9 @@ -use lib qw(lib); -use lib qw(Apache-Test/lib); +#!/usr/bin/perl -w -use Apache::Build (); -use Apache::TestConfig (); +use strict; +use FindBin qw($Bin); +use lib "$Bin/../lib"; -my $build_config = Apache::Build-build_config; +use ModPerl::Config (); -print "using $INC{'Apache/BuildConfig.pm'}\n"; - -print "Makefile.PL options:\n"; -for (sort keys %$build_config) { -next unless /^MP_/; -printf "%-20s = %s\n", $_, $build_config-{$_}; -} - -my $test_config = Apache::TestConfig-new; -my $httpd = $test_config-{vars}-{httpd}; - -print "\n$httpd -V:\n"; -system "$httpd -V"; - -my $perl = $build_config-{MODPERL_PERLPATH}; - -print "\n$perl -V:\n"; -system "$perl -V"; - +print ModPerl::Config::config_as_str(); 1.1 modperl-2.0/util/bugreport.pl Index: bugreport.pl === #!/usr/bin/perl -w use strict; use FindBin qw($Bin); use lib "$Bin/../lib"; use ModPerl::Config (); my $env = ModPerl::Config::config_as_str(); { local $/ = undef; my $template = DATA; $template =~ s/\[CONFIG\]/$env/; print $template; } __DATA__ -8--Start Bug Report 8-- 1. Problem Description: [DESCRIBE THE PROBLEM HERE] 2. Used Components and their Configuration: [CONFIG] 3. This is the core dump trace: (if you get a core dump): [CORE TRACE COMES HERE] -8--End Bug Report --8-- Note: Complete the rest of the details and post this bug report to [EMAIL PROTECTED] as is. To subscribe to the list send an empty email to [EMAIL PROTECTED]