[12739] in Perl-Users-Digest
Perl-Users Digest, Issue: 149 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 15 01:17:25 1999
Date: Wed, 14 Jul 1999 22:10:15 -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, 14 Jul 1999 Volume: 9 Number: 149
Today's topics:
Re: Help: reading from COM1 (Matthew Bafford)
HTTP and Perl <dgreer@connectnet.com>
Re: HTTP and Perl (brian d foy)
Re: Is my Perl script or IE4 ??? <rmcvay@acm.org>
Re: learning perl (Tad McClellan)
Re: Net::SMTP problem? <qwerty@post.utfors.se>
Re: Newbie needs help: Environment variables (Tad McClellan)
newby Q- how:perl script to cgi? monotone@my-deja.com
Re: Old database is erased when I add new information <bjm@a2b01118.paralynx.bconnected.net>
Re: Old database is erased when I add new information (John Stanley)
Re: OVER 18 ONLY! 72808 <qwerty@post.utfors.se>
Re: pattern matching with variables (brian d foy)
Re: pattern matching with variables (brian d foy)
Re: pefskr lksj knna ksk <qwerty@post.utfors.se>
running .pl file by invoking their name mamorshedi@my-deja.com
Re: Search array (Tad McClellan)
Re: stripping html tags <hiller@email.com>
Re: stripping html tags <tungyat@yahoo.com>
Tom Christiansen is a perlscript himself... <qwerty@post.utfors.se>
Re: Tom Christiansen is a perlscript himself... (I R A Aggie)
Re: Win32 Perl Editors <andrew.yuen@fujitsu.com.au>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 15 Jul 1999 02:38:49 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Help: reading from COM1
Message-Id: <slrn7oqgvj.1ju.*@dragons.duesouth.net>
Once upon a time (Thu, 15 Jul 1999 01:53:52 GMT), George Avison) was
attempting to figure out Ilya's new Perl regex features, and accidently
sent the following to comp.lang.perl.misc:
: I'm trying to read a text file coming through COM1 on an NT 4.0
: system. I'm using the following commands in a Perl script:
:
: open (Scanner, "COM1") or die "Can't open COM1/n";
It's common to use all uppercase letters for filehandles.
If the open fails, you don't get any information about WHY it failed.
/n is not what you think it is.
open(SCANNER, "COM1") || die "Can't open COM1: $!\n";
: $h=0;
: while ($line = Scanner) {
This isn't what you think it is.
You want something like:
while ( $line = <SCANNER> ) {
perldoc -f readline
: $linearray[$h] = $line;
: $h++;
: }
While your algorithm is ok, it's not very perlish.
Try:
while($line = <SCANNER>) {
push @linearray, $line;
}
or:
@linearray = <SCANNER>;
: Thanks for any help you can give me -- I'm obviously a Perl and NT
: rookie.
HTH,
--Matthew
------------------------------
Date: Wed, 14 Jul 1999 21:24:38 -0700
From: David Greer <dgreer@connectnet.com>
Subject: HTTP and Perl
Message-Id: <378D6286.E3CECB69@connectnet.com>
Know of any good resources dealing with getting HTTP with Perl and/or
Perl socket scripting?
David Greer, MCP
Ordained Priest of the Church of Linuxology
Geek Code v3.12
GCS d- s: a17 C++ UL++ P++ L+++ E W+ N++ o K- w- O- M- V-
PS+ PE++ Y+ PGP++ t+ 5- X+ R++ tv- b++ DI+ D+ G+ e- h! r-- y--
------------------------------
Date: Wed, 14 Jul 1999 23:24:25 -0500
From: brian@pm.org (brian d foy)
Subject: Re: HTTP and Perl
Message-Id: <brian-1407992324260001@34.bloominton-01rs13-14rt.il.dial-access.att.net>
In article <378D6286.E3CECB69@connectnet.com>, David Greer
<dgreer@connectnet.com> wrote:
>Know of any good resources dealing with getting HTTP with Perl and/or
>Perl socket scripting?
you want the LWP modules found in the libnet bundle on CPAN.
if you want to do sockets, see the Sockets module, or the IO::Sockets
stuff. (hmmm, IO::Sockets... i guess that stuff i was talking about
today *is* useful ;)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Thu, 15 Jul 1999 04:08:14 GMT
From: Ray McVay <rmcvay@acm.org>
Subject: Re: Is my Perl script or IE4 ???
Message-Id: <378D5ABD.7767E92C@acm.org>
John Steer wrote:
>
> I have a Perl CGI that open a binary file and send the
> content to the user. The code is very simple :
> -------------
> print "Content-Type: application/octet-stream; name=\"myfile.cgi\"\n";
> print "Content-Disposition: attachment; filename=\"myfile.cgi\"\n";
> print "Content-Transfer-Encoding: binary\n";
> print "Content-Length: 125872\n\n";
> open FPTR, "myfile.cgi" ;
> while (<FPTR>) {
> print STDOUT;
> };
> ------------
> This works great with Netscape, and IE5. Neverthless, when IE4
> runs the script and open a message box to save the file name,
> the suggested file name is randomly choosen like "CA8HMUAY."
> or "CAEP4ZOF." or so on. Am I missing any header in my Perl file or it is
> IE4 ???
It's IE4. Actually I'm amazed it worked with IE5.
--
Ray
------------------------------
Date: Wed, 14 Jul 1999 19:00:15 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: learning perl
Message-Id: <vp4jm7.qck.ln@magna.metronet.com>
messmer (messmer@sirius.com) wrote:
: I recently quit my job as a social worker and am now driving a taxicab by
: night, learning perl by day. (I include this for entertainment value
: only.)
It is quite entertaining.
Thanks!
: In working through Learning Perl, the llama book, Im having trouble
: with exersize one in chapter 5.
What does "having trouble" mean?
It won't run?
It runs but spits out some messages instead of good output?
(what do the messages say?)
It runs but spits out the wrong output?
It dumps core?
It reaches out and slaps you in the face and makes remarks
about your ancestry?
Something else?
: The answer given in the back of the book
: seems neither to work,
Where is your code?
We cannot troubleshoot code that cannot be seen.
(be sure to cut/paste, don't try and type it)
: or to make any sense whatsoever. Am I missing
: something, or what?
I think that is pretty obvious.
Must be a rhetorical question.
: I think I understand how to assign hash element, but
So that eliminate "having trouble" with the 1st of the three lines.
Which of the other two don't you understand?
Prompting and retrieving the input?
Removing the line ending sequence (newline)?
print()ing output?
getting the value saved in the hash into the output string?
: this one has me banging my head against my stupid monitor and gnashing my
: teeth, whatever that means.
You have to give us a little something to go on if you want us
to be able to help.
Like an article of clothing once worn by the suspect or something...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 03:57:45 +0200
From: "Dr. Who" <qwerty@post.utfors.se>
Subject: Re: Net::SMTP problem?
Message-Id: <378BEE99.5B631AAB@post.utfors.se>
nope
------------------------------
Date: Wed, 14 Jul 1999 17:01:35 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie needs help: Environment variables
Message-Id: <frtim7.dbk.ln@magna.metronet.com>
Peter Marek (pmarek@stargate-systems.com) wrote:
: I'm running Perl verion 5 and need to execute a bourne shell script that
: exports some environment variables. These variables need to be visible
: to the caller which is the Perl script.
Children cannot affect their parent's environment.
It would be a wide shining security whole if they could.
So they can't.
: Can anyone shed some light on this?
Anybody well-mannered Usenet citizen would have checked the
Perl FAQ before posting to the Perl newsgroup.
So now folks know something about you.
Anyway...
_They_ could shed some light on it for those too selfish to
look it up themselves.
Perl FAQ, part 8:
"I {changed directory, modified my environment} in a perl script.
How come the change disappeared when I exited the script?
How do I get my changes to be visible?"
Write a wrapper shell script (parent) that sets the env vars
before invoking perl (child).
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 15 Jul 1999 02:06:53 GMT
From: monotone@my-deja.com
Subject: newby Q- how:perl script to cgi?
Message-Id: <7mjfno$2ke$1@nnrp1.deja.com>
I've been trying to create the beginning cgi's in "Learning PERL" by
O'Reilly but I can't get my browzer to recognize them as cgi's.
I've made them executables, given them names like "hello.html" and
"hello.cgi" but they still come accross as plain text.
What am I not doing?
Thnkas in advance, Tone
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 14 Jul 1999 19:11:53 -0700
From: Brad Murray <bjm@a2b01118.paralynx.bconnected.net>
Subject: Re: Old database is erased when I add new information
Message-Id: <87hfn6mzkm.fsf@a2b01118.paralynx.bconnected.net>
>>>>> "John" == John Stanley <stanley@skyking.OCE.ORST.EDU> writes:
John> Hardly. Everyone has a text editor -- they come with the
John> computer. Not everyone has the tools to take a truck apart,
John> and even if they do, there is no grease to clean up when you
John> edit code.
Everyone has *something* they could use to bash a truck to
pieces. possibly in the guise of trying to fix it. I would certainly
be preparing a large quotation for any customer that came back after
chopping up my work and wanted their damage repaired. I would never
hide the source---if they want to change it, that's cool, but it's no
longer my work at that point and I certainly won't be responsible for
it. They are made aware of this in much the same way as the label on
your hard drive lets you know that if you decide to break in with a
ball peen hammer and a nail file, Quantum will not participate in the
repairs without being paid.
You don't need any special tools to violate a warranty. Whatever you
try is probably goo enough.
Perhaps better than hiding source is a tamper-proof label. Say an MD5
message digest of it or something.
--
Brad Murray
Perl Geek and Triangle Corner
------------------------------
Date: 15 Jul 1999 04:10:55 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Old database is erased when I add new information
Message-Id: <7mjn0f$2ol$1@news.NERO.NET>
In article <87hfn6mzkm.fsf@a2b01118.paralynx.bconnected.net>,
Brad Murray <bjm@a2b01118.paralynx.bconnected.net> wrote:
>Everyone has *something* they could use to bash a truck to
>pieces.
Right. There is absolutely no difference between someone who thinks
they can fix their truck with a sledgehammer and someone who thinks
they can add a feature to a working piece of perl code using a text
editor. Everyone who watches a mechanic work on a car sees the mechanic
start by prying the hood off with a crowbar and removing the spark
plugs with an axe, and nobody has ever seen a programmer use a text
editor to fix code. Nobody would ever be confused into thinking they
can add features without understanding the whole program, ever.
And most of all, nobody has ever come to this newsgroup telling us that
the programmer who sold him some code that used to work until the user
tried fixing is unethical.
Is the sky blue on your planet like it is here on Earth?
>I would certainly
>be preparing a large quotation for any customer that came back after
>chopping up my work and wanted their damage repaired.
Good for you. That's your right. Just as it is the right for someone
else to not want to deal with code broken by foolish users. Why is it
that those who oppose hiding source are so free to tell others that they
cannot do it, even though those who want to hide their code never tell
others they can't do what they want to?
>I would never
>hide the source---if they want to change it, that's cool, but it's no
>longer my work at that point and I certainly won't be responsible for
>it.
Ummm, I think that is what I said already. Yep, that's what I told the
luser who expected the original author to jump at his beck and call.
>Perhaps better than hiding source is a tamper-proof label. Say an MD5
>message digest of it or something.
You missed the point completely. Your reputation is hurt much less by
someone who cannot edit your code and claim you gave them bad code in
the first place than by someone who can do that. Your time is wasted
much less often by someone who cannot edit the code and demand you fix
than than someone who can.
------------------------------
Date: Wed, 14 Jul 1999 04:14:41 +0200
From: "Dr. Who" <qwerty@post.utfors.se>
Subject: Re: OVER 18 ONLY! 72808
Message-Id: <378BF291.306D3FD9@post.utfors.se>
eat my shit and choke ..fucking spammer
------------------------------
Date: Wed, 14 Jul 1999 23:20:07 -0500
From: brian@pm.org (brian d foy)
Subject: Re: pattern matching with variables
Message-Id: <brian-1407992320080001@34.bloominton-01rs13-14rt.il.dial-access.att.net>
In article <7mh05k$6g9$1@nnrp1.deja.com>, Ida Wong <ida@fcmc.com> wrote:
>Hi there,
>
>This is most likely an easy question. I would like to to have a variable
>in my pattern match string. ie
>
>if /$var/
>
>but $ is the end of char and if I use \$ instead, then it resolve to a
>simple "$" and not recognising $var is a variable.
>
>any advice?
just try it and see what happens. then read the docs.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Wed, 14 Jul 1999 23:21:02 -0500
From: brian@pm.org (brian d foy)
Subject: Re: pattern matching with variables
Message-Id: <brian-1407992321020001@34.bloominton-01rs13-14rt.il.dial-access.att.net>
In article <378C8501.E92BD790@sbphrd.com>, David Pratt
<David_J_Pratt@sbphrd.com> wrote:
> Easiest way to do this is put the variable name in curly brackets.....
>
>e.g.
>
>$var = "Hello";
>$string = "sldkfsjdHelloasdsad";
>if ($s =~ /${var}/) { print "Found $var in $string\n"; }
that really doesn't do anything other than make you type two
extra characters.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Wed, 14 Jul 1999 04:30:44 +0200
From: "Dr. Who" <qwerty@post.utfors.se>
Subject: Re: pefskr lksj knna ksk
Message-Id: <378BF654.8D566653@post.utfors.se>
Ikjsf!!
slök kslödk ölkwe nmm,n sdmn iowu oijhbjnmx ljkeeeor ukl ...... slkjj
lkjlwr ..
slkj ,nwer opisdv ???
jskklsjdf lkj woieru ojkl ncmnm,errrrrwr?
------------------------------
Date: Thu, 15 Jul 1999 02:50:47 GMT
From: mamorshedi@my-deja.com
Subject: running .pl file by invoking their name
Message-Id: <7mjia3$3g9$1@nnrp1.deja.com>
In VMS command file files are invoked by "@". Does anybody know how to
do something similar with Perl running on Open VMS. How does one run
perl program in dos in a similar way. Thanks
Mark
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 14 Jul 1999 19:23:28 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Search array
Message-Id: <g56jm7.bfk.ln@magna.metronet.com>
Mark Wisniewski (ski@northwood.edu) wrote:
: I'm am just starting to play with perl. I have always used Korn shell
: programming in the past.
Well you should be made aware of the documentation that is
included with the perl distribution.
It is about 1200 "pages".
Worth looking at as a *first* resource when you are having
Perl problems.
Posting to Usenet is a last resource.
: How do I search the /etc/passwd file for a unique uid and exit the script if
: the user exist or continue on if the user doesn't exist.
You find out where the *.pod files are, then
grep '/etc/passwd' *.pod
perldata.pod: $fh = newopen('/etc/passwd');
perlform.pod: # a report on the /etc/passwd file
perlfunc.pod: open(PASSWD, '/etc/passwd');
perlport.pod:system-specific files, like F</etc/passwd>, F</etc/sendmail.conf>, or
perlport.pod:F</etc/resolv.conf>. For example the F</etc/passwd> may exist but it
I'll betcha there's something there...
See also the getpwnam(), getpwuid() family of functions in
perlfunc.pod.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 15 Jul 1999 03:38:30 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Re: stripping html tags
Message-Id: <378D57BA.8C7DDE82@email.com>
Try running the following code from the command line to see how.
In MS-DOS:
perl -e
"$c=\"5365652046415120706172742038\";$c=~s/[^A-F\d-]//g;for($c=~/(..?)/g){($d.=chr
hex)or($d=chr hex);}print $d;"
Or in UNIX:
perl -e
'$c="5365652046415120706172742038";$c=~s/[^A-F\d-]//g;for($c=~/(..?)/g){($d.=chr
hex)or($d=chr hex);}print $d;'
(Like that Abigail? Try it ;)
HTH,
Jordan
Rita Van Leer wrote:
>
> i am running an auction site done with perl and it auto sends email with
>
> the description of the item
>
> the only problem is that if the user has html tags in the description it
>
> passes this also and looks like crap
>
> is there any way to automatically strip the html tags out of the
> description before it is sent
--
Jordan Hiller (hiller@email.com)
JavaScript and Perl programs for
making online tests and quizzes:
http://web-shack.hypermart.net/quiz.html
------------------------------
Date: Thu, 15 Jul 1999 04:10:43 GMT
From: "Winter" <tungyat@yahoo.com>
Subject: Re: stripping html tags
Message-Id: <7bdj3.2631$n5.54610@news1.rdc2.on.home.com>
this is should work too:
$content =~ s/<([^\0]*?)>//g;
Rita Van Leer <zigmart@zigmart.com> wrote in message
news:378D23F1.3BB3CCEC@zigmart.com...
>
> i am running an auction site done with perl and it auto sends email with
>
> the description of the item
>
> the only problem is that if the user has html tags in the description it
>
> passes this also and looks like crap
>
> is there any way to automatically strip the html tags out of the
> description before it is sent
>
------------------------------
Date: Wed, 14 Jul 1999 04:01:15 +0200
From: "Dr. Who" <qwerty@post.utfors.se>
Subject: Tom Christiansen is a perlscript himself...
Message-Id: <378BEF6B.A1CB0A18@post.utfors.se>
Why doesn't Larry Wall post things here?
------------------------------
Date: 15 Jul 1999 03:27:43 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Tom Christiansen is a perlscript himself...
Message-Id: <slrn7oqldn.8of.fl_aggie@thepentagon.com>
On Wed, 14 Jul 1999 04:01:15 +0200, Dr. Who <qwerty@post.utfors.se>, in
<378BEF6B.A1CB0A18@post.utfors.se> wrote:
+ Why doesn't Larry Wall post things here?
Why should he?
James
------------------------------
Date: Thu, 15 Jul 1999 13:36:20 +1000
From: "Fujitsu Australia Limited" <andrew.yuen@fujitsu.com.au>
Subject: Re: Win32 Perl Editors
Message-Id: <7mjkqk$ahe@newshost.fujitsu.com.au>
I use Ultraedit, www.ultraedit.com
It has configurable syntax highlighting setup out of the box for Perl, C,
C++, HTML, etc, a window that lists the functions in your file and lets you
jump to them, taglist windows, regex search/replace in buffer or files,
execute commands with output window, and a reasonably useful macro language.
With a more sophisticated macro language it would be perfect.
I'm looking at vim and emacs as well. Like all this Unix oriented stuff, the
theory is that after you get over the initial learning curve you are a more
powerful person. Just right at the moment using vim or emacs I'm a less
powerful person because I can't control my editor.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 149
*************************************