[13522] in Perl-Users-Digest
Perl-Users Digest, Issue: 932 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 28 15:32:57 1999
Date: Tue, 28 Sep 1999 12:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938545513-v9-i932@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 28 Sep 1999 Volume: 9 Number: 932
Today's topics:
Re: DBD::Pg + SELECT not working (Kenneth Graves)
Dealing with "MS-ASCII" - again! (yes, I know it is a b (Kenny McCormack)
Re: Dealing with "MS-ASCII" - again! (yes, I know it is <flavell@mail.cern.ch>
Re: Difference between do and require.... <malcolm.dewjones@moh.hnet.bc.ca>
Error <aakhanna@aludra.usc.edu>
Re: File Upload (Larry Rosler)
Re: File Upload <picaza@chsi.com>
gcos/gecos <picaza@chsi.com>
Re: How to append an extension to a value in a variable <rootbeer@redcat.com>
How to save a file as binary? <loc@holly.colostate.edu>
Re: Line-wrap <rootbeer@redcat.com>
Re: New book: Automating Windows With Perl <rootbeer@redcat.com>
Re: Pathetic Question for the Newbie <emschwar@rmi.net>
Re: Piping <rootbeer@redcat.com>
Re: print (Kragen Sitaker)
Re: Simple Mail Transfer Protocol ... Not So Simple! (Kragen Sitaker)
Re: Sorting weird numeric data (Michel Dalle)
Re: Sorting weird numeric data (Larry Rosler)
Re: threads?? <marshalc@americasm01.nt.com>
Re: UNIX (Solaris 2.6) to NT ACCESS DB? (Kragen Sitaker)
Re: why use references - in laymans terms? <uri@sysarch.com>
Re: why use references - in laymans terms? <laurensmith@sprynet.com>
Re: why use references - in laymans terms? <jeff@jhmi.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 28 Sep 1999 18:32:04 GMT
From: kag@kag.citysource.com (Kenneth Graves)
Subject: Re: DBD::Pg + SELECT not working
Message-Id: <slrn7v227b.97.kag@kag.citysource.com>
In article <3H6I3.241$hs.15796@monger.newsread.com>, Scott McMahan wrote:
>Where do I even start trying to figure this out?
Show us your code. (From the prepare call to the finish call.)
It might be something simple that someone else can spot.
You can see how fetchrow_array or fetchrow_hashref behave.
--kag
------------------------------
Date: 28 Sep 1999 13:14:49 -0500
From: gazelle@yin.interaccess.com (Kenny McCormack)
Subject: Dealing with "MS-ASCII" - again! (yes, I know it is a bad term, but we're stuck with it)
Message-Id: <7sr0ip$jt2$1@yin.interaccess.com>
A few months ago, I posted about the problem of dealing with text posted to
the net from silly word processors like MS Word and so on that have non-ASCII
characters in them ("non-ASCII" meaning characters whose code is >= 128)
At that time, I got a bunch of responses including the usual net quibbling,
and a Perl program from Tom Christianson (sp?) called demoronizer. The
program looked cute and all and certainly looked like a complete solution,
but I could not get it to run - probably due to some limitation in my Perl
setup. In any case, I didn't feel like fighting with it too much.
So, recently, I have taken up the task anew. I downloaded CP1252.TXT from
one of the web/ftp sites mentioned in a response to my earlier thread (thank
you Alan [somebody]!) and edited it to get the file below. I'm not sure how
much of it I got right - in most cases, I was merely guessing based on the
comment field. If anyone can suggest any improvements, please let me know.
In particular, I have no idea what a "CARON" is...
The format of the file is: 1st col = hex code, 2nd col = standard ASCII
replacement string (i.e., the part I filled in/made up), 3rd col and
beyond = comments from original file.
Here's the file:
0x80 & #EURO SIGN
0x82 ' #SINGLE LOW-9 QUOTATION MARK
0x83 f #LATIN SMALL LETTER F WITH HOOK
0x84 '' #DOUBLE LOW-9 QUOTATION MARK
0x85 ... #HORIZONTAL ELLIPSIS
0x86 + #DAGGER
0x87 ++ #DOUBLE DAGGER
0x88 ^ #MODIFIER LETTER CIRCUMFLEX ACCENT
0x89 % #PER MILLE SIGN
0x8A S! #LATIN CAPITAL LETTER S WITH CARON
0x8B ` #SINGLE LEFT-POINTING ANGLE QUOTATION MARK
0x8C OE #LATIN CAPITAL LIGATURE OE
0x8E Z! #LATIN CAPITAL LETTER Z WITH CARON
0x91 ' #LEFT SINGLE QUOTATION MARK
0x92 ' #RIGHT SINGLE QUOTATION MARK
0x93 " #LEFT DOUBLE QUOTATION MARK
0x94 " #RIGHT DOUBLE QUOTATION MARK
0x95 * #BULLET
0x96 - #EN DASH
0x97 = #EM DASH
0x98 ~ #SMALL TILDE
0x99 @ #TRADE MARK SIGN
0x9A s! #LATIN SMALL LETTER S WITH CARON
0x9B ' #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
0x9C oe #LATIN SMALL LIGATURE OE
0x9E z! #LATIN SMALL LETTER Z WITH CARON
0x9F y: #LATIN CAPITAL LETTER Y WITH DIAERESIS
0xA0 - #NO-BREAK SPACE
0xA1 ! #INVERTED EXCLAMATION MARK
0xA2 % #CENT SIGN
0xA3 # #POUND SIGN
0xA4 $ #CURRENCY SIGN
0xA5 Y #YEN SIGN
0xA6 | #BROKEN BAR
0xA7 $ #SECTION SIGN
0xA8 : #DIAERESIS
0xA9 @ #COPYRIGHT SIGN
0xAA () #FEMININE ORDINAL INDICATOR
0xAB << #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0xAC ^ #NOT SIGN
0xAD - #SOFT HYPHEN
0xAE @ #REGISTERED SIGN
0xAF + #MACRON
0xB0 o #DEGREE SIGN
0xB1 + #PLUS-MINUS SIGN
0xB2 2 #SUPERSCRIPT TWO
0xB3 3 #SUPERSCRIPT THREE
0xB4 ` #ACUTE ACCENT
0xB5 . #MICRO SIGN
0xB6 . #PILCROW SIGN
0xB7 . #MIDDLE DOT
0xB8 . #CEDILLA
0xB9 1 #SUPERSCRIPT ONE
0xBA )( #MASCULINE ORDINAL INDICATOR
0xBB >> #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0xBC .25 #VULGAR FRACTION ONE QUARTER
0xBD .5 #VULGAR FRACTION ONE HALF
0xBE .75 #VULGAR FRACTION THREE QUARTERS
0xBF ? #INVERTED QUESTION MARK
0xC0 A| #LATIN CAPITAL LETTER A WITH GRAVE
0xC1 A\ #LATIN CAPITAL LETTER A WITH ACUTE
0xC2 A^ #LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0xC3 A~ #LATIN CAPITAL LETTER A WITH TILDE
0xC4 A: #LATIN CAPITAL LETTER A WITH DIAERESIS
0xC5 A% #LATIN CAPITAL LETTER A WITH RING ABOVE
0xC6 AE #LATIN CAPITAL LETTER AE
0xC7 A. #LATIN CAPITAL LETTER C WITH CEDILLA
0xC8 E| #LATIN CAPITAL LETTER E WITH GRAVE
0xC9 E\ #LATIN CAPITAL LETTER E WITH ACUTE
0xCA E^ #LATIN CAPITAL LETTER E WITH CIRCUMFLEX
0xCB E: #LATIN CAPITAL LETTER E WITH DIAERESIS
0xCC I| #LATIN CAPITAL LETTER I WITH GRAVE
0xCD I\ #LATIN CAPITAL LETTER I WITH ACUTE
0xCE I^ #LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0xCF I: #LATIN CAPITAL LETTER I WITH DIAERESIS
0xD0 ETH #LATIN CAPITAL LETTER ETH
0xD1 N~ #LATIN CAPITAL LETTER N WITH TILDE
0xD2 O| #LATIN CAPITAL LETTER O WITH GRAVE
0xD3 O\ #LATIN CAPITAL LETTER O WITH ACUTE
0xD4 O^ #LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0xD5 O~ #LATIN CAPITAL LETTER O WITH TILDE
0xD6 O: #LATIN CAPITAL LETTER O WITH DIAERESIS
0xD7 * #MULTIPLICATION SIGN
0xD8 O! #LATIN CAPITAL LETTER O WITH STROKE
0xD9 U| #LATIN CAPITAL LETTER U WITH GRAVE
0xDA U\ #LATIN CAPITAL LETTER U WITH ACUTE
0xDB U^ #LATIN CAPITAL LETTER U WITH CIRCUMFLEX
0xDC U: #LATIN CAPITAL LETTER U WITH DIAERESIS
0xDD Y\ #LATIN CAPITAL LETTER Y WITH ACUTE
0xDE THORN #LATIN CAPITAL LETTER THORN
0xDF s! #LATIN SMALL LETTER SHARP S
0xE0 a| #LATIN SMALL LETTER A WITH GRAVE
0xE1 a\ #LATIN SMALL LETTER A WITH ACUTE
0xE2 a^ #LATIN SMALL LETTER A WITH CIRCUMFLEX
0xE3 a~ #LATIN SMALL LETTER A WITH TILDE
0xE4 a: #LATIN SMALL LETTER A WITH DIAERESIS
0xE5 a% #LATIN SMALL LETTER A WITH RING ABOVE
0xE6 ae #LATIN SMALL LETTER AE
0xE7 c. #LATIN SMALL LETTER C WITH CEDILLA
0xE8 e| #LATIN SMALL LETTER E WITH GRAVE
0xE9 e\ #LATIN SMALL LETTER E WITH ACUTE
0xEA e^ #LATIN SMALL LETTER E WITH CIRCUMFLEX
0xEB e: #LATIN SMALL LETTER E WITH DIAERESIS
0xEC i| #LATIN SMALL LETTER I WITH GRAVE
0xED i\ #LATIN SMALL LETTER I WITH ACUTE
0xEE i^ #LATIN SMALL LETTER I WITH CIRCUMFLEX
0xEF i: #LATIN SMALL LETTER I WITH DIAERESIS
0xF0 eth #LATIN SMALL LETTER ETH
0xF1 n~ #LATIN SMALL LETTER N WITH TILDE
0xF2 o| #LATIN SMALL LETTER O WITH GRAVE
0xF3 o\ #LATIN SMALL LETTER O WITH ACUTE
0xF4 o^ #LATIN SMALL LETTER O WITH CIRCUMFLEX
0xF5 o~ #LATIN SMALL LETTER O WITH TILDE
0xF6 o: #LATIN SMALL LETTER O WITH DIAERESIS
0xF7 / #DIVISION SIGN
0xF8 o! #LATIN SMALL LETTER O WITH STROKE
0xF9 u| #LATIN SMALL LETTER U WITH GRAVE
0xFA u\ #LATIN SMALL LETTER U WITH ACUTE
0xFB u^ #LATIN SMALL LETTER U WITH CIRCUMFLEX
0xFC u: #LATIN SMALL LETTER U WITH DIAERESIS
0xFD y\ #LATIN SMALL LETTER Y WITH ACUTE
0xFE thorn #LATIN SMALL LETTER THORN
0xFF y: #LATIN SMALL LETTER Y WITH DIAERESIS
------------------------------
Date: Tue, 28 Sep 1999 20:41:19 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Dealing with "MS-ASCII" - again! (yes, I know it is a bad term, but we're stuck with it)
Message-Id: <Pine.HPP.3.95a.990928202830.22229C-100000@hpplus01.cern.ch>
On 28 Sep 1999, Kenny McCormack wrote:
> In particular, I have no idea what a "CARON" is...
It looks like an upside-down circumflex accent, and appears over
certain letters (such as S) in some "East European" (Latin-2) languages.
Does that help?
It's also called a hacek. Except that the "c" in "hacek" is really
c-caron. Er, do I mean c-hacek. I feel an infinite regress coming
on...
If you visit the unicode web site you can view images of unicode
characters alongside their code values (the four-digit hex values
you see in those mapping tables you downloaded from the ftp site).
See for instance
http://charts.unicode.org/Unicode.charts/normal/U0100.html
Excuse me for pointing this out after you've done the work, but Lynx
(the web browser, not the realtime operating system!) actually has
something like what you're presenting here, built into it for the
purpose of displaying what it calls "7-bit approximations" when run in a
presentation situation (terminal emulation etc.) that has nothing richer
available.
cheers
------------------------------
Date: Tue, 28 Sep 1999 10:53:47 -0700
From: Malcolm Dew-Jones <malcolm.dewjones@moh.hnet.bc.ca>
Subject: Re: Difference between do and require....
Message-Id: <37F100AB.92F80EDF@moh.hnet.bc.ca>
People will tell you to read the manual, and it will tell you the
technical differences, but the practical differences may still escape
you.
In one sense there is no difference difference between do, require and
use. They all eval a file. However they build on each other, providing
minor useful extras at each stage. At each stage, the eval is slightly
less flexible.
'do' evals a file each time it is called, and you must check various
status codes for errors. You could use this to re-read a configuration
file multiple times.
'require' optimizes the 'do' by only ever evaling the same file once,
and simplifies error checking. This makes it more useful (than 'do')
for loading simple subroutine libraries.
'use' evals the file before your script is running, and adds the
'import' hook. Both are useful in conjunction with nicely "packaged"
modules. The 'import' hook allows you to suck in someone elses code and
specify which subroutine names will be available to you without using
the complete module name - so for example if you are going to use the
subroutine "TEXT::ABREV::TECHNICAL::COMPUTER::IBM::VM::Abreviate()"
lots of times then you might want to shorten its name to just
Abreviate() (or at least i would want to). 'use' makes it trivial to
write the "suck-the-other-guys-code-in" end of this published module
interface.
> > >>>>> "BM" == Brian Matchick <matchick@enteract.com> writes:
> >
> > BM> I'm writing some of my own libraries for some cgi programs and I
> > BM> can't figure out the difference between calling do './whatever.pl'
> > BM> and require './whatever.pl'. They both seem to do the same thing,
> > BM> which is run the code in the file.
------------------------------
Date: Tue, 28 Sep 1999 11:32:31 -0700
From: Ajay Khanna <aakhanna@aludra.usc.edu>
Subject: Error
Message-Id: <Pine.GSO.4.10.9909281128570.4104-100000@aludra.usc.edu>
Hi..
I have written a perl program which when tried to run on a browser gives
an "Internal Server Error". The error written in the error_log is :
[Mon Sep 27 16:44:09 1999] [error] (8)Exec format error: exec of
/home/imsc2/www/cgi-bin/calendar-show.pl failed
[Mon Sep 27 16:44:09 1999] [error] [client 128.125.163.100] Premature end
of script headers " /home/imsc2/www/cgi-bin/calendar-show.pl
Could someone help me with it
-Ajay
------------------------------------------------------------------------------
Ajay Khanna
University of Southern California MSCENG (Networks)
1184 West 30th #17, LA, CA 90007.
(323) 735 6931
http://www-scf.usc.edu/~aakhanna
LOGO :SUCCESS IS A TRIBUTE TO THE VIRTUES OF HARD WORK, DEDICATION AND THE
UNCOMPROMISING PURSUIT OF EXCELLENCE.
------------------------------------------------------------------------------
------------------------------
Date: Tue, 28 Sep 1999 11:01:56 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: File Upload
Message-Id: <MPG.125aa26b7589c8fd989fec@nntp.hpl.hp.com>
In article <37f0bd4a_1@newsread3.dircon.co.uk> on 28 Sep 1999 14:06:18
+0100, Jonathan Stowe <gellyfish@gellyfish.com> says...
> Burt Hwang <BurtHwangSPAMSUCKS@SPAMSUCKS.ufsltd.com> wrote:
> > Sorry if this is a silly question but what is "Jeopardy style"? In case I'm
> > doing it, I want to know so that I don't do it again.
>
> Yep you're doing it alright ...
>
> > Martien Verbruggen wrote in message
> > <1AWH3.154$aN.4870@nsw.nnrp.telstra.net>...
> >>In article <938484960.341318@news.tir.com>,
> >> "Bob Wilcox" <bwilcox@eudoramail.com> writes:
> >>> Abigail wrote in message ...
> >>>>Bob Wilcox (bwilcox@eudoramail.com) wrote on MMCCXI September MCMXCIII in
> >>>><URL:news:937869758.672994@news.tir.com>:
> >>>>[] Take a look at http://www.terminalp.com/scripts/
> >>>
> >>>>You post a one-liner, Jeopardy style, quoting 94 lines, including
> >>>>the sig?
> > [snip]
It would be possible to be a bit more helpful, /J\!
Q. "A very long-running TV quiz show, in which the MC poses 'answers' to
which the contestants have to respond in the form of 'questions'."
A. "What is 'Jeopardy'?"
This gimmick is obviously nonsensical, but without it the program would
probably have died many years ago.
In this newsgroup's context, it means posting your answer ahead of the
question being asked. Because your so-called newsreader
'X-Newsreader: Microsoft Outlook Express 4.72.2106.4'
makes it easy to do that by default, Burt, it is up to you to overcome
it.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 28 Sep 1999 14:16:38 -0400
From: "Peter Icaza" <picaza@chsi.com>
Subject: Re: File Upload
Message-Id: <7sr0lb$32j0$1@pike.uhc.com>
Burt Hwang <BurtHwangSPAMSUCKS@SPAMSUCKS.ufsltd.com> wrote in message
news:Pe2I3.7$_X2.365@client...
> Sorry if this is a silly question but what is "Jeopardy style"? In case
I'm
> doing it, I want to know so that I don't do it again.
>
"Jeopardy style" is when you post a response in front of/on top of the
original post. as in Jeopardy, you get the answer first, bad dog!
------------------------------
Date: Tue, 28 Sep 1999 14:58:11 -0400
From: "Peter Icaza" <picaza@chsi.com>
Subject: gcos/gecos
Message-Id: <7sr338$nfu$1@pike.uhc.com>
hi,
on page 163 of the llama book it mentions the gcos field of the passwd file.
i have seen this refered to as gecos as well. clearly it refers to the
comment filed of the passwd file, but what does g[e]?cos stand for? nothing
returned my man -k, kornshell, UNIX in a nutshell, the UNIX programming env,
the camel book, mastering regex's etc.
------------------------------
Date: Tue, 28 Sep 1999 11:07:04 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to append an extension to a value in a variable
Message-Id: <Pine.GSO.4.10.9909281105580.17231-100000@user2.teleport.com>
On Tue, 28 Sep 1999, David wrote:
> I need to add an extension (.wav) to a scaler variable value.
If I were giving you a fish, I'd say "period". As I'd prefer to teach you
to fish, I'll say "the perlop manpage". Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 28 Sep 1999 12:19:03 -0600
From: "Tim Renner" <loc@holly.colostate.edu>
Subject: How to save a file as binary?
Message-Id: <7sr0ol$43r0@yuma.ACNS.ColoState.EDU>
Offhand, I can't get perl to just load in a .GIF and save an exact copy of
it... it cooks out after saving 1k (on a 39k GIF ;) It seems like it's
loading or saving as an ASCII file and I'd like to be able to do it in
binary.
The original problem however... I'm using
$UA=LWP::UserAgent->new;
my $Res = $UA->request(GET $pagename);
to snag an image from the web... I'm fairly sure (I hope) that it does grab
the entire image intact... when I try to save it however, it's being dumped
as an ASCII file and the image is unreadable or corrupted... so, again, I
need to save as binary, or if that's not the problem, does anyone know how
to read as binary off the web?
Any help would be appreciated ;)
Thanks,
-Tim
------------------------------
Date: Tue, 28 Sep 1999 11:14:58 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Line-wrap
Message-Id: <Pine.GSO.4.10.9909281114410.17231-100000@user2.teleport.com>
On Tue, 28 Sep 1999, A Zielke wrote:
> Subject: Line-wrap
If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-) Hope this helps!
http://www.cpan.org/
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 28 Sep 1999 11:12:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: New book: Automating Windows With Perl
Message-Id: <Pine.GSO.4.10.9909281110200.17231-100000@user2.teleport.com>
On Tue, 28 Sep 1999, Scott McMahan wrote:
> I don't want to blatantly advertise, but I want to get the word out.
A better way to do that might be to search the web for some sites which
have reviews of books and ask whether they'd like a review copy. I'm sure
that some of them would be glad to do so. Of course, you shouldn't do this
if you fear the reviews. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 28 Sep 1999 12:14:39 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Pathetic Question for the Newbie
Message-Id: <xkfvh8uhpio.fsf@valdemar.col.hp.com>
lord_mokole@hell.com (Lord Mokole) writes:
> I'm trying to write my first CGI in Perl; this is also the first
> experience I've had with Perl. I know where Perl is located on the
> Unix host, and I can run my scripts using the compiler when I put the
> file on the host, but I don't understand how to link the file to
> cgi-lib.pl as well.
Oh, geez, that's easy. You don't! cgi-lib.pl was written for perl4. We
now have much nicer modules that actually work correctly now, with
perl5. "perldoc CGI" to find out more.
> Essentially, the only way I can get to run the
> program is including "/usr/local/bin/perl"
You don't include it-- you do put it in your shebang line, though.
> and my webmaster tells me
> that the only way to run CGI is to use the stdin parser cgi-bin.pl
> located at "/var/www/cgi-bin".
This is only true if they're running a version of perl that's seriously
seriously obsolete. CGI.pm is included with the standard distribution of
Perl, and has been since-- hey, does anybody know? Well, it's been in
there since 5.004 for sure. Anyway, if your "webmaster" tells you that
you don't have CGI.pm available then he's either:
A) Woefully ignorant of the state of his system, or
B) Hideously incompetent.
Either way, he doesn't deserve the job he has.
> Can anyone tell me how exactly I'm supposed to get this to work.
The docs for CGI.pm are insanely complete. If they don't answer your
questions, try the "Official Guide to Programming with CGI.pm" by Lincoln
Stein. If *that* doesn't answer your questions, come back here and ask
again.
> Example (all be it pathetic):
That's "albeit". Not a spelling flame, just thought you'd care.
-=Eric
------------------------------
Date: Tue, 28 Sep 1999 11:22:11 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Piping
Message-Id: <Pine.GSO.4.10.9909281116280.17231-100000@user2.teleport.com>
On Tue, 28 Sep 1999 nihad@yahoo.com wrote:
> Trying to execute a a compiled CGI within a perl script while
> passing inputs to the compiled CGI,
If you're calling a CGI program, you must follow the CGI protocol spec.
http://hoohoo.ncsa.uiuc.edu/cgi/
> here is the code
>
> $excgi = "/usr/blah/cgi-bin/somecgi.cgi";
>
> open (PIPE, "$execgi|") || print "$?";
That's misleading to have two variables with such similar names. And if
the open fails, do you really want your program to continue?
> while (<PIPE>) {
> print PIPE "input1=value1";
> print PIPE "input2=value2";
> }
Why are you printing to a read-only pipe?
Implementing the CGI protocol from the server's side isn't especially
difficult, but I suspect that it's beyond your current skill set. You
should probably try a simpler problem and come back to this one later. Or,
alternatively, hire someone with more experience. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 28 Sep 1999 19:01:20 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: print
Message-Id: <4g8I3.1583$w32.120377@typ11.nn.bcandid.com>
In article <Pine.GSO.4.10.9909281123540.3920-100000@allegro>,
<buck_naked@NOiname.SPAMcom> wrote:
>spaces between two words. I am planning to just get the length of the
>first word and then add spaces based on that. That's easy, but is
>there a way for me to tell 'print' to print something a certain number
>of times instead of saying 'print " "' I could say 'print " "*6
>or something.
You want the 'x' operator.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Sep 28 1999
43 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Tue, 28 Sep 1999 18:47:05 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Simple Mail Transfer Protocol ... Not So Simple!
Message-Id: <J28I3.1553$w32.118919@typ11.nn.bcandid.com>
In article <h65I3.1637$Lh.209598@pm02news>,
Majid Sharif <majid.sharif@mci.com> wrote:
>I writing a Multiscreen CGI Script (Form) that is to email some of the forms
>input within that email.
>The issue that I'm having is the email is not implementing the form fields
>that I'm referencing.
>For example, If the user inputs "TTI National" in the Account Name Field of
>the form, the body of the email sent should read,
>"The following product items for the TTI National Account have been
>Approved. However, the email reads,
>"The following product items for the Account have been Approved.
>
> my $EmailTitle = "The following product items for the " .
>$Cgi->param('AcctName'). " Account have been Approved:\n\n";
In all likelihood, $Cgi->param('AcctName') is undefined; if you begin
your script with #!/usr/bin/perl -w, you will get a warning about using
an undefined value like that.
Some reasons why it might be undefined:
- $Cgi is defined and is a CGI object, but doesn't contain the values from
your form;
- $Cgi is defined, is a CGI object, contains the values for your form,
and AcctName is not among them; perhaps it is not being submitted by
the client, or perhaps it is being submitted under a slightly different
name, such as acctname or Acct_Name.
- CGI.pm is broken.
You should be able to figure out which, if any, of the above is the
problem by using -w and including the return value of $Cgi->dump() in
the email; this will include an HTML rendering of the full contents of
the CGI object.
HTH.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Sep 28 1999
43 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Tue, 28 Sep 1999 18:00:35 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Sorting weird numeric data
Message-Id: <7sr005$iok$1@news.mch.sbs.de>
In article <37F02930.F3C909C@rochester.rr.com>, Bob Walton <bwalton@rochester.rr.com> wrote:
>Mike Sosteric wrote:
>>
>> How can I sort strings like this
>>
>> 1.1
>> 1.1.1
>> 1.1.2
>> 1.2
>> 1.3
>>
[snip]
>> as I do with <=>
>>
>> cmp will not work because then I get
>>
>> 1.1
>> 10.0
>>
>> which is not what I want
>
>Mike, try:
>
[snap]
>
>This isn't the most efficient, but works regardless of the depth
>of nesting of the numbers.
As an alternative, you might try converting the indices to strings
and compare the strings. But this is limited to 255 (or 127?) entries
for each level, which may not be enough for you...
A no-brains approach would look like this :
sub idx2str {
my($idx) = @_;
my $str = '';
for (split(/\./,$idx)) {
$str .= chr($_);
}
return $str;
}
@out = map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, idx2str($_) ] }
@in;
See Perl FAQ 4 and further for more information about
sorting. Some kind of binary pack would probably be better
here, I guess.
Have fun,
Michel.
------------------------------
Date: Tue, 28 Sep 1999 11:55:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting weird numeric data
Message-Id: <MPG.125aaf03f00fbaad989fed@nntp.hpl.hp.com>
In article <7sr005$iok$1@news.mch.sbs.de> on Tue, 28 Sep 1999 18:00:35
GMT, Michel Dalle <michel.dalle@usa.net> says...
...
> As an alternative, you might try converting the indices to strings
> and compare the strings. But this is limited to 255 (or 127?) entries
> for each level, which may not be enough for you...
It is 256. Some indexes may be 0, and all are unsigned.
There are other ways of converting larger unsigned integers to sortable
strings, such as "printf '%.10d'" or (better) "pack 'N'" for numbers < 2
** 32.
> A no-brains approach would look like this :
>
> sub idx2str {
> my($idx) = @_;
> my $str = '';
> for (split(/\./,$idx)) {
> $str .= chr($_);
> }
> return $str;
> }
> @out = map { $_->[0] }
> sort { $a->[1] cmp $b->[1] }
> map { [ $_, idx2str($_) ] }
> @in;
>
> See Perl FAQ 4 and further for more information about
> sorting. Some kind of binary pack would probably be better
> here, I guess.
Yes. The subroutine idx2str is identical to
pack 'C*' => split /\./ => $idx;
which I posted today.
Using a packed-string sortkey is a good start. Using it in the Schwartz
Transform, as you show, loses efficiency compared to using the default
sort. This is discussed in detail in:
http://www.hpl.hp.com/personal/Larry_Rosler/sort/
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 28 Sep 1999 13:07:54 -0500
From: Marshall Culpepper <marshalc@americasm01.nt.com>
Subject: Re: threads??
Message-Id: <37F103F9.9843EDE6@americasm01.nt.com>
## Right, that's why you don't read from the filehandle unless you're sure
## the child process is sending stuff out regularly.
Which it isn't (sure would make this problem alot easier eh? :)
## Regardless, caffiene has set my brain in motion and a more obvious
## solution's occurred to me.
Yes, caffeine is great fuel!
## What'd be easier is to do a fork and exec, with
## a SIGCHLD handler in the parent process. Something like:
## $is_done = 0;
## $SIG{CHLD} = {$is_done = 1};
## if (fork()) {
## while(!$is_done) {
## sleep 1;
## # Update the display
## }
## wait;
## } else {
## exec("whatever");
## }
This is along the lines of what I was thinking...but mysteriously enough, If I run
the process and tell it to print the number of seconds it's been running, nothing
at all happens (not even when the CHLD process is finished!) here's the code I
derived from your snippet:
$done = 0;
$SIG{'CHLD"} = {$done = 1}
if (fork){ while (!$done){ sleep 1; $a++; print $a } wait; }
else { exec("whatever") }
of course whatever has been changed to the program I'm trying to call...any more
ideas from the caffeine stimulated mind? :)
~Marshall
------------------------------
Date: Tue, 28 Sep 1999 19:00:28 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: UNIX (Solaris 2.6) to NT ACCESS DB?
Message-Id: <gf8I3.1579$w32.119585@typ11.nn.bcandid.com>
In article <7sqpvo$puh$1@bgtnsc02.worldnet.att.net>,
George Plumfield <GPlumfield@worldnet.att.net> wrote:
>I'll be Perl-processing some files on a UNIX-Solaris 2.6 machine and would
>like to directly update an Access DB (.mdb) residing on a NT machine
>(intranet and NFS Maestro access to the NT filesystem).
First, if you do succeed in doing this, make sure Access isn't trying
to modify the .mdb at the same time you are -- or make sure you do the
locking correctly, which may be harder than you think via NFS Maestro.
Second, in order to do this, you need to understand the .mdb file
format. There's something called DAO "Data Access Objects", which is
part of MFC, and lets you access .mdb files directly. MFC comes with
full source code, so I think you might be able to learn the format of
the data file by that method. However, I'm not sure of this.
Porting MFC to run on a non-Microsoft OS is forbidden by the Microsoft
Visual C++ EULA.
>Is this possible?
Oh, certainly.
>If so, hi-level how?
Learn the .mdb file format and implement it.
>The alternative is to copy the files over to NT and then run through DBI,
>DBD::ADO, but I would love to do it directly from UNIX.
That would probably require a fraction of the effort.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Sep 28 1999
43 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 28 Sep 1999 14:06:01 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: why use references - in laymans terms?
Message-Id: <x7aeq6zzau.fsf@home.sysarch.com>
>>>>> "j" == jdkronicz <jdkronicz@my-deja.com> writes:
j> Could someone explain to me the purpose for references? I've read
j> that they allow complex datastructures, nesting etc. I realize
j> that this is a fundamental question and very basic for most reading
j> this newsgroup but I would really like to hear the laymans
j> explanation of why they are necessary?
you just answered the question yourself. do you know what complex
datastructures or nesting means? they are fundamental constructs in all
computer programs and references are perl's way to create them.
if you don't want to use references, go back to using perl4. (but only
if you like flogging a flea bitten dead camel carcass)
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Tue, 28 Sep 1999 11:30:05 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: why use references - in laymans terms?
Message-Id: <7sr1fg$59u$1@brokaw.wa.com>
jdkronicz@my-deja.com wrote in message <7sqt5h$ff6$1@nnrp1.deja.com>...
>Could someone explain to me the purpose for references? I've read that
they
>allow complex datastructures, nesting etc. I realize that this is a
>fundamental question and very basic for most reading this newsgroup but
I
>would really like to hear the laymans explanation of why they are
necessary?
A very good reason to use references is that it allows you to send
datastructures as parameters to functions.
If you try:
$a = $b = 0;
@c = (1,2,3,4,5);
func($a,@c,$b);
the function will put (0,1,2,3,4,5,0) into @_. If you know the length
of @c when it is passed, then you can always parse out the specific
values, but if the length of @c is variable, then you don't know where
the end of it is nor where $b is neither.
But if you:
$a = $b = 0;
@c = (1,2,3,4,5);
func($a, \@c, $b);
the resulting contents of @_ are (0,<address of @c>, 0). It doesn't
matter how long @c is anymore, you have a reference to the array as an
entity in and of itself.
Now if you take a array and instead of putting plain old scalar values
into each slot you put references to arrays, you now have an array of
arrays. This can be extended to any depth that you want and with hashes
as well as arrays.
Try reading
perlref
perldsc
perllol
Lauren
------------------------------
Date: Tue, 28 Sep 1999 18:38:28 GMT
From: Jeff S. <jeff@jhmi.edu>
Subject: Re: why use references - in laymans terms?
Message-Id: <7sr1v2$j75$1@nnrp1.deja.com>
In article <7sqt5h$ff6$1@nnrp1.deja.com>,
jdkronicz@my-deja.com wrote:
> Could someone explain to me the purpose for references? I've read
that they
> allow complex datastructures, nesting etc. I realize that this is a
> fundamental question and very basic for most reading this newsgroup
but I
> would really like to hear the laymans explanation of why they are
necessary?
Since I am just a bit above layman myself, maybe I can explain... and
this explanation is going to include a bit of C and general computer
architecture as well as perl type stuff.
From what I understand, references allow things like arrays of arrays to
be possible. I don't fully understand or know why, but (at least as far
as Perl is concerned), the original design of Perl allowed only scalar
values in arrays. so a reference is a scalar value that is equal to the
name/number of a memory address. anything can be stored in that address,
including another array, so an array of references to arrays is a lot
like an array of arrays.
since that sounded like mumbo jumbo, think of this:
a computer's memory can be thought of as a contiguous row of cells:
+-----+
| 001 | (these numbers are the addresses, not the values!)
+-----+
| 002 |
+-----+
| 003 |
+-----+
| 004 |
+-----+
| ... |
+-----+
for simplification sake, i'll say that each cell can contain a value,
like a number or a letter. "12" or "A". So 001 may contain "42", for
example.
Now, an array is a list, and thus would use several cells in a row for
its data. I guess in perl, these lists were originally restricted to
being only lists of scalar data, like "42" or "A", and the array was
known to the computer to be "Cell 002 through 004" or somesuch.
(Actually, at least in C, an array is known to the computer as more like
"Starts in cell 002, is of length three cells").
Anyways, if you want to make an array that is itself composed of
separate arrays, (and take my word for it, you do), you can't if
individual array entries can only be scalar. So Perl got around its
original problem by using references, that is, scalar values that tell
the computer that the rest of this list is located "over there--->".
+-----+
| 002 |<-------+
|=099 |--+ +-(these numbers are "address=value of another address")
+-----+ |
| 003 | | +-----+
|=400 |+ +--------->| 099 |
+-----+| +-----+
| 004 || | 100 |
+-----+| +-----+
| 005 || | 101 |
+-----+| +-----+
| ... || | ... |
+-----+| +-----+
|
| +-----+
+----------->| 400 |
+-----+
| 401 |
+-----+
| ... |
+-----+
So the array in this case is cells 002-003, each cell contains a
reference that points to 099, and to 400, respectively. Now 099 and 400
are memory locations that contain arrays.
Naturally, the computer has to know information like how long these
referenced arrays are, and what type of information they contain (like a
hash or a scalar or an array) and this info is stored in the reference.
in fact, if you call up the value of a scalar reference without
"de-referencing" it, you will see a value like
SCALAR0xbff009 or
ARRAY990xff01
if you dereference it properly, Perl will go to the memory location and
get the value you want, and you won't even see the differenc between a
referenced value and an actual value.
In C, you must declare the size of an array from the start, and this
cannot be changed (mostly). this is because of the nature of arrays, and
how the computer knows where to find them in its memory.
Perl will let you expand arrays at will. I infer from this (although I
am not sure) that Perl's arrays are constructed differently than C's,
and probably using an invisible referencing scheme similar to what I
discussed here. Of course that's just a guess.
I hope this was helpful at all. I describe these things in order to both
inform someone else, and to learn myself, because I find that one of the
best ways to learn something is to explain it in detail to someone else.
later...
--
| |\ /\ ---------------------------------------*
| | | \ Jeffrey D. Silverman * jeff@jhmi.edu
\/ |/ \/ Johns Hopkins University * Baltimore, MD
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 932
*************************************