[29112] in Perl-Users-Digest
Perl-Users Digest, Issue: 356 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 18 21:10:11 2007
Date: Wed, 18 Apr 2007 18:09:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 18 Apr 2007 Volume: 11 Number: 356
Today's topics:
Any Help? Stuck trying to create cgi perl program shadkeene@hotmail.com
Re: Any Help? Stuck trying to create cgi perl program <joe@inwap.com>
Re: Any Help? Stuck trying to create cgi perl program shadkeene@hotmail.com
Re: Any Help? Stuck trying to create cgi perl program <bik.mido@tiscalinet.it>
Re: Any Help? Stuck trying to create cgi perl program <noreply@invalid.net>
Re: Error connecting to remote database <joe@inwap.com>
Re: Error connecting to remote database <nikos1337@gmail.com>
Re: FAQ 9.20 How do I send mail? <hjp-usenet2@hjp.at>
Re: How can I use wget to get the result of jsp page <ysongfinance@gmail.com>
Re: How can I use wget to get the result of jsp page <bik.mido@tiscalinet.it>
Re: is laziness a programer's virtue? <duane@franz.com>
Re: is laziness a programer's virtue? <ken@theoryyalgebra.com>
Re: Question to B::Deparse <bik.mido@tiscalinet.it>
Server For Rent? Where? <nikos1337@gmail.com>
Re: Server For Rent? Where? <someone@example.com>
Re: Server For Rent? Where? <jurgenex@hotmail.com>
Re: Server For Rent? Where? <edMbj@aes-intl.com>
Re: Server For Rent? Where? <bik.mido@tiscalinet.it>
Re: UTF16 input file to ISO-8859-1 output <joe@inwap.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Apr 2007 12:02:35 -0700
From: shadkeene@hotmail.com
Subject: Any Help? Stuck trying to create cgi perl program
Message-Id: <1176922955.564324.19880@b75g2000hsg.googlegroups.com>
Hi,
I've been learning perl/html while creating a program where the user
fills out textboxes and checkboxes while the program places the values
from the text and checkboxes into a .csv file. However, I want all
columns in the .csv file to correspond to the same text/checkbox each
time the user fills out the form so it's easy to run graphs and such
through excel. The problem is, if a checkbox isn't checked, no value
is returned and the column in the .csv file is only filled in if the
user checks the box, resulting in a row of 12 columns one day and 8
columns the next depending on how many boxes are checked. I want a
blank or zero in the .csv column if the user doesn't fill out the
checkbox...that way there is the same number of columns filled out in
the .csv file each time the form is filled out and submitted...and
equally important, the same column corresponds to the same checkbox
each time the form is submitted.
Sorry if this is vague...the code is at work and I'm at home...just
wondering if the above can be done and if I'm going about this the
best way possible....goal is to create statistics from the form data
that folks submit. I'll post the short code tomorrow if necessary.
Thanks for any help.
------------------------------
Date: Wed, 18 Apr 2007 14:09:27 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Any Help? Stuck trying to create cgi perl program
Message-Id: <TaCdnaZFstJW57vbnZ2dnUVZ_hOdnZ2d@comcast.com>
shadkeene@hotmail.com wrote:
> Hi,
> I've been learning perl/html while creating a program where the user
> fills out textboxes and checkboxes while the program places the values
> from the text and checkboxes into a .csv file. However, I want all
> columns in the .csv file to correspond to the same text/checkbox each
> time the user fills out the form so it's easy to run graphs and such
> through excel. The problem is, if a checkbox isn't checked, no value
> is returned
That's trivial to fix. The CGI program should know the names of
all the allowable text/checkbox items. When it goes through the list
of returned items, it can supply a default value for anything that is
missing.
Since the browser and/or CGI parser may produce a list of returned
items in random order, you want to go through them in a specific
order before creating the CSV data.
@fields = qw(name addr1 addr2 phone zip box1 box2 box3);
push @output,$param{$_} || '""' for @fields;
-Joe
------------------------------
Date: 18 Apr 2007 14:53:32 -0700
From: shadkeene@hotmail.com
Subject: Re: Any Help? Stuck trying to create cgi perl program
Message-Id: <1176933212.738564.40000@d57g2000hsg.googlegroups.com>
On Apr 18, 2:09 pm, Joe Smith <j...@inwap.com> wrote:
> shadke...@hotmail.com wrote:
> > Hi,
> > I've been learning perl/html while creating a program where the user
> > fills out textboxes and checkboxes while the program places the values
> > from the text and checkboxes into a .csv file. However, I want all
> > columns in the .csv file to correspond to the same text/checkbox each
> > time the user fills out the form so it's easy to run graphs and such
> > through excel. The problem is, if a checkbox isn't checked, no value
> > is returned
>
> That's trivial to fix. The CGI program should know the names of
> all the allowable text/checkbox items. When it goes through the list
> of returned items, it can supply a default value for anything that is
> missing.
>
> Since the browser and/or CGI parser may produce a list of returned
> items in random order, you want to go through them in a specific
> order before creating the CSV data.
>
> @fields = qw(name addr1 addr2 phone zip box1 box2 box3);
> push @output,$param{$_} || '""' for @fields;
>
> -Joe
Thanks Joe...yeah, I'm a beginner but saw this forum had more
activity, so I posted here. I'll give it a go and let you know how it
goes. Thanks again for such a quick answer,
Shad
------------------------------
Date: Wed, 18 Apr 2007 23:58:23 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Any Help? Stuck trying to create cgi perl program
Message-Id: <d05d23l9mlkjn79a91vna1u5ktrp8qlqtr@4ax.com>
On 18 Apr 2007 14:53:32 -0700, shadkeene@hotmail.com wrote:
>Thanks Joe...yeah, I'm a beginner but saw this forum had more
>activity, so I posted here. I'll give it a go and let you know how it
>goes. Thanks again for such a quick answer,
You welcome. Just two picky side notes:
(i) this is *not* a "forum";
(ii) more activity than... what?
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Thu, 19 Apr 2007 00:55:27 GMT
From: Ala Qumsieh <noreply@invalid.net>
Subject: Re: Any Help? Stuck trying to create cgi perl program
Message-Id: <36zVh.4663$2v1.3373@newssvr14.news.prodigy.net>
Michele Dondi wrote:
> On 18 Apr 2007 14:53:32 -0700, shadkeene@hotmail.com wrote:
>
>>Thanks Joe...yeah, I'm a beginner but saw this forum had more
>>activity, so I posted here. I'll give it a go and let you know how it
>>goes. Thanks again for such a quick answer,
>
> You welcome. Just two picky side notes:
>
> (i) this is *not* a "forum";
Why not? A forum, by definition, is a public place where people can meet and
exchange ideas. Newsgroups are forums.
--Ala
------------------------------
Date: Wed, 18 Apr 2007 14:25:27 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Error connecting to remote database
Message-Id: <BtCdnWGkoP0X47vbnZ2dnUVZ_gmdnZ2d@comcast.com>
skieros wrote:
> Isnt it weird that it cant even get to then print hello or die
> statement?
First off, are you able to run any sort of perl script at all?
#!/usr/bin/perl
print "Content-type: text/plain\n\n Hello, world\n";
There is no point in going any further if that does not work.
-Joe
------------------------------
Date: 18 Apr 2007 13:46:35 -0700
From: skieros <nikos1337@gmail.com>
Subject: Re: Error connecting to remote database
Message-Id: <1176929195.277851.267900@q75g2000hsh.googlegroups.com>
On Apr 19, 12:25 am, Joe Smith <j...@inwap.com> wrote:
> skieros wrote:
> > Isnt it weird that it cant even get to then print hello or die
> > statement?
>
> First off, are you able to run any sort of perl script at all?
>
> #!/usr/bin/perl
> print "Content-type: text/plain\n\n Hello, world\n";
>
> There is no point in going any further if that does not work.
> -Joe
Ill try to keep this on mind next time i move my perl webpage in
another server...thank you.
------------------------------
Date: Wed, 18 Apr 2007 15:22:29 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 9.20 How do I send mail?
Message-Id: <slrnf2c6sl.3io.hjp-usenet2@zeno.hjp.at>
On 2007-04-18 05:31, timdooling <timdooling@qconline.com> wrote:
> PerlFAQ Server <brian@stonehenge.com> wrote:
>>I tried the code you listed on the page, slightly modified as below:
> #!/usr/bin/perl --
> require 5;
> open(SENDMAIL, "|/usr/bin/sendmail -oi -t")
> or die "Can't fork for sendmail: $!\n";
> print SENDMAIL <<"EOF";
> From: <timdooling@qconline.com>
> To: <timdooling@qconline.com>
> Subject: test
>
> test
> EOF
> close(SENDMAIL) or warn "sendmail didn't close nicely";
>
> IT responded with "Internal Server Error" when I tried to run the program in IE with no mail sent.
>
> What is wrong with this coding?
Since IE cannot (to the best of my knowledge) execute perl code, you
probable meant to say that you executed that script from your webserver.
Since you didn't say which webserver you use, or which method of
executing perl you use (e.g., mod_perl, CGI, ...) we can only speculate
what you did wrong, but one thing that is obviously missing is output. A
webserver's job is to send *information* to the browser, and a script
which produces no output at all is treated as faulty by most webservers.
You generally need to generate at least a minimal HTTP header and a
minimal body.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
Date: 18 Apr 2007 06:38:00 -0700
From: Yang <ysongfinance@gmail.com>
Subject: Re: How can I use wget to get the result of jsp page
Message-Id: <1176903480.494496.189440@o5g2000hsb.googlegroups.com>
On Apr 18, 8:04 am, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On 17 Apr 2007 19:25:21 -0700, Yang <ysongfina...@gmail.com> wrote:
>
> >I have a jsp page that takes one parameter say:http://www.a.com/a.jsp?id=1
>
> So far so fine.
>
> >and use different id to generate different pages,
>
> Typical.
>
> >now I want to get the results from that and I use
>
> Reasonable.
>
> >>> wget "http://www.a.com/a.jsp?id=1"
>
> Common. I use that too. At some time I was dubbed "the wgetter"...
>
> >unfortunately, I can only get the source code of a.jsp, which is
> >useless to me.
>
> I don't see why one should do such a stupid thing, but if the damned
> thing works from a browser and not with wget, it may have to do with
> the useragent identifier. Try playing with -U.
>
> >Is there any other methods for doing this?
>
> Oh, c'mon! Do you realize that this is a ng dedicated to the Perl
> programming language. I still fail to see the actual Perl question
> here, so I'm inventing one for you and answering it along the lines
> of: use LWP.
>
> Michele
> --
> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
That is actually what I did, using LWP:Simple and use "get $url", the
same thing happened.
------------------------------
Date: Wed, 18 Apr 2007 16:15:18 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How can I use wget to get the result of jsp page
Message-Id: <sm9c23d7ndmmu39dc0ug6mg225lk5snigv@4ax.com>
On 18 Apr 2007 06:38:00 -0700, Yang <ysongfinance@gmail.com> wrote:
>That is actually what I did, using LWP:Simple and use "get $url", the
>same thing happened.
Ok, so now you're ON topic. Does the page get down as expected if you
access it from a browser. If so, then the first thing I would try to
do would be to use the full power of LWP and set the user agent
accordingly. However I can't understand the logic behind the action of
serving a script's source if accessed by an unwanted client. They
generally throw an error or some bogus page, in these cases, which is
also annoying, but somewhat more reasonable. All in all I would regard
this behaviour as a bug of the site you're visiting. (It's true that
security through obscurity is not security, but exhibiting the source
may expose some less than obvious hole and thus suggest a way to abuse
it.)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 18 Apr 2007 09:32:29 -0700
From: Duane Rettig <duane@franz.com>
Subject: Re: is laziness a programer's virtue?
Message-Id: <o0647tabj6.fsf@gemini.franz.com>
Pascal Bourguignon <pjb@informatimago.com> writes:
> Dan Bensen <randomgeek@cyberspace.net> writes:
>> Laziness (physical, not intellectual) is exceedingly useful in
>> programming.
>>
>> I also disagree with the idea that Larry is any more dangerous than
>> Guido, Matz, or Gosling. They're all part of a reaction against
>> the difficulties of C++ that started somewhere around 1990 or so.
>> I don't seen any merit in singling out Larry and Perl for special
>> treatment.
>
> Well at least the notion of the lazy programmer is much older than
> 1990. In 1981 already my programming teachers were telling us that a
> good programmer was an intelligent lazy programmer.
Actually, I think the phrase is a specific instance of the generic
phrase: "A good N is a lazy N." which has been around for a lot
longer; I remember in my high-school years in the late 60s my
chemistry teacher saying "A good chemist is a lazy chemist." and
noting to myself at the time that the phrase seemed a bit cliche.
--
Duane Rettig duane@franz.com Franz Inc. http://www.franz.com/
555 12th St., Suite 1450 http://www.555citycenter.com/
Oakland, Ca. 94607 Phone: (510) 452-2000; Fax: (510) 452-0182
------------------------------
Date: Wed, 18 Apr 2007 13:36:13 -0400
From: Ken Tilton <ken@theoryyalgebra.com>
Subject: Re: is laziness a programer's virtue?
Message-Id: <lGsVh.447$ru1.329@newsfe12.lga>
Duane Rettig wrote:
> Pascal Bourguignon <pjb@informatimago.com> writes:
>
>
>>Dan Bensen <randomgeek@cyberspace.net> writes:
>>
>>>Laziness (physical, not intellectual) is exceedingly useful in
>>>programming.
>>>
>>>I also disagree with the idea that Larry is any more dangerous than
>>>Guido, Matz, or Gosling. They're all part of a reaction against
>>>the difficulties of C++ that started somewhere around 1990 or so.
>>>I don't seen any merit in singling out Larry and Perl for special
>>>treatment.
>>
>>Well at least the notion of the lazy programmer is much older than
>>1990. In 1981 already my programming teachers were telling us that a
>>good programmer was an intelligent lazy programmer.
>
>
> Actually, I think the phrase is a specific instance of the generic
> phrase: "A good N is a lazy N." which has been around for a lot
> longer; I remember in my high-school years in the late 60s my
> chemistry teacher saying "A good chemist is a lazy chemist." and
> noting to myself at the time that the phrase seemed a bit cliche.
>
So I turn to Google to determined exactly how cliched and what other
expansions of your template could be found, and after sorting thru the
"No-good lazy justices" hits come upon <sigh> Wall's definition:
"Laziness: The quality that makes you go to great effort to reduce
overall energy expenditure. It makes you write labor-saving programs
that other people will find useful, and document what you wrote so you
don’t have to answer so many questions about it. Hence, the first great
virtue of a programmer. "
That actually seems like an awful definition, possibly because Perl does
not really support the productivity leaps possible with other languages?
It certainly seems neutral on the /quality/ of the code.
kt
--
http://www.theoryyalgebra.com/
"Algebra is the metaphysics of arithmetic." - John Ray
"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts
"Stand firm in your refusal to remain conscious during algebra."
- Fran Lebowitz
"I'm an algebra liar. I figure two good lies make a positive."
- Tim Allen
------------------------------
Date: Wed, 18 Apr 2007 15:31:55 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Question to B::Deparse
Message-Id: <0u6c235rgt8h2n8nl3k65qshnleqrhh9pj@4ax.com>
On Wed, 18 Apr 2007 09:29:57 +0200, "Ferry Bolhar"
<bol@adv.magwien.gv.at> wrote:
>I want to use B::Deparse from within a script and want to deparse
>this script (or parts of). B::Deparse offers the method coderef2text()
>which expects a code reference as argument. But where can I get
>the code reference of the script's main code?
I don't have the slightest idea. But I know someone who certaily does.
It's "diotalevi" in PerlMonks, so you may try asking there, and
perhaps /msg him if you see he (nor anyone else) gives an answer. I
say so because I've seen him doing quite impressing B::* wizardry in
the past...
See e.g.
http://perlmonks.org/?node_id=493947
(Bear in mind that that is not an actual solution to a real problem as
much as a proof of concept, in a thread that BTW is of great
importance to me, although it went largely misunderstood as my
original post in p6l had, before it.)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 18 Apr 2007 13:48:48 -0700
From: skieros <nikos1337@gmail.com>
Subject: Server For Rent? Where?
Message-Id: <1176929328.154600.115430@y5g2000hsa.googlegroups.com>
Hello iam thinkignt o start a web design + domain registration +
hosting company on my own and i want to ask you if you know where can
i find reliable an very cheap servers for rent. Thank you.
I askes this in other forums as well but i also asked here because
you people are on the business of web design/programmign and there is
a good chanc of you know...
------------------------------
Date: Wed, 18 Apr 2007 21:04:17 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Server For Rent? Where?
Message-Id: <lJvVh.16464$GV5.2803@edtnps89>
skieros wrote:
> Hello iam thinkignt o start a web design + domain registration +
> hosting company on my own and i want to ask you if you know where can
> i find reliable an very cheap servers for rent. Thank you.
>
> I askes this in other forums as well but i also asked here because
> you people are on the business of web design/programmign and there is
> a good chanc of you know...
I've never done any "web design/programmign" so perhaps you are mistaken?
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: Wed, 18 Apr 2007 21:24:28 GMT
From: "Jurgen Exner" <jurgenex@hotmail.com>
Subject: Re: Server For Rent? Where?
Message-Id: <g0wVh.10477$IG1.7361@trndny07>
skieros wrote:
> you people are on the business of web design/programmign
You are mistaken
jue
------------------------------
Date: Wed, 18 Apr 2007 14:29:02 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Server For Rent? Where?
Message-Id: <qb3d23hqdn4juppj8fb9mir5dlc59rvcao@4ax.com>
skieros scribed:
>Hello iam thinkignt o start a web design + domain registration +
>hosting company on my own and i want to ask you if you know where can
>i find reliable an very cheap servers for rent. Thank you.
>
>I askes this in other forums as well but i also asked here because
>you people are on the business of web design/programmign and there is
>a good chanc of you know...
A good place to ask your question is alt.www.webmaster.
--
Ed Jay (remove 'M' to respond by email)
------------------------------
Date: Thu, 19 Apr 2007 00:55:28 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Server For Rent? Where?
Message-Id: <6e8d23t415fq896h4kmtl0p7qahgv7iu6d@4ax.com>
On 18 Apr 2007 13:48:48 -0700, skieros <nikos1337@gmail.com> wrote:
>I askes this in other forums as well but i also asked here because
>you people are on the business of web design/programmign and there is
>a good chanc of you know...
Am I? Whoa, I didn't know!!
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 18 Apr 2007 14:17:44 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: UTF16 input file to ISO-8859-1 output
Message-Id: <ePWdnehNsKch4bvbnZ2dnUVZ_uOmnZ2d@comcast.com>
R Wood wrote:
> use utf8;
Don't do that.
The pragma "use utf8;" is used in the cases where a perl program
includes quoted strings containing UTF8 characters, which you don't.
It does not affect reading or writing UTF8 data - for that you want
to use the extra options in the open() function.
-Joe
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 356
**************************************