[7434] in Perl-Users-Digest
Perl-Users Digest, Issue: 1059 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 22 17:17:16 1997
Date: Mon, 22 Sep 97 14:00:28 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 22 Sep 1997 Volume: 8 Number: 1059
Today's topics:
Re: "here document" method of print erroring (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: "here document" method of print erroring (Faust Gertz)
Re: : Perl and form fields (David Alan Black)
^Z and file input problem Icepick@pclink.com
Re: ^Z and file input problem (Mike Stok)
Re: ^Z and file input problem (Terry Michael Fletcher - PCD ~)
Accessing modem on NT: works (Terry Michael Fletcher - PCD ~)
Re: Any Recommendations for portable signal processing? (Chip Salzenberg)
arithmetics on multiple array? <beahmed@dartmouth.ccfne.ns.ca>
Assigning Arguments to Script (David Zeng)
Re: Assigning Arguments to Script (Mike Stok)
Re: Assigning Arguments to Script (Jeremy D. Zawodny)
Re: bitwise xor of strings <jim.michael@gecm.com>
Re: bitwise xor of strings (Terry Michael Fletcher - PCD ~)
CGI.pm 2.36 -- passing a cookie to a 2nd form (Aram Mirzadeh)
Contract programmer needed <mark@elastic.net>
Re: Deleting temp files with perl (Andrew M. Langmead)
GDBM: Incompatable between Perl and C?? (neal)
Re: Getting a String from the User <russ@mail.org.uk>
Re: handling a non-terminating system() call <russ@mail.org.uk>
Image Module <aobrien@ziplink.net>
Re: Image Module (Jason Gloudon)
Re: NNTP question... (Kenneth A Graves)
Re: NT IIS help (Jeremy D. Zawodny)
Perl <-> RPC <-> C (Jared Evans)
Re: Perl <-> RPC <-> C (Matthew Cravit)
Perl on standalone NT 4.0 server <myleslawrence@email.msn.com>
Re: Perl on standalone NT 4.0 server (Jeremy D. Zawodny)
Re: Problem of Perl in FrontPage (Jeremy D. Zawodny)
Problem with files!!! Please help me! <dagon@dagon.co.uk>
Re: Regular expression matching <dehon_olivier@jpmorgan.com>
REQUEST: POP3 script <nbarreto@itm.pt>
Re: REQUEST: POP3 script <rootbeer@teleport.com>
Re: strange behaviour of sort in perl 5.004.03 <andi@team-konzept.de>
Re: strange behaviour of sort in perl 5.004.03 <andi@team-konzept.de>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 22 Sep 97 12:47:29 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: "here document" method of print erroring
Message-Id: <3426a181$1$ofn$mr2ice@speaker.kf8nh.apk.net>
In <EGuFxK.Ho9@nonexistent.com>, on 09/21/97 at 05:44 AM,
abigail@fnx.com (Abigail) said:
+-----
| ++ I am using the "here document" style of the print command and it is not
| ++ working correctly for me. please lemme know if I'm doing everything ++
| Are you sure you have the above fragment? No blanks after
| END_OF_TEXT? Perhaps a trailing ^M ?
+--->8
Is he using Perl 4, by any chance? Neither Perl3 nor Perl4 worked right when
combining print() and here documents (no output); in Perl 5 it works.
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) FORZA CREW!
Warpstock '97: OS/2 for the rest of us! http://www.warpstock.org
------------------------------
Date: Mon, 22 Sep 1997 18:11:24 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: "here document" method of print erroring
Message-Id: <3426b236.837661@news.wwa.com>
On Sat, 20 Sep 1997 22:15:15 -0500, Ben Scott <jds02@ix.netcom.com>
wrote:
>I am using the "here document" style of the print command and it is not
>working correctly for me. please lemme know if I'm doing everything
>right or am completely off in some way. code and error follow:
>
>code____________________________
> print <<END_OF_TEXT;
> a bunch of text
> with quotes "and other stuff"
>END_OF_TEXT
>
>error___________________________
>Can't find string terminator "END_OF_TEXT" anywhere before EOF at
>mycgi.cgi line 68.
I had a similar problem about ten days ago. Are you writing the
scrips on a DOS based machine and then uploading them to a unix
machine? When you try to do things like enable taint checking
(#!/user/local/bin/perl -T) or run perl -w (#!/user/local/bin/perl
-w), do you get errors messages such as:
>.nrecognized switch: -
If you do, there is a good chance that you have an FTP problem and not
a perl problem. Your DOS based editor is adding hidden characters
which affect some parts of your code, but not others. Make sure you
are uploading the file in ASCII and not Binary mode. Do not trust
some automatic mode to decide which transfer type is appropriate. If
that still doesn't work, try a different FTP program. Sometimes, they
differ and some work better than others.
Faust Gertz
Philosopher at Large
When Russell was still doubtful as to Wittgenstein's ability, he
asked G.E. Moore for his opinion. Moore replied, "I think very well
of him indeed." When Russell enquired the reason for his opinion,
Moore said that it was because Wittgenstein was the only man who
looked puzzled during his lectures.
------------------------------
Date: 22 Sep 1997 18:29:30 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: : Perl and form fields
Message-Id: <606dea$8h@pirate.shu.edu>
Hello -
(Sorry - I don't have the original posting - we seem to
be getting 99% answers here for some reason....)
waqar.hafiz@virgin.net ("Waqar Hafiz") writes:
>COWBYS (cowbys@aol.com) wrote:
>: Is there a way to use Perl to "pad" input fields from a form once they
>are
>: parsed, so for example
>: If I have a form, and one of its input fields is "Name", with a max input
>: lenght of 25, and someone enters a name thats only 16 chars long, I can
>pad
>: the rest of the field with 9 zeroes or spaces or something so that its
>: always 25 chars long regardless of the number of chars entered?
>: I ask this becuz I am outputting "Name" and other fields to a txt file
>: which I intend to read later, and I need to know that Name and the other
>: fileds are always going to be the same length, so I can use seek and read
>: to pull the values out of this file, always from the same position.
You could do:
$name .= '0' x (25 - length($name));
or some variant thereof.
David Black
dblack@icarus.shu.edu
------------------------------
Date: Mon, 22 Sep 1997 11:22:59 -0600
From: Icepick@pclink.com
Subject: ^Z and file input problem
Message-Id: <874945018.28650@dejanews.com>
I'm writting a tiny crypto script as entertainment. But it barfs
when ever a byte is encrypted as ASCII 26 aka ^Z. Everything
beyond that byte is ignored.
My script will encrypt and write just fine, but it chokes when
reading in the data, at the ^Z point. My read file sub is below.
How can I do this so that I can read in beyond a ^Z?
open (INP, "text") || die "can't open \"text\""; # open the file (nicely)
for ($i=0;$i<=$len;$i++) { read(INP,$plain[$i],1);
$plain[$i]=ord($plain[$i]); # convert to asci
}
close (INP) || die "can't close \"text\""; # and close it (nicely)
--
no more no less no fear no need no height no depth too great godspeed
Want $1000?? Help break RC5! http://rc5.distributed.net/
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 22 Sep 1997 17:06:59 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: ^Z and file input problem
Message-Id: <6068jj$8pc@news-central.tiac.net>
If you're on a PC/MS DOS machine then ^Z in a text file signifies end of
file. You can try
binmode INP;
after opening INP but before doing any IO on it and this should stop it
interpreting ^Z as EOF and doing any line end translations on the file.
Hope this helps,
Mike
In article <874945018.28650@dejanews.com>, <Icepick@pclink.com> wrote:
>I'm writting a tiny crypto script as entertainment. But it barfs
>when ever a byte is encrypted as ASCII 26 aka ^Z. Everything
>beyond that byte is ignored.
>
>My script will encrypt and write just fine, but it chokes when
>reading in the data, at the ^Z point. My read file sub is below.
>
>How can I do this so that I can read in beyond a ^Z?
>
>open (INP, "text") || die "can't open \"text\""; # open the file (nicely)
>
>for ($i=0;$i<=$len;$i++) { read(INP,$plain[$i],1);
>$plain[$i]=ord($plain[$i]); # convert to asci
>
> }
>
>close (INP) || die "can't close \"text\""; # and close it (nicely)
>
>
>--
>no more no less no fear no need no height no depth too great godspeed
>Want $1000?? Help break RC5! http://rc5.distributed.net/
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 22 Sep 1997 17:55:45 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: ^Z and file input problem
Message-Id: <606bf1$9r$1@news.fm.intel.com>
Icepick@pclink.com so eloquently and verbosely pontificated:
> I'm writting a tiny crypto script as entertainment. But it barfs
> when ever a byte is encrypted as ASCII 26 aka ^Z. Everything
> beyond that byte is ignored.
>
> My script will encrypt and write just fine, but it chokes when
> reading in the data, at the ^Z point. My read file sub is below.
>
> How can I do this so that I can read in beyond a ^Z?
good question. sorry i cant test this right now, but im wondering, did
you try sysread() instead of read()? that should use the proper
platform's reading, whether you are on an NT or unix.
also, (not positive on this), isnt ^Z the EOF char in DOS? i would think
that this would return a false (0) value when the read is done on that
byte, and not an ASCII 26. instead it gives a null character? is that
what you mean by chokes? or do you mean the whole script dies? ill have
to test this tonight myself. also, does binmode make a difference? it
shouldnt since i dont think you would get chars above ASCII 127.
> for ($i=0;$i<=$len;$i++) { read(INP,$plain[$i],1);
> $plain[$i]=ord($plain[$i]); # convert to asci
> }
--
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
map{$;.=chr$_}(112,114,105,110,116,32,117,110,112,97,99,107,32,34,117,
34);$_=$;.=q>,':2G5S="!A;F]T:&5R(%!E<FP@:&%C:V5R+`H`'>;y[\034]{}d;eval
------------------------------
Date: 22 Sep 1997 18:18:33 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Accessing modem on NT: works
Message-Id: <606cpp$137$1@news.fm.intel.com>
i cant remember the poster that asked about this a while ago, but i did
some tinkering with it, since i am going to be reading/writing the serial
port with a board sometime in the near future.
this is the code that worked for me (of course it took some tries to
figure out what was going on, and figure out the input record separator).
the hard part was figuring out the terminating character. the modem
returns data with "\n" as the separator, but there is no final terminating
"\n", and the program will hang because it does not know when to finally
stop grabbing data, even when closing the filehandle. strangely, i found
that the entire string is terminated with a "\b" backspace character, so
the whole thing can be sucked into a scalar (then split on newlines if you
want). my program was this, with the output after the __END__
#!/usr/intel/bin/perl -w
print "Starting to open modem...\n";
system('mode COM3 baud=96 parity=n data=8');
open (MODEM, "+>COM3") || die $!;
$/ = "\b"; # seems to be the terminating char
select MODEM; $| = 1; select main::STDOUT;
print "ATDT\n";
print MODEM "ATDT\r";
sleep 4; # seems to be enough to let modem respond
$response = <MODEM>; # slurp up to the \b char (or \008)
map {print ord$_,","} (split //,$response); # print char values
print "\n$response\n"; # print the string
close (MODEM);
print "Done\n";
__END__
sample of the output from this:
C:\PERL5\SAMPLES\perl coms.pl
Status for device COM3:
-----------------------
Baud: 9600
Parity: None
Data Bits: 8
Stop Bits: 1
Timeout: OFF
XON/XOFF: OFF
CTS handshaking: OFF
DSR handshaking: OFF
DSR sensitivity: OFF
DTR circuit: ON
RTS circuit: ON
Starting to open COM3...
AT
65,84,68,84,13,10,78,79,32,68,73,65,76,32,84,79,78,69,10,10,78,79,32,67,65,82,82,73,69,82,10,
ATDT
NO DIAL TONE
NO CARRIER
Done
--------END OF OUTPUT COPY--------
the string returned is interesting:
65,84,68,84,13,10,78,79,32,68,73,65,76,32,84,79,78,69,10,10,78,79,32,67,65,82,82,73,69,82,10,
^^^^^^^^^^^^^^ \n N O ' ' D I A L ' ' T O N E \n \n N O ' ' C A R R I E R \n (and a \b was here at the end)
the first part is an exact echo of what was sent to the modem.
the sleep time may be different for other users, or if necessary, one can
set up pseudo-interrupt vectors as described in the select() function
manpage.
anyways, sorry to take up so much space explaining modem transfer
protocol, but i felt it necessary to answer the question that i saw here
before. also, i WAS able to dial numbers with perl, but this was just an
example while i was not connected to the phone line.
hope that helps.
--
#!/usr/local/bin/perl -w
print "J" ."u". # -- Terry Fletcher
"s" ."t". " A", "n" # tfletche@pcocd2.intel.com
. "o" ,""."". "the", "r ","P". # Views expressed....not
"e"."rl" ." Ha", "c",'' ."" ."". # INTeL's....yadda yadda
"" , "k". "e" ."r" ;# yadda....
------------------------------
Date: 22 Sep 1997 19:13:30 GMT
From: chip@rio.atlantic.net (Chip Salzenberg)
Subject: Re: Any Recommendations for portable signal processing?
Message-Id: <606g0q$jtf$1@news1.atlantic.net>
According to aml@world.std.com (Andrew M. Langmead):
>arpepper@math.uwaterloo.ca (Adrian Pepper) writes:
>>I have to do a moderate amount of signal catching in a perl application
>>which I would like to remain the same across 5 or so different UNIX and
>>UNIX-like (AIX) architectures.
>
>Thats too bad. Have you seen the patches the Chip Salzenberg made for
>perl5porters that make signals safe in perl? There seem to still be
>some discussions about performance and backwards compatibility ...
There sure are. :-)
>>keys %SIG
>>is not initialized to anything. Nor is there a built-in "kill -l".
It's for performance reasons. But I think that specific case should be
changed (i.e. C<keys %SIG> should populate %SIG).
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Men of lofty genius are most active
when they are doing the least work."
-- Leonardo da Vinci
------------------------------
Date: Mon, 22 Sep 1997 14:34:20 -0300
From: ahmed bentiba <beahmed@dartmouth.ccfne.ns.ca>
Subject: arithmetics on multiple array?
Message-Id: <3426AC1A.496B73AF@dartmouth.ccfne.ns.ca>
Hi everyone
I would like to know if here is a perl script that allows me to do
arithmetics on a text file (database) generated by another perl script?
For example the text file is as follow:
john 5 6 7 8
lisa 6 8 5 6
carlos 5 5 9 6
lee 8 5 6 4
the first column holds names and the other columns hold numbers.
I would like to sum, average...these columns.
Is it possible in Perl? How?
Thanks
Ahmed Bentiba
beahmed@dartmouth.ccfne.ns.ca
------------------------------
Date: 22 Sep 1997 16:17:17 GMT
From: dizzy@soda.CSUA.Berkeley.EDU (David Zeng)
Subject: Assigning Arguments to Script
Message-Id: <6065md$sek@agate.berkeley.edu>
Hi, there,
I have a question on how to assign arguments to a Perl script. I understand
that using <STDIN> is one way for the script to prompt for arguments.
What if I want to give the script arguments as if it's a built-in shell
command? For example, I have a script called "foo," and foo takes 2
arguments "duh" and "blah." I would like to be able to type in
foo duh blah OR ./foo duh blah
from the shell and start "foo" with those two arguments. Is there any
way to design the Perl script to accept this type of arguments. With
<STDIN>, I only know how to accept arguments by typing "./foo," <enter>,
then type in the arguments on a new line.
Thanks for any hints and help.
David Zeng
------------------------------
Date: 22 Sep 1997 16:22:16 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Assigning Arguments to Script
Message-Id: <6065vo$7ah@news-central.tiac.net>
In article <6065md$sek@agate.berkeley.edu>,
David Zeng <dizzy@soda.CSUA.Berkeley.EDU> wrote:
>Hi, there,
>
>I have a question on how to assign arguments to a Perl script. I understand
>that using <STDIN> is one way for the script to prompt for arguments.
>What if I want to give the script arguments as if it's a built-in shell
>command? For example, I have a script called "foo," and foo takes 2
>arguments "duh" and "blah." I would like to be able to type in
> foo duh blah OR ./foo duh blah
>from the shell and start "foo" with those two arguments. Is there any
>way to design the Perl script to accept this type of arguments. With
><STDIN>, I only know how to accept arguments by typing "./foo," <enter>,
>then type in the arguments on a new line.
The array @ARGV contains command line arguments which weren't consumed by
the interpreter e.g.
[mike@stok mike]$ perl -e 'print "(@ARGV)\n"' foo bar
(foo bar)
Here, the -e 'print "(@ARGV)\n"' are used by the interpreter, and foo bar
are left in @ARGV.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Mon, 22 Sep 1997 16:32:59 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Assigning Arguments to Script
Message-Id: <34299d75.2713281@igate.hst.moc.com>
[cc'd automagically to original author]
On 22 Sep 1997 16:17:17 GMT, dizzy@soda.CSUA.Berkeley.EDU (David Zeng)
wrote:
>I have a question on how to assign arguments to a Perl script. I understand
>that using <STDIN> is one way for the script to prompt for arguments.
>What if I want to give the script arguments as if it's a built-in shell
>command? For example, I have a script called "foo," and foo takes 2
>arguments "duh" and "blah." I would like to be able to type in
> foo duh blah OR ./foo duh blah
>from the shell and start "foo" with those two arguments. Is there any
>way to design the Perl script to accept this type of arguments. With
><STDIN>, I only know how to accept arguments by typing "./foo," <enter>,
>then type in the arguments on a new line.
Sure.
You can access them via the @ARGV array in your script.
in your case, $ARGV[0] would hold "duh" and $ARGV[1] would hold
"blah". Check your local Perl documentation for the gory details.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 22 Sep 1997 10:37:16 -0400
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: bitwise xor of strings
Message-Id: <3426829C.5207@gecm.com>
Tom Phoenix wrote:
>
> sub dumphex {
> print join(" ", map unpack("H*", $_), @_), "\n";
> }
> $b = "0101";
> $c = "0011";
> dumphex $b ^ $c;
>From which I get the interesting result:
00010100
This is perl, version 5.004_01
Copyright 1987-1997, Larry Wall
But,
$b = 0101
$c = 0011
---------
xor= 0110
Cheers,
Jim
------------------------------
Date: 22 Sep 1997 17:29:52 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: bitwise xor of strings
Message-Id: <6069ug$sjv$1@news.fm.intel.com>
Ralph Stirling (stirra@wwc.edu) so eloquently and verbosely pontificated:
> Bitwise exclusive-or on strings does not seem to work as
> advertised in Prog Perl 2nd Ed. page 88. Both AND and OR
> work properly under Perl 5, and Perl 4 at least tries to
> get XOR (just leaves off the MSB when a zero), but XOR fails
> completely under Perl 5:
>
> $b = "0101";
> $c = "0011";
these are strings because you put quotes around them.
> print "(1) $b ^ $c=",$b ^ $c,"\n";
running Perl with the "-w" option would have given a warning about
"argument not numeric in bitwise exclusive or...." or something similar.
i ran into this problem when i wanted to be clever and initialize a
variable to a 1 if it didnt already exist:
$x ^= 0;
needless to say, this didnt work when $x was a string, amongst other
problems. :-(
> The output from this code, run under Perl 5.00x on SunOS4.1.4,
> Solaris 2.5.1, and Linux 2.0.29 is:
> [stuff]
> Under Perl 4.036, the output is:
> [different stuff]
that is interesting to see that their difference there, and that Perl5
takes care of the data types properly.
--
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
map{$;.=chr$_}(112,114,105,110,116,32,117,110,112,97,99,107,32,34,117,
34);$_=$;.=q>,':2G5S="!A;F]T:&5R(%!E<FP@:&%C:V5R+`H`'>;y[\034]{}d;eval
------------------------------
Date: 22 Sep 1997 18:24:16 GMT
From: awm@luers.qosina.com (Aram Mirzadeh)
Subject: CGI.pm 2.36 -- passing a cookie to a 2nd form
Message-Id: <slrn62ddug.ren.awm@luers.qosina.com>
Greetings,
I'm trying to setup two forms to work with each other passing a cookie.
The first form is a listing of a set of part numbers from an external database.
By choosing the part number you can add them to a "shopping basket". This
basket is kept as a cookie, and past back to the same form.
Now I would like to have this cookie (array) passed to a 2nd form where you
can enter some more information (name, address, ya da ya da... )
However, using CGI 2.36 I am running into the following problem, when the
1st form runs trying to build a array to be passed on: (the output of the
cgi program)
...
<FORM METHOD="GET" ACTION="/cgi-bin-local/test.cgi"
ENCTYPE="application/x-www-form-urlencoded">
Not an ARRAY reference at (eval 21) line 12.
The offending line is here:
$method = "GET";
$action = "/cgi-bin/test.cgi";
$encoding = "application/x-www-form-urlencoded";
print start_form($method,$action,$encoding);
print hidden(-name=>'sample',
-value=>\%parts);
print submit(-value=>'Process');
print end_form;
Where %parts is the array. I can print this array out:
if (%parts) {
print "<ul>\n";
foreach (sort keys %parts) {
print "<li>$_\n";
}
print "</ul>\n";
}
%parts is being created via:
%parts = cookie('qparts');
Any suggestions would be greatly appreciated.
Thank You.
<Aram>
------------------------------
Date: Mon, 22 Sep 1997 12:37:39 -0400
From: "Mark Weinstein" <mark@elastic.net>
Subject: Contract programmer needed
Message-Id: <6066ok$g4m@snews3.zippo.com>
I am in the need for a programmer to create some simple perl scripts for
me.
If interested, please respond via email.
Thanks.
Mark Weinstein
mark@elastic.net
------------------------------
Date: Mon, 22 Sep 1997 15:38:32 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Deleting temp files with perl
Message-Id: <EGx249.39x@world.std.com>
ajs@lorien.ajs.com (Aaron Sherman) writes:
>That "useful trick" will certainly get you into enough trouble.
Why? It serves as a basis for many unix tmpfile() implementations.
>How about something a little more general (this is just a sketch, you
>may have to modify it to get it to work):
How about:
use IO::File;
my $tmp = IO::File->new_tmpfile();
print $tmp "Temp data...";
--
Andrew Langmead
------------------------------
Date: 22 Sep 1997 16:17:40 GMT
From: neal@toby.valinet.com (neal)
Subject: GDBM: Incompatable between Perl and C??
Message-Id: <6065n4$8oq@ns.valinet.com>
Please disregard my above post. I figured it out: I was only null
terminating the key value, not the key name itself, so it should be
something like:
$GDBM{'name\0'} = "value\0";
------------------------------
Date: Mon, 22 Sep 1997 14:08:00 +0100
From: Russell Odom <russ@mail.org.uk>
Subject: Re: Getting a String from the User
Message-Id: <34266DB0.E3CE54F0@mail.org.uk>
Alex McCool wrote:
>
> How can I ask a user for a string value.
>
> single chars are working fine with getc, but I can't get it to work with
> a string.
RTFM.
The documentation that comes with perl is excellent - type 'perldoc' at
your local friendly command prompt to get started.
If you can't do something this basic, you should invest in a good tutorial
book. 'Learning Perl' is quite good; type 'perldoc perlbook' to find out
more.
HTH,
Russ
---------------------------------------------------------------------
--[ R u s s e l l O d o m ]---[ *NEW:* mailto:russ@mail.org.uk ]--
--[ University of York, UK ]---[ http://www.york.ac.uk/~rjo100/ ]--
---------------------------------------------------------------------
--[ FAQ maintainer, news:comp.os.ms-windows.win95.moderated ]--
---------------------------------------------------------------------
------------------------------
Date: Mon, 22 Sep 1997 14:02:47 +0100
From: Russell Odom <russ@mail.org.uk>
Subject: Re: handling a non-terminating system() call
Message-Id: <34266C77.F04B57CC@mail.org.uk>
Bill Wilson wrote:
>
> I'm trying to automate a dailup ppp session
> from a perl script. I'm using system() to execute
> the ppp chat session, but since chat doesn't
> terminate, I can't get back into the original
> perl script. Is there anyway to execute the
> chat session and get back into the parent script?
>From the Llama book (1st Ed p154): "...processes that end in & are
launched and not waited for, just as if you had typed a line that ends in
an & to the shell."
HTH,
Russ
---------------------------------------------------------------------
--[ R u s s e l l O d o m ]---[ *NEW:* mailto:russ@mail.org.uk ]--
--[ University of York, UK ]---[ http://www.york.ac.uk/~rjo100/ ]--
---------------------------------------------------------------------
--[ FAQ maintainer, news:comp.os.ms-windows.win95.moderated ]--
---------------------------------------------------------------------
------------------------------
Date: Mon, 22 Sep 1997 11:12:54 -0500
From: Austin O'Brien <aobrien@ziplink.net>
Subject: Image Module
Message-Id: <34269905.3FE8@ziplink.net>
I noticed on the Perl Wish list there is a request for a image module,
has anyone seriously coinsidered creating one? Actually created one?
Or know any more about one? I'm particularly interested in converting
between different formats.
Please cc: responses to email if possible.
Austin O'Brien
aobrien@ziplink.net
------------------------------
Date: 22 Sep 1997 17:57:27 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Image Module
Message-Id: <606bi7$4i$1@daily.bbnplanet.com>
Austin O'Brien (aobrien@ziplink.net) wrote:
: I noticed on the Perl Wish list there is a request for a image module,
: has anyone seriously coinsidered creating one? Actually created one?
: Or know any more about one? I'm particularly interested in converting
: between different formats.
: Please cc: responses to email if possible.
: Austin O'Brien
: aobrien@ziplink.net
ImageMagick may be useful to you. It converts between a large number of
formats, and an object-oriented perl interface is available for it. The details
can be found at http://www.wizards.dupont.com/cristy/www/perl.html.
Jason Gloudon
------------------------------
Date: 22 Sep 1997 13:35:50 -0400
From: kag@kag.citysource.com (Kenneth A Graves)
Subject: Re: NNTP question...
Message-Id: <606a9n$7t@kag.citysource.com>
In article <604143$qrv$1@trotsky.cig.mot.com>,
Brian DeRosa <deroREMOVE_THIS_LARGE_TEXT_PLEASEsbr@cig.mot.com> wrote:
>I suspect that a large part of my processessing time is taken up in the
>"looking for Subject" lines or something along that line. Is there a way to
>get the subject lines and article numbers (or some other sort of article
>identifyer) in a more efficient/timely manner? Same question except relate it
>to the body of the article.
It sounds like you are using "ARTICLE" to get the article information.
That downloads the entire article across your modem link: inefficient.
Use either XOVER or XHDR if your server supports them, or at least use
HEAD instead of ARTICLE, which will only download the header information.
As for getting the body of an article, you pretty much have to use ARTICLE.
(If you've already used HEAD, you *could* use BODY, but the savings is
insignificant.)
Read the docs for Net::NNTP (or whichever NNTP module you are using) for
details. Read RFC 1036 for gory details.
--kag
------------------------------
Date: Mon, 22 Sep 1997 16:31:45 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: NT IIS help
Message-Id: <34289d52.2677860@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 22 Sep 1997 07:03:16 -0700, "Myles Lawrence"
<myleslawrence@email.msn.com> wrote:
> I installed perl5 on an NT 4 server. The installation created a key with
>the value perllS.dll instead of perl.exe %s %s. Neither seems to work for
>me. When I execute the script fron the HTML page, the browser tries to
>download the pl. file??
>Can someone straghten me out?
First guess: is execute access turned on for the IIS virtual root in
which the script reside?
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 22 Sep 1997 17:34:30 GMT
From: jared@node6.frontiernet.net (Jared Evans)
Subject: Perl <-> RPC <-> C
Message-Id: <606a76$js6$1@node6.frontiernet.net>
I have designed a RPC service under C for both client and server sides. I'm
looking into the possiblity of using perl on the client side. Is it possible
for perl to communicate to a server written in C via RPC? What sort of
things would be involved?
-Jared
--
Jared Evans Manufacturing Technology Analyst/Developer @ The Gleason Works
http://www.frontiernet.net/~jared
------------------------------
Date: 22 Sep 1997 11:29:19 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Perl <-> RPC <-> C
Message-Id: <606ddv$rgu$1@shell3.ba.best.com>
In article <606a76$js6$1@node6.frontiernet.net>,
Jared Evans <jared@node6.frontiernet.net> wrote:
>I have designed a RPC service under C for both client and server sides. I'm
>looking into the possiblity of using perl on the client side. Is it possible
>for perl to communicate to a server written in C via RPC? What sort of
>things would be involved?
The Advanced Perl book,
Advanced Perl Programming
By Sriram Srinivasan
O'Reilly & Associates, 1997
ISBN 1-56592-220-4, $34.95
has a chapter dealing with RPC. Also, browsing the CPAN modules list
(http;//www.perl.com/CPAN/) reveals the following modules which might
be of help:
RPC undef SRIRAM/examples.tar.gz
RPC::ONC undef JAKE/perlrpcgen-0.71a.tar.gz
RPC::pClient 0.1002 JWIED/pRPC-modules-0.1002.tar.gz
RPC::pServer 0.1002 JWIED/pRPC-modules-0.1002.tar.gz
RPC::Simple undef DDUMONT/RPC-Simple-0.1.tar.gz
RPC::Simple::Agent 0.01 DDUMONT/RPC-Simple-0.1.tar.gz
RPC::Simple::AnyLocal 0.01 DDUMONT/RPC-Simple-0.1.tar.gz
RPC::Simple::AnyRemote 0.01 DDUMONT/RPC-Simple-0.1.tar.gz
RPC::Simple::CallHandler 0.01 DDUMONT/RPC-Simple-0.1.tar.gz
RPC::Simple::Factory 0.01 DDUMONT/RPC-Simple-0.1.tar.gz
RPC::Simple::ObjectHandler 0.01 DDUMONT/RPC-Simple-0.1.tar.gz
RPC::Simple::Server 0.01 DDUMONT/RPC-Simple-0.1.tar.gz
All of the paths (in the 3rd column of the above) are relative to
http://www.perl.com/CPAN/authors/id/ (or equivalent on your local
CPAN mirror).
Hope this helps.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Mon, 22 Sep 1997 09:36:08 -0700
From: "Myles Lawrence" <myleslawrence@email.msn.com>
Subject: Perl on standalone NT 4.0 server
Message-Id: <#FNFnZ3x8GA.48@upnetnews02.moswest.msn.net>
I'm kind of stuck. I've most documentation, couple of books, etc. I'm
running NT4.0 Server as a standalone at home without network and have
installed perl and have checked the path and registry. When I click on a
link to a perl script, the browser tries to open it instead of run it. I can
run perl standalone from the perl5 directory but not from a web page. Any
suggestions?
Myles
------------------------------
Date: Mon, 22 Sep 1997 16:57:28 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Perl on standalone NT 4.0 server
Message-Id: <342aa341.4197555@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 22 Sep 1997 09:36:08 -0700, "Myles Lawrence"
<myleslawrence@email.msn.com> wrote:
>
>I'm kind of stuck. I've most documentation, couple of books, etc. I'm
>running NT4.0 Server as a standalone at home without network and have
>installed perl and have checked the path and registry. When I click on a
>link to a perl script, the browser tries to open it instead of run it. I can
>run perl standalone from the perl5 directory but not from a web page. Any
>suggestions?
Treat it like any other mis-behaving file type. Manually remove the
existing file association (using Explorer) and re-created it by
double-clicking on a .pl file so that it will as you what to do with
them from then on.
Good Luck,
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 22 Sep 1997 16:31:07 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Problem of Perl in FrontPage
Message-Id: <34279c93.2486915@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 22 Sep 1997 10:41:09 -0400, comdog@computerdog.com (brian d
foy) wrote:
>In article <342777df.520050012@igate.hst.moc.com>, zawodny@hou.moc.com (Jeremy D. Zawodny) wrote:
>
>>On Mon, 22 Sep 1997 06:51:40 -0600, shgbrc@online.sh.cn wrote:
>
>>>I installed MS FrontPage2.0 and perl5 in my computer, and want to make a
>>>test of CGI script in Perl.
>>
>>Let me cut you off there. You need a web server to run CGI scripts.
>>CGI is an acronym for Common Gateway Interface--the mechanism my which
>>web servers can launch external programs and pass data to them.
>
>that's strange - i run CGI scripts without a web server all the time.
>remember it's the Common Gateway Interface - not what is on either
>side of that interface (remember that CGI.pm allows one to run CGI
>scripts without a web server, not to mention various stress-testers
>that pretend to be web servers). perhaps you should have said "I need
>a web server..." :)
As far as generalizations go, yes, I probably over-did it on that one.
However, taken in the context of what the original poster asked, I
believed it's fair to say that s/he will not get the desired result
without a web server to run the script(s) in question.
As far as CGI.pm goes, yes, that's a special case. I'd like to believe
that most people are using it for their development (I do), but I've
seen too many examples to the contrary. And many of those who do use
it fail to realize that command-line debugging is possible. (I know,
RTFM...)
Also, what sort of stress-tester CGI scripts are your referring to?
The only stress-testers I know of act as web *clients* to access many
resources on a server in an attempt to find its limits.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 22 Sep 97 17:12:49 GMT
From: "Dan Norcott" <dagon@dagon.co.uk>
Subject: Problem with files!!! Please help me!
Message-Id: <01bcc77a$9884aa60$4efe4ac2@default>
Hi there.
I'm currently trying to build a chat system on my website, and I've got
myself a script from Matt's CGI archive, which works fine.
However, in order to make it fit in with the rest of my site, I need to
make several alterations, most of which have worked fine.
My problem is with the following piece of code:
foreach $followup_num (@followup_num) {
open(FOLLOWUP,"$basedir/$mesgdir/t$followup_num\.$ext");
@followup_lines = <FOLLOWUP>;
close(FOLLOWUP);
open(FOLLOWUP,">$basedir/$mesgdir/t$followup_num\.$ext");
foreach $followup_line (@followup_lines) {
$work = 0;
if ($followup_line =~ /<ul>/) { print FOLLOWUP "<ul>\n<li><a
href=\"$num\.$ext\">$subject</a> <b>$name</b> <i>$date</i></li>\n";}
else { print FOLLOWUP "$followup_line"; }
}
close(FOLLOWUP);
}
This is a modified version of the code that was in the original script, but
as I am new to PERL, there's something quite basic I can't work out.
This piece of code looks through all the files in the 'followup_num' array,
and adds that bit of HTML in the correct place. However, I only want it to
alter the first file from that array, and as I am new to the language, I
dont
know how to just say 'for file(1)' as opposed to looping through the entire
array. At the moment, this creates lots of redundant files, which I don't
want at all.
Anyone kind enough to aid a struggling fellow, please email me at
dan@NOSPAMdagon.co.uk (remove NOSPAM).
Thanks a lot for your help,
Dan Norcott
------------------------------
Date: 22 Sep 1997 17:04:40 +0200
From: Olivier Dehon <dehon_olivier@jpmorgan.com>
Subject: Re: Regular expression matching
Message-Id: <njzd8m1fkzb.fsf@jpmorgan.com>
barman@watt.cs.unc.edu (Dilip Barman) writes:
>
> MY SAMPLE PROGRAM
>
> #!/usr/local/bin/perl
>
> $d1 = "\*\$\["; $d2 = "\]\$\*";
> $x = "\*\$\[value1\]\$\*\*\$\[value2\]\$\*";
>
> $_ = $x;
> print "d1 is \"$d1\" and ";
> print "d2 is \"$d2\".";
> print "\nSource string is \"$x\".\n";
>
> /$d1(.*)$d2/;
>
>
> THE OUTPUT
>
> d1 is "*$[" and d2 is "]$*".
> Source string is "*$[value1]$**$[value2]$*".
> /*$[(.*)]$*/: ?+*{} follows nothing in regexp at try.pl line 11.
> barman on watt [62] %
>
> print "1st match is $1 and 2nd is $2\n";
>
First of all : use the -w switch ;-)
The problem comes from the fact that $d1 and $d2, which you use as
patterns in your regexp contain regexp meta-characters (*, $,
[). These characters should be backslashed (They aren't when you
initialize $d1 with "\*\$\[", and you can see it when you print $d1
!!!).
You should use single quotes instead of double quotes:
$d1 = '\$\*\[';
or even:
$d1 = q(\$\*\[);
I think you should always use single quotes for string
constants. Double quotes are useful when you want to interpolate
variables. If you don't want to backslash a single quote character
within a string constant, use the q() function !
Hope this helps.
Olivier Dehon
------------------------------
Date: 22 Sep 1997 16:05:47 GMT
From: "B" <nbarreto@itm.pt>
Subject: REQUEST: POP3 script
Message-Id: <01bcc769$933922e0$4e4e41c2@nazare>
Hello, I'm looking for a POP3 script that enables me to read mail. I'm not
concerned on sending but only on receiving.
Nuno
nbarreto@itm.pt
------------------------------
Date: Mon, 22 Sep 1997 08:39:16 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: B <nbarreto@itm.pt>
Subject: Re: REQUEST: POP3 script
Message-Id: <Pine.GSO.3.96.970922083853.24984W-100000@usertest.teleport.com>
On 22 Sep 1997, B wrote:
> Hello, I'm looking for a POP3 script that enables me to read mail.
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.perl.org/CPAN/
http://www.perl.com/CPAN/
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 22 Sep 1997 18:45:13 +0200
From: Andreas Schmidt <andi@team-konzept.de>
To: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: strange behaviour of sort in perl 5.004.03
Message-Id: <3426A08C.2417@team-konzept.de>
Ron Savage wrote:
>
> Andreas Schmidt wrote:
> >
> > I'm porting some perl-modules from perl 5.003 to 5.004.03. Most things
> > were easy, but there is a strange behaviour when using perl's sort ^^^^^^^
> [snip]
>
> Which OS?
>
> Are you using IRIX? Under IRIX 6.2/Perl 5.003, @ara = sort(@ara); puts the first element of the (sorted?)
> input array into all elements of the output array.
No, I'm using Linux, kernel version 2.0.30
------------------------------
Date: Mon, 22 Sep 1997 19:40:10 +0200
From: Andreas Schmidt <andi@team-konzept.de>
To: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: strange behaviour of sort in perl 5.004.03
Message-Id: <3426AD69.7452@team-konzept.de>
Ilya Zakharevich wrote:
>
> In article <3421898E.1364@team-konzept.de>,
> Andreas Schmidt <andi@team-konzept.de> wrote:
...
> > In perl 5.003 I used quite often code like:
> >
> > my @lala = sort { return &foo( $a, $b ); } @lolo;
>
> ..
>
> > After spending a long time with looking for errors, I realized that
> > everything is fine, if I remove the word return in the anonymous
> > function, or if i pass the result of &foo( $a, $b ) to a local variable
> > before returning it. But just return &foo( $a, $b ) did not work..
>
> Sure it would not, why do you think it would? Would you think this
> will print xxx:
>
> sub a { map {print 'x'; return 1} 1..3 }
> a
Yes, it should! What is the reason, why this does not happen?
> ? The sort BLOCK is not a subroutine too.
May be, but I expected the BLOCK to be executed like a subroutine.
Since it is possible to prototype a function with
sub mysort(&@) {...}
and then call mysort with
mysort { return $a, $b } @lolo
This is just a shortcut for
mysort( sub{ return $a, $b }, @lolo )
Since prototyping is the way to implement functions that behave exact
like the build-in functions the sort BLOCK should both should accept a
return-statement.
> If it worked earlier, than it might have been a bug in the older version.
Once again: may be. But from my point of view, it was clearer.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 1059
**************************************