Re: XML vs Perl (Re: separating C from V in MVC)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 13 June 2002 6:20 am, Rob Nagler wrote: Matt Sergeant writes: This assumes you need XML in the first place. No, it does not. The rest of my post spoke about XML as a data format and set of tools, not as a syntax. Please stop thinking about XML as syntax!! If my entire system is written in Perl, why do I need XML as a data format? Need is *not* what I said. But anyway, I already said: because of the tools. Perl has nothing that even comes close to SAX as a clean way of doing the unix-like thing of having small tools to do just one job when it comes to data munging. Perl's data structures are richer and have much more support in Perl than XML has in any language. Perl has been around much longer and is full-fledged programming language. It has better tools. It's got a larger community. We disagree on this. You seem to speak as someone who has never tried by the sounds of things. This is one of the things AxKit's XSP taglibs are designed to provide for. I've never used XSP. I have used XSLT, tried to use XSD, and am currently mired in DocBook/XML. One of my sites generates XML for its data export format. Let's take an XSP example from axkit.org: xsp:structure xsp:includeTime::Object/xsp:include /xsp:structure xsp:logic![CDATA[ sub mytime { my ($time) = _; $time ||= time; return Time::Object-new($time); } ]]/xsp:logic Why is the above better than below? (I cleaned up the perl :-) use Time::Object; sub mytime { my ($time) = _; return Time::Object-new($time || time); } Or, why can't I just call Time::Object-new where I need it? Erk. I knew the docs on AxKit.org were going to bite me in the ass one day. This is a really *bad* example of XSP usage. It's not separating content from presentation. Nowadays everything I do uses taglibs, which makes pages look like: wiki xmlns:wiki=http://axkit.org/NS/xsp/wiki/1; wiki:login/ wiki:display-page/ /wiki (yes, I'm writing an axkit wiki in case anyone's interested) Anyway, that's off topic, because the point was you were trying to argue (IIRC) why would you bother hand generating XML from your data just to get access to XML tools. But XSP's two taglib modules (look at the docs on search.cpan.org, rather than on axkit.org) do that conversion automatically for you. - -- :-get a SMart net/:- -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9CErhVBc71ct6OywRAn67AJ9E9o+MAnvkbXutEycFk+y7LAEVQwCfeUuI 95rN/7rb51T9wLJgY3EamL0= =c8HN -END PGP SIGNATURE-
RE: separating C from V in MVC
-Original Message- From: Perrin Harkins [mailto:[EMAIL PROTECTED]] Sent: 13 June 2002 03:43 To: Fran Fabrizio; [EMAIL PROTECTED] Subject: Re: separating C from V in MVC 2. Does the first part of my code above even remotely resemble a Controller? Sort of. It does choose a view and it does parse some user input, but a controller is more than just a dispatcher. It would include some of the code that you're currently putting into your doDoctorActivity() sub. The idea is that the model objects represent just the data in your application (the nouns) and the controller understands how to translate user input into a series of method calls on the model objects to carry out the user's request. It's hard to give a good example that is short, but let's say you were building an application to sell concert tickets. The act of buying the ticket might involve model objects representing a concert, a user, a form of payment, etc. The concert object knows how to reserve a specific seat (or call a seat object to do that). The payment object knows how to verify and charge a credit card. The user object has a mailing address. The controller knows how to turn the user's form data into a bunch of method calls on these objects that accomplish reserving the ticket and charging the user. If you find yourself writing a BuyTicket module, that's a controller not a model object. I disagree with this definition of a Controller. A Controller is primarily responsible for mapping user input onto a business Model, and should not know that buying a ticket requires creation of concert, payment, seat, client, theatre, agent, reservation, whatever objects. In the same way that the View keeps the output format independent of the Model properties, the Controller keeps the User Input method independent of business logic. This is the reason for having a Controller class. Consider that your mod_perl website Controllers will have to understand all about web requests, headers, error headers, cookies, sessions, redirects, URLs and URL decoding etc etc - these are things that relate directly to how the user is interacting with the Model. In the concert example, the Controller would interpret the web request, create a Ticket object, and call $Ticket-buy( %all_the_cleaned_up_params ). It would then pass this to the View to render. That's it. Consider the case where you wanted to buy hundreds or even thousands of tickets in a batch process - maybe you have agents that collect all the details for Kylie concerts, and then send them to you in a file. If you had made the mistake of creating a web Controller aka BuyTicket() module that understood it had to create concert, payment, seat, client, theatre, agent, reservation, whatever objects, you would have to duplicate all this logic AGAIN in the batch process Controller. You now have to maintain the business logic in two places. Always keep the _business_ behaviour in Models. The $Ticket-buy() processing must instantiate and create relationships to all the other objects it needs. Put all things that are specific to handling the User Interaction (eg web request) into your Controller. Business logic always goes into a Model. The idea is that the model objects represent just the data in your application (the nouns) and the controller understands how to translate user input into a series of method calls on the model objects to carry out the user's request. Models are not just collections of stateful data, they are the right place to encapsulate complex business behaviour. At the risk of repetition, all behaviour [e.g. $Ticket-buy()] that is not specific to the User Interface should go into Models. Controller and View are closely related elements of GUI. This is like the old 'Two Tier App' problem... when business logic and GUI become inexorably entwined, maintenance goes out the window. Have a look at this picture: http://www.ddj.com/documents/s=867/ddj0105i/0105if2.htm which comes from this article: http://www.ddj.com/documents/s=867/ddj0105i/0105i.htm Maybe in the future, we will get drag-and-drop via the web - interpreting this should go into the Controller. Maybe in the future you will change the business requirements for buying Tickets - this will go in a Model, and the effect will be felt consistently in both your web applications and your batch processing. Regards Jeff
Re: tutorials (was: Re: rfc Apache::Dynagzip)
On Wed, 12 Jun 2002, Slava Bizyayev wrote: Since now the draft tutorial Features of Content Compression for Different Web Clients (for Part IV: Client side facts and bugs) is available for preview and discussion at http://devl4.outlook.net/devdoc/Dynagzip/ContentCompressionClients.html . Here is first part of criticism. 1. You should not mix proxies and browsers. 2. As I said you MS Proxy has not mask at all. ^1\.1 is not a mask. ^Squid/ is incorrect mask. Here is example of Via header of HTTP/1.1 request that goes though Squid, MS Proxy and Oops: 1.1 proxy1.domain1.com:3128 (Squid/2.4.STABLE2), 1.0 PROXY2, proxy3.domain3.com:3128 (Oops 1.5.22f1) 3. Proxy masks will not help. About 70% of all proxied request are going through Squid and about 15% are going through MS Proxy. So much safe way is to disable proxy requests at all instead of tring to look mask. Besides I suspect that most proxies handle compressed content incorrectly. I had checked only Squid, MS Proxy and Oops but there are many another proxies. So I think you should disable gzip for all proxied request or enable it for all proxied request if you do not care about old broswer. mod_deflate by default disable it. 4. You should not unset Accept-Encoding. Better way is to set $r-note('disable_gzip'). 5. There are two unrelated mod_deflate. First is my mod_deflate for Apache 1.3: http://sysoev.ru/mod_deflate/ It'd been tested for one year on loaded sites. Second is expiremental module for Apache2 by Apache tream. Next part will be about browsers bugs. Igor Sysoev http://sysoev.ru
Re: tutorials (was: Re: rfc Apache::Dynagzip)
On Wed, 12 Jun 2002, Slava Bizyayev wrote: Since now the draft tutorial Features of Content Compression for Different Web Clients (for Part IV: Client side facts and bugs) is available for preview and discussion at http://devl4.outlook.net/devdoc/Dynagzip/ContentCompressionClients.html . About browsers. First we should not mention any browser that does not send 'Accept-Encoding'. So remove Opera 3.5 from list. Netscape 4.x All NN 4.x does not understand chunked content. And they should not. Chunked encoding is part of HTTP/1.1 and NN4.x support HTTP/1.0 only. It's server bug if server sends chunked response to HTTP/1.0 request. And your devl4.outlook.net has this bug (I suspect 1.3.24 mod_proxy). So remove this bug from list. Netscape 4.0-4.05 understand gzip and x-gzip. They did not send 'Accept-Encoding'. MSIE 4.x Code $r-header_in('Range') 0 or length($r-uri) 253 is wrong. 1. Range. We should send full (and probaly gzipped) response to MSIE 4.x if it asks byte-range and our response can be gzipped. We should disable byte-range but not gzipping. 2. $r-uri 253. Not only $r-uri but also $r-args, server name, port and user name and password. In short - all without 'http://' prefix. URI can be - http://name:password@host:port/uri?args. So in mod_deflate I simply check r-unparsed_uri 200 MSIE 6.0 I do not understand this: A: Unfortunately, IE6 (and perhaps earlier versions?) appears to have a bug with gzip over SSL where the first 2048 characters are not included in the HTML rendering of the page when refresh is pressed. It only seems to happen on longish pages, and not when the page is first loaded. In fact, sometimes it doesn't happen at all. The only current solution is to put a 2048 character comment at the start of your longish pages of all spaces (which compresses pretty well, fortunately). If bug with first 2048 characters are NOT included in HTML rendering then why to put 2048 character comment ? Comments do not included in rendering. FlashPlayer 4.x-5.x Plug-in. Fails to decompress data received from the browser. flash recieves all data from browser. But it can play gzipped swf because all browsers (except NN 4.x for Windows) uncompressed them. All flash players can not handle gzipped data received via loadVariables() and XML.Load() (5.x). You had mentioned Galeon and SkipStone but had not mentioned Mozilla 0.9.1 and Netscape6.1b1 that have bug. Yes, this browsers already old and rare but Galeon and Skipstone now include own version string. It's much simply to translate from Russian my information than to try to interpret it. Igor Sysoev http://sysoev.ru
Re: Idiot question: headers at the base of the page.
umm... If you send them twice. Aside from happening by doing $r-send_http_header twice (it's happened), it could be something else is automatically sending header s for you... Just an idea... Issac - Original Message - From: Rafiq Ismail (ADMIN) [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 13, 2002 12:19 AM Subject: Idiot question: headers at the base of the page. I'm doing squinty eyed coding and need someone to knock common sense into me. In the right order - as far as I can see - I have my content_type ;send_http_headers; $r-print'ed. With loads of poo in between. Under what circumstances would my page render, dumping the HTTP headers at the base? Other than their being sequentially out of order, that is. It's probably one of those look at it again in the morning questions. Someone hit me over the head with a hammer please.
Re: Idiot question: headers at the base of the page.
Hi all, On Thu, 13 Jun 2002, Issac Goldstand wrote: - Original Message - From: Rafiq Ismail (ADMIN) [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 13, 2002 12:19 AM Under what circumstances would my page render, dumping the HTTP headers at the base? Other than their being sequentially out of order, that is. umm... If you send them twice. Aside from happening by doing $r-send_http_header twice (it's happened), it could be something else is automatically sending header s for you... Or there might be some funny buffering going on that you don't know about. (Or this might be happening as well as incorrectly sending things twice:). 73, Ged.
RE: separating C from V in MVC
Ok so Collections was the missing piece in my puzzle. Very interesting (and intuitive now that you present it to me). Controller: --- my $Stale = Model::WatchCollection-new( status = 'stale' ); Controller: --- my $WC= Model::WatchCollection-new(); Out of these two, I would think that the first one is actually better. What if you have 300,000 watches and only 25 are stale, for example (numbers that are not all that far from the truth, in my case)? That'd be a lot of data I'd be slinging around in the 2nd example. Which is probably what you meant by might be better. :-) Thanks for the example code, it was very enlightening! I'll digest further at the office this morning. -Fran
mod_perl2 and ASP
Hi NG, Does someone have a HowTow for mod_perl2 with Apache2 (Win32) and ASP? If possible ask in the detail. Thanks for your assistance. Stefan
header woes
Hi Why do I have have so much trouble doing some header parsing? I am doing header parsing because I wanted to check out cookie behaviour on relocation/redirection by browser. I get stuck when I cannot get with the basic stuff. Clues appreciated.. I tried to go back to basics with a small script but that also seems to refuse to work as I would expect. package Alfass::Reloc; use strict; use Apache::Constants; use Apache::Reload; use CGI qw(:standard :html3 :netscape); use Apache::Table; sub handler { my $r = shift; my $reason = $r-subprocess_env(AuthCookieReason); my $cookie = $r-header_in('Cookie'); my $table = $r-headers_in; my $bla =sdadsadadadasdadadadadad; my $type = $table-{'Content-type'}; print header,start_html, h2($bla), h2($type), end_html; } 1; __END__ Arnold van Kampen
Re: separating C from V in MVC
I just wanted to comment on Number 3, here. Scroll down ;-) kyle dawkins wrote: Fran (et al) I've stayed out of the MVC chitchat for a long time (very interesting thread) because it's such a deep topic. But seeing as how Fran has some concrete questions... 3. How do you prevent a Controller from just becoming another big if statement, or is this their purpose in life? See Jeff's previous mail. Your structure is crying out for a dispatch table; Jeff suggests building this out of a hash that defines what actions to perform based on what your query values are. That's a great place to start. GET RID OF YOUR BIG IF STATEMENT ASAP. If I read this right, then it's something I am already doing and I'll throw it in here to show: ## My idea of a dispatch table! my %actions = ( 'view' = 'FES::Control::View', 'logout' = 'FES::Control::Logout', 'edit' = 'FES::Control::Edit', 'notes'= 'FES::Control::Notes', 'save' = 'FES::Control::Save', 'calendar' = 'FES::Util::Calendar', ); sub handler { my $r = Apache::Request-new(shift); ## BEGIN ignore (DECLINE) image requests and allow regular apache to handle them. return DECLINED if $r-content_type =~ /image/; ## END ignore image requests my $act = $r-param('act') || 'view'; if (my $h = $actions{$act}) { $r-push_handlers(PerlHandler = $h); $r-handler('perl-script'); return DECLINED; } else { my $stmt = There is no such action as \' . $act . \'\n; $r-pnotes('error', $stmt); $r-push_handlers(PerlHandler = 'FES::Error::Error'); $r-handler('perl-script'); return DONE; } ## end else [ if (my $h = $actions{$act... } 1; That's how I impliment at least _part_ of my controller without resorting to huge IF statements. Is this what was meant guys? --Jon R. If this is overly simplistic, or not what you meant, feel free to smack me around.
Re: Idiot question: headers at the base of the page.
Don't recall offhand, but I know there is an http.conf momd_perl config command that will set 'auto-header' for you. Perhaps that is already on? --Jon Robison Issac Goldstand wrote: umm... If you send them twice. Aside from happening by doing $r-send_http_header twice (it's happened), it could be something else is automatically sending header s for you... Just an idea... Issac - Original Message - From: Rafiq Ismail (ADMIN) [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 13, 2002 12:19 AM Subject: Idiot question: headers at the base of the page. I'm doing squinty eyed coding and need someone to knock common sense into me. In the right order - as far as I can see - I have my content_type ;send_http_headers; $r-print'ed. With loads of poo in between. Under what circumstances would my page render, dumping the HTTP headers at the base? Other than their being sequentially out of order, that is. It's probably one of those look at it again in the morning questions. Someone hit me over the head with a hammer please.
Re: header woes
Sorry, forgot the error message: Use of uninitialized value in join or string at (eval 9) line 16. [ = my $type = $table-{'Content-type'}; ] On Thu, 13 Jun 2002, Arnold van Kampen wrote: Hi Why do I have have so much trouble doing some header parsing? I am doing header parsing because I wanted to check out cookie behaviour on relocation/redirection by browser. I get stuck when I cannot get with the basic stuff. Clues appreciated.. I tried to go back to basics with a small script but that also seems to refuse to work as I would expect. package Alfass::Reloc; use strict; use Apache::Constants; use Apache::Reload; use CGI qw(:standard :html3 :netscape); use Apache::Table; sub handler { my $r = shift; my $reason = $r-subprocess_env(AuthCookieReason); my $cookie = $r-header_in('Cookie'); my $table = $r-headers_in; my $bla =sdadsadadadasdadadadadad; my $type = $table-{'Content-type'}; print header,start_html, h2($bla), h2($type), end_html; } 1; __END__ Arnold van Kampen
Sending Mail
Can anyone give me recommendations on a good Mail handler that integrates well with mod_perl? I have a system whereby I want to give people the ability to mail the currently viewed page to someone. Once they select a To: address, the system will look up some data, re-construct the viewed page in a textual format, and send the mail. I'm just looking for recommendations on a good perl mailing module for this kind of use. --Jon Robison
Re: header woes
At 16:04 13.06.2002, Arnold van Kampen wrote: forgot the error message: Use of uninitialized value in join or string at (eval 9) line 16. [ = my $type = $table-{'Content-type'}; ] Maybe because there is no Content-Type sent with a request unless it's a POST request? Content-Type is usually in the *outgoing* headers... -- Per Einar Ellefsen [EMAIL PROTECTED]
RE: Sending Mail
We use MIME::Lite seems to work well for us. -Original Message- From: Jon Robison [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 8:57 AM To: [EMAIL PROTECTED] Subject: Sending Mail Can anyone give me recommendations on a good Mail handler that integrates well with mod_perl? I have a system whereby I want to give people the ability to mail the currently viewed page to someone. Once they select a To: address, the system will look up some data, re-construct the viewed page in a textual format, and send the mail. I'm just looking for recommendations on a good perl mailing module for this kind of use. --Jon Robison
Re: Mapping to location /
--- Per Einar Ellefsen [EMAIL PROTECTED] wrote: At 23:06 12.06.2002, md wrote: I'm not quite sure about this, been wondering about it, but in theory you should be able to use DirectoryIndex index.phtml and like that you won't have to worry about / etc anymore. Try it out.. And so I did...it won't work since mod_dir (as far as I can tell) looks for a physical file, and my index.phtml is virtual. What I'm really trying to do is more like the PHP I'm replacing. I should be able to go to: www.someserver.com/index.phtml for a dynamic page and www.someserver.com/index.html for a static page. I'm guessing that my best solution would be to use HTML::Mason or Apache::ASP instead of Template-Toolkit. However, I can' really do that...it took me a while to get the designers to use TT, and I doubt I can get them to change again. I may try using the PerlTransHandler to change the uri to a location...say with www.someserver.com/index.phtml the uri gets changed to /modperl (or www.someserver.com/somedir/index.phtml the uri becomes /modperl/somedir) which is used in a Location /modperl directive. __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
Re: Sending Mail
Can MIME::Lite do attachments? --Jon Joe Breeden wrote: We use MIME::Lite seems to work well for us. -Original Message- From: Jon Robison [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 8:57 AM To: [EMAIL PROTECTED] Subject: Sending Mail Can anyone give me recommendations on a good Mail handler that integrates well with mod_perl? I have a system whereby I want to give people the ability to mail the currently viewed page to someone. Once they select a To: address, the system will look up some data, re-construct the viewed page in a textual format, and send the mail. I'm just looking for recommendations on a good perl mailing module for this kind of use. --Jon Robison
Re: separating C from V in MVC
Fran Out of these two, I would think that the first one is actually better. What if you have 300,000 watches and only 25 are stale, for example (numbers that are not all that far from the truth, in my case)? That'd be a lot of data I'd be slinging around in the 2nd example. Which is probably what you meant by might be better. :-) Jeff's example was very abbreviated to make a point. In your case, you should think about two things: 1) the representation of your data 2) the fetching of your data Since you could have a zillion watches, you could use something like my $staleWatches = WatchManager::watchesWithStatus(stale); This allows you to implement the watchesWithStatus method any way you choose, and simply returning an arrayref of matching watches. Then you can pass that arrayref to your View, which, as Jeff says, should apply some transform to your data to produce your report.I realise this is essentially what Jeff is saying but the key point is that you don't need to have all 300,000 watches in memory... you can abstract the data using a Manager (or Broker, or... ) so you hide the data store. Cheers Kyle Dawkins Central Park Software
Re: Sending Mail
Jon Robison wrote: Can MIME::Lite do attachments? yes. there is an example in the cookbook that uses MIME::Lite: http://www.modperlcookbook.org/code/ch15/Cookbook/Mail.pm http://www.modperlcookbook.org/code/ch15/Cookbook/EmailUploads.pm HTH --Geoff
RE: separating C from V in MVC
-Original Message- From: Fran Fabrizio [mailto:[EMAIL PROTECTED]] Sent: 13 June 2002 13:23 To: Jeff AA Cc: [EMAIL PROTECTED] Subject: RE: separating C from V in MVC Controller: --- my $Stale = Model::WatchCollection-new( status = 'stale' ); Controller: --- my $WC= Model::WatchCollection-new(); Out of these two, I would think that the first one is actually better. What if you have 300,000 watches and only 25 are stale, for example (numbers that are not all that far from the truth, in my Don't make the mistake of fetching all the data when a Collection is instantiated. It is usually better to make the Collection only really fetch data when a View actually asks for it by calling $WC-fetch( status = 'stale' ), after all, sometimes you might go down another route and the View might never call fetch() - for example if there is an exception and you decide not to bother showing stale Watches. Also, you should generally not fetch everything from the database unless there is a very good reason to do so. Try to keep your memory usage to a minimum, and restrict the result set to something useful. I recall a system that used to pop up a dialog saying 'Warning: This will return 645,345 rows' and the only user option was 'Ok'! I have seen about 4.2 million Collection designs, and my current favourite is an abstraction of the Borland Data Engine DB/Table/Dataset design (BDE) in conjunction with some of the Java collection concepts. Common Collection niceties include things like 'find me Watch ABC' in the Collection. A Collection can have the concept of a 'current' thing so that a View can display both the list of Watches in a table, and more detailed attributes of the 'currently selected' Watch object etc. If you are going to support paginated collections, you should build this into your base Collection class. So far we have been talking about flat Collections, don't forget that some of them are not flat, but hierarchical - e.g. tree-like, and some are circular e.g. no beginning and no end, etc. ciao Jeff
Re: Sending Mail
Jon Robison wrote: Can MIME::Lite do attachments? yes, it can. install it, then read perldoc MIME::Lite for info on how.
Re: Mapping to location /
At 16:04 13.06.2002, md wrote: --- Per Einar Ellefsen [EMAIL PROTECTED] wrote: At 23:06 12.06.2002, md wrote: I'm not quite sure about this, been wondering about it, but in theory you should be able to use DirectoryIndex index.phtml and like that you won't have to worry about / etc anymore. Try it out.. And so I did...it won't work since mod_dir (as far as I can tell) looks for a physical file, and my index.phtml is virtual. Ok, too bad. What I'm really trying to do is more like the PHP I'm replacing. I should be able to go to: www.someserver.com/index.phtml for a dynamic page and www.someserver.com/index.html for a static page. Does PHP do that? I'm guessing that my best solution would be to use HTML::Mason or Apache::ASP instead of Template-Toolkit. However, I can' really do that...it took me a while to get the designers to use TT, and I doubt I can get them to change again. Using HTML::Mason or Apache::ASP won't solve anything special. It's still the same basic thing. I may try using the PerlTransHandler to change the uri to a location...say with www.someserver.com/index.phtml the uri gets changed to /modperl (or www.someserver.com/somedir/index.phtml the uri becomes /modperl/somedir) which is used in a Location /modperl directive. Let's assess your situation a litte: why can't you just put your TT templates into your document root, and do like with your PHP pages? That would solve the current problem you seem to be facing. Furthermore, have you looked into the Apache::Template module? I think it's pretty close to what you want. -- Per Einar Ellefsen [EMAIL PROTECTED]
RE: mod_perl/passing session information (MVC related, maybe...)
I am not sure if I follow completely. How do you verify that user who the user says he/she is? I log into your web-site as memberA. You kindly leave me a delicious cookie with my username stored in it. Maybe even my password (I hope not!). Now, I know that another member, memberB, has special rights to your site. What is stopping me from editting the cookie to memberB's username and hijacking their account? And if you do store the password information in the cookie...you are letting each user be compromised either as the cookie is flung through the Internet ether, or minimally on their own computer where someone else can easily access the cookies. With sessionID, you have an ID and information that is checksum'd. We keep that sessionID in a DB once a user has successfully logged in. Whenever I check the sessionID I know they have already logged in -- on top of that, there is no really useful information in the cookie that might compromise security. (Plus, the checksum ensures that one is tampering with the cookie.) But you do keep username, userlevel information within the session information stored on your local DB -- where is reasonably safe from prying eyes. If I wanted to delete a user and ensure they immediately lost all access, it is rather trivial to go through all active sessions in the db, see if the user I am deleting matches the username in the session information, and if so delete the session record. : : * User logs in. : * Site Admin decides to delete the user. : * In our stateless servers, the user_id is invalidated : immediately. : * Next request from User, he's implicitly logged out, : because the user_id :is verified on every request. : : In the case of a session-based server, you have to delete : the user and : invalidate any sessions which the user owns. :
mod_perl-based registration programs?
Before I start rewriting... Anyone know of a mod_perl based program for registering people for events? The existing system allows people to sign up and cancel for classes and workshops that are offered at various locations and also for on-line classes. We have a collection of training workshops that are each offered a number of times a year, and are taught by a pool of instructors. Typically a few classes a week. It mails reminders a few days before the classes, sends class lists to the assigned instructor before their class, and normal database stuff for displaying, searching and reporting. Currently, billing is by invoice, but we would like an on-line payment option. Anyone know of something similar? Thanks, Bill Moseley mailto:[EMAIL PROTECTED]
Re: mod_perl2 and ASP
On Thu, 13 Jun 2002, Stefan Sabolowitsch wrote: Does someone have a HowTow for mod_perl2 with Apache2 (Win32) and ASP? If possible ask in the detail. As modperl-2 is still in the development stage, using this may not be straightforward - see http://perl.apache.org/release/docs/ for docs, including some Win32 specific stuff. Installing Apache::ASP can be done through ppm: C:\ ppm ppm set rep theoryx5 http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer ppm install Apache-ASP ppm set save which should install Apache::ASP and its dependencies. Details on configuration and use can be then found in the installed docs and at http://www.apache-asp.org/. See especially the asp mailing list archives (http://www.apache-asp.org/support.html) for discussion on using this with modperl2. If you're just looking at learning Apache::ASP and don't care if it's with Apache2/modperl2 or Apache1/modperl1, then it'd probably be easier to start with the latter. best regards, randy kobes
RE: mod_perl/passing session information (MVC related, maybe...)
At 07:32 AM 6/13/02 -0700, Vuillemot, Ward W wrote: I log into your web-site as memberA. You kindly leave me a delicious cookie with my username stored in it. Maybe even my password (I hope not!). Now, I know that another member, memberB, has special rights to your site. What is stopping me from editting the cookie to memberB's username and hijacking their account? snip (Plus, the checksum ensures that one is tampering with the cookie.) You touched this subject in the next paragraph. You should always include a hash or checksum as part of your cookie value. And then validate this info on each request. This prevents the situation you described where you just change the cookie. Even if the cookie value is just a session id, it is nice to have the hash to make sure they just don't go changing their cookie, but not necessary if your session IDs are random. Drew == Drew Taylor | Freelance web development using http://www.drewtaylor.com/ | perl/mod_perl/MySQL/postgresql/DBI mailto:[EMAIL PROTECTED] | Email jobs at drewtaylor.com -- Speakeasy.net: A DSL provider with a clue. Sign up today. http://www.speakeasy.net/refer/29655 ==
RE: mod_perl/passing session information (MVC related, maybe...)
Vuillemot, Ward W writes: I log into your web-site as memberA. You kindly leave me a delicious cookie with my username stored in it. Maybe even my password (I hope not!). Now, I know that another member, memberB, has special rights to your site. What is stopping me from editting the cookie to memberB's username and hijacking their account? If you can crack Blowfish, IDEA, etc., you are in. Then again you can probably just sniff the network for memberB's username and everybody else's passwords for that matter, even via SSL. Part of bOP is multi-tiered security architecture including something I call data gateways to help protect against programmer mistakes. And if you do store the password information in the cookie...you are letting each user be compromised either as the cookie is flung through the Internet ether, or minimally on their own computer where someone else can easily access the cookies. If you have access to someone's cookie file, you probably can log their keystrokes. Contact your local spy agency for more information on how to do this. With sessionID, you have an ID and information that is checksum'd. Sessions and user IDs are equivalent. They are called credentials which allow access to a system. There's no fundamental difference between hijacking a session or stealing a user id/password. If I wanted to delete a user and ensure they immediately lost all access, it is rather trivial to go through all active sessions in the db, see if the user I am deleting matches the username in the session information, and if so delete the session record. Denormalization is the root of all evil. The extra step involves more code, more bugs, and more system resources. Other than that, you're right. You can do this, but the question I ask: Do you need to? Rob
Re: Mapping to location /
md wrote: What I'm really trying to do is more like the PHP I'm replacing. I should be able to go to: www.someserver.com/index.phtml for a dynamic page and www.someserver.com/index.html for a static page. I'm guessing that my best solution would be to use HTML::Mason or Apache::ASP instead of Template-Toolkit. Why? Just because you don't have literal files for those URLs with TT and with Mason or ASP you would? I don't really see the problem. You can map all the URLs that end with a certain extension to one module that does some work and then calls a template. You can map individual URLs or sets of URLs to separate modules that do different processing and call a template. You could even put the actual files there and use Apache::Template to serve them. Apache::Template has a hook to add your processing code before the template gets run, and you can have multiple handlers that do different processing in different locations. I may try using the PerlTransHandler to change the uri to a location...say with www.someserver.com/index.phtml the uri gets changed to /modperl (or www.someserver.com/somedir/index.phtml the uri becomes /modperl/somedir) which is used in a Location /modperl directive. What does that get you? I don't see why you would want to do that. - Perrin
Re: mod_perl/passing session information (MVC related, maybe...)
On 6/13/02 11:04 AM, Rob Nagler wrote: With sessionID, you have an ID and information that is checksum'd. Sessions and user IDs are equivalent. They are called credentials which allow access to a system. There's no fundamental difference between hijacking a session or stealing a user id/password. Well, given a user/pass, you can login form anywhere. Given a session that's tied to information like the remote IP, user agent, date, etc. etc., it's a lot harder to reuse that information to login from elsewhere. -John
Re: Mapping to location /
--- Per Einar Ellefsen [EMAIL PROTECTED] wrote: At 16:04 13.06.2002, md wrote: What I'm really trying to do is more like the PHP I'm replacing. I should be able to go to: www.someserver.com/index.phtml for a dynamic page and www.someserver.com/index.html for a static page. Does PHP do that? Yes...since both index.html and index.php are physical files. Using HTML::Mason or Apache::ASP won't solve anything special. It's still the same basic thing. Except that there will by a physical file with embedded code like PHP, so I think Mason and Apache::ASP would be closer to what I want. However, I don't have that option. I'd really like to use a Location, but the request is to keep existing directory structures (over 200 top-level directories) and the main index page needs to be dynamic as well. Let's assess your situation a litte: why can't you just put your TT templates into your document root, and do like with your PHP pages? That would solve the current problem you seem to be facing. Because the templates need to be processed by a mod_perl script and I need to map that somehow. Furthermore, have you looked into the Apache::Template module? I think it's pretty close to what you want. I haven't looked at it, but I believe it's just a wrapper to Template-Toolkit. Thanks for the suggestions :) __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
Re: Sending Mail
I'm using Mail::Sender which can send attachments. Not sure how it compares to Mime::Lite. -doug On Thu, 13 Jun 2002, Jon Robison wrote: Can anyone give me recommendations on a good Mail handler that integrates well with mod_perl? I have a system whereby I want to give people the ability to mail the currently viewed page to someone. Once they select a To: address, the system will look up some data, re-construct the viewed page in a textual format, and send the mail. I'm just looking for recommendations on a good perl mailing module for this kind of use. --Jon Robison -- ~~ Doug Silver 619 235-2665 Network Manager Urchin Software Corp. http://www.urchin.com ~~
Re: PerlSetVar WhatEverSecure
Brian Reichert wrote: Location /formscript/login PerlSetVar FormScriptSecure 1 AuthType Apache::AuthTicket ... /Location But, in each case, my login program is server in the clear. What am I missing? THe authnameSecure setting only affects the cookie. If you want to forbid access to the login form from non-ssl, there are verious ways to do that. One way would be to add SSLRequireSSL that block (assuming your using mod_ssl). Regards, Mike
Re: separating C from V in MVC
Fran Fabrizio wrote: Now, how do you represent in the model a complex query that joins across 5 of the nouns? Others have already commented on this, but I want to point out that this is a general OO modelling question, not an MVC one, and there are many resources available to help you learn this stuff. I'd suggest getting to your local computer book store and browsing through some OO programming titles. In your concert example, if I wanted to define a report that showed me all of the seats that were purchased by people from New Jersey with a Mastercard in the last week, how would I represent that? That's a tricky one, because it doesn't make much sense to put all that logic about finding users' home states and payment types into a Concert class. You could manipulate the objects to accomplish this: my wanted_seats; my seats = Model::Concert-findSeatsReservedAfter($date); foreach my $seat (seats) { if ($seat-person()-address()-state() = 'NJ') { push wanted_seats, $seat; } } As you can see it gets messy fast, and I didn't even cover the Mastercard part. It would probably have terruble performance too. This is why people usually just write this kind of report as a big SQL query instead. You can make a model object called ConcertSeatSearch: seats = Model::ConcertSeatSearch-findSeats( reserved_after = $date, payment_type = $card, user_state = $state, ); Just be careful that you don't end up making this into something that mirrors the SQL exactly. There might be 4 tables involved in finding out what kind of credit card the user had, but that gets hidden behind this API. If you find yourself writing classes that take options like where = 'date ' . $date you are reinventing SQL, and you've lost your abstraction. - Perrin
Re: Sending Mail
Geesh, it's nice having the books author(s) on the mailing list here! --Jon R. Geoffrey Young wrote: Jon Robison wrote: Can MIME::Lite do attachments? yes. there is an example in the cookbook that uses MIME::Lite: http://www.modperlcookbook.org/code/ch15/Cookbook/Mail.pm http://www.modperlcookbook.org/code/ch15/Cookbook/EmailUploads.pm HTH --Geoff
Re: header woes
* Arnold van Kampen [EMAIL PROTECTED] [2002-06-13 09:34]: Why do I have have so much trouble doing some header parsing? I am doing header parsing because I wanted to check out cookie behaviour on relocation/redirection by browser. I get stuck when I cannot get with the basic stuff. Clues appreciated.. Why not use Apache::Cookie, or even CGI's cookie() function, to parse cookies? use strict; use Apache::Constants; use Apache::Reload; use CGI qw(:standard :html3 :netscape); use Apache::Table; sub handler { my $r = shift; my $reason = $r-subprocess_env(AuthCookieReason); my $cookie = $r-header_in('Cookie'); my $table = $r-headers_in; my $bla =sdadsadadadasdadadadadad; my $type = $table-{'Content-type'}; print header,start_html, h2($bla), h2($type), end_html; } You can iterate over the keys of %$table, to see what's being set. Change your print statement to something like: print header,start_html, h2($bla), h2($type), ul(map(li($_, = , $table-{$_}), keys %{$table})), end_html; To get a list of the keys in $r-headers_in; Also, you forgot to return OK. (darren) -- Responsible behavior is the result of a socialization process.
Re: PerlTransHandler problem
* Rasoul Hajikhani [EMAIL PROTECTED] [2002-06-12 19:12]: Hello folks, I am trying to implement a simple PerlTransHandler to change: http://myserver/ to http://myserver.rhythm.com/ And here is my code: [-- snip --] Have you seen http://httpd.apache.org/docs/misc/rewriteguide.html? The first section is about URL layout, and the first example is about canonicalizing URLs. (darren) -- It has long been an axiom of mine that the little things are infinitely the most important. -- Arthur Conan Coyle
Re: separating C from V in MVC
On 6/13/02 1:29 PM, Perrin Harkins wrote: Just be careful that you don't end up making this into something that mirrors the SQL exactly. There might be 4 tables involved in finding out what kind of credit card the user had, but that gets hidden behind this API. If you find yourself writing classes that take options like where = 'date ' . $date you are reinventing SQL, and you've lost your abstraction. Stringy stuff like that is certainly a poor abstraction (or no abstraction at all if it's stuck directly into the SQL!) But I've done stuff like this: Pets-get_pets(type = [ 'dog', 'cat' ], age = { and = { gt = 5, lt = 10 } }, name = { match = 'Fi.*' }); which is powerful enough to do most types of basic selects, but still abstract enough that the user of this class never actually types SQL fragments directly. Of course, the case above is a rarity. Usually, it'll be used in the simple form like: Pets-get_pets(type = 'dog', age = 5); But just having that more complex form in there for the one or two times you need it is sometimes valuable, IMO. And the overhead is minimal if you have a nice base class that supports all this stuff for you. -John
Setting Cookies
Hello folks, Yesterday I posted a question about PerlTransHandler and received a lot of responses. Thanks to all of you who replied. However, my problem persists. I try to be more precise in explaining the problem today. My login module sets a few cookies that expire 24 hrs after they are set. Upon each request the validity of the cookies is checked, and in case of an expired cookie, the user is redirected to the login page to resubmit username/password again. A request with a fully qualified URL, example: http://myserver.mydomain.com/someLocation, has no problem continuing. The cookies are set. However, in case the URL has the .domain.com stripped, the login page is regenerated indefinitely. The cookies never get set. There were a few suggestions, such as using mod_rewrite, however that is out of the question because mod_rewrite was not built with our http server. My PerlTransHandler does not seem to be able to distinguish myserver.domain.com/someLocation request with myserver/someLocation. I appreciate any suggestions on this. -r
Re: Fooey. Can't compile mod_perl.
southernstar wrote: Hi, I can't compile mod_perl 1.27 on Cygwin with apache 1.3.24-5 src no matter what I do. At first it complained (make complained) that it didn't know how to make httpd.h etc, so I made them dummy targets with .PHONEY. OK, fine. Then it couldn't find them in apache_inc.h - so I put the path in for it. Now in os.h (from apache) it can't find ap_config.h, whatever that is. Has mod_perl EVER compiled on Cygwin? If so, how do I get it to build? (I have the latest net release of cygwin, everything installed). I tried it a couple of weeks ago, and ran into some problems too. I'm pretty sure it was a different issue though. At the moment I'm reinstalling Cygwin, since I've rebuilt my development system since then. At the moment, I've installed ActivePerl-5.6.1.631, apache_1.3.25-win32-x86-src.msi from apache.org, and mod_perl 1.x using the instructions at http://theoryx5.uwinnipeg.ca/win32_apache2.html. Works fine for me... except the apache service doesn't start. I haven't had a chance to look into that yet though. Wim
Help with apache::sandwich
I have the following added to my httpd.conf file: # (Apache::Sandwich)# Add directory custom "header"Location /web/httpd/htdocs/elterry SetHandler perl-script PerlHandler Apache::Sandwich PerlSetVar HEADER "/my_header.html"/Location Here are my "html" files: my_header.html: htmlheadtitleSystem Wide/title/headbodyp /I am the header. Index.html: hrp /This is just a thought.p /But something should be above me./body/html The header doesn't show up when I go to the index page. What's up? Eric
Re: Mapping to location /
--- Perrin Harkins [EMAIL PROTECTED] wrote: I don't really see the problem. You can map all the URLs that end with a certain extension to one module that does some work and then calls a template. OK...the little light bulb has just come on... I didn't realize that I could put my templates directly in htdocs. Now I can create a template and call it index.phtml and set DirectoryIndex to include index.phtml and all works like I want. Thanks! __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
Re: mod_perl/passing session information (MVC related, maybe...)
Rob Nagler wrote: A session is useful for very limited things, like remembering if this user is logged in and linking him to a user_id. We store this information in the cookie. I don't see how it could be otherwise. It's the browser that maintains the login state. My preferred design for this is to set one cookie that lasts forever and serves as a browser ID. If that user logs in, you can associate a user ID with that browser ID, on the server side. You never need to send another cookie after the very first time someone hits your site. If you decide to attach new kinds of state information to the browser, you still don't need to send a new cookie. Many sites need to keep track of state information (like what's in your shopping cart) for anonymous users who haven't logged in. Having this unique browser ID (or session ID, if you prefer to give out a new one each time someone comes to the site) lets you track this for unregistered users. Consider the following scenario: * User logs in. * Site Admin decides to delete the user. * In our stateless servers, the user_id is invalidated immediately. * Next request from User, he's implicitly logged out, because the user_id is verified on every request. In the case of a session-based server, you have to delete the user and invalidate any sessions which the user owns. I don't see that as a big deal. You'd have to delete lots of other data associated with a user too. Actually deleting a user is something I've never seen happen anywhere. Although Oracle can be fast, some data models and application requirements make it hard to do live queries every time and still have decent performance. This is especially true as traffic starts to climb. I've tried to put numbers on some of this. I've never worked on a 1M/day site, so I don't know if this is the point where you need sessions. What sites other than etoys needs this type of session caching? Well, eToys handled more than 2.5 million pages per hour, but caching can be important for much smaller sites in some situations. It's not session caching necessarilly, although we did cache session data in a local write-through cache on each server. We knew that the database would probably be the bottleneck in scaling our application, and it was. We took pains to take as much work as possible off the database, so that it could spend its resources on handling things that can't be cached, like user submitted data and orders. Here's a situation where a small site could need caching: suppose you have a typical hierarchical catalog site, with a tree of categories that contain products. Now suppose that the requirements for the site make it necessary to do a pretty hairy query to get the list of products in a category, because you have some sort of indirect association based on product attributes or something and you have to account for start and end dates on every product and various availability statuses, etc. Categories should only be shown if they have products in them or if their child categories have products in them. Keep piling on business rules. Then the UI design calls for the front page to have a Yahoo-style display showing multiple levels of the category hierarchy, maybe 70 categories or so. Sure, you get your DBAs to tune the SQL and to put all the indexes in place, and it gets the results for a single category pretty fast, in .08 seconds, but you have 70 of them! When you throw multiple users in the mix, all executing these queries every time they hit the homepage, your database server will burn a hole through the floor. Or you can take advantage of your domain knowledge, that the data used in generating this page only changes every 6 hours or so, and just cache the page, or part of the page, or the data, for an hour. Maybe I just have bad luck, but I always seem to end up at companies where they give me requirements like these. And then they say to make it really fast and handle a billion users. They are happy to trade slightly stale data for very good performance, and part of the requirements gathering process involves finding out how often various kinds of data change and how much it matters if they are out of date. (For example, inventory data for products changes often and needs to be much more current than, say, user comments on that product.) - Perrin - Perrin
Re: Help with apache::sandwich
Éric, Try: Directory /web/httpd/htdocs/elterry ... snip ... /Directory instead. Location is used for URIs, not directories. An alternative would be: Location /elterry ... snip ... /Location if DocumentRoot is set to /web/httpd/htdocs for Apache. Paul Eric Terry écrivit: I have the following added to my httpd.conf file: # (Apache::Sandwich) # Add directory custom header Location /web/httpd/htdocs/elterry SetHandlerperl-script PerlHandler Apache::Sandwich PerlSetVar HEADER /my_header.html /Location Here are my html files: my_header.html: html head titleSystem Wide/title /head body p /I am the header. Index.html: hr p /This is just a thought. p /But something should be above me. /body /html The header doesn't show up when I go to the index page. What's up? Eric Paul de Repentigny Directeur Développement Logiciel / Director Software Development Graph Architecture Inc. C/C++/Perl/mod_perl/Linux/PHP/MySQL/Lingo/BasicScript/WUP/Etc. tel: (418) 659-5611 email: [EMAIL PROTECTED] web: http://www.grapharchitecture.com/ If you're not part of the solution, start another problem!
Re: PerlSetVar WhatEverSecure
On Thu, Jun 13, 2002 at 10:40:18AM -0500, Michael Schout wrote: Brian Reichert wrote: Location /formscript/login PerlSetVar FormScriptSecure 1 AuthType Apache::AuthTicket ... /Location But, in each case, my login program is server in the clear. What am I missing? THe authnameSecure setting only affects the cookie. If you want to forbid access to the login form from non-ssl, there are verious ways to do that. One way would be to add SSLRequireSSL that block (assuming your using mod_ssl). Apache::AuthTicket says: Finally, by using the Secure mode of Apache::AuthCookie, the ticket is not passed over unencrypted connections. Passed in what direction? It would only go server-client if the client made a SSL request. With the 'FormScriptSecure' as I have it above, I _can_ log in over a non-encrypted channel, so clearly it's not enforcing the 'secure' criteria... (Still reading up on cookies...) I suppose my real question is: How can I intercept a unencrypted request for a protected document, but have the login form be submitted over an encrypted channel? (Thanks for the feedback, by the way...) Regards, Mike -- Brian 'you Bastard' Reichert[EMAIL PROTECTED] 37 Crystal Ave. #303Daytime number: (603) 434-6842 Derry NH 03038-1713 USA Intel architecture: the left-hand path
Re: separating C from V in MVC
On Thu, 13 Jun 2002, Perrin Harkins wrote: As you can see it gets messy fast, and I didn't even cover the Mastercard part. It would probably have terruble performance too. This is why people usually just write this kind of report as a big SQL query instead. You can make a model object called ConcertSeatSearch: seats = Model::ConcertSeatSearch-findSeats( reserved_after = $date, payment_type = $card, user_state = $state, ); Just be careful that you don't end up making this into something that mirrors the SQL exactly. There might be 4 tables involved in finding out what kind of credit card the user had, but that gets hidden behind this API. If you find yourself writing classes that take options like where = 'date ' . $date you are reinventing SQL, and you've lost your abstraction. This approach works for some things, but I think it falls down when it comes to doing complex database searches, particularly searches generated ad-hoc on multiple columns in multiple tables. This is why Alzabo is much lower-level than what you have above. I needed something where I could easily construct queries that might include 1+ tables, with various types of searches of individual columns in those tables (equal to, between, less than, like, etc.) with dynamic sorting (again, on any of the columns in any of the tables, ascending or descending). With what you're proposing, I think you could easily end up with either: A) a ridiculously flexible interface that looks sort of like SQL, except where it is SQL, except where it's only sort of like SQL, etc. B) a ridiculous profusion of classes, methods, or both. SQL has its place, and Alzabo merely provides a thin layer on top of it. Trying to jam a thick layer of OO-goodness over relational data is asking for a mess. OO has its place, but if your application is primarily about the database, I don't think that a heavy OO layer on top of that will do you much good. And OO has a huge impedance mismatch with relational data (irregardless of SQL or not). -dave /*== www.urth.org we await the New Sun ==*/
Re: What causes memory leaks during graceful restarts?
DM == Doug MacEachern [EMAIL PROTECTED] writes: DM what version of perl? what modperl Makefile.PL options? DM if you're using modperl as a dso, you'll need at least perl 5.6.1 and DM modperl-1.26 to prevent this leakage on restarts. Even with these versions, I get massive leakage on restart with FreeBSD. I always do a stop/start now. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D.Khera Communications, Inc. Internet: [EMAIL PROTECTED] Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/
Re: mod_perl2.0 / TIPool
On Thu, 13 Jun 2002, Stathy G. Touloumis wrote: Is there an idea of when the TIPool API will be available for mod_perl 2.0? probably never now that threads::shared has been implemented in perl-5.8, which can be used to provide the same functionality (i think). threads::shared came to be after writing about the Perl interface to TIPool.
Re: mod_perl2.0 / TIPool
On Thursday 13 June 2002 10:46 pm, Doug MacEachern wrote: On Thu, 13 Jun 2002, Stathy G. Touloumis wrote: Is there an idea of when the TIPool API will be available for mod_perl 2.0? probably never now that threads::shared has been implemented in perl-5.8, which can be used to provide the same functionality (i think). threads::shared came to be after writing about the Perl interface to TIPool. Also note perl.com is now running an article on threads::shared. http://www.perl.com/pub/a/2002/06/11/threads.html It's mainly aimed at module authors, but it could be of interest anyway.
Re: Setting Cookies
ok - here is something ugly - off the top of my head. when a user submits without a cookie, or a cookie that u do not recognize: 1) Set-Cookie for the proper domain (i.e. .rhythym.com) 2) redirect them to the requested page, but with a fully qualified host/domain (i.e. http://www.rhythym.com/someLocation/) Rasoul Hajikhani wrote: Hello folks, Yesterday I posted a question about PerlTransHandler and received a lot of responses. Thanks to all of you who replied. However, my problem persists. I try to be more precise in explaining the problem today. My login module sets a few cookies that expire 24 hrs after they are set. Upon each request the validity of the cookies is checked, and in case of an expired cookie, the user is redirected to the login page to resubmit username/password again. A request with a fully qualified URL, example: http://myserver.mydomain.com/someLocation, has no problem continuing. The cookies are set. However, in case the URL has the .domain.com stripped, the login page is regenerated indefinitely. The cookies never get set. There were a few suggestions, such as using mod_rewrite, however that is out of the question because mod_rewrite was not built with our http server. My PerlTransHandler does not seem to be able to distinguish myserver.domain.com/someLocation request with myserver/someLocation. I appreciate any suggestions on this. -r -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/
Apache::URI::hostname is blank
For some odd reason, Apache::URI::hostname is showing up as blank. I've tried reading the various man pages and the Oriley book, but I can't find any explanation for why hostname would be blank.. Am I overlooking something? Thanks in advance. -- Write the bad things that are done to you in sand, but write the good things that happen to you on a piece of marble.--Arabic proverb Adam Ness AIM: GreyLurk| YIM: greylurk1 LiveJournal: incarnate | Journalscape: incarnate _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx
RE: Perl_Tstack_sp_ptr
On Tue, 11 Jun 2002, Paul G. Weiss wrote: OK, until I can decide whether to take a chance on FreeBSD-current or to convince my employers who were so enamored of FreeBSD that we should rebuild the server with Linux, I'm going prefork. worth skimming the [EMAIL PROTECTED] archives. if the issue has already been fixed in the freebsd kernel, you'd need to upgrade from 4.5 It still doesn't work precisely as it should though. I decided to go with the cvs builds of apache and mod_perl. I have to confess that the installation instructions seem strange (both for CVS and non-CVS). You have to build and install Apache in order to get the include files to build mod_perl. Then after doing a make for mod_perl you are supposed to go back to Apache and configure, make, make-install -- even though the mod_perl make touched nothing in the Apache tree! I assume after all of this you do make install on both Apache and mod_perl although the doc doesn't say so. the docs are broken then. all you have to do is: - install perl - install apache - build modperl with: perl Makefile.PL MP_AP_PREFIX=/usr/local/apache2 make test make install I suppose I could have done --enable-threads in Apache with --with-mpm=prefork and it might have worked. Is that considered kosher? maybe. but if you are using prefork, no need to build perl with -Dusethreads
Re: threads in 5.8 (was: mod_perl2.0 / TIPool)
On 6/13/02 5:58 PM, Matt Sergeant wrote: Also note perl.com is now running an article on threads::shared. http://www.perl.com/pub/a/2002/06/11/threads.html It's mainly aimed at module authors, but it could be of interest anyway. Does anyone know the logic behind making the threads modules all lowercase? I'd expect it to be Threads::Shared, not threads::shared. -John
Re: Apache::URI::hostname is blank
Adam Ness wrote: For some odd reason, Apache::URI::hostname is showing up as blank. I've tried reading the various man pages and the Oriley book, but I can't find any explanation for why hostname would be blank.. Am I overlooking something? yes :) see Recipe 5.3 in the cookbook for the complete lowdown, but I'm pretty sure it's there in the eagle as well... for the moment, though, know that there are two ways of getting an Apache::URI object: my $uri = $r-parsed_uri; my $uri = Apache::URI-parse($r); parsed_uri() will only return the scheme, port, and hostname if the incoming URI is an absolute URI (which is typically the case with proxies but atypical for most of your programing). Apache::URI-parse($r) tries to find what it can from the request, then it makes decisions based on what else Apache knows about the server. typically this will involve populating $uri-hostname but, as someone brought up just recently, if you use a _default_ vhost config you'll get '_default_' for the hostname. there are other differences between the two methods, but this is what you're interested in now... --Geoff
Re: threads in 5.8 (was: mod_perl2.0 / TIPool)
On Thursday 13 June 2002 11:37 pm, John Siracusa wrote: On 6/13/02 5:58 PM, Matt Sergeant wrote: Also note perl.com is now running an article on threads::shared. http://www.perl.com/pub/a/2002/06/11/threads.html It's mainly aimed at module authors, but it could be of interest anyway. Does anyone know the logic behind making the threads modules all lowercase? I'd expect it to be Threads::Shared, not threads::shared. Pragmas are lowercase. And use threads; is really a pragma. Matt.
Re: threads in 5.8 (was: mod_perl2.0 / TIPool)
On 6/13/02 6:40 PM, Matt Sergeant wrote: Does anyone know the logic behind making the threads modules all lowercase? I'd expect it to be Threads::Shared, not threads::shared. Pragmas are lowercase. And use threads; is really a pragma. A pragma with class methods? A pragma that exports functions? Maybe I'm confused about the distinction between a pragma and a module... -John
Re: threads in 5.8 (was: mod_perl2.0 / TIPool)
On Thursday 13 June 2002 11:50 pm, John Siracusa wrote: On 6/13/02 6:40 PM, Matt Sergeant wrote: Does anyone know the logic behind making the threads modules all lowercase? I'd expect it to be Threads::Shared, not threads::shared. Pragmas are lowercase. And use threads; is really a pragma. A pragma with class methods? A pragma that exports functions? Maybe I'm confused about the distinction between a pragma and a module... It's a really fine line ;-) See also use fields.
which handler?
i want to make a apacher perlhandler method for location / (i think) that will check and see if my system state is ok (like database, jabber, and imap connectivity), and if not will redirect to another page. if everything is kosher i would like everything to move on like normal ... which handler method do i use for this. thanks --- Gabriel C. Millerd | Have you noticed the way people's intelligence Script Monkey | capabilities decline sharply the minute they start |waving guns around? -Dr. Who
Re: which handler?
Gabriel C Millerd wrote: i want to make a apacher perlhandler method for location / (i think) that will check and see if my system state is ok (like database, jabber, and imap connectivity), and if not will redirect to another page. if everything is kosher i would like everything to move on like normal ... which handler method do i use for this. sounds like a job for a PerlTransHandler... if ($not_ok) { $r-uri('/not_ok_page.html'); return DECLINED; } keep in mind that the PerlTransHandler cannot be applied to any Location (or any other container like Directory) so it will automatically apply to an entire (virtual) server. HTH --Geoff
Re: mod_perl2.0 / TIPool
Doug MacEachern wrote: On Thu, 13 Jun 2002, Stathy G. Touloumis wrote: Is there an idea of when the TIPool API will be available for mod_perl 2.0? probably never now that threads::shared has been implemented in perl-5.8, which can be used to provide the same functionality (i think). threads::shared came to be after writing about the Perl interface to TIPool. what about perl 5.8.0? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: which handler?
On Thu, 13 Jun 2002, Geoffrey Young wrote: sounds like a job for a PerlTransHandler... thanks keep in mind that the PerlTransHandler cannot be applied to any Location (or any other container like Directory) so it will automatically apply to an entire (virtual) server. that would have been my problem all today i think thanks again --- Gabriel C. Millerd | When sorrows come, they come not single spies, But Sith Admin |in battalions. --William Shakespeare, Hamlet |
Re: separating C from V in MVC
Dave Rolsky writes: Trying to jam a thick layer of OO-goodness over relational data is asking for a mess. Most OLTP applications share a lot in common. The user inputs data in forms. The fields they edit often correspond one-to-one with database fields, and certainly their types. The user wants reports which are usually closely mapped to a table/view/join, i.e. an ordered list of tuples. A reasonable O/R mapping can solve this problem easily. Like Perl, it makes the easy things easy and the hard things possible. The bOP Pet Shop demostrates how you can build a simple application with only a couple of custom SQL queries. The rest are simple joins and CRUD. If you need more complex queries, there are escapes. You still probably end up with a list of tuples for your reports. The key we have found is avoiding indirection by naming fields and models the same in SQL and Perl objects. This allows you to seamlessly switch between the two. We've found the O/R mapping to be an indispensable part of the system. Since all data is contained in objects, the views/widgets don't need to how the data is populated. They access all data through a single interface. Rob
Re: mod_perl/passing session information (MVC related, maybe...)
Perrin Harkins writes: My preferred design for this is to set one cookie that lasts forever and serves as a browser ID. I like this. It's clean and simple. In this sense, a browser is not really a session. The only thing I don't like is garbage collection. unique browser ID (or session ID, if you prefer to give out a new one each time someone comes to the site) lets you track this for unregistered users. We call this a visitor id. In the PetShop we have a cart id, but we're not too happy with the abstraction. I don't see that as a big deal. You'd have to delete lots of other data associated with a user too. Actually deleting a user is something I've never seen happen anywhere. We do. Especially when we went from free to fee. :-( The big issue I have with session data is that it is often a BLOB which you can't query. Well, eToys handled more than 2.5 million pages per hour, but caching can be important for much smaller sites in some situations. I'd like numbers on smaller and some. :) Here's a situation where a small site could need caching: We cache, too. An interesting query is the club count on bivio.com's home page. The count of clubs is a fast query, but the count of the members is not (about 4 seconds). We compute a ratio when the server starts of the members to clubs. We then run the club count query and use the ratio to compute the member count. We restart the servers nightly, so the ratio is computed once a day. Maybe I just have bad luck, but I always seem to end up at companies where they give me requirements like these. It's the real world. Denormalization is necessary, but only after you test the normal case. One of the reasons I got involved in this discussion is that I saw a lot of messages about solutions and very few with numbers identifying the problem. Rob
Re: which handler?
On Thu, 13 Jun 2002, Geoffrey Young wrote: sounds like a job for a PerlTransHandler... if ($not_ok) { $r-uri('/not_ok_page.html'); return DECLINED; } this works great until i run into an Alias or a mod_rewite rule it seems. what is the proper way to indicate success here? ora's writing apache modules has this method and the method omitting '$r-filename()' line - which i have not been able to get to work. one step away from this .. perhaps a set of logic to act differently is needed for different requests. sub handler { my $r=shift; if(Apache::MonDiag($r) { $r-filename($r-document_root . $r-uri); return OK; } else { $r-warn(Apache::MonDiag($state)); my $url=$r-dir_config('MonDiagRedirect'); $r-content_type('text/html'); $r-header_out(Location=$url); return REDIRECT; } } --- Gabriel C. Millerd
Re: SEGV in bleadperl@17165 under mod_perl
On Wed, 12 Jun 2002 23:45:41 +0200, [EMAIL PROTECTED] (Andreas J. Koenig) said: Currently I have a testcase that is still 7300 lines of perl code for the server (after all these are in one file) but only 50 lines for the client. I hope to cut that down to a reasonable size tomorrow. I fear I have to give up on this, I cannot cut the test case below 2800 lines. I cannot make it database-independent either. Whatever I cut out, the SEGV goes away. :-( I have switched to blead@17207 (apache is 1.3.24, mod_perl is 1.27) and this is the stack trace today. The line numbers are again wrong and I have no idea why. Please take another *sharp* look. If this bug cannot be fixed, I cannot upgrade PAUSE to 5.8.0 (unless I rename it to PAUSEGV :-) Program received signal SIGSEGV, Segmentation fault. 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 43 iofflush.c: No such file or directory. (gdb) bt #0 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 #1 0x8205fea in PerlIOStdio_flush (my_perl=0x82f4258, f=0x82fb298) at perlio.c:2738 #2 0x8203fde in Perl_PerlIO_flush (my_perl=0x82f4258, f=0x82fb298) at perlio.c:1459 #3 0x82040a8 in Perl_PerlIO_flush (my_perl=0x82f4258, f=0x82fb298) at perlio.c:1487 #4 0x8173e8f in Perl_my_popen (my_perl=0x82f4258, cmd=0x88b8fc1 -, mode=0xb524 w) at util.c:2080 #5 0x81e3297 in Perl_do_openn (my_perl=0x82f4258, gv=0x88c5f34, name=0x88b8fc1 -, len=1, as_raw=0, rawmode=0, rawperm=0, supplied_fp=0x0, svp=0x84f7098, num_svs=0) at doio.c:282 #6 0x81cbda3 in Perl_pp_open (my_perl=0x82f4258) at pp_sys.c:542 #7 0x816eb43 in Perl_runops_debug (my_perl=0x82f4258) at dump.c:1398 #8 0x81174a3 in S_call_body (my_perl=0x82f4258, myop=0xb758, is_eval=0) at perl.c:2044 #9 0x8117003 in Perl_call_sv (my_perl=0x82f4258, sv=0x8387470, flags=4) at perl.c:1962 #10 0x809da38 in perl_call_handler (sv=0x8387470, r=0x87869ac, args=0x0) at mod_perl.c:1658 #11 0x809cbc4 in perl_run_stacked_handlers (hook=0x828e399 PerlHandler, r=0x87869ac, handlers=0x83873ec) at mod_perl.c:1371 #12 0x809a637 in perl_handler (r=0x87869ac) at mod_perl.c:897 #13 0x80e6379 in ap_invoke_handler () at eval.c:88 #14 0x80fbbdf in process_request_internal () at eval.c:88 #15 0x80fbc4a in ap_process_request () at eval.c:88 #16 0x80f2897 in child_main () at eval.c:88 #17 0x80f2a55 in make_child () at eval.c:88 #18 0x80f2bd6 in startup_children () at eval.c:88 #19 0x80f326d in standalone_main () at eval.c:88 #20 0x80f3acc in main () at eval.c:88 #21 0x400a475d in __libc_start_main (main=0x80f3738 main, argc=4, ubp_av=0xbae4, init=0x807a628 _init, fini=0x8286704 _fini, rtld_fini=0x4000b8f4 _dl_fini, stack_end=0xbadc) at ../sysdeps/generic/libc-start.c:129 Loaded modules of the application are quite a lot: Apache Apache::Connection Apache::Constants Apache::Constants::Exports Apache::HeavyCGI Apache::HeavyCGI::Date Apache::HeavyCGI::Exception Apache::HeavyCGI::ExePlan Apache::HeavyCGI::Layout Apache::Request Apache::Server Apache::Status Apache::Symbol Apache::Table Apache::URI AutoLoader B Carp Class::Singleton Compress::Zlib Config Cwd DBD::mysql DBI Data::Dumper Devel::Symdump DirHandle DynaLoader Encode Encode::Alias Encode::Config Encode::Encoding Exporter Exporter::Heavy ExtUtils::Manifest Fcntl File::Basename File::Copy File::Find File::Spec File::Spec::Unix HTML::Entities HTML::Parser HTTP::Date IO IO::File IO::Handle IO::Seekable List::Util Mail::Mailer Mail::Mailer::rfc822 Mail::Mailer::sendmail Mail::Send Scalar::Util SelectSaver String::Random Symbol Text::Tabs Text::Wrap Time::HiRes Time::Local URI URI::Escape URI::URL URI::WithBase URI::_generic URI::_query URI::_server URI::_userpass URI::ftp Unicode::String XML::Parser XML::Parser::Expat XSLoader base bytes constant fields integer lib mod_perl overload pause_1999::authensegv pause_1999::configsegv re strict utf8 vars warnings warnings::register Most of the modules are not involved in any action, most of the testscript is unused code. The test script only does the following: 1. Authentication via DBI (mysql) 2. Receive an uploaded file via Apache::Request 3. Send mail via Mail::Mailer (sendmail) Action must be repeated about 6-8 times, only then the SEGV is reached. -- andreas
Re: SEGV in bleadperl@17165 under mod_perl
On Thu, Jun 13, 2002 at 06:52:13PM +0200, Andreas J. Koenig wrote: On Wed, 12 Jun 2002 23:45:41 +0200, [EMAIL PROTECTED] (Andreas J. Koenig) said: Currently I have a testcase that is still 7300 lines of perl code for the server (after all these are in one file) but only 50 lines for the client. I hope to cut that down to a reasonable size tomorrow. I fear I have to give up on this, I cannot cut the test case below 2800 lines. I cannot make it database-independent either. Whatever I cut out, the SEGV goes away. :-( I have switched to blead@17207 (apache is 1.3.24, mod_perl is 1.27) and this is the stack trace today. The line numbers are again wrong and I have no idea why. Please take another *sharp* look. If this bug cannot be fixed, I cannot upgrade PAUSE to 5.8.0 (unless I rename it to PAUSEGV :-) Program received signal SIGSEGV, Segmentation fault. 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 43 iofflush.c: No such file or directory. (gdb) bt #0 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 #1 0x8205fea in PerlIOStdio_flush (my_perl=0x82f4258, f=0x82fb298) at perlio.c:2738 I'm grasping at straws, and I really don't know much about PerlIO... but try this: //depot/perl/perlio.c#179 - /u/vieraat/vieraat/jhi/pp4/perl/perlio.c Index: perl/perlio.c --- perl/perlio.c.~1~ Thu Jun 13 20:05:05 2002 +++ perl/perlio.c Thu Jun 13 20:05:05 2002 @@ -2734,7 +2734,7 @@ PerlIOStdio_flush(pTHX_ PerlIO *f) { FILE *stdio = PerlIOSelf(f, PerlIOStdio)-stdio; -if (PerlIOBase(f)-flags PERLIO_F_CANWRITE) { +if (stdio PerlIOBase(f)-flags PERLIO_F_CANWRITE) { return PerlSIO_fflush(stdio); } else { End of Patch. NI-S will probably find this patch very wrong :-) #2 0x8203fde in Perl_PerlIO_flush (my_perl=0x82f4258, f=0x82fb298) at perlio.c:1459 #3 0x82040a8 in Perl_PerlIO_flush (my_perl=0x82f4258, f=0x82fb298) at perlio.c:1487 #4 0x8173e8f in Perl_my_popen (my_perl=0x82f4258, cmd=0x88b8fc1 -, mode=0xb524 w) at util.c:2080 #5 0x81e3297 in Perl_do_openn (my_perl=0x82f4258, gv=0x88c5f34, name=0x88b8fc1 -, len=1, as_raw=0, rawmode=0, rawperm=0, supplied_fp=0x0, svp=0x84f7098, num_svs=0) at doio.c:282 #6 0x81cbda3 in Perl_pp_open (my_perl=0x82f4258) at pp_sys.c:542 #7 0x816eb43 in Perl_runops_debug (my_perl=0x82f4258) at dump.c:1398 #8 0x81174a3 in S_call_body (my_perl=0x82f4258, myop=0xb758, is_eval=0) at perl.c:2044 #9 0x8117003 in Perl_call_sv (my_perl=0x82f4258, sv=0x8387470, flags=4) at perl.c:1962 #10 0x809da38 in perl_call_handler (sv=0x8387470, r=0x87869ac, args=0x0) at mod_perl.c:1658 #11 0x809cbc4 in perl_run_stacked_handlers (hook=0x828e399 PerlHandler, r=0x87869ac, handlers=0x83873ec) at mod_perl.c:1371 #12 0x809a637 in perl_handler (r=0x87869ac) at mod_perl.c:897 #13 0x80e6379 in ap_invoke_handler () at eval.c:88 #14 0x80fbbdf in process_request_internal () at eval.c:88 #15 0x80fbc4a in ap_process_request () at eval.c:88 #16 0x80f2897 in child_main () at eval.c:88 #17 0x80f2a55 in make_child () at eval.c:88 #18 0x80f2bd6 in startup_children () at eval.c:88 #19 0x80f326d in standalone_main () at eval.c:88 #20 0x80f3acc in main () at eval.c:88 #21 0x400a475d in __libc_start_main (main=0x80f3738 main, argc=4, ubp_av=0xbae4, init=0x807a628 _init, fini=0x8286704 _fini, rtld_fini=0x4000b8f4 _dl_fini, stack_end=0xbadc) at ../sysdeps/generic/libc-start.c:129 Loaded modules of the application are quite a lot: Apache Apache::Connection Apache::Constants Apache::Constants::Exports Apache::HeavyCGI Apache::HeavyCGI::Date Apache::HeavyCGI::Exception Apache::HeavyCGI::ExePlan Apache::HeavyCGI::Layout Apache::Request Apache::Server Apache::Status Apache::Symbol Apache::Table Apache::URI AutoLoader B Carp Class::Singleton Compress::Zlib Config Cwd DBD::mysql DBI Data::Dumper Devel::Symdump DirHandle DynaLoader Encode Encode::Alias Encode::Config Encode::Encoding Exporter Exporter::Heavy ExtUtils::Manifest Fcntl File::Basename File::Copy File::Find File::Spec File::Spec::Unix HTML::Entities HTML::Parser HTTP::Date IO IO::File IO::Handle IO::Seekable List::Util Mail::Mailer Mail::Mailer::rfc822 Mail::Mailer::sendmail Mail::Send Scalar::Util SelectSaver String::Random Symbol Text::Tabs Text::Wrap Time::HiRes Time::Local URI URI::Escape URI::URL URI::WithBase URI::_generic URI::_query URI::_server URI::_userpass URI::ftp Unicode::String XML::Parser XML::Parser::Expat XSLoader base bytes constant fields integer lib mod_perl overload pause_1999::authensegv pause_1999::configsegv re strict utf8 vars warnings warnings::register Most of the modules are not involved in any action, most of the testscript is unused code. The test script only does the following: 1. Authentication via DBI (mysql) 2. Receive an uploaded file via Apache::Request 3. Send mail
Re: SEGV in bleadperl@17165 under mod_perl
On Thu, 13 Jun 2002, Andreas J. Koenig wrote: this might be worth a try. since the segv is something stdio, must be one of std{out,err} getting corrupted somehow. ap_error_log2stderr does this: API_EXPORT(void) ap_error_log2stderr(server_rec *s) { if ( s-error_log != NULL fileno(s-error_log) != STDERR_FILENO) dup2(fileno(s-error_log), STDERR_FILENO); } no other suspects at the moment. of course, something else in your mix could be messing with std{out,err}. strace might reveal some clues. --- src/modules/perl/mod_perl.c~Wed May 22 21:23:18 2002 +++ src/modules/perl/mod_perl.c Thu Jun 13 10:24:59 2002 -1454,7 +1454,7 #endif /* hookup stderr to error_log */ -#ifndef PERL_TRACE +#if 0 if(r-server-error_log) error_log2stderr(r-server); #endif
Re: SEGV in bleadperl@17165 under mod_perl
On Thu, 13 Jun 2002, Andreas J. Koenig wrote: Program received signal SIGSEGV, Segmentation fault. 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 43 iofflush.c: No such file or directory. (gdb) bt #0 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 also, if possible could you: (gdb) p *fp
Re: SEGV in bleadperl@17165 under mod_perl
On Thu, Jun 13, 2002 at 08:26:30PM +0200, Andreas J. Koenig wrote: On Thu, 13 Jun 2002 10:32:01 -0700 (PDT), Doug MacEachern [EMAIL PROTECTED] said: On Thu, 13 Jun 2002, Andreas J. Koenig wrote: Program received signal SIGSEGV, Segmentation fault. 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 43 iofflush.c: No such file or directory. (gdb) bt #0 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 also, if possible could you: (gdb) p *fp (gdb) p *fp I'll try the other suggestions next. Mine probably doesn't help much since the pointer seems to be non-NULL... $1 = {_flags = 1075460144, _IO_read_ptr = 0x401a3830 0ã\210\b0ã\210\bØñw\bØñw\b88\032@88\032@@8\032@@8\032@H8\032@H8\032@P8\032@P8\032@X8\032@X8\032@`8\032@`8\032@h8\032@h8\032@p8\032@p8\032@x8\032@x8\032@\2008\032@\2008\032@\2108\032@\2108\032@\2208\032@\2208\032@\2308\032@\2308\032@ 8\032@ 8\032@¨8\032@¨8\032@°8\032@°8\032@¸8\032@¸8\032@À8\032@À8\032@È8\032@È8\032@0ð\213\b0ð\213\bØ8\032@Ø8\032@à8\032@à8\032@è8\032@è8\032@..., This doesn't look good... _IO_read_end = 0x646e4128 Address 0x646e4128 out of bounds, _IO_read_base = 0x73616572 Address 0x73616572 out of bounds, _IO_write_base = 0x202e4a20 Address 0x202e4a20 out of bounds, _IO_write_ptr = 0x6eb6c34b Address 0x6eb6c34b out of bounds, _IO_write_end = 0x20296769 Address 0x20296769 out of bounds, _IO_buf_base = 0x69736976 Address 0x69736976 out of bounds, _IO_buf_end = 0x20646574 Address 0x20646574 out of bounds, _IO_save_base = 0x20656874 Address 0x20656874 out of bounds, _IO_backup_base = 0x53554150 Address 0x53554150 out of bounds, _IO_save_end = 0x20200a45 Address 0x20200a45 out of bounds, These look fishy... _markers = 0x20646e61, _chain = 0x75716572, _fileno = 1702130533, _blksize = 1851859044, _old_offset = 1819309344, _cur_column = 24943, _vtable_offset = 100 'd', _shortbuf = , _lock = 0x6f746e69, _offset = 8243109245980600352, _codecvt = 0x72696420, _wide_data = 0x6f746365, _mode = 170817906, _unused2 = The request used the following parameters\n\n SUBMIT_} If this is an unused field why does it contain a very readable string :-) In my Linux stdio.h unused2 is int _unused2[16], but off-hand I don't even think it should be part of a FILE, so I really don't know what to say. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: SEGV in bleadperl@17165 under mod_perl
_IO_read_end = 0x646e4128 Address 0x646e4128 out of bounds, _IO_read_base = 0x73616572 Address 0x73616572 out of bounds, _IO_write_base = 0x202e4a20 Address 0x202e4a20 out of bounds, _IO_write_ptr = 0x6eb6c34b Address 0x6eb6c34b out of bounds, _IO_write_end = 0x20296769 Address 0x20296769 out of bounds, _IO_buf_base = 0x69736976 Address 0x69736976 out of bounds, _IO_buf_end = 0x20646574 Address 0x20646574 out of bounds, _IO_save_base = 0x20656874 Address 0x20656874 out of bounds, _IO_backup_base = 0x53554150 Address 0x53554150 out of bounds, _IO_save_end = 0x20200a45 Address 0x20200a45 out of bounds, These look fishy... $ perl -le 'print pack i, hex $_ foreach ARGV' 0x646e4128 0x73616572 0x202e4a20 0x6eb6c34b 0x20296769 0x69736976 0x20646574 0x20656874 0x53554150 0x20200a45 0x20646e61 (And reas J. Kön ig) visi ted the PAUS E Ouch. How did you even start to suspect this? Because the hexdigitsq looked like fitting well into the ASCII range? 08\cZ 08\cZ (Andreas J. König) visited the PAUSE and reqested an upload into his/her directory.\n . The request used the following parameters\n\n SUBMIT_ I think. (that's König in utf8, isn't it?) Yes. I don't think we're in FILE* any longer, Toto. (and I didn't get the misquote quite correct, did I?) What's a good memory leak checker for running PAUSE under? valgrind with Dunno about memory *leaks* but definitely looks like fandango on core... showleaks turned on? -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: SEGV in bleadperl@17165 under mod_perl
seems to be an Apache::Request issue with perlio. i can get a similar segv with the modperl test change below. system() triggers a PERL_FLUSHALL_FOR_CHILD; with the Apache::Upload filehandles still alive. there is some ugly code to import the FILE* from ApacheUpload_fh to a PerlIO, which could be the culprit. is there any way to flag a PerlIO to not be flushed during PerlIO_flush(NULL) ? --- t/net/perl/request-upload.pl~ Thu Dec 30 11:51:16 1999 +++ t/net/perl/request-upload.plThu Jun 13 14:31:37 2002 -28,7 +28,8 my $name = $upload-name; my $type = $upload-type; next unless $filename; - +local $ENV{PATH} = '/bin'; +system /bin/echo $filename /tmp/uploads; print $name $filename ($type); if ($fh and $name) { no strict;
Re: SEGV in bleadperl@17165 under mod_perl
also note that the problem goes away if PERL_FLUSHALL_FOR_CHILD happens after the Apache::Upload handles have gone out of scope. the change below does not trigger and segvs, all tests pass. andreas, you could try to make sure your Apache::Upload handles have gone out of scope (or are undef-ed) before calling Mail::Mailer. also make sure you are using the 1.0 version of libapreq, i think older versions leaked filehandles. --- t/net/perl/request-upload.pl~ Thu Dec 30 11:51:16 1999 +++ t/net/perl/request-upload.plThu Jun 13 14:41:51 2002 -107,3 +107,5 print $filename bytes=$bytes,wanted=$wanted\n; } +local $ENV{PATH} = '/bin'; +system /bin/echo ok /tmp/uploads;
Re: SEGV in bleadperl@17165 under mod_perl
patch below also cures (when calling system() with Apache::Upload handles still alive). seems PerlIO_importFILE() should have a mode argument, in this case we only want to allow reading on the given FILE* --- Request/Request.xs~ Sun Jan 20 09:27:35 2002 +++ Request/Request.xs Thu Jun 13 15:07:28 2002 -38,6 +38,7 #undef __attribute__ #include mod_perl.h +#include perliol.h #ifdef WIN32 -494,6 +495,7 CODE: if ( ( RETVAL = PerlIO_importFILE(ApacheUpload_fh(upload),0) ) == NULL ) XSRETURN_UNDEF; +PerlIOBase((PerlIO*)RETVAL)-flags = ~PERLIO_F_CANWRITE; OUTPUT: RETVAL
Re: SEGV in bleadperl@17165 under mod_perl
On Thu, Jun 13, 2002 at 09:36:42PM +0300, Jarkko Hietaniemi wrote: On Thu, Jun 13, 2002 at 08:26:30PM +0200, Andreas J. Koenig wrote: On Thu, 13 Jun 2002 10:32:01 -0700 (PDT), Doug MacEachern [EMAIL PROTECTED] said: On Thu, 13 Jun 2002, Andreas J. Koenig wrote: Program received signal SIGSEGV, Segmentation fault. 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 43 iofflush.c: No such file or directory. (gdb) bt #0 0x400ed761 in _IO_fflush (fp=0x877f1e0) at iofflush.c:43 also, if possible could you: (gdb) p *fp (gdb) p *fp I'll try the other suggestions next. Mine probably doesn't help much since the pointer seems to be non-NULL... $1 = {_flags = 1075460144, _IO_read_ptr = 0x401a3830 0ã\210\b0ã\210\bØñw\bØñw\b88\032@88\032@@8\032@@8\032@H8\032@H8\032@P8\032@P8\032@X8\032@X8\032@`8\032@`8\032@h8\032@h8\032@p8\032@p8\032@x8\032@x8\032@\2008\032@\2008\032@\2108\032@\2108\032@\2208\032@\2208\032@\2308\032@\2308\032@ 8\032@ 8\032@¨8\032@¨8\032@°8\032@°8\032@¸8\032@¸8\032@À8\032@À8\032@È8\032@È8\032@0ð\213\b0ð\213\bØ8\032@Ø8\032@à8\032@à8\032@è8\032@è8\032@..., This doesn't look good... _IO_read_end = 0x646e4128 Address 0x646e4128 out of bounds, _IO_read_base = 0x73616572 Address 0x73616572 out of bounds, _IO_write_base = 0x202e4a20 Address 0x202e4a20 out of bounds, _IO_write_ptr = 0x6eb6c34b Address 0x6eb6c34b out of bounds, _IO_write_end = 0x20296769 Address 0x20296769 out of bounds, _IO_buf_base = 0x69736976 Address 0x69736976 out of bounds, _IO_buf_end = 0x20646574 Address 0x20646574 out of bounds, _IO_save_base = 0x20656874 Address 0x20656874 out of bounds, _IO_backup_base = 0x53554150 Address 0x53554150 out of bounds, _IO_save_end = 0x20200a45 Address 0x20200a45 out of bounds, These look fishy... $ perl -le 'print pack i, hex $_ foreach @ARGV' 0x646e4128 0x73616572 0x202e4a20 0x6eb6c34b 0x20296769 0x69736976 0x20646574 0x20656874 0x53554150 0x20200a45 0x20646e61 (And reas J. Kön ig) visi ted the PAUS E _markers = 0x20646e61, _chain = 0x75716572, _fileno = 1702130533, _blksize = 1851859044, _old_offset = 1819309344, _cur_column = 24943, _vtable_offset = 100 'd', _shortbuf = , _lock = 0x6f746e69, _offset = 8243109245980600352, _codecvt = 0x72696420, _wide_data = 0x6f746365, _mode = 170817906, _unused2 = The request used the following parameters\n\n SUBMIT_} $ perl -le 'print pack i, hex $_ foreach @ARGV' 0x20646e61 0x75716572 and requ $ perl -le 'print pack i, $_ foreach @ARGV' 1702130533 1851859044 1819309344 este d an upl $ perl -le 'print pack s, $_ foreach @ARGV' 24943 oa 'd' perl -le 'print pack i, hex $_ foreach @ARGV' 0x6f746e69 into perl13693-64 -le 'print pack Q, 8243109245980600352' his/her perl -le 'print pack i, hex $_ foreach @ARGV' 0x72696420 0x6f746365 dir ecto perl -le 'print pack i, $_ foreach @ARGV' 170817906 ry. If this is an unused field why does it contain a very readable string :-) In my Linux stdio.h unused2 is int _unused2[16], but off-hand I don't even think it should be part of a FILE, so I really don't know what to say. 08\cZ@ 08\cZ@ (Andreas J. König) visited the PAUSE and reqested an upload into his/her directory.\n . The request used the following parameters\n\n SUBMIT_ I think. (that's König in utf8, isn't it?) I don't think we're in FILE* any longer, Toto. (and I didn't get the misquote quite correct, did I?) What's a good memory leak checker for running PAUSE under? valgrind with showleaks turned on? Nicholas Clark -- Even better than the real thing:http://nms-cgi.sourceforge.net/
Re: SEGV in bleadperl@17165 under mod_perl
On Thu, 13 Jun 2002 15:11:04 -0700 (PDT), Doug MacEachern [EMAIL PROTECTED] said: patch below also cures (when calling system() with Apache::Upload handles still alive). Thank you so much, Doug. Your diagnostics confirmed: the upload filehandle was still in scope. The fix to Request.xs fixes the bug as does narrowing the scope of the filehandle. Phew! -- andreas
Re: SEGV in bleadperl@17165 under mod_perl
On Thu, Jun 13, 2002 at 11:22:46PM +0300, Jarkko Hietaniemi wrote: _IO_read_end = 0x646e4128 Address 0x646e4128 out of bounds, _IO_read_base = 0x73616572 Address 0x73616572 out of bounds, _IO_write_base = 0x202e4a20 Address 0x202e4a20 out of bounds, _IO_write_ptr = 0x6eb6c34b Address 0x6eb6c34b out of bounds, _IO_write_end = 0x20296769 Address 0x20296769 out of bounds, _IO_buf_base = 0x69736976 Address 0x69736976 out of bounds, _IO_buf_end = 0x20646574 Address 0x20646574 out of bounds, _IO_save_base = 0x20656874 Address 0x20656874 out of bounds, _IO_backup_base = 0x53554150 Address 0x53554150 out of bounds, _IO_save_end = 0x20200a45 Address 0x20200a45 out of bounds, These look fishy... $ perl -le 'print pack i, hex $_ foreach ARGV' 0x646e4128 0x73616572 0x202e4a20 0x6eb6c34b 0x20296769 0x69736976 0x20646574 0x20656874 0x53554150 0x20200a45 0x20646e61 (And reas J. Kön ig) visi ted the PAUS E Ouch. How did you even start to suspect this? Because the hexdigitsq looked like fitting well into the ASCII range? Yes. Basically. :-) I didn't get where I am today ... by not being suspicious about 0x646e It there seemed to be rather too many bytes in ASCII letter range. Particularly that there were steady 4 bytes all in ASCII range. Most integers and pointers don't look like that on 32 bit systems - most integers don't need to be that big, and most pointers have more 0 bits in them. (People (like me at work) will mess this up by trying to use all of the 32 bit memory map to store large volumes of data) To be honest I didn't remember that 6x was lower case (ie I should actually also be suspicious about numbers in the range 0x41-0x5A) but after finding that I had a good start with a word: $ perl -le 'print pack i, hex $_ foreach ARGV' 0x646e4128 (And I just kept on going. What's a good memory leak checker for running PAUSE under? valgrind with Dunno about memory *leaks* but definitely looks like fandango on core... Ah. That's what valgrind is good for finding the cause of. By the way, did I say that I like valgrind? I like ccache too. (The two are unrelated, other than they are both GPL and I like them both). The samba folks have a new scary thing under development - a distributed compile demon. I'm not sure how useful that is to most of us, except that it should allow anyone with 2+ similar machines a chance to debug Makefiles running under -j :-) Nicholas Clark -- Even better than the real thing:http://nms-cgi.sourceforge.net/
RE: PerlSetVar WhatEverSecure
It's not the prettiest in the world, but try this (see attached file). If anyone sees room for improvement, please, chime in. It's working fine on the intranet site I run at work - and I haven't tried to make it any better since it's working as is. You use this script instead of the loginscreen method of AuthTicket. It uses the http-equiv refresh when switch schemes since going from https to http causes most browsers to popup a warning about getting redirected to an insecure site. Here are my relevant httpd.conf settings: PerlSetVar realmTicketLoginHandler /LOGIN PerlSetVar realmTicketLogoutURI / PerlSetVar realmLoginScript /login Alias /login /v01/data/web/auth/login Location /login Options ExecCGI SetHandler perl-script PerlHandler Apache::Registry /Location Location /LOGIN IfDefine SSL SSLRequireSSL /IfDefine SetHandler perl-script PerlHandler Apache::AuthTicket-login /Location --Jim -Original Message- From: Brian Reichert [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 1:13 PM To: Michael Schout Cc: Brian Reichert; [EMAIL PROTECTED] Subject: Re: PerlSetVar WhatEverSecure On Thu, Jun 13, 2002 at 10:40:18AM -0500, Michael Schout wrote: Brian Reichert wrote: Location /formscript/login PerlSetVar FormScriptSecure 1 AuthType Apache::AuthTicket ... /Location But, in each case, my login program is server in the clear. What am I missing? THe authnameSecure setting only affects the cookie. If you want to forbid access to the login form from non-ssl, there are verious ways to do that. One way would be to add SSLRequireSSL that block (assuming your using mod_ssl). Apache::AuthTicket says: Finally, by using the Secure mode of Apache::AuthCookie, the ticket is not passed over unencrypted connections. Passed in what direction? It would only go server-client if the client made a SSL request. With the 'FormScriptSecure' as I have it above, I _can_ log in over a non-encrypted channel, so clearly it's not enforcing the 'secure' criteria... (Still reading up on cookies...) I suppose my real question is: How can I intercept a unencrypted request for a protected document, but have the login form be submitted over an encrypted channel? (Thanks for the feedback, by the way...) Regards, Mike -- Brian 'you Bastard' Reichert [EMAIL PROTECTED] 37 Crystal Ave. #303 Daytime number: (603) 434-6842 Derry NH 03038-1713 USA Intel architecture: the left-hand path login Description: Binary data
Re: separating C from V in MVC
On Thu, 13 Jun 2002, Rob Nagler wrote: Most OLTP applications share a lot in common. The user inputs data in forms. The fields they edit often correspond one-to-one with database fields, and certainly their types. The user wants reports which are usually closely mapped to a table/view/join, i.e. an ordered list of tuples. A reasonable O/R mapping can solve this problem easily. Like Perl, it makes the easy things easy and the hard things possible. The bOP Pet Shop demostrates how you can build a simple application with only a couple of custom SQL queries. The rest are simple joins and CRUD. If you need more complex queries, there are escapes. You still probably end up with a list of tuples for your reports. The key we have found is avoiding indirection by naming fields and models the same in SQL and Perl objects. This allows you to seamlessly switch between the two. The Pet Shop has a grand total of 13 tables. How well does this approach work with 90 tables? How does it handle arbitrary queries that may join 1-6 tables, with conditionals and sorting of arbitrary complexity? We've found the O/R mapping to be an indispensable part of the system. Since all data is contained in objects, the views/widgets don't need to how the data is populated. They access all data through a single interface. I'm not a big fan of O/R. I prefer R/O. But to each their own. -dave /*== www.urth.org we await the New Sun ==*/
Re: separating C from V in MVC
At 12:58 PM 6/14/2002, Dave Rolsky wrote: On Thu, 13 Jun 2002, Rob Nagler wrote: I'm not a big fan of O/R. I prefer R/O. But to each their own. Would one of you mind providing a 1 paragraph definition of each? I am afraid that I am starting to get lost in the semantic differences of controllers and actions and O/R, R/O?
Re: separating C from V in MVC
On Fri, 14 Jun 2002, Gunther Birznieks wrote: Would one of you mind providing a 1 paragraph definition of each? I am afraid that I am starting to get lost in the semantic differences of controllers and actions and O/R, R/O? Well, here's my take on it. 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? If the first thing you think about is classes, objects, hierarchies, delegation, etc., then an O-R mapper may be for you. Most applications need some sort of persistent data storage, and if you think of your app solely as a collection of objects, then an O-R mapper is a natural fit. However, if you're like me, and given an app, the first thing you think about is _data_ and relationships, then a R-O mapper may be better. I for one start a project by designing a relational schema for the data. Then I want some nice programmatic way to get at it so Alzabo is key for me. Of course, all this assumes some large amount of persistent data, as is the case with many (but not all) web apps. OTOH, if you don't have much (or any) persistent data, this is all meaningless. For example, when I work on Mason I think objects. But when I work on my Hong Kong movie DB project, I think about tables. I have 90-some tables and I don't really want to create 90-some individual classes, plus some ungodly number of query classes (as proposed by Perrin) to deal with it. Thanks, but no thanks. OTOH, I hate writing raw SQL and I hate generating SQL dynamically even more. Alzabo provides a nice layer over SQL, provides a multitude of convenience methods, has hook/trigger support, supports caching, transactions, and facilitates writing additional canned query methods as needed, and much much more ;) -dave /*== www.urth.org we await the New Sun ==*/
Re: separating C from V in MVC
Shop demostrates how you can build a simple application with only a couple of custom SQL queries. The rest are simple joins and CRUD. If you need more complex queries, there are escapes. You still probably end up with a list of tuples for your reports. The key we have found is avoiding indirection by naming fields and models the same in SQL and Perl objects. This allows you to seamlessly switch between the two. How well does this approach work with 90 tables? How does it handle arbitrary queries that may join 1-6 tables, with conditionals and sorting of arbitrary complexity? I'd have to agree, most of the real-world scenarios I have run across do not consist of these neat 1-to-1 field to attribute type of mappings where the majority of the queries are simple inserts or selects from a single table or simple joins. Most of the apps I work on quickly evolve to the point of many (in my current case, 120+) tables and where most of the queries are gathering data for reports/views that bring data together from several tables. Joins of 5+ tables, unions, excepts, subselects, self-joins, complex sorting/grouping rules, etc are all commonplace and this is where I think overzealous attempts to abstract the queries away fall apart. I guess I'm more of the Perrin school of thought, where I prefer crafting all the SQL directly. I don't typically find apps that just mirror some subset of one of the db tables to be all that interesting. After all, it's the relationships between the data that make the data interesting, and by necessity this means your queries will be complex. And looking over the stuff outlined at poop.sourceforge.net, there's not too many models/frameworks out there that can accurately abstract ALL of SQL, and if it only does a subset, I feel like that's shooting myself in the foot. -Fran
Re: separating C from V in MVC
Dave Rolsky writes: The Pet Shop has a grand total of 13 tables. How well does this approach work with 90 tables? Works fine with bivio.com, which has 50 tables. How does it handle arbitrary queries that may join 1-6 tables, with conditionals and sorting of arbitrary complexity? The ListModel can override or augment its query. You can load a ListModel from an arbitrary data source as a result. After the load, it can fix up rows, e.g. computing percent portfolio is not done in SQL but in Perl in internal_post_load_row(). The automatic sorting is handy for simple joins. For complex queries, there's no fully automatic solution for sorting. Here's a simple query: http://petshop.bivio.biz/pub/products?p=DOGS The ListModel declares which columns are sortable: order_by = [ 'Product.name', 'Product.product_id', ], The view doesn't need to say anything, because the Table widget queries the ListModel meta-data. The SQL query is dynamically constructed by the o HTTP query value. For complex queries, you may be able to take advantage of the sort infrastructure. There are no guarantees, but you have the rope. The software is designed for the 80% solution. As we see patterns develop in our code, we add general cases to the infrastructure. I'm not a big fan of O/R. I prefer R/O. But to each their own. I guess we do R/O in the sense that we design the database relationally and then map PropertyModels one-to-one with the tables. Is that what you mean by R/O? Rob
Re: separating C from V in MVC
On Fri, 14 Jun 2002, Fran Fabrizio wrote: How well does this approach work with 90 tables? How does it handle arbitrary queries that may join 1-6 tables, with conditionals and sorting of arbitrary complexity? I'd have to agree, most of the real-world scenarios I have run across do not consist of these neat 1-to-1 field to attribute type of mappings where the majority of the queries are simple inserts or selects from a single table or simple joins. Most of the apps I work on quickly evolve to the point of many (in my current case, 120+) tables and where most of the queries are gathering data for reports/views that bring data together from several tables. Joins of 5+ tables, unions, excepts, subselects, self-joins, complex sorting/grouping rules, etc are all commonplace and this is where I think overzealous attempts to abstract the queries away fall apart. I guess I'm more of the Perrin school of thought, where I prefer crafting all the SQL directly. I never said I like to actually write SQL directly. See below ... I don't typically find apps that just mirror some subset of one of the db tables to be all that interesting. After all, it's the relationships between the data that make the data interesting, and by necessity this means your queries will be complex. And looking over the stuff outlined at poop.sourceforge.net, there's not too many models/frameworks out there that can accurately abstract ALL of SQL, and if it only does a subset, I feel like that's shooting myself in the foot. Well, I'm the author of both that doc _and_ Alzabo, which of the R-O tools described in that document supports the most of SQL except for DBIx::RecordSet, which is quite a bit lower-level, but basically can be used for _any_ SQL (I think). Alzabo supports enough for me and my 90-table database. So far I haven't needed unions, excepts, or difference, nor have I needed subselects (Alzabo actually has some support for subselects, though not the first three). I do need complex joins, self-joins, joins with aliases, complex sorting grouping (though it doesn't support HAVING yet), outer joins, and all conditionals. Alzabo does support all of this, and frankly I find it easier to do this, particularly when it needs to be done on the fly, then I could by just generating SQL in the app itself. I'm all for _some_ abstraction. The eternal question is how much? -dave /*== www.urth.org we await the New Sun ==*/
Re: Fooey. Can't compile mod_perl. / cygwin / success
Yea. If I just install Apache using the MSI installer, it automatically sets up the service, and it works dandy. After I install the mod_perl 1.x PPM package from the uwinnipeg.ca site, the service no longer starts apache. Even if I use apache -k to remove, then re-add the service. I think it may have something to do with the path to Perl not being in the environment, and I don't know where that should get set. For now, I've been just opening up a new cmd.exe window and running it from the command line, but obviously that isn't the preferred solution. Here's what I've done to get Apache and mod_perl to work under Cygwin: cd /lib/perl5/5.6.1/cygwin-multi/CORE ln -s libperl5_6_1.a libperl.a unzip apache_1.3.24-win32-src.zip tar xvfz mod_perl-1.27.tar.gz cd mod_perl-1.27 vi apaci/mod_perl.config.sh # insert #!/bin/bash as the very first line perl Makefile.PL USE_APACI=1 EVERYTHING=1 DO_HTTPD=1 \ PERL_EXTRA_CFLAGS=-DUSEIMPORTLIB make make install cd ../apache_1.3.24 make install cd /usr/local/apache vi conf/httpd.conf conf/startup.pl bin/apachectl start For some reason, the mod_perl.config.sh wasn't getting executed because it was missing the hash bang line. This caused some Makefiles to get messed up, most notably apache_1.3.24/src/modules/perl/Makefile. Things like CC and AR were not getting defined correctly, so nothing worked. Hopefully your httpd.h problem was caused by that too. Because that link to libperl.a in Cygwin wasn't there, dllwrap couldn't resolve symbols. Eventually found the fix for that (create a link) in the mod_perl archives. An important thing to do is ensure that the whole Makefile.PL/configure stage proceeds without any warnings or errors. If there are any warnings, they probably will cause problems during the compile. If my steps above don't work for you, maybe quickly check that Apache compiles on its own (./configure make), you never know. By the way, how well does PostgreSQL = 7.2 work on Win32? I'm been wanting to port an app that's currently using SQL Server 2000 (eek, , ODBC) to PostgreSQL. Since there are next to no benchmarks comparing the too on the net (darn MS EULA's), I'll probably end up doing some of my own benchmarks to prove to my client that performance will be similiar. southernstar wrote: Hi Wim, Is that the Win32 service, that you can get to in the control panel administrative tools - services? So apache starts manually okay but not as a service? Maybe it needs TCP/IP to start first so it should have dependencies which need to start before it does. I did this when trying to start postgresql using the win32 control panel. Had to start ipc-daemon first. (That still doesn't work either - only works with a manual startup at the cygwin bash shell.) I think I will get rid of cygwin's perl and install activeperl, then install a source code kit from apache like you did (my apache has cygwin patches which may have buggered things up.) Then I'll try for mod_perl 1.27 and see if that works. If it does I'll send you mail and let you know what I've done (any changes etc.) In the mean time if you get yours working be sure to give me a yell. Best of luck, James I tried it a couple of weeks ago, and ran into some problems too. I'm pretty sure it was a different issue though. At the moment I'm reinstalling Cygwin, since I've rebuilt my development system since then. At the moment, I've installed ActivePerl-5.6.1.631, apache_1.3.25-win32-x86-src.msi from apache.org, and mod_perl 1.x using the instructions at http://theoryx5.uwinnipeg.ca/win32_apache2.html. Works fine for me... except the apache service doesn't start. I haven't had a chance to look into that yet though. Wim
Re: Fooey. Can't compile mod_perl. / cygwin / success
Wim Kerkhoff wrote: perl Makefile.PL USE_APACI=1 EVERYTHING=1 DO_HTTPD=1 \ PERL_EXTRA_CFLAGS=-DUSEIMPORTLIB Bleah, here I go replying to my own message... That last part isn't needed. The only reason I had it there was as the remnants of a shot in the dark, based of a post in the archives. I've tested it with just a plain: perl Makefile.PL USE_APACI=1 EVERYTHING=1 DO_HTTPD=1 which works fine. Wim
Re: threads in 5.8 (was: mod_perl2.0 / TIPool)
We are really having fun here of courseand personally I'm more interested in the features than the writing Thread or thread...but perhaps one place to draw the line would be If a directive or hint changes the behavior of the compiler or interpreter in a non-reversable fashion then it deserve to be called a pragma. ie the 'no mod' is not supported, similar to 'use diagnostics'. Anything else that can be turned on and off at run time, could be called a module. So 'use integer' falls in that category. This approach allows the interpreter designer to fully take advantages of the optimization opportunities or plan of actions. Having said that I was drawn to this language, because I (as a perl programmer) can be schizophrenic and the language accommodates me, Ican change everything at run timethanks Perl Matt Sergeant wrote: On Thursday 13 June 2002 11:50 pm, John Siracusa wrote: > On 6/13/02 6:40 PM, Matt Sergeant wrote: > >> Does anyone know the logic behind making the threads modules all > >> lowercase? I'd expect it to be Threads::Shared, not threads::shared. > > > > Pragmas are lowercase. And use threads; is really a pragma. > > A pragma with class methods? A pragma that exports functions? Maybe I'm > confused about the distinction between a pragma and a module... It's a really fine line ;-) See also use fields. -- - Medi Montaseri [EMAIL PROTECTED] Unix Distributed Systems Engineer HTTP://www.CyberShell.com CyberShell Engineering -