Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
--- [EMAIL PROTECTED] wrote: Curtis, You make some good points. I will be leaving in about 10 minutes for a vacation, and wont be back until Monday, so if you wouldn't mind sending an email to the list Monday as a reminder, I will submit the code then. Thanks, David David, Just a reminder regarding posting your alternative to CGI.pm (and thanks to niko for reminding me to remind you :) Cheers, Curtis Ovid Poe = Ovid on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
Curtis, Thanks for the reminder, I'll get it up shortly after I get home from work. About 5:00pm Mountain Time. David - Original Message - From: Ovid [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, July 01, 2002 11:39 AM Subject: Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems --- [EMAIL PROTECTED] wrote: Curtis, You make some good points. I will be leaving in about 10 minutes for a vacation, and wont be back until Monday, so if you wouldn't mind sending an email to the list Monday as a reminder, I will submit the code then. Thanks, David David, Just a reminder regarding posting your alternative to CGI.pm (and thanks to niko for reminding me to remind you :) Cheers, Curtis Ovid Poe = Ovid on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
Picky, picky. :) You're right, my bad. use CGI; my $q = new CGI; my %params = $q-Vars; SR -Original Message- From: Felix Geerinckx [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 2:16 AM To: [EMAIL PROTECTED] Subject: RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems on Thu, 27 Jun 2002 02:54:10 GMT, [EMAIL PROTECTED] (Scot Robnett) wrote: Its pretty hard to make it more simple than: use Form; my %input = Form(); Let me try. use CGI; %params = $q-Vars; Try again. Your code throws the following error: Can't call method Vars on an undefined value ... -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
The difference is, the efficiency and data structure CGI.pm returns. Mine came to I think 72 times faster when not uploading images, and 2.5 times faster when uploading images. I'm not saying CGI.pm is written poorly or anything, I am saying that it is a little bit bloated and has a lot of functionality that is not needed (especially if the only thing you are doing with it is receiving input). Well personally, I've always used print Content-type:text/html\n\n; but somebody told me this was not the spec, so I read through the spec and looked up how CGI.pm was doing it and what I found was ${CRLF}${CRLF} as the \n\n replacement. I of coarse should have looked a little higher where they defined $CRLF, or at least tested what I had read before posting it, but oh well. From here on out, I'll stick with what I've known to work instead. Like I've said before, it doesn't make much sense to make a wrapper for CGI.pm so that I can have things the way I want them, because this is doubling the work necessary. I'm not making my lib to prove superior, or to say anything like mine is better. I have simply found a very positive solution for me (quick and in a structure that works well for me). If others like my solution, and it works well for them too, more power to them. I will post mine on CPAN, if nobody else in the world feels it is a good solution for them, that's just fine with me. If people like my solution, but have a few suggestions of how to improve it, I welcome that. One thing I am open to after posting my lib to CPAN is suggestions. I'm not exactly close minded here, I'm just the type of person who if I'm not perfectly happy with the way something works (whether programming or in the real world), I determine whether I can fix it, if I can I do. Because this lib puts the received values in a structure that I like to work with, in my mind it fixes things. David - Original Message - From: Todd Wade [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 26, 2002 11:12 PM Subject: CGI.pm v/s roll-your-own [WAS:] Displaying Problems [EMAIL PROTECTED] wrote in message 008d01c21c73$aa978a30$d381f6cc@david">news:008d01c21c73$aa978a30$d381f6cc@david... .. snip I'm sure I'll get lots of hate mail from CGI.pm die hard's, but my other choice is to just not Not trying to post hate mail, just reasoning on the subject. post this at all. What I hope for is several people telling me how to make it slightly more efficient or compatible with other OS's (you see I've only had opportunity to test it on Linux and Win2000, though I've been testing it on Linux for about 2 1/2 years). Lincoln Stein (the original author of CGI.pm) already has (lots of) people doing this for him, and his module has been maintained for around 10 years. Its been tested on scores of OS's. Ive read four of his books. There is a book dedicated to CGI.pm. My point is his module has been rigorously debugged and you are just now here asking people for help debugging yours. Its pretty hard to make it more simple than: use Form; my %input = Form(); But something else has already made it that easy. Im not knocking your module. Im just explaining why people like us trust people like Lincoln Stein's module over yours. For example, Ive seen alot of hand rolled CGI parameter parsers, most of them have a line that says: @pairs = split(//, $ENV{QUERY_STRING}); # WRONG!! This works when the user agent uses an as a delimeter, but some user agents use ; (a semicolon) which is perfectly valid. program chokes. Then people are in the newsgroups trying to get others to help track down a very, VERY difficult-to-track bug. But at the end of the post they say, I dont want to use CGI.pm! Floors me. Really floors me. And this is just one of several examples I've seen. So I know, when I say: print $q-header(); Its going to get it right. BTW, I find the source to CGI.pm very easy to read and makes alot of sence. Ive seen suggestions from you in this thread that are either wrong or wont even work. (What does this do- print Content-type: text/html${CRLF}${CRLF};) Which tells us again Mr. Stein has a thorough understanding of the HTTP protocol, while you stll have a little to learn. Again, this is NOT a flame. I suggest accepting the constructive criticism professionally. Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
You make a very good point fliptop, I did forget the nature of this mailing list. As far as CGI.pm debating, I will step down in this mailing list. David - Original Message - From: fliptop [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Bob Showalter [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 26, 2002 6:24 PM Subject: Re: Displaying Problems On Tue, 25 Jun 2002, [EMAIL PROTECTED] opined: : CGI.pm--a threat to our way of life! Down with the troglodytes! :) :Well, not exactly my point, but ok :) Just kidding :I just think there are too many who close their minds to anything but CGI.pm, :including potentially :more efficient customized solutions. i would guess that, for the purposes of this mailing list, most who recommend using CGI.pm do so because this list is aimed at beginners, and they most definitely should be using it to parse query strings. other available solutions, and the semantics of using them, probably wouldn't be a good place for a beginner to learn about cgi programming. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
my point stands :) So out of curiosity, what kind of data structure do you get back with this? If its as I would imagine, then its very close to my own. %hash = ( 'a_name' = 'value', # for single name value pairs 'b_name' = [multiple, values, for, this], # for single name muli-value sets 'c_name' = { 'original_name' = 'filename.jpg', 'size' = '23554', 'location' = '/tmp/fileupload/tmpfile-10028983-88.57.192.3-2783-298374-927837' } # for files ); Of coarse I know the image information is not in there the same way. David - Original Message - From: Scot Robnett [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Felix Geerinckx [EMAIL PROTECTED] Sent: Thursday, June 27, 2002 8:29 AM Subject: RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems Picky, picky. :) You're right, my bad. use CGI; my $q = new CGI; my %params = $q-Vars; SR -Original Message- From: Felix Geerinckx [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 2:16 AM To: [EMAIL PROTECTED] Subject: RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems on Thu, 27 Jun 2002 02:54:10 GMT, [EMAIL PROTECTED] (Scot Robnett) wrote: Its pretty hard to make it more simple than: use Form; my %input = Form(); Let me try. use CGI; %params = $q-Vars; Try again. Your code throws the following error: Can't call method Vars on an undefined value ... -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
I haven't seen the rest of your module, so I'm not so sure that the point really stands. It might. But, adding one line to initialize the CGI object is really not that big a deal considering the kind of power you have associated with that object. How much extra work do I have to do to utilize the keys and values in your hash vs. the CGI.pm hash? The data structure you get back from CGI.pm is: - Called in a scalar context, a tied hash reference. - Called in a list context, a standard hash containing key/value pairs. - Keys/params with multiple values are returned as a packed string separated by \0. Scot R. inSite -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 10:44 AM To: Scot Robnett; [EMAIL PROTECTED] Cc: Felix Geerinckx Subject: Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems my point stands :) So out of curiosity, what kind of data structure do you get back with this? If its as I would imagine, then its very close to my own. %hash = ( 'a_name' = 'value', # for single name value pairs 'b_name' = [multiple, values, for, this], # for single name muli-value sets 'c_name' = { 'original_name' = 'filename.jpg', 'size' = '23554', 'location' = '/tmp/fileupload/tmpfile-10028983-88.57.192.3-2783-298374-927837' } # for files ); Of coarse I know the image information is not in there the same way. David - Original Message - From: Scot Robnett [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Felix Geerinckx [EMAIL PROTECTED] Sent: Thursday, June 27, 2002 8:29 AM Subject: RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems Picky, picky. :) You're right, my bad. use CGI; my $q = new CGI; my %params = $q-Vars; SR -Original Message- From: Felix Geerinckx [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 2:16 AM To: [EMAIL PROTECTED] Subject: RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems on Thu, 27 Jun 2002 02:54:10 GMT, [EMAIL PROTECTED] (Scot Robnett) wrote: Its pretty hard to make it more simple than: use Form; my %input = Form(); Let me try. use CGI; %params = $q-Vars; Try again. Your code throws the following error: Can't call method Vars on an undefined value ... -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
by the way, :) is a smiley, it means I'm joking with you. (reference the last email) With mine, there is nothing beyond what I described. The hash structure I gave you below, that's it. Form.pm takes the input, makes a hash with it, and if you understand how to use a hash and array ref, your set. Its just a hash, no objects, no functions, just a hash. So you use: use Form.pm my %input = Form(); and your done. All the data is sitting in the hash %input. You can at that point do anything you want to with it. Like I say, simple and efficient. If you decide you want to know what you are getting from the cgi input, simply do something to this effect: --- foreach $key(keys(%input)){ # loop through all of the hash elements if (ref($input{$key}) eq ARRAY){ # if this is an array ref local $ = ', '; # change the array delimiter to , temporarily for display print qq^\@{\$input{$key}} = (@{$input{$key}})\n^; # print out the array's values # (make it easy to see which name in the hash this array belongs to) } else { # if its not an array ref print qq^\$input{$key} = $input{$key}\n^; # print out the hash element } } --- Anyway, you will be able to get a closer look at it within a months time if you so choose. David - Original Message - From: Scot Robnett [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 27, 2002 10:03 AM Subject: RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems I haven't seen the rest of your module, so I'm not so sure that the point really stands. It might. But, adding one line to initialize the CGI object is really not that big a deal considering the kind of power you have associated with that object. How much extra work do I have to do to utilize the keys and values in your hash vs. the CGI.pm hash? The data structure you get back from CGI.pm is: - Called in a scalar context, a tied hash reference. - Called in a list context, a standard hash containing key/value pairs. - Keys/params with multiple values are returned as a packed string separated by \0. Scot R. inSite -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 10:44 AM To: Scot Robnett; [EMAIL PROTECTED] Cc: Felix Geerinckx Subject: Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems my point stands :) So out of curiosity, what kind of data structure do you get back with this? If its as I would imagine, then its very close to my own. %hash = ( 'a_name' = 'value', # for single name value pairs 'b_name' = [multiple, values, for, this], # for single name muli-value sets 'c_name' = { 'original_name' = 'filename.jpg', 'size' = '23554', 'location' = '/tmp/fileupload/tmpfile-10028983-88.57.192.3-2783-298374-927837' } # for files ); Of coarse I know the image information is not in there the same way. David - Original Message - From: Scot Robnett [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Felix Geerinckx [EMAIL PROTECTED] Sent: Thursday, June 27, 2002 8:29 AM Subject: RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems Picky, picky. :) You're right, my bad. use CGI; my $q = new CGI; my %params = $q-Vars; SR -Original Message- From: Felix Geerinckx [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 2:16 AM To: [EMAIL PROTECTED] Subject: RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems on Thu, 27 Jun 2002 02:54:10 GMT, [EMAIL PROTECTED] (Scot Robnett) wrote: Its pretty hard to make it more simple than: use Form; my %input = Form(); Let me try. use CGI; %params = $q-Vars; Try again. Your code throws the following error: Can't call method Vars on an undefined value ... -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
After all, Hubris is one of St. Larry's Three Cardinal Virtues! So this seems to me to be a properly Perl-ish attitude. - John --- [EMAIL PROTECTED] wrote: ... minded here, I'm just the type of person who if I'm not perfectly happy with the way something works (whether programming or in the real world), I determine whether I can fix it, if I can I do. = Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
That actually has nothing to do with it. It has everything to do with the strong desire to improve circumstances, be innovative, make the world a better place. If you want to call me arrogant for trying to improve my surroundings, go right ahead, but your tacking the wrong name on me. David - Original Message - From: John Brooking [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Todd Wade [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 27, 2002 12:57 PM Subject: Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems After all, Hubris is one of St. Larry's Three Cardinal Virtues! So this seems to me to be a properly Perl-ish attitude. - John --- [EMAIL PROTECTED] wrote: ... minded here, I'm just the type of person who if I'm not perfectly happy with the way something works (whether programming or in the real world), I determine whether I can fix it, if I can I do. = Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
True. Whew, my hand hurts from all that extra typing. ;) Scot R. -Original Message- From: John Brooking [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 1:50 PM To: Scot Robnett; [EMAIL PROTECTED] Cc: Felix Geerinckx Subject: RE: CGI.pm v/s roll-your-own [WAS:] Displaying Problems See?! Your version just expanded by 50% !! ;-) --- Scot Robnett [EMAIL PROTECTED] wrote: Picky, picky. :) You're right, my bad. use CGI; my $q = new CGI; my %params = $q-Vars; = Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
Oh, dear, I was afraid that that message might be misinterpreted! I thought my humor was evident enough by the informal language, but I guess I should have put a smiley on it too. I didn't mean hubris in a bad sense. The sense I get from Larry's use of it (from reading the Camel book), and the sense I meant here, was having enough self-confidence to believe that you *can* do all the things you mention, rather than just putting up with what is handed to you because you're too humble to think that little old you could do better. It might tend towards arrogance in some cases, maybe, especially when unwarranted by the actual talent behind it, but true arrogance connotes more negative personality traits, such as not being open to other points of view or debate, and that's *not* what I meant. I did assume familiarity with Larry's philosophy of Laziness, Impatience, and Hubris as The Basis of All Good Software Design, and maybe I shouldn't have. I'd quote some of this from the Camel book, but I don't have it with me. I would summarize it as good programmers don't like write the same thing over and over, yet if they don't like something they got elsewhere, they'll write something themselves that they like better. I suspect he intentionally chose provocative words to get people's attention, but his claim that they lead to good software design implies that far from being bad traits, he thinks that they are actually good traits, properly applied. I apologize that my message was taken negatively. I meant it positively. I support the spirit of your effort. - John --- [EMAIL PROTECTED] wrote: That actually has nothing to do with it. It has everything to do with the strong desire to improve circumstances, be innovative, make the world a better place. If you want to call me arrogant for trying to improve my surroundings, go right ahead, but your tacking the wrong name on me. David - Original Message - From: John Brooking [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Todd Wade [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 27, 2002 12:57 PM Subject: Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems After all, Hubris is one of St. Larry's Three Cardinal Virtues! So this seems to me to be a properly Perl-ish attitude. - John = Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
No offence taken, I have heard the word hubris before, but I wasn't certain of the meaning, so naturally I looked it up (now that you mention it, I have heard that quote out of the Camel book before). At first I thought it was a compliment the way you said it and all, but after seeing dictionary.com's definition, I wondered. Well thank you for the compliment. David - Original Message - From: John Brooking [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 27, 2002 3:39 PM Subject: Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems Oh, dear, I was afraid that that message might be misinterpreted! I thought my humor was evident enough by the informal language, but I guess I should have put a smiley on it too. I didn't mean hubris in a bad sense. The sense I get from Larry's use of it (from reading the Camel book), and the sense I meant here, was having enough self-confidence to believe that you *can* do all the things you mention, rather than just putting up with what is handed to you because you're too humble to think that little old you could do better. It might tend towards arrogance in some cases, maybe, especially when unwarranted by the actual talent behind it, but true arrogance connotes more negative personality traits, such as not being open to other points of view or debate, and that's *not* what I meant. I did assume familiarity with Larry's philosophy of Laziness, Impatience, and Hubris as The Basis of All Good Software Design, and maybe I shouldn't have. I'd quote some of this from the Camel book, but I don't have it with me. I would summarize it as good programmers don't like write the same thing over and over, yet if they don't like something they got elsewhere, they'll write something themselves that they like better. I suspect he intentionally chose provocative words to get people's attention, but his claim that they lead to good software design implies that far from being bad traits, he thinks that they are actually good traits, properly applied. I apologize that my message was taken negatively. I meant it positively. I support the spirit of your effort. - John --- [EMAIL PROTECTED] wrote: That actually has nothing to do with it. It has everything to do with the strong desire to improve circumstances, be innovative, make the world a better place. If you want to call me arrogant for trying to improve my surroundings, go right ahead, but your tacking the wrong name on me. David - Original Message - From: John Brooking [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Todd Wade [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 27, 2002 12:57 PM Subject: Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems After all, Hubris is one of St. Larry's Three Cardinal Virtues! So this seems to me to be a properly Perl-ish attitude. - John = Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems
On Thu, 27 Jun 2002, [EMAIL PROTECTED] opined: :With mine, there is nothing beyond what I described. The hash structure I gave you :below, that's :it. Form.pm takes the input, makes a hash with it, and if you understand how to use :a hash and :array ref, your set. Its just a hash, no objects, no functions, just a hash. : :So you use: : :use Form.pm :my %input = Form(); : :and your done. All the data is sitting in the hash %input. You can at that point do :anything you :want to with it. : :Like I say, simple and efficient. can you limit upload sizes? can you disable uploads altogether? how does it handle errors, especially during file uploads? can you exclude undefined parameters from the parameter list? does it have a debug mode? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Templates v/s CGI.pm [WAS:] Displaying Problems
Kyle Babich [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ... bunch of code snipped here . -bgcolor = \#00, -align = center}, Font({ -face = Verdana, Arial, Times New Roman, -size = 4, -color = \#FF}, IMAP.cc ) ),),),),),),),), ^^^ this ^^^ means its time for a template. for all out in beginners land =0) I do suggest it (CGI.pm) for one offs, or prototypes, or maybe even when defining subs that return marked up data, but its a nightmare to maintain Just a suggestion for anyone's code I may be editing ;0) Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
On Tue, 25 Jun 2002, [EMAIL PROTECTED] opined: : CGI.pm--a threat to our way of life! Down with the troglodytes! :) :Well, not exactly my point, but ok :) Just kidding :I just think there are too many who close their minds to anything but CGI.pm, :including potentially :more efficient customized solutions. i would guess that, for the purposes of this mailing list, most who recommend using CGI.pm do so because this list is aimed at beginners, and they most definitely should be using it to parse query strings. other available solutions, and the semantics of using them, probably wouldn't be a good place for a beginner to learn about cgi programming. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
On Tue, 25 Jun 2002, Kyle Babich wrote: Ok, I did like perldoc cgi said and changed it to this: print start_html( -title = IMAP.cc, -head = Link( { -rel = stylesheet, -type = text/css, -href = style.css, } ), -bgcolor = \#FF ), It still won't work though. Kyle: 1. Are you able to execute *other* cgi scripts from this directory? Check your server's configuration. 2. Does this script have the permissions set correctly? The file itself must be executable before the Web server (i.e., mod_cgi) will execute the script. 3. Is the filename-extension correct to enable the server to recognize it as executable? (e.g., '.cgi' vs '.pl') 4. Did you tell the OS how to execute this script? (e.g., #!/usr/bin/perl) -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Displaying Problems
For the following the syntax is correct but when I try to open it nothing displays, what should I change? #!/usr/bin/perl -wT use strict; use CGI::Pretty qw/ :standard /; $CGI::DISABLE_UPLOADS = 1; $CGI::POST_MAX = 512 * 1024; print header ( text/html ); my $date = localtime; my $c = param('c'); my $content = c; if ($c eq h) { $content = qq{\n}; } elsif ($c eq eh) { $content = qq{\n}; } elsif ($c eq hd) { $content = qq{\n}; } elsif ($c eq p) { $content = qq{\n}; } elsif ($c eq c) { $content = qq{\n}; } elsif ($c eq su) { $content = qq{\n}; } my @nav = (Home,E-Mail Hosting,Help Desk,Policies,Contact,Signup); my @loc = (index.cgi?c=h,index.cgi?c=eh,index.cgi?c=hd,index.cgi? c=p, index.cgi?c=c,index.cgi?c=su); print start_html( -title = IMAP.cc E-Mail Hosting, -head = Link( { -rel = stylesheet, -type = text/css, -href = style.css } ), ), body( -bgcolor = \#FF ), table({ -width = 95\%, -cellspacing = 0, -cellpadding = 0, -border = 1, -bordercolor = \#00}, tbody( Tr( td( {-width = 100\%}, table({ -width = 100\%, -cellspacing = 0, -cellpadding = 1, -border = 1, -bordercolor = \#00 -align = center}, tbody( Tr( td( {-width = 100\%, -bgcolor = \#00, -align = center}, Font({ -face = Verdana, Arial, Times New Roman, -size = 4, -color = \#FF}, IMAP.cc ) ),),),),),),),), end_html -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Displaying Problems
-Original Message- From: Kyle Babich [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 4:09 PM To: [EMAIL PROTECTED] Subject: Displaying Problems For the following the syntax is correct but when I try to open it nothing displays, what should I change? There are some errors. The following patch shows what I had to change to make it run: 3c3 use CGI::Pretty qw/ :standard /; --- use CGI::Pretty qw/ :standard tbody /; 60c60 -bordercolor = \#00 --- -bordercolor = \#00, 67c67 Font({ --- font({ #!/usr/bin/perl -wT use strict; use CGI::Pretty qw/ :standard /; $CGI::DISABLE_UPLOADS = 1; $CGI::POST_MAX = 512 * 1024; print header ( text/html ); my $date = localtime; my $c = param('c'); my $content = c; if ($c eq h) { $content = qq{\n}; } elsif ($c eq eh) { $content = qq{\n}; } elsif ($c eq hd) { $content = qq{\n}; } elsif ($c eq p) { $content = qq{\n}; } elsif ($c eq c) { $content = qq{\n}; } elsif ($c eq su) { $content = qq{\n}; } my @nav = (Home,E-Mail Hosting,Help Desk,Policies,Contact,Signup); my @loc = (index.cgi?c=h,index.cgi?c=eh,index.cgi?c=hd,index.cgi? c=p, index.cgi?c=c,index.cgi?c=su); print start_html( -title = IMAP.cc E-Mail Hosting, -head = Link( { -rel = stylesheet, -type = text/css, -href = style.css } ), ), body( -bgcolor = \#FF ), table({ -width = 95\%, -cellspacing = 0, -cellpadding = 0, -border = 1, -bordercolor = \#00}, tbody( Tr( td( {-width = 100\%}, table({ -width = 100\%, -cellspacing = 0, -cellpadding = 1, -border = 1, -bordercolor = \#00 -align = center}, tbody( Tr( td( {-width = 100\%, -bgcolor = \#00, -align = center}, Font({ -face = Verdana, Arial, Times New Roman, -size = 4, -color = \#FF}, IMAP.cc ) ),),),),),),),), end_html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
Kyle, Well, I'd start by printing an actual content type instead of depending on CGI.pm for that: --- print content-type: text/html\n\n; --- Second, I would condense your if to this --- my $c = param('c'); my $content = $c; $content = \n if ($c eq h or $c eq eh or $c eq hd or $c eq p or $c eq c or $c eq su); --- Then I would HIGHLY recommend that you not depend on CGI.pm so heavily. I would suggest you print out your own html, then you can see exactly what it is displaying and know what to change. If you wanted to print it all in one clump, you could do it like this. --- # the qq^ makes it use ^ as the quote. Just make sure if you us a ^ inside that you escape it (like this \^ ) print qq^ html head title$thetitle/title /head body bgcolor=#FF !-- the rest of your html goes in here -- /body /html ^; --- Trust me on this one, it will save you so much headache if you will just print your own html. Regards, David - Original Message - From: Kyle Babich [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 24, 2002 2:09 PM Subject: Displaying Problems For the following the syntax is correct but when I try to open it nothing displays, what should I change? #!/usr/bin/perl -wT use strict; use CGI::Pretty qw/ :standard /; $CGI::DISABLE_UPLOADS = 1; $CGI::POST_MAX = 512 * 1024; print header ( text/html ); my $date = localtime; my $c = param('c'); my $content = c; if ($c eq h) { $content = qq{\n}; } elsif ($c eq eh) { $content = qq{\n}; } elsif ($c eq hd) { $content = qq{\n}; } elsif ($c eq p) { $content = qq{\n}; } elsif ($c eq c) { $content = qq{\n}; } elsif ($c eq su) { $content = qq{\n}; } my @nav = (Home,E-Mail Hosting,Help Desk,Policies,Contact,Signup); my @loc = (index.cgi?c=h,index.cgi?c=eh,index.cgi?c=hd,index.cgi? c=p, index.cgi?c=c,index.cgi?c=su); print start_html( -title = IMAP.cc E-Mail Hosting, -head = Link( { -rel = stylesheet, -type = text/css, -href = style.css } ), ), body( -bgcolor = \#FF ), table({ -width = 95\%, -cellspacing = 0, -cellpadding = 0, -border = 1, -bordercolor = \#00}, tbody( Tr( td( {-width = 100\%}, table({ -width = 100\%, -cellspacing = 0, -cellpadding = 1, -border = 1, -bordercolor = \#00 -align = center}, tbody( Tr( td( {-width = 100\%, -bgcolor = \#00, -align = center}, Font({ -face = Verdana, Arial, Times New Roman, -size = 4, -color = \#FF}, IMAP.cc ) ),),),),),),),), end_html -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Displaying Problems
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 10:26 AM To: Kyle Babich; [EMAIL PROTECTED] Subject: Re: Displaying Problems Kyle, Well, I'd start by printing an actual content type instead of depending on CGI.pm for that: --- print content-type: text/html\n\n; Except that that's not RFC2616-compliant, while CGI.pm's output is. Most browsers will accept this, but you still shouldn't generate it. ... Then I would HIGHLY recommend that you not depend on CGI.pm so heavily. I would suggest you print out your own html, then you can see exactly what it is displaying and know what to change. I fail to see how writing code with errors is somehow CGI.pm's fault. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
Bob, I fail to see how writing code with errors is somehow CGI.pm's fault No its not. But I'll tell you one thing, people who depend so heavily on CGI.pm generally have a good understanding of how to use CGI.pm, but have less understanding of what is really going on. Me personally, I want to know what's really happening. And once I get to that point, not only can I become more efficient, but I can make better decisions for my own application. You see, just like sterio-typing can frequently be incorrect (because it uses blanket statements), CGI.pm is not the most efficient and for that matter appropriate for many situations. Except that that's not RFC2616-compliant, while CGI.pm's output is So what exactly is the RFC2616 compliant content type? You know its funny, but it seems that so many who stick up for CGI.pm so strongly are quick to say that CGI.pm is doing things right and that it does them better, but they seem to purposely avoid giving the actual solution. It seems to me that our way of life (freedom and prosperity) came about from people thinking for them selves and from innovation, learning and continued drive to improve what was given us. I do a little system admin on the side, and I've come to find that learning the actual conf files is such a boon over simply using the GUI app. So much understanding has come and it takes me to a more advanced level. Many times I can discover a problem, or have understanding of the underlying problem when coming across things I don't expect. In my mind programming is the same. I want to know what's going on, so I can make a wise and educated decision of how to approach it. David - Original Message - From: Bob Showalter [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 25, 2002 8:39 AM Subject: RE: Displaying Problems -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 10:26 AM To: Kyle Babich; [EMAIL PROTECTED] Subject: Re: Displaying Problems Kyle, Well, I'd start by printing an actual content type instead of depending on CGI.pm for that: --- print content-type: text/html\n\n; Except that that's not RFC2616-compliant, while CGI.pm's output is. Most browsers will accept this, but you still shouldn't generate it. ... Then I would HIGHLY recommend that you not depend on CGI.pm so heavily. I would suggest you print out your own html, then you can see exactly what it is displaying and know what to change. I fail to see how writing code with errors is somehow CGI.pm's fault. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Displaying Problems
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 11:12 AM To: Bob Showalter; [EMAIL PROTECTED] Subject: Re: Displaying Problems Bob, ... So what exactly is the RFC2616 compliant content type? cf. ftp://ftp.isi.edu/in-notes/rfc2616.txt, section 2.2 You know its funny, but it seems that so many who stick up for CGI.pm so strongly are quick to say that CGI.pm is doing things right and that it does them better, but they seem to purposely avoid giving the actual solution. See above. It seems to me that our way of life (freedom and prosperity) came about from people thinking for them selves and from innovation, learning and continued drive to improve what was given us. I do a little system admin on the side, and I've come to find that learning the actual conf files is such a boon over simply using the GUI app. So much understanding has come and it takes me to a more advanced level. Many times I can discover a problem, or have understanding of the underlying problem when coming across things I don't expect. In my mind programming is the same. I want to know what's going on, so I can make a wise and educated decision of how to approach it. CGI.pm--a threat to our way of life! Down with the troglodytes! :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
Bob, CGI.pm--a threat to our way of life! Down with the troglodytes! :) Well, not exactly my point, but ok :) Just kidding I just think there are too many who close their minds to anything but CGI.pm, including potentially more efficient customized solutions. David - Original Message - From: Bob Showalter [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 25, 2002 9:33 AM Subject: RE: Displaying Problems -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 11:12 AM To: Bob Showalter; [EMAIL PROTECTED] Subject: Re: Displaying Problems Bob, ... So what exactly is the RFC2616 compliant content type? cf. ftp://ftp.isi.edu/in-notes/rfc2616.txt, section 2.2 You know its funny, but it seems that so many who stick up for CGI.pm so strongly are quick to say that CGI.pm is doing things right and that it does them better, but they seem to purposely avoid giving the actual solution. See above. It seems to me that our way of life (freedom and prosperity) came about from people thinking for them selves and from innovation, learning and continued drive to improve what was given us. I do a little system admin on the side, and I've come to find that learning the actual conf files is such a boon over simply using the GUI app. So much understanding has come and it takes me to a more advanced level. Many times I can discover a problem, or have understanding of the underlying problem when coming across things I don't expect. In my mind programming is the same. I want to know what's going on, so I can make a wise and educated decision of how to approach it. CGI.pm--a threat to our way of life! Down with the troglodytes! :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
Well, I still can't get my page to display. Quoting [EMAIL PROTECTED]: Ok, so here's the deal: Some HTTP/1.0 software has interpreted a Content-Type header without charset parameter incorrectly to mean recipient should guess. Senders wishing to defeat this behavior MAY include a charset parameter even when the charset is ISO-8859-1 and SHOULD do so when it is known that it will not confuse the recipient. By the way, I did not upper case the MAY and SHOULD, those were that way in the doc which means they were trying to emphasize them. I'd have to say that MAY doesn't suggest that it is a requirement for the content-type to work properly. David - Original Message - From: Bob Showalter [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 25, 2002 9:33 AM Subject: RE: Displaying Problems -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 11:12 AM To: Bob Showalter; [EMAIL PROTECTED] Subject: Re: Displaying Problems Bob, ... So what exactly is the RFC2616 compliant content type? cf. ftp://ftp.isi.edu/in-notes/rfc2616.txt, section 2.2 You know its funny, but it seems that so many who stick up for CGI.pm so strongly are quick to say that CGI.pm is doing things right and that it does them better, but they seem to purposely avoid giving the actual solution. See above. It seems to me that our way of life (freedom and prosperity) came about from people thinking for them selves and from innovation, learning and continued drive to improve what was given us. I do a little system admin on the side, and I've come to find that learning the actual conf files is such a boon over simply using the GUI app. So much understanding has come and it takes me to a more advanced level. Many times I can discover a problem, or have understanding of the underlying problem when coming across things I don't expect. In my mind programming is the same. I want to know what's going on, so I can make a wise and educated decision of how to approach it. CGI.pm--a threat to our way of life! Down with the troglodytes! :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - This mail sent through IMP: http://horde.org/imp/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Displaying Problems
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 12:47 PM To: Bob Showalter; [EMAIL PROTECTED] Subject: Re: Displaying Problems Ok, so here's the deal: Some HTTP/1.0 software has interpreted a Content-Type header without charset parameter incorrectly to mean recipient should guess. Senders wishing to defeat this behavior MAY include a charset parameter even when the charset is ISO-8859-1 and SHOULD do so when it is known that it will not confuse the recipient. By the way, I did not upper case the MAY and SHOULD, those were that way in the doc which means they were trying to emphasize them. I'd have to say that MAY doesn't suggest that it is a requirement for the content-type to work properly. This is the relevant paragraph from 2.2 that I was going for: HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all protocol elements except the entity-body (see appendix 19.3 for tolerant applications). The end-of-line marker within an entity-body is defined by its associated media type, as described in section 3.7. Appendix 19.3 (Tolerant Applications) says, in part: The line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR. But, section 3.7 says: When in canonical form, media subtypes of the text type use CRLF as the text line break. HTTP relaxes this requirement and allows the transport of text media with plain CR or LF alone representing a line break when it is done consistently for an entire entity-body. HTTP applications MUST accept CRLF, bare CR, and bare LF as being representative of a line break in text media received via HTTP. In addition, if the text is represented in a character set that does not use octets 13 and 10 for CR and LF respectively, as is the case for some multi-byte character sets, HTTP allows the use of whatever octet sequences are defined by that character set to represent the equivalent of CR and LF for line breaks. This flexibility regarding line breaks applies only to text media in the entity-body; a bare CR or LF MUST NOT be substituted for CRLF within any of the HTTP control structures (such as header fields and multipart boundaries). Note especially the last sentence. A nit-pick, to be sure. But little things like this cause programs to break all the time. Like I said, most (maybe all?) clients will accept what you wrote, but why not stick to the standard? Or, save all the trouble of grovelling through the RFC's and: print $q-header; Cheers. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
Hmm, a perl syntax checks out, but the script seemingly dies when ran? One thing I've found and don't yet fully understand, is it seems like when importing other modules the perl check doesn't seem to catch undeclared subs despite use strict- any ideas? Either way, I digress- basic things but, A) I'd check the webserver logs- usually theres some info in there at least of what happened, B) and I'd try running the script via the terminal- it'll require a little bit of modification to it (aka, hardcode $c to a value for testing), but I've used it time and time again to find exactly how and where a script that has passed syntax checking is doing something that leads to its death... On a seperate note- I'd tend to agree with the other poster- while the CGI module is indispensible, it seems like some parts of it are overkill- a base example would be existance of a paragraph method- a method that returns a 'p'. Either way, good luck with it. ~Brian On Monday 24 June 2002 15:09, Kyle Babich wrote For the following the syntax is correct but when I try to open it nothing displays, what should I change? #!/usr/bin/perl -wT use strict; use CGI::Pretty qw/ :standard /; $CGI::DISABLE_UPLOADS = 1; $CGI::POST_MAX = 512 * 1024; print header ( text/html ); my $date = localtime; my $c = param('c'); my $content = c; if ($c eq h) { $content = qq{\n}; } elsif ($c eq eh) { $content = qq{\n}; } elsif ($c eq hd) { $content = qq{\n}; } elsif ($c eq p) { $content = qq{\n}; } elsif ($c eq c) { $content = qq{\n}; } elsif ($c eq su) { $content = qq{\n}; } my @nav = (Home,E-Mail Hosting,Help Desk,Policies,Contact,Signup); my @loc = (index.cgi?c=h,index.cgi?c=eh,index.cgi?c=hd,index.cgi? c=p, index.cgi?c=c,index.cgi?c=su); print start_html( -title = IMAP.cc E-Mail Hosting, -head = Link( { -rel = stylesheet, -type = text/css, -href = style.css } ), ), body( -bgcolor = \#FF ), table({ -width = 95\%, -cellspacing = 0, -cellpadding = 0, -border = 1, -bordercolor = \#00}, tbody( Tr( td( {-width = 100\%}, table({ -width = 100\%, -cellspacing = 0, -cellpadding = 1, -border = 1, -bordercolor = \#00 -align = center}, tbody( Tr( td( {-width = 100\%, -bgcolor = \#00, -align = center}, Font({ -face = Verdana, Arial, Times New Roman, -size = 4, -color = \#FF}, IMAP.cc ) ),),),),),),),), end_html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using CGI.pm [WAS Re: Displaying Problems]
I tend to always use CGI.pm to get the parameters, but I may or may not use it to output HTML. If it's simple HTML, I will, because it's easier and safer, but if it's complicated, like a lot of JavaScript in the header, or for most form input controls, I just use print statements, either normal ones for one or two lines, or the END form for larger sections. The other day I found myself using mostly one large END statement, with variables embedded to insert the results that I had calculated earlier. At some point, I realized I was approaching the concept used by HTML::Template, except that I had both code and presentation in one source file rather than splitting it. Different techniques for different situations. - John = Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
Bob, That's interesting. You know, I work with about 5 other perl programmers, most of which do use CGI.pm, but none of them use it for anything other that gathering input from the web. I have also downloaded many packages from CPAN, I would say a majority of them use CGI.pm, but very rarely do I see it used for anything but gathering data. I'm not suggesting we shouldn't follow the standard. I am suggesting that this particular standard will never be enforced, because if it was, I'd be willing to bet, it would break a great percentage of perl scripts out there. But yes, I agree with you that we should all try to follow the specs pretty closely. Anyway, personally, I don't use CGI.pm at all, and it would be a real shame if I began including the whole thing just for that. It would just seem smarter for me to begin using this print Content-type: text/html${CRLF}${CRLF}; instead. I created a lib for receiving data from GET, POST or shell. I will be releasing it to CPAN soon, and expect to get this sort of thing quite a bit. That is good, because I want my lib to be very efficient and proper. The reason I wrote my own is because I like my variables in a easy to use structure: %hash = ( 'a_name' = 'value', # for single name value pairs 'b_name' = [multiple, values, for, this], # for single name muli-value sets 'c_name' = { 'original_name' = 'filename.jpg', 'size' = '23554', 'location' = '/tmp/fileupload/tmpfile-10028983-88.57.192.3-2783-298374-927837' } # for files ); With this structure, I can get to everything very easily. It didn't make much sense to use CGI.pm to gather the data, smush it into a data structure, only to loop through all the data and shove it into another structure. I'm sure I'll get lots of hate mail from CGI.pm die hard's, but my other choice is to just not post this at all. What I hope for is several people telling me how to make it slightly more efficient or compatible with other OS's (you see I've only had opportunity to test it on Linux and Win2000, though I've been testing it on Linux for about 2 1/2 years). Its pretty hard to make it more simple than: use Form; my %input = Form(); David - Original Message - From: Bob Showalter [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 25, 2002 11:12 AM Subject: RE: Displaying Problems -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 12:47 PM To: Bob Showalter; [EMAIL PROTECTED] Subject: Re: Displaying Problems Ok, so here's the deal: Some HTTP/1.0 software has interpreted a Content-Type header without charset parameter incorrectly to mean recipient should guess. Senders wishing to defeat this behavior MAY include a charset parameter even when the charset is ISO-8859-1 and SHOULD do so when it is known that it will not confuse the recipient. By the way, I did not upper case the MAY and SHOULD, those were that way in the doc which means they were trying to emphasize them. I'd have to say that MAY doesn't suggest that it is a requirement for the content-type to work properly. This is the relevant paragraph from 2.2 that I was going for: HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all protocol elements except the entity-body (see appendix 19.3 for tolerant applications). The end-of-line marker within an entity-body is defined by its associated media type, as described in section 3.7. Appendix 19.3 (Tolerant Applications) says, in part: The line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR. But, section 3.7 says: When in canonical form, media subtypes of the text type use CRLF as the text line break. HTTP relaxes this requirement and allows the transport of text media with plain CR or LF alone representing a line break when it is done consistently for an entire entity-body. HTTP applications MUST accept CRLF, bare CR, and bare LF as being representative of a line break in text media received via HTTP. In addition, if the text is represented in a character set that does not use octets 13 and 10 for CR and LF respectively, as is the case for some multi-byte character sets, HTTP allows the use of whatever octet sequences are defined by that character set to represent the equivalent of CR and LF for line breaks. This flexibility regarding line breaks applies only to text media in the entity-body; a bare CR or LF MUST NOT be substituted for CRLF within any of the HTTP control structures (such as header fields and multipart boundaries). Note especially the last sentence. A nit-pick, to be sure. But little things like this cause programs to break all the time. Like I said, most (maybe
Re: Displaying Problems
On Tue, Jun 25, 2002 at 12:10:34PM -0600, [EMAIL PROTECTED] wrote: You know, I work with about 5 other perl programmers, most of which do use CGI.pm, but none of them use it for anything other that gathering input from the web. I have also downloaded many packages from CPAN, I would say a majority of them use CGI.pm, but very rarely do I see it used for anything but gathering data. ah yes, I also use CGI.pm only to gather the input data as I'm afraid my own method will break somewhere. :o So, it's kinda of waste to use a big module for a simple task. Instead of using CGI.pm to construct HTML, i'm using CGI::FastTemplate which is more efficient and neater to use. I created a lib for receiving data from GET, POST or shell. I will be releasing it to CPAN soon, and expect to get this sort of thing quite a bit. That is good, because I want my lib to be very efficient and proper. The reason I wrote my own is because I like my variables in a easy to use structure: I'm looking forward to this module to replace my CGI.pm :) With this structure, I can get to everything very easily. It didn't make much sense to use CGI.pm to gather the data, smush it into a data structure, only to loop through all the data and shove it into another structure. Yes, it's a pity regards, niko -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying Problems
Ok, I did like perldoc cgi said and changed it to this: print start_html( -title = IMAP.cc, -head = Link( { -rel = stylesheet, -type = text/css, -href = style.css, } ), -bgcolor = \#FF ), It still won't work though. - Original Message - From: Bob Showalter [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 25, 2002 1:23 PM Subject: RE: Displaying Problems -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 1:05 PM To: [EMAIL PROTECTED] Subject: Re: Displaying Problems Well, I still can't get my page to display. Remove this line: body( -bgcolor = \#Ff ), It's emitting a body/body sequence. start_html opens the body tag and end_html closes it, so you don't need this. bgcolor should be passed to start_html. Read the docs. perldoc CGI. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]