[9465] in Perl-Users-Digest
Perl-Users Digest, Issue: 3059 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 4 12:07:12 1998
Date: Sat, 4 Jul 98 09:00:27 -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 Sat, 4 Jul 1998 Volume: 8 Number: 3059
Today's topics:
Re: 2-byte code match problem amr@miyako.japanologie.kultur.uni-tuebingen.de
Re: 2-byte code match problem (Abigail)
Re: attachment to email (Jeremy D. Zawodny)
Re: capturing STDOUT ouput from a child process <rootbeer@teleport.com>
Re: changing shell <rootbeer@teleport.com>
file/directory mode problems within a perl script <rmullen@mcmail.com>
Re: FREE Shopping Cart <max@idfw.com>
HELP: compiling 5.004_04 under Linux problem <raker@ods.ods.net>
how to replace ... (PONG Hay Chi)
Re: how to replace ... (Larry Rosler)
Re: how to replace ... (Tad McClellan)
Re: HTTP header: changing the type field <rootbeer@teleport.com>
Re: Looking for Perl-Script to configure Sendmail (xcitor)
Re: Looking for Perl-Script to configure Sendmail (Ralf Hildebrandt)
Re: Problem using Compiler-a3 with Perl5.004_O1 <tchrist@mox.perl.com>
Re: Q: object's memory space <rootbeer@teleport.com>
Re: question about objects <tchrist@mox.perl.com>
Re: replacing search variable in foreach (Tad McClellan)
Re: replacing search variable in foreach (Josh Kortbein)
Re: Script displaying IP address and hostnames? <flavell@mail.cern.ch>
Re: Script displaying IP address and hostnames? <merlyn@stonehenge.com>
Re: Simple, efficient way of checking whether $VAR is a <andy@tagish.co.uk>
Re: Simple, efficient way of checking whether $VAR is a (Tad McClellan)
Re: slurping when it's not supposed to? <rootbeer@teleport.com>
Re: Uploading image files <tjchamberlain@hotmail.com>
Re: Uploading image files (Bob Trieger)
Re: Virtual functions. (Mark-Jason Dominus)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 04 Jul 1998 15:29:05 +0200
From: amr@miyako.japanologie.kultur.uni-tuebingen.de
Subject: Re: 2-byte code match problem
Message-Id: <359E2E20.21A2@miyako.japanologie.kultur.uni-tuebingen.de>
Try
ftp.oreilly.com/pub/examples/nutshell/ujip/perl/perl97.pdf
Here you will find code examples and an general explanations
concerning CJK-issues.
HTH
Andreas Marcel Riechert
------------------------------
Date: 4 Jul 1998 15:04:22 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: 2-byte code match problem
Message-Id: <6nlg9m$rsm$1@client3.news.psi.net>
Yun Giljung (mingtian@hanmail.net) wrote on MDCCLXVIII September MCMXCIII
in <URL: news:359e1c0e.47881494@usenet.kornet21.net>:
++ abigail@fnx.com (Abigail) wrote:
++ >There doesn't seem to be any indication Perl is going towards fixed
++ >width 16bit characters. But it will have UTF-8 support.
++ >
++ >Perl has always been Western oriented, and it seems I18N means
++ >Unicode, not 16 bit chars.
++
++ I meant what you said..
++ i18n is mostly just funny idea, the one good point of MS is
++ its Korean,Chinese,Japanese..versions of win95/NT/3.1..and
++ tightly fixed version of international versions of software.
++
++ that's why i18n is just annoying and funny thing, i hope Perl does not
++ follow such useless thing.
I18N or Unicode is not useless nor annoying, as it includes a lot more
than just Korean, Chinese, Japanese and Western languages. But Perl
cannot be incompatible with what it is being used for now. Hence the
decision to do UTF-8, as that encodes ASCII with a single byte.
++ the idea of 'checking locale or something and showing allong with it'
++ is just annoying idea and not good idea, i hope OS, language tools
++ just read,output and USER select apprpriate software,fonts...etc.
++
++ under erd hat linux 4.x and over it always complains "Locale...!@#$"
++ when it is not LANG=c, it's not good idea, just run and show the result!
++ user will make routine without locale setting,
++ 8bit area of one code may not be a letter for english so it refers locale..
++ this idea is not that good, german user can add such chars when checking
++ and the people like me will make new long routine with 'while' and 'for'
++ to do s//,m//,y// , it's better a way.
++
++ i hope Perl just to be for only mostly english version not i18n version like Java.
++ making another way of implementing for 2 bytes code from english version is better
++ than using Unicode or referring to Locale stuff for my opinion.
Could you then please formulate those objections in a reasonable way
instead of just saying it's bad?
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
------------------------------
Date: 04 Jul 1998 11:06:45 -0400
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: attachment to email
Message-Id: <m390m9k64a.fsf@peach.z.org>
Gangadhar Vaddepalli <vadepali@ix.netcom.com> writes:
> I'm wondering whether we can attach another file to email using
> Perl. I want to send an attchment which is also an HTML file along
> with the message.
Yes.
I'd look at the various MIME and Mail related modules on CPAN.
Jeremy
--
Jeremy D. Zawodny Web Geek, Perl Hacker, etc.
http://www.wcnet.org/~jzawodn/ jzawodn@wcnet.org
LOAD "LINUX",8,1
------------------------------
Date: Sat, 04 Jul 1998 15:44:51 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: capturing STDOUT ouput from a child process
Message-Id: <Pine.GSO.3.96.980704084342.21492H-100000@user2.teleport.com>
On Thu, 2 Jul 1998, Matt Knecht wrote:
> Try this instead:
>
> @return=`dd if=/dev/rmt/0m of=/dev/null 2>&1`;
>
> Which does the trick under bash.
Of course, you don't have to have bash installed to do this. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 04 Jul 1998 15:51:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: changing shell
Message-Id: <Pine.GSO.3.96.980704085020.21492I-100000@user2.teleport.com>
On Thu, 2 Jul 1998, Ozkan Dikmen wrote:
> What I want is: after changing the shell, the script should continue
> executing in the new shell.
It sounds as if you want to run a _shell_ script in that shell - not perl.
No? Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 04 Jul 1998 16:39:11 +0100
From: Ross Mullen <rmullen@mcmail.com>
Subject: file/directory mode problems within a perl script
Message-Id: <359E4C9E.5F54B0C8@mcmail.com>
I have an irritating problem which someone may be able to help me out
with. It concerns a HTML form which accepts data and passes this to a
script, one form parameter is for "county" and depending what the user
types in will create a directory and place everything else typed in the
form into a file in this newly created directory.
When the program is first run it creates the directory with appropriate
file/directory modes and creates the file with all the form data.
However if the program is run again (as I want the program to append
data into this file) it displays a server error.
I have been told by the server administration that a script periodically
runs and chowns everything in my directory back to me, and I cant change
the modes on the directories or files as the web server doesn't have
permission to set permissions in my directory, it is running at a low
privilege user. If I try to manually change the file modes I receive
"operation not permitted".
My script requires the files to be updated in real-time and obviously at
the moment this cant happen, can anyone explain how I could get round
this problem. I have used the PERL >> operator to appended to the file.
Thanks in advance
------------------------------
Date: Sat, 4 Jul 1998 08:14:47 -0500
From: "Max Files" <max@idfw.com>
Subject: Re: FREE Shopping Cart
Message-Id: <990E072C6BBA588F.A612D7D1A1F4AC1B.32759FE53F179380@library-proxy.airnews.net>
I checked this out but didn't find a quick way to download the
file. Anyway, I found a decent shopping cart program which
is also free. I haven't had the time to get it fully configured
yet, but you can't beat the price.
http://www.minivend.com
veronica@iminet.com wrote in message <6ng6m3$pa6$1@nnrp1.dejanews.com>...
>I found an awesome web-based shopping cart for free.
>http://www.321website.com
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 3 Jul 1998 23:50:23 -0500
From: "Nick Hadaway" <raker@ods.ods.net>
Subject: HELP: compiling 5.004_04 under Linux problem
Message-Id: <6nkc95$kia@ns.sol.net>
I am trying to compile perl 5.004_04 and I keep getting this error. What
could this possibly be?!?!? I have included the error messages from the
'make test' and the './perl harness' commands...
A basic description of my system. Linux kernel 2.0.33 with a couple of
patches for sound and PPP upgrades and fat32 support. As you can see, i am
sending this through my secondary win98 system... :) It is basically from
a slackware distribution. Any help as to what i have to do to get this to
work would be a great help. raker@ods.ods.net is my email address for any
responses, or i will see re:'s on the newsgroup here. Thanks in advance for
your help...
lib/io_sock.......No such file or directory at ./lib/io_sock.t line
29.
FAILED at test 1
lib/io_taint......ok
lib/io_tell.......ok
lib/io_udp........Can't call method "sockname" without a package or
object reference at ./lib/io_udp.t line 39.
FAILED at test 2
Failed Test Status Wstat Total
Fail Failed List of failed
----------------------------------------------------------------------------
---
lib/io_sock.t 2 512 5 5 100.00% 1-5
lib/io_udp.t 2 512 3 2 66.67% 2-3
Failed 2/153 test scripts, 98.69% okay. 7/4857 subtests failed, 99.86%
okay.
Basically this is all the problems that I have been having. No matter how
i run the configure I get this same problem. I have looked at the
io_sock.t file and tried to figure out what line 29 points to but I can't
figure it out. If there is anything that you can do to help, I would be
much appreciative.
-Nick
------------------------------
Date: 4 Jul 1998 14:09:15 GMT
From: s9703579@study.ouhk.edu.hk (PONG Hay Chi)
Subject: how to replace ...
Message-Id: <6nld2b$ve5@du04.oli.hk>
Hi,
i want to replace all characters between '<' and '>' and including
'<' and '>'
by a comma
in the following line, would somebody help me?
before :
<content1 ....><content2 ....>this is data<content3..><content4..>
after :
,,this is data,,
Many thanks.
rgds.
alanpong@hkstar.com
------------------------------
Date: Sat, 4 Jul 1998 08:05:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: how to replace ...
Message-Id: <MPG.1007e486cc21747b989712@nntp.hpl.hp.com>
In article <6nld2b$ve5@du04.oli.hk> on 4 Jul 1998 14:09:15 GMT, PONG Hay
Chi <s9703579@study.ouhk.edu.hk> says...
> Hi,
> i want to replace all characters between '<' and '>' and including
> '<' and '>'
> by a comma
> in the following line, would somebody help me?
>
> before :
> <content1 ....><content2 ....>this is data<content3..><content4..>
>
> after :
> ,,this is data,,
$line =~ s/<[^>]*>/,/g;
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 4 Jul 1998 09:32:50 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: how to replace ...
Message-Id: <ieeln6.5ee.ln@localhost>
PONG Hay Chi (s9703579@study.ouhk.edu.hk) wrote:
: i want to replace all characters between '<' and '>' and including
: '<' and '>'
: by a comma
: in the following line, would somebody help me?
: before :
: <content1 ....><content2 ....>this is data<content3..><content4..>
: after :
: ,,this is data,,
s/<[^>]*>/,/g;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 04 Jul 1998 15:35:22 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: HTTP header: changing the type field
Message-Id: <Pine.GSO.3.96.980704083456.21492G-100000@user2.teleport.com>
On Thu, 2 Jul 1998, Jonathan Cavell wrote:
> The problem is that it doesn't work. When I try to downoad the sample in
> Netscape I still get the error that the file type was unknown.
If you're following the proper protocol but some browser or server doesn't
cooperate, then it's the other program's fault. If you're not following
the protocol, then it's your fault. If you aren't sure about the protocol,
you should read the protocol specification. If you've read it and you're
still not sure, you should ask in a newsgroup about the protocol.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 4 Jul 1998 09:16:19 -0400
From: xcitor@pobox.com (xcitor)
Subject: Re: Looking for Perl-Script to configure Sendmail
Message-Id: <slrn6psap3.nu.xcitor@axel.bonzoid.com>
On Fri, 03 Jul 1998 21:06:33 +0200,
Andreas Heinbokel wrote
from <Andreas.Heinboke@stud.uni-hannover.de>
in message <359D2BB9.8AFD490@stud.uni-hannover.de>:
|I heard from HP, that there exists a perl-script by which I can
|configure sendmail for my system. The script shall be interactive asking
|me all necessary questions and after this creating my
|sendmail-configuration file.
|Does anybody knows where I can find this script?
I'm not sure about a downloadable perl script, but there in an online
configuration tool located at
<http://www.harker.com/gen.sendmail.cf/index.html/>. It is a very
decent tool.
Enjoy.
- --
xcitor@pobox.com
Linux - the choice of a GNU generation.
1024/A883405D 1998/06/16 xcitor <xcitor@pobox.com>
Key fingerprint = E6 30 57 68 E9 3E 4B 79 5E B7 DE EF F8 DF 90 8F
Public Key Block at:
http://pgp5.ai.mit.edu:11371/pks/lookup?op=get&search=0xA883405D
Version: 2.6.3a
Charset: noconv
iQCVAwUBNZ4rII+3viuog0BdAQGTSQQAt5fZIuxO5kL4fRpouo8f7GzgEAu3er38
xDANtnWGuW5G/bn8jAbTzygm51vX5NDH/kPjIO2KUfFnPwcya5UTqGTq3bYl5BF5
hYDn8a0zx9aVyOugWwmNt3aYT80Ajl8Rm7iFCIHplXTNL1doqcVsvNh/RZWS0v3f
fUbBCz1n5NI=
=3CbB
-----END PGP SIGNATURE-----
------------------------------
Date: 4 Jul 1998 13:19:04 GMT
From: R.Hildebrandt@tu-bs.de (Ralf Hildebrandt)
Subject: Re: Looking for Perl-Script to configure Sendmail
Message-Id: <slrn6psau8.qp5.R.Hildebrandt@stahlw00.stahl.bau.tu-bs.de>
On Fri, 03 Jul 1998 21:06:33 +0200, Andreas Heinbokel <Andreas.Heinboke@stud.uni-hannover.de> wrote:
>I heard from HP, that there exists a perl-script by which I can
>configure sendmail for my system. The script shall be interactive asking
>me all necessary questions and after this creating my
>sendmail-configuration file.
>Does anybody knows where I can find this script?
I'd give the m4 methode a try...
--
Ralf Hildebrandt <R.Hildebrandt@tu-bs.de>
Institute for Steel-Structures, Techn. Univ. of Braunschweig, Germany
http://www.stahl.bau.tu-bs.de/~hildeb Phone:(0)531/391-3366
In my opinion M$ is a lot better at making money than it is at making
good operating systems. -- Linus Torvalds
------------------------------
Date: 4 Jul 1998 15:39:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Problem using Compiler-a3 with Perl5.004_O1
Message-Id: <6nlibi$qf7$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
danperl@copernicus.bbn.com (Dan Franklin (Perl Posting)) writes:
:The Perl compiler looked like a good thing to try to speed up a
:CGI script
It's not. The perlfaq3 manpage tells why, and provides useful
suggestions.
--tom
--
Lispers are among the best grads of the Sweep-It-Under-Someone-Else's-Carpet
School of Simulated Simplicity. [Was that sufficiently incendiary? :-)]
--Larry Wall in <1992Jan10.201804.11926@netlabs.com
------------------------------
Date: Sat, 04 Jul 1998 15:11:42 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Q: object's memory space
Message-Id: <Pine.GSO.3.96.980704080829.21492E-100000@user2.teleport.com>
On Wed, 1 Jul 1998, aspa wrote:
> is there a way for finding out how much memory space a certain perl
> object occupies?
Well, you could try deleting it and see how much more free memory you have
now.... :-) But, in general, no. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 4 Jul 1998 15:25:35 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: question about objects
Message-Id: <6nlhhf$qf7$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
charlie @antipope.org writes:
:I dislike reliance on idiom; the implicit use of $_ and @_ in
:particular. Yeah, they're handy -- but it's a royal pain in the ass
:when you have to hand over code to someone who, in the phrase of
:someone I had to deliver to, "has not yet been assimilated by the perl
:hive mind".
You are going to have to invent a better excuse than this.
You don't have someone maintain your code who doesn't know
the language. That's like telling a C programming not to
use pointers, or a scheme programmer not to use closures,
for fear that an untrained reader would be confused.
--tom
--
Think of your family tonight. Try to crawl home after the
computer crashes.
------------------------------
Date: Sat, 4 Jul 1998 10:11:48 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: replacing search variable in foreach
Message-Id: <kngln6.7ie.ln@localhost>
- (root.noharvest.\@not_even\here.com) wrote:
: Tom Phoenix <rootbeer@teleport.com> Said this:
: >On Mon, 29 Jun 1998, Randy Kimple wrote:
: >
: >> I have a foreach loop in which I need to replace a section of code with
: >> a different line each time through.
: >> Here is a snipet of my code in which $insert needs to change each time
: >> through the loop.
: >
: >
: >> foreach $position(@position) {
: >> open(FILE, "$section");
: >
: >It's unlikely (but possible) that you want to open a new file each time
: >through the loop. It's more likely that you want to open it once, outside
: >the loop. (You may or may not want to seek to the beginning in each
: >iteration.)
: Perhaps he's grep'ed a directory into @position, and now he's
: accessing each file looking for something?
Perhaps that's why Tom put the "(but possible)" in there?
: >Of course, those double quotes are merely misleading. And even when your
: >script is "just an example" (and perhaps especially in that case!) you
: >should _always_ check the return value after opening a file.
: Do you have this on some kind of macro? It's the same wording every
: time!!!
When you see folks using Really Bad Practice over and over, it seems
sensible to just write it once.
Followup Reuse saves labor just as Code Reuse does ;-)
: What's your hangup with return values?
It is standard practice in *any* programming language to check the
return value from system calls (not system() calls).
It is usual Software Engineering Standard Practice, not specific
to Perl, nor to Tom.
System calls can fail. Robust programs will give some helpful
diagnostic message rather than just plowing on as if the system
call had succeeded.
Tom's hangup is that robust programs are better than fragile programs.
An open() can fail for a great many reasons. Any one of which
will cause a program to not do the Right Thing:
typo in the filename
(incorrect) whitespace at the beginning/end of the filename
permission denied
file not found
...
: I never use return
^^^^^
: values, and my programs work great.
A "root" that trusts that *all* system calls will succeed every time.
Pretty darn scary. Astonishing, actually...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 4 Jul 1998 15:48:07 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: replacing search variable in foreach
Message-Id: <6nlirn$3j6$1@news.iastate.edu>
- (root.noharvest.\@not_even\here.com) wrote:
: Tom Phoenix <rootbeer@teleport.com> Said this:
: >Of course, those double quotes are merely misleading. And even when your
: >script is "just an example" (and perhaps especially in that case!) you
: >should _always_ check the return value after opening a file.
: Do you have this on some kind of macro? It's the same wording every
: time!!! What's your hangup with return values? I never use return
: values, and my programs work great.
You must be pretty lucky then, or you never make typographical errors.
FWIW, just last week I started on a quest to always check the return
values from my opens, etc., and I've already caught 2 or 3 errors due
to incorrectly typed paths, etc., on my part. Much easier than sticking
print statements in my script, hoping to see how far it gets before dying.
Plus, it helps guard against problems in the future, like somebody renaming
a file I need, etc. [Well, not against them moving it - but as soon as they
do, I'll know something's broken!]
Josh
--
__________________________________________
She had heard all about excluded middles;
they were bad shit, to be avoided.
- Thomas Pynchon
------------------------------
Date: Sat, 4 Jul 1998 14:51:16 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Script displaying IP address and hostnames?
Message-Id: <Pine.HPP.3.95a.980704142811.21460F-100000@hpplus20.cern.ch>
On Sat, 4 Jul 1998, F.Quednau wrote:
> Try this for a starter: (untested)
>
> print "Content-type: text/html\n\n";
> foreach $key(keys %ENV) {
> print "$key = $ENV{$key}";
> }
I think you need text/plain for that: it'd be a mess if parsed as HTML.
In fact, the one and only /bin/sh CGI that I use is this:
#!/bin/sh
echo Content-type: text/plain
echo
env
I don't think anybody said you _have_ to program everything in perl ;-)
If you _want_ to program in perl, [and be on topic for this group, yeah]
then you can at least sort the keys into alphabetical order, rather than
use them in their "random" hash ordering. You could even use your
text/html content type, and generate some HTML markup to suit, e.g make
a TABLE:
---fragment of script---
print <<EOD;
Content-type: text/html
<title>Server environment</title>
<table border=3>
EOD
foreach $name (sort keys %ENV) {
print "<tr><td>$name </td><td>$ENV{$name} </td></tr>\n";
}
print "</table>\n";
---
Oh well, in perl there's always several ways of doing it...
cheers
------------------------------
Date: Sat, 04 Jul 1998 15:58:29 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Script displaying IP address and hostnames?
Message-Id: <8ck95tobft.fsf@gadget.cscaper.com>
>>>>> "Alan" == Alan J Flavell <flavell@mail.cern.ch> writes:
Alan> If you _want_ to program in perl, [and be on topic for this group, yeah]
Alan> then you can at least sort the keys into alphabetical order, rather than
Alan> use them in their "random" hash ordering. You could even use your
Alan> text/html content type, and generate some HTML markup to suit, e.g make
Alan> a TABLE:
Alan> ---fragment of script---
add:
use HTML::Entities;
Alan> print <<EOD;
Alan> Content-type: text/html
Alan> <title>Server environment</title>
Alan> <table border=3>
Alan> EOD
Alan> foreach $name (sort keys %ENV) {
Alan> print "<tr><td>$name </td><td>$ENV{$name} </td></tr>\n";
replace with:
print "<tr><td>", encode_entities($name), "</td><td>",
encode_entities($ENV{$name}), "</td></tr>\n";
Alan> }
Alan> print "</table>\n";
Alan> ---
Alan> Oh well, in perl there's always several ways of doing it...
Of course. Some of them are more robust than others. :)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 59 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sat, 4 Jul 1998 15:56:41 +0100
From: Andy Armstrong <andy@tagish.co.uk>
Subject: Re: Simple, efficient way of checking whether $VAR is an element of set @LIST ?
Message-Id: <Xt$IvHApKkn1EwVm@tagish.co.uk>
In article <xfkn2b4r03c.fsf@big.aa.net>, Charles Roten
<croten@big.aa.net> writes
>
>Yeah, it's probably a _really_ dumb question ... but while a subroutine
>for such would be quite simple to write, I hate to reinvent the wheel ..
>and I'd bet two dollars ot a donut that this is probably already done
>_properly_, in some standard callable routine.
>
>I am really thinking in set-theoretic terms here. And that's the sort
>of test I want.
>
>What I'm _really_ after will look like this ...
>
>@LIST = keys (%hash);
>if ( $VAR is an element of @LIST ) {
> do stuff ;
>} else {
> scream bloody murder .. the other shoe just dropped ;
>}
Why not just test the hash directly?
if ($hash{$var}) {
do stuff ;
}
--
** Don't CC any follow-ups to me - I *do* read the newsgroups I post to **
Andy Armstrong, Wonderworks, http://www.wonderworks.co.uk
------------------------------
Date: Sat, 4 Jul 1998 10:30:21 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Simple, efficient way of checking whether $VAR is an element of set @LIST ?
Message-Id: <dqhln6.hke.ln@localhost>
Andy Armstrong (andy@tagish.co.uk) wrote:
: In article <xfkn2b4r03c.fsf@big.aa.net>, Charles Roten
: <croten@big.aa.net> writes
: >
: >Yeah, it's probably a _really_ dumb question ... but while a subroutine
: >for such would be quite simple to write, I hate to reinvent the wheel ..
: >and I'd bet two dollars ot a donut that this is probably already done
: >_properly_, in some standard callable routine.
: >
: >I am really thinking in set-theoretic terms here. And that's the sort
: >of test I want.
: >
: >What I'm _really_ after will look like this ...
: >
: >@LIST = keys (%hash);
: >if ( $VAR is an element of @LIST ) {
: > do stuff ;
: >} else {
: > scream bloody murder .. the other shoe just dropped ;
: >}
: Why not just test the hash directly?
: if ($hash{$var}) {
: do stuff ;
: }
Because that won't do the Right Thing for several potential values:
$hash{$var} = ''; # empty string is false...
undef $hash{$var}; # ... so is undef
$hash{$var} = 0; # ... so is zero
In each case $var *would* appear in @LIST...
if (exists $hash{$var}) {
do stuff ;
}
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 04 Jul 1998 15:59:30 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: slurping when it's not supposed to?
Message-Id: <Pine.GSO.3.96.980704085425.21492J-100000@user2.teleport.com>
On Thu, 2 Jul 1998, Randy Schultz wrote:
> elsif (($rc == 220) && ($act =~ /\[Connect\]/o))
It seems that someone has misled you about the /o option to pattern
matching. It doesn't hurt anything here, but it is misleading in that it
implies that it's helping. (Also, I suspect you wish to know merely
whether the variable $act contains '[Connect]', so you may not need a
pattern at all.)
> $rest =~ s/\<|\>//gi; # strip out all "<" and ">"
Perhaps someone has misled you about the /i option as well. And you
shouldn't have to backwhack the angle brackets; they're not special in
perl patterns. Of course, this transformation should be much faster if you
used something like this.
$rest =~ tr/<>//d;
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 04 Jul 1998 22:56:08 +1000
From: Toby Chamberlain <tjchamberlain@hotmail.com>
Subject: Re: Uploading image files
Message-Id: <359E2668.D4CA016@hotmail.com>
Tony Curtis wrote:
> Re: Uploading image files, Toby
> <tjchamberlain@hotmail.com> said:
>
> Toby> read(STDIN, $QUERY, $ENV{"CONTENT_LENGTH"});
>
> Toby> #-------------- Get Form function ------------- # Read
> Toby> the form into a hash (%in).
> Toby> sub GetForm { local %in; my($in, $name, $value);
>
> &reinvent('wheel') && die;
>
> Why not:
>
> use CGI;
For two reasons :
A: Can't locate CGI.pm in @INC at ./setdat.cgi line2
and more importantly....
B: Because I like to know how things work sometimes, so if I need or want to do
something different I can. (Why not just get someone else to write the code for
me in the first place??)
I have actually been looking in other places to help solve my problem, but as yet
haven't found anything that does.... If I can't find out what's happening then
my next step will be trying to use pre-written code (such as CGI.pm or cgilib.pl)
to determine if it is a fault in my code or something strange happening with the
server.
As I said in every post so far.. the script seems to run fine - it parses the
form data fine - it's just that all the form data doesn't appear to be there, is
there any reason why CGI.pm would be able to read data that is invisible to a
non-CGI.pm script??
Here's hoping I get some useful information soon
Toby
------------------------------
Date: Sat, 04 Jul 1998 13:43:56 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Uploading image files
Message-Id: <6nlbms$i8h$1@strato.ultra.net>
[ posted and mailed ]
Toby Chamberlain <tjchamberlain@hotmail.com> wrote:
-> As I said in every post so far.. the script seems to run fine - it parses the
-> form data fine - it's just that all the form data doesn't appear to be there,
-> is
-> there any reason why CGI.pm would be able to read data that is invisible to a
-> non-CGI.pm script??
->
-> Here's hoping I get some useful information soon
You are getting the most useful information available and arguing against it
instead of putting it to work for you.
CGI.pm is not `pre-written' code. It is a module and does many things easier
for you, including making `uploading images'. If you are going to be writing
cgi, you are going to need it sooner or later, if only for it's ReadParse
function.
Read the documentation for it and you will probably find your answer.
http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html
Good luck,
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-286-0591
and let the jerk that answers know that his
toll free number was sent as spam. "
------------------------------
Date: 4 Jul 1998 11:33:26 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Virtual functions.
Message-Id: <6nli06$mqo$1@monet.op.net>
In article <899477722.650052@thrush.omix.com>,
Zenin <zenin@bawdycaste.org> wrote:
>Mark-Jason Dominus <mjd@op.net> wrote:
> You didn't pass $class btw, so _check_virtual_functions() won't
> ever see it
Thanks. I originally wrote it as one function, and when I broke it in
two, I forgot to pas $class along.
I didn't want it to be global.
------------------------------
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 3059
**************************************