'die' in a CleanupHandler
Just curious ... what happens if I call 'die' in a mod_perl handler (especially a CleanupHandler)? Does it actually kill the apache child or does something catch the exception before that happens? -- 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: 'die' in a CleanupHandler
At 6:19 PM -0400 9/8/03, Perrin Harkins wrote: On Mon, 2003-09-08 at 16:10, Ray Zimmerman wrote: Just curious ... what happens if I call 'die' in a mod_perl handler (especially a CleanupHandler)? Does it actually kill the apache child or does something catch the exception before that happens? The latter. Your 'die' is caught by mod_perl. Is there something you're trying to do? I was just considering how to handle it when a serious error occurs during a CleanupHandler and was wondering what the difference was between 'warn' and 'die' in that context. -- 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
crazy problem
I have a bizarre problem and I've run out of ideas ... Here's the gist ... when I run some code which looks like ... my result = `/usr/local/bin/matlab input_file.m`; ... from a perl CGI, then matlab (a commercial math package) segfaults. However, when I run it from mod_perl on the same server it runs fine (it runs fine from the command line, btw). My web server is running as 'nobody'. I've also run the script as 'nobody' from the command line and wiped out %ENV before executing the above code ... works fine. Call the exact same script as a CGI and ... BOOM. It can't be a permissions problem, right? If so, mod_perl would also have trouble? Any clues? I'm out of ideas ... For anyone who may have Matlab available, btw, this is only with Matlab 6. Matlab 5 (which we no longer have a license for) works just fine. -- 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
URI escaping question
Suppose I have a hash of string values that I want to include in the query string of a redirect URL. What is the accepted way of escaping the values to be sure that they come through intact? Specifically, it seems that Apache::Util-escape_uri() -- 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
URI escaping question
Oops ... finger slipped before I was done typing ... Suppose I have a hash of string values that I want to include in the query string of a redirect URL. What is the accepted way of escaping the values to be sure that they come through intact? Specifically, it seems that Apache::Util-escape_uri() is not escaping '=' and '' so if one of the values in the hash is a URI with a query string it messes things up. -- 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?
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
O-R mapping vs. R-O mapping (was Re: separating C from V in MVC)
At 12:22 AM -0500 6/14/02, Dave Rolsky wrote: An Object-Relational mapper takes objects and stores them in a relational database, as transparently as possible. I think the most pure example of this I've seen in the Perl world is Tangram (www.tangram-persistence.org). SPOPS is also an O-R mapper (actually, its a generic Object persistence mechanism but it seems to most feature-rich when used with an RDBMS). A Relational-Object takes a relational database, and provides access to it (select, insert, update, delete) via objects. Class::DBI, Alzabo, and DBIx::RecordSet are examples of such a beast. I think what it comes down to is how do you start thinking your project? Well said, Dave. I don't think one approach is strictly better than the other. It depends what you need to accomplish. I wouldn't be surprised to find that the majority of the folks on the modperl list would favor an R-O approach to an O-R one, but that's because probably the vast majority of web apps are primarily about the data. This happens to not be the case for me and I find my O-R mapper to be enormously helpful, exactly what I need most of the time. I'm using ESPOPS, a package built on top of SPOPS to handle objects with inherited attributes spread across multiple tables. Granted, when I do need to fetch my objects based on complicated criteria involving joining of lots of tables, it's not as clean as I'd like. It requires passing SQL fragments into the fetch methods. To me this just means that my O-R mapper has abstracted things nicely to the point where I don't have to touch any SQL 90% of the time, but for those cases where I do need more complicated SQL, it lets me directly at the SQL and doesn't pretend that it's going to be able to do everything I might want. This seems like a good tradeoff to me. One possible improvement (with emphasis on possible) might be to build the O-R mapper on top of something like Alzabo or some other R-O mapper which does a more complete job of abstracting me away from the actual SQL. Then when I want to pass some more explicit query specs through the O-R mapper it would be in Alzabo instead of SQL. My gut feeling is that the extra layer probably wouldn't be worth it. Anyway, my main point is O-R and R-O are different tools for different jobs. A hammer is not better than a saw until you know you're trying to drive a nail as opposed to cut wood. BTW, this thread should probably be moved to the poop list ... -- 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
requesting feedback on MVC implementation
All this MVC discussion has been very helpful. There are obviously many ways to do MVC web apps and I'd love to get a bit of feedback on the approach we are currently planning for ours before we jump into coding. Our app is a platform for running econ experiments, each of which is structured a bit like a multi-player game. We already have a pretty well developed Model containing the application logic, and for the web UI we're planning to use Mason for a number of reasons which I won't get into here. The only reason I mention it is that our approach does use Mason specific features like autohandlers/dhandlers. The directory structure looks something like ... /C /autohandler /login /register_action /login_action /E /Game1 /autohandler /submit_decision_action /display_results_action /Game2 /autohandler /submit_decision_action /display_results_action /V /autohandler /login /E /Game1 /autohandler /decision_submission_view /results_view /Game2 /autohandler /decision_submission_view /results_view ... where the stuff under /C makes up the Controller(s) and the stuff under /V the Views. The C components and corresponding autohandlers are pure Perl (no HTML output) and the V components and autohandlers are simple templates with minimal code (presentation-related only). URLs would always point to some action component under /C which would then call the appropriate view component under /V using the new sub-request mechanism in Mason 1.1. This would allow us to use autohandlers as a directory based inheritance mechanism for sharing Controller code. And we can also use autohandlers as a directory based inheritance for templates for wrapping page content. So a Controller would consist of an action component and all of its autohandlers, and a View would consist of the view component and its autohandlers. In order to avoid hard coding paths URLs, we would use something like the action table Chris Winters mentioned. This would be a Perl object with action key to component path mappings, as well as view name to component path mappings. We'd probably put this action table as well as some of the font/color type of data together into some UIConfig class, similar to what Rob Nagler is doing with his Facade. The appropriate sub-class of UIConfig to use for a given request would be specified in the autohandlers under /C, with /C/autohandler providing a default, which could be overridden by /C/E/Gamen/autohandler. One nice feature of this architecture is that it should allow us to easily create a new Game3 which inherits all actions and views from Game2. Overriding an action or view could be done by creating a new UIConfig sub-class which inherits from the one used by Game2 and overrides the corresponding entry in the action table. I'm sure there are details that I haven't thought about yet, but any comments on this structure? Tear it apart! :-) -- Ray Zimmerman / e-mail: [EMAIL PROTECTED] / 428-B Phillips Hall Sr Research / phone: (607) 255-9645 / Cornell University Associate / FAX: (815) 377-3932 / Ithaca, NY 14853
Re: separating C from V in MVC
At 12:02 AM -0600 6/6/02, Rob Nagler wrote: To solve this problem, we added a letter. bOP is MVCF, where F stands for Facade. A Facade allows you to control icons, files, colors, fonts, text, and tasks. You can add other components, but we usually use text as a catch all, e.g. numeric formats. Facades can inherit from other facades and can be cloned from other facades. We use this to support different skins and co-brands. snip A Facade is the first thing set in a request. You then know what tasks are available and what URLs map to them. Take a look at: http://petshop.bivio.biz/src?s=Bivio::PetShop::Facade::PetShop All the URLs for the site are contained in this file. Anybody rendering a URL, does it through Bivio::UI::Task. Two specifically for Rob ... (1) What are you using to display the nice syntax-colored Perl source at http://petshop.bivio.biz/ ? (2) Are you using the term Facade in the same sense as in Design Patterns p. 185? If not, could you define what a facade is in terms of its role? I'm planning an MVC-type architecture for my web-app and am looking for a place to put the kinds of data you have in your Facade - URL mappings, colors, fonts, etc. It seems that some of it is data that is used strictly by the View (colors, fonts) and other parts (URL mapping) are used by the View (for generating links) and Controller (for calling the View or doing a redirect). ... and one for everybody ... So how is everybody else handling URL mapping? Do others group this kind of data together with fonts, colors, etc? And where do you define it? Very much appreciating all the MVC discussion ... -- 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
separating C from V in MVC
We're developing a pretty complex web app using mod_perl and Mason and I'd like to use some form of MVC structure to keep things manageable. I'm looking for some pointers on MVC in this context. Specifically, M is easy ... use Perl objects, but how are others implementing the Controllers and Views in order to keep them separate? If I understand correctly, the Mason component that generates the page the user sees would be considered the View. But where is the Controller? I assume that, conceptually, the Controller is the code that responds to a given web request and decides which view to display. This is code I would normally have put in the %init section of the display component (with a possible redirect to another component based on application logic). This sounds like C and V are not separated as they should be. What's the right way to do it? (None of this TMTOWTDO stuff now, I want the RIGHT way :-) ... and do I have the concepts right? -- 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: OT: secure mod_perl enabled apache on MacOSX 10.1
At 11:24 AM -0700 10/3/01, Wilfredo Sanchez wrote: On Wednesday, October 3, 2001, at 11:10 AM, Ray Zimmerman wrote: I've been able to build a mod_perl enabled apache (not DSO) for Mac OS X 10.1 and it seems to work fine. Now I'd like to include the apple_hfs_module or hfs_apple_module that Apple included as a DSO in the standard install to take care of some security issues related to the case-insensitivity of the HFS+ file system. /usr/libexec/httpd/libperl.so ships with 10.1; there's usually no need to build your own. Just uncomment the LoadModule/AddModule lines referencing perl in /etc/httpd/httpd.conf. Oh, I didn't realize that. But anyway, I've always stayed away from mod_perl as a DSO since I thought there were problems with it ... have they (don't even know what they were) all been fixed? For what it's worth, I've heard that mod_hfs_apple is broken in 10.1, but I haven't verified that. According to ... http://www.stepwise.com/Articles/Technical/2001-09-29-01.html ... it's because of a name change. The article gives a fix. -- 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: OT: secure mod_perl enabled apache on MacOSX 10.1
At 2:23 PM -0400 10/3/01, John Siracusa wrote: On Wednesday, October 3, 2001, at 02:10 PM, Ray Zimmerman wrote: I've been able to build a mod_perl enabled apache (not DSO) for Mac OS X 10.1 and it seems to work fine. Would it be too much trouble for you to post a complete, step-by-step account of exactly what you did you accomplish this? :) OK, this is with apache_1.3.20, perl-5.6.1 and mod_perl-1.26. (1) Unpack apache and mod_perl into the same directory, e.g. cd ~ tar zxvf apache_1.3.20.tar.gz tar zxvf mod_perl-1.26.tar.gz (2) Run configure for apache. cd ~/apache_1.3.20 ./configure (3) Make and install mod_perl. cd ~/mod_perl-1.26 perl Makefile.PL APACHE_SRC=../apache_1.3.20/src \ DO_HTTPD=1 \ USE_APACI=1 \ PREP_HTTPD=1 \ EVERYTHING=1 make sudo make install (4) Reconfigure and make apache. cd ~/apache_1.3.20 ./configure \ --enable-module=info \ --enable-module=status \ --enable-module=proxy \ --activate-module=src/modules/perl/libperl.a make (5) Test mod_perl. cd ~/mod_perl-1.26 make test (6) Install apache. cd ~/apache_1.3.20 sudo make install -- 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
OT: secure mod_perl enabled apache on MacOSX 10.1
I suppose this is slightly off-topic for both lists I'm posting to, but I don't know of a better place to ask ... I've been able to build a mod_perl enabled apache (not DSO) for Mac OS X 10.1 and it seems to work fine. Now I'd like to include the apple_hfs_module or hfs_apple_module that Apple included as a DSO in the standard install to take care of some security issues related to the case-insensitivity of the HFS+ file system. Can anybody tell me how to do this? I've never used DSO's before. Are there other things Apple has included beyond the standard apache distribution? Thanks, -- 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: [OT] Inspired by closing comments from the UBB thread.
At 12:50 PM -0400 8/1/01, Perrin Harkins wrote: It would really be nice if someone could write an overview of the O/R mapping tools for Perl. I know Dave Rolsky was working on one, but it's a big job and he's busy with Mason. I agree. There was a bit of discussion on this topic on this list around May 10th of this year. Dave mentioned that you could have a look at what he'd started writing a long time ago at ... http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/poop/documents/poop-comparison.pod?rev=1.2content-type=text/vnd.viewcvs-markup One of the tools that is not mentioned in Dave's write-up (probably because it didn't exist then) is SPOPS, mentioned earlier in this thread. There is also a related mailing list at ... http://lists.sourceforge.net/lists/listinfo/poop-group -- 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: Object - RDBMS mapping tools and mod_perl
At 12:03 AM -0400 5/11/01, Chris Winters wrote: SPOPS is built to map objects to relational databases, or other data stores. If you're just getting/setting object properties and persistence (create/update/fetch/remove) along with relationships among the objects, you don't even need to write any Perl code. Just some fairly simple configuration info. Plus you can (if you wish) get per-object security for free. Using Dave Rolsky's OO-RDBMS vs RDBMS-OO sort of description of Tangram and Alzabo, it sounds like SPOPS is more in the same category as Tangram, correct? Anyone (including Chris) done a comparison of the two (SPOPS and Tangram) and willing to comment on strengths, weaknesses, differences, etc? Thanks, Ray
Object - RDBMS mapping tools and mod_perl
I'm looking for a good package to use for Object - RDBMS mapping in the context of mod_perl and Mason. Something that will handled object inheritance and nested objects, etc. I'm aware of Tangram, Alzabo and SPOPS (not sure all these do what I need) ... are there any others? Any particular reasons why any of these may not play with with mod_perl/Mason? Thanks, -- 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
[JOB] Web/Database Programmer/Analyst (US-NY-Ithaca)
The Applied Economics Management department at Cornell University invites applications for a Web/Database Programmer/Analyst for the Laboratory for Experimental Economics and Decision Research. To work in close partnership with team leadership to design implement a flexible web-based platform for simulating economic markets. Platform will be used for a national electric power market experiment, will serve as a foundation for many other economics experiments for research teaching. Requirements: Bachelors in computer science or equivalent experience. Must have experience in design implementation of large complex database-driven web applications. Must have 5 yrs experience in object-oriented Perl programming, SQL database programming web programming. Apache/mod_perl mysql experience desired. Experience w/embedded Perl technologies, Linux server administration, XML, Java, JavaScript open source software a plus. Full-time employee or on-site contractor options are possible. For more information on life in the beautiful Ithaca area or employment at Cornell University, please see the Cornell University Profile at http://chronicle.com/jobs/profiles/002711.htm. Contact Information: Ray Zimmerman Cornell University 428 Phillips Hall Ithaca NY 14853 Ph: (607) 255-9645
Re: HTML Mason 1.0 setup
At 11:03 AM -0800 3/1/01, Rob Bloodgood wrote: I've been using HTML::Mason under mod_perl on my site for awhile, using 0.89, and I like it lots. :-) So when the new 1.0 came out, I went to go upgrade, and broke EVERYTHING. Not only that, but, I haven't been able to make sense out of what Mason wants for its dir heirarchy, anyway: First, comp_root (apparently) needs to be the same as DocumentRoot, which seems horribly insecure... if I could find another way to do it, I would, but for now, knowing the path my components run under makes them viewable _AS SOURCE_ by anyone who knows the url. Well, the only reason a component should be visible as source is if Mason isn't working, right? So saying that it's horribly insecure is the same as saying that it's not working right? Here's what I use in my httpd.conf to get get Mason to handle all files with .md extensions (Mason documents). These are the top level components that return an entire page. The .mc files are other components which in the comp_root and thus available be called by other Mason components, but cannot be requested directly via a URL. This seems secure to me and it's been working just fine from 0.7 or so up through 1.0. AddType text/html .md FilesMatch ".*\.md$" SetHandler perl-script PerlHandler HTML::Mason Options Indexes FollowSymLinks ExecCGI /FilesMatch FilesMatch ".*\.mc$" Order allow,deny Deny from all /FilesMatch and in the same vein, the *ONLY* way I could get it to run was to put it's data_dir under DocumentRoot as well. Is it a file permissions problem? If you're running your webserver as user 'nobody', nobody has to have write access to the data_dir. You definitely don't want to have your data_dir under your DocumentRoot. Ray
[JOB] Perl web/database programmer needed
Within the next few weeks we expect to formally announce a position open immediately for an on-site web/database programmer (using mod_perl, mysql and probably Mason). We're located in the beautiful Fingerlakes region of upstate New York. Here's the description ... - Web/Database Programmer: To work in close partnership with the team lead to design and implement a flexible web-based platform for simulating economic markets. The platform will be used for a national electric power market experiment, and will serve as a foundation for many other economics experiments for research and teaching. Applicant must have experience in design and implementation of large complex database-driven web applications. Must have 5 years experience in object-oriented Perl programming, SQL database programming and web programming. Apache/mod_perl and mysql experience desired. Experience with embedded Perl technologies, Linux server administration, XML, Java, JavaScript and open source software are a plus. - ... e-mail me off-list if you are interested. -- 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: baffled by Directory vs. Location problem [SOLVED]
Thanks ... I finally figured out what it was ... the path I was using in Directory was not consistent with the one used in DocumentRoot because of the use of symlinks. I fixed that and things are working fine now. Ray
baffled by Directory vs. Location problem
I ran into a problem trying to get MysqlTool running under mod_perl using the instructions in the included README, so I've broken down my problem into a simple Hello World script (modified from the one in the Eagle book) that demonstrates the same problem. The problem I'm having is that I can get Location directives to pass control to a mod_perl handler OK, but if I try to switch it to a Directory, it stops working. I have an Apache::Hello.pm that just displays the values of the MOD_PERL and GATEWAY_INTERFACE env vars. I have a CGI script /hello/index.cgi that just calls Apache::Hello::handler. This CGI works fine ( $ENV{MOD_PERL} and $ENV{GATEWAY_INTERFACE} as expected for outside of mod_perl ). When I put the following in my httpd.conf ... Location /hello SetHandler perl-script PerlHandler Apache::Hello /Location ... and access the same URL, mod_perl handles it. But if I change the entry in httpd.conf to ... Directory /home/ray/www/hello SetHandler perl-script PerlHandler Apache::Hello /Directory ... it goes back to executing the CGI. I must be missing something obvious, right? Ray P.S. In case it matters, this is Perl 5.00503, Apache 1.3.17, mod_perl 1.25 running on Red Hat 6.2.
Re: problems with HTML::Embperl on macos x (darwin)
At 1:17 PM -0500 11/13/00, Ruben I Safir wrote: Is that the new Machintosh BSD OS? Yes. Darwin refers to the open source BSD layers, and Mac OS X refers to the whole thing including the new Aqua UI on top and the Classic compatibility environment for running previous Mac OS apps. Mac OS X is currently available from Apple (for $30) as a Public Beta. There is also a Mac OS X Server product which has been a shipping product for some time now, which is based on an earlier version of much of the same technology. A lot of this stuff is built on the old NextStep stuff. Personally, I'm hoping this will live up to the goal of a nice Mac UI on top of a real, honest-to-goodness Unix. Ray