[7027] in Perl-Users-Digest
Perl-Users Digest, Issue: 652 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 24 11:18:13 1997
Date: Tue, 24 Jun 97 08:00:39 -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 Tue, 24 Jun 1997 Volume: 8 Number: 652
Today's topics:
Re: Broken Pipe (Daniel Donghoon Paik)
Checking a string for "@' and "." <deanh@nospam.mail>
Re: Example in PF doesn't work <eric@hilding.com>
Filehandles & data input --- A few Questions topaz56@one.net
get end of string (easy question) <cathyh@cs.berkeley.edu>
good online Perl Tutorial? <kinlum@wco.com>
Re: Help me!!! <rootbeer@teleport.com>
Re: Line into Array <rootbeer@teleport.com>
Re: microsoft personal web server parsing perl scripts <rootbeer@teleport.com>
Re: mod_perl installation <dougm@osf.org>
Need HELP with LINKS.PL Script <JimmyVB@servers-unlimited.com>
Re: Need HELP with LINKS.PL Script <rootbeer@teleport.com>
Perl & SQL <mpolly@miint.net>
Re: POssibly Dumb Question: qq() and qw()... <rootbeer@teleport.com>
Re: POssibly Dumb Question: qq() and qw()... (Michael Fuhr)
Re: POssibly Dumb Question: qq() and qw()... (Abigail)
Re: Q: an alternative to this use of "goto"? <rootbeer@teleport.com>
Re: regular expressions (Tung-chiang Yang)
Remove duplicate values from array (George Pieri)
s/Hex/Char/ ? s/Char/Hex/ <wesley@woais.com>
Re: s/Hex/Char/ ? s/Char/Hex/ <merlyn@stonehenge.com>
Re: s/Hex/Char/ ? s/Char/Hex/ <wesley@woais.com>
Re: Script to verify email addresses? (Magnus Bodin)
Source Code for you and SWLock for Shareware programmer <chizl@cyberdude.com>
Re: stdin, stdout, exec (Andrew M. Langmead)
Strings to Associative Arrays <pdenman@ims.ltd.uk>
Re: Why do i get text/octet-stream download when i try <chriskl@tartarus.uwa.edu.au>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Jun 1997 22:31:19 -0700
From: uctt@soda.CSUA.Berkeley.EDU (Daniel Donghoon Paik)
Subject: Re: Broken Pipe
Message-Id: <5ol1n7$5r0@soda.CSUA.Berkeley.EDU>
In article <33A94719.4FD6@informatik.tu-muenchen.de>,
Alex `Taker` Pircher <pircher@informatik.tu-muenchen.de> wrote:
>The problem is I try to send for example Netscape a file, but
>if the User cancel's the Downloading process my perl-script
>stops with "Broken pipe".
i think you should check to see the max file size of the file to upload in
your perl library. it may be set too low. try uploading a small file.
if it works, then this is the problem.
Dan.
------------------------------
Date: Mon, 23 Jun 1997 10:41:57 +0800
From: Dean Hollister <deanh@nospam.mail>
Subject: Checking a string for "@' and "."
Message-Id: <33ADE275.395B@nospam.mail>
Hello,
Can anyone point me to the required code to check whether or not a
string has BOTH the "@" and "." characters in it?
Using Perl 5.
Regards,
d.
--
+--------------------------------------------------------+
| Dean Hollister, | deanh@iinet.net.au |
| Region Co-Ordinator, | dean@odyssey.apana.org.au* |
| APANA, | |
| Western Australia. | *finger A/C for DISCLAIMER |
+--------------------------------------------------------+
ST:VOY Kess: "I wish people would stop talking to me as if
I'm still a child! I'm three years old now!"
------------------------------
Date: Sun, 22 Jun 1997 01:36:22 -0700
From: Eric Hilding <eric@hilding.com>
Subject: Re: Example in PF doesn't work
Message-Id: <33ACE406.1D5F@hilding.com>
Mike Stok wrote:
>
> In article <33AA3A34.5344@hilding.com>, Eric Hilding <eric@hilding.com> wrote:
> >I culled this from the Perl FAQ:
> >
> > s/^\s+|\s+$//g; # perl4 or perl5
> >
> >It is supposed to strip blank space from the beginning and
> >end of a string. I've tried it on:
> >
> > "DAWSON DRIVE - LOT "
> >
> >It doesn't work...it actually axes out *all* the text.
>
> Hi Eric,
>
> it does work, I think:
>
> $ perl -e '$_ = "DAWSON DRIVE - LOT "; s/^\s+|\s+$//g; print ">$_<\n"'
> >DAWSON DRIVE - LOT<
>
> Do you have an actual code snippet?
>
if ($line =~ m/LOCATION:\s*(.{1,24})/)
{
$line =~ m/LOCATION:\s*(.{1,24})/;
$address = $line;
# $address =~ s/^\s+|\s+$//g; #temp out-of-service
$address = $1;
print ">$address<\n";
}
If I un# the whitespace cleanup line, I don't get an address to print.
Without
the line, the address prints but with extra spaces at the end. I also
have
to write this to an ascii .csv file which is done with a subroutine in a
subsequent block. Weird. I tried the perl -e '$_ <blah blah> one-liner
above but it won't work on my Win32 port (Perl 5.003_07) Win32 Build 306
4/10/97 by Microsoft & ActiveWare. Perl gremlins in my machine?
Tnx.
Eric
------------------------------
Date: Mon, 23 Jun 1997 04:46:16 GMT
From: topaz56@one.net
Subject: Filehandles & data input --- A few Questions
Message-Id: <33aeff93.98307271@news.mindspring.com>
Hi,
In all of the perl texts, it seems that the authors tend to gloss over
file input unless it comes in on STDIN or as an environmental
variable.
Now, it seems pretty simple to take say the input from a textarea
or a text file in general & dump it into an array, like below...
open (DATAFILE, "$data") || die "Can't open $data\n";
@data = <DATAFILE>;
I understand looping through a scalar newline by newline, maybe doing
a regex match or sub on the line... Finally here's the question...
I want to read in a datafile into one scalar not an array w/o looping.
undef $/;
$data =(<DATA>, datafile.txt);
doesn't seem to work...
as $_ doesn't seem to hold the entire scalar value (Maybe it does, and
I'm just not checking it right).
Do I have to loop like this
$data =(<DATA>, datafile.txt);
while
{
something...
$data1=+$data;
}
w/ $data1 having each line appended to it?
or is there an easier way???
Seems like I'm being really stupid, but I don't know where else to go
w/ this...
Best, Tom
=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=
tporter@dtool.com
Thomas Porter, Ph.D.
THE DIGITAL TOOL GROUP
http://www.dtool.com
"Never attribute to malloc
that which can be adequately explained by stupidity"
=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
------------------------------
Date: Sun, 22 Jun 1997 19:53:07 -0700
From: Cathy Huang <cathyh@cs.berkeley.edu>
Subject: get end of string (easy question)
Message-Id: <33ADE513.47E8@cs.berkeley.edu>
Say
$IMAGE = http://www.women.com/guide/guide/gifs/nav.7.gif
This is wrong:
---------------------
if ($IMAGE =~ /\/(.*?)$/i)
{
$END = $+;
}
-----------------------
$END = /www.women.com/guide/guide/gifs/nav.7.gif
------------------------
How can I get $END = nav.7.gif? I just want to get the string between
the last / and the end of the line.
Please email cathyh@cs.berkeley.edu if possible.
Thanks,
Cathy
------------------------------
Date: Sun, 22 Jun 1997 22:46:50 -0700
From: Kenneth Kin Lum <kinlum@wco.com>
Subject: good online Perl Tutorial?
Message-Id: <5ol2lu$78n$1@news.wco.com>
Does some one know of a good online Perl Tutorial?
------------------------------
Date: Sun, 22 Jun 1997 16:29:24 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Wayne Smith <gnu@netcom.com>
Subject: Re: Help me!!!
Message-Id: <Pine.GSO.3.96.970622162555.13872I-100000@kelly.teleport.com>
On Sun, 22 Jun 1997, Wayne Smith wrote:
> Subject: Help me!!!
Here's your first help: See the frequent posting about choosing good
subject lines.
> I have this script to add users from a file with the format firstname
> lastname. What I would like to do is modify the script to read from a
> file that has just the userID an run the output through the userdel
> command.
What's stopping you? :-) I'd like to help, but I can't see why you can't
do this. It sounds like a simple modification to what you have. Good luck!
-- 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/
------------------------------
Date: Sun, 22 Jun 1997 16:25:22 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Kenneth Kin Lum <kinlum@wco.com>
Subject: Re: Line into Array
Message-Id: <Pine.GSO.3.96.970622162326.13872H-100000@kelly.teleport.com>
On Sat, 21 Jun 1997, Kenneth Kin Lum wrote:
> From: Kenneth Kin Lum <"kinlum"@wco(dot).com>
Your address seems to be mangled.
> Newsgroups: comp.lang.perl
If your news administrator still carries comp.lang.perl, please encourage
him or her to check out the frequent posting about bogus newsgroup names
in news.announce.newgroups. You'll be doing yourself and many others a
favor to use comp.lang.perl.misc (and other valid Perl newsgroups)
instead.
news:news.announce.newgroups
> Say I got a line from a file. Is there a way
> to easily refer to the individual words in the line,
> separated by spaces or comma?
> Such as:
> $a = <FILE>
> @a_array = get_array($a, " "); #separated by space
> @b_array = get_array($a, ","); #separated by comma
Sure, you could use split, or one of the text-handling modules. Hope this
helps!
-- 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/
------------------------------
Date: Sun, 22 Jun 1997 16:22:21 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ralf =?iso-8859-1?Q?L=F6ffler?= <hexe_lenggries@t-online.de>
Subject: Re: microsoft personal web server parsing perl scripts
Message-Id: <Pine.GSO.3.96.970622161950.13872F-100000@kelly.teleport.com>
On 20 Jun 1997, Ralf [iso-8859-1] L=F6ffler wrote:
> Can't find any documentation how to configure the microsoft personal web
> server, so it parses .pl files. Must be some registry keys. Any hints
> will be appreciated
If it's not in the documentation, you should try to get your money back.=20
In any case, this is a server question, not a Perl question. (You can tell
because the answer won't require any Perl code.) If you still have
questions, see if you can find a server newsgroup, or their FAQ. Good
luck!
-- 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/
------------------------------
Date: Sun, 22 Jun 1997 20:36:07 -0400
From: Doug MacEachern <dougm@osf.org>
To: Marshall Dudley <mdudley@execonn.com>
Subject: Re: mod_perl installation
Message-Id: <33ADC4F7.3720@osf.org>
Marshall Dudley wrote:
>
> I am running a banner exchange which uses a perl file to throw banners.
> Since this is taking much more cpu resources than we can afford I am
> trying to install the mod_perl in the Apache server. However I am
> getting some cryptic error messages and am not sure where to go to from
> here.
>
> I have Perl 5.003. I have installed ExtUtils and upgraded the CGI.pm to
> version 2.36. I have downloaded and made available Apache 2.0.
> [...]
> net/cgi.............FAILED tests 2-4 <-----------------------------
> Failed 3/4 tests, 25.00% okay
> net/headers.........ok
> net/hooks...........ok
> net/http-get........ok
> net/http-post.......ok
> net/taint...........ok
> httpd terminated
> Failed 1 test script, 87.50% okay. 3/43 subtests failed, 93.02% okay.
> <--------------------
> *** Error code 29
> make: Fatal error: Command failed for target `run_tests'
> <---------------------------------
>
> This is the error log that got written at /tmp/mod_perl_error.log:
>
> [Fri Jun 20 12:17:04 1997] Can't locate CGI/Switch.pm in @INC at
> /opt/software/etc/apache/mod_perl-0.99/t/net/perl/cgi.pl line 3.
> BEGIN failed--compilation aborted at
> /opt/software/etc/apache/mod_perl-0.99/t/net/perl/cgi.pl line 3.[...]
It looks like you just copied CGI.pm into your site_perl, instead of a
full 'make install', which would have installed CGI::Switch. There's
a few others that you should see in site_perl/CGI/
-Doug
------------------------------
Date: Sun, 22 Jun 1997 19:29:01 -0400
From: SERVERS UNLIMITED <JimmyVB@servers-unlimited.com>
Subject: Need HELP with LINKS.PL Script
Message-Id: <33ADB538.8C5EEEA0@servers-unlimited.com>
Hi,
I currently am running Perl script LINKS.PL for a Free Links
Page. I would like to be able to send a text email file to
everyone who adds a link. I have coded the Email text field
into my free links page, but now need to know what needs to
be added to the CGI script to make it work.
Does anyone know what I can add to the script so the email
address entered into the field on the html page receives the
txt document I have??
Please email me any responses or HELP at
mailto:jimmy@servers-unlimited.com
--
Thankyou,
James Van Broekhoven, President
Servers Unlimited
Save 50% on Virtual Server Setup!
http://www.servers-unlimited.com
Establish Your Internet Presence TODAY!!
Join our sales force
http://www.adgrafix.com/info/jvanbroekh/sales.html
mailto:webmaster@servers-unlimited.com
------------------------------
Date: Sun, 22 Jun 1997 16:44:12 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: SERVERS UNLIMITED <JimmyVB@servers-unlimited.com>
Subject: Re: Need HELP with LINKS.PL Script
Message-Id: <Pine.GSO.3.96.970622164324.13872L-100000@kelly.teleport.com>
On Sun, 22 Jun 1997, SERVERS UNLIMITED wrote:
> Does anyone know what I can add to the script so the email address
> entered into the field on the html page receives the txt document I
> have??
I think you probably want to call either a module or an external program
(like sendmail) to send the mail. Hope this helps!
-- 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/
------------------------------
Date: Sun, 22 Jun 1997 19:22:54 -0500
From: Michael Polikoff <mpolly@miint.net>
Subject: Perl & SQL
Message-Id: <33ADC1DE.6ECA@miint.net>
I'm currently working on a databasing project in which I'm designing an
applications interface in HTML. In order to interface with the database
(Oracle), I need to write CGI scripts with embedded SQL. I know this
can be accomplished with C or Visual Basic, but I don't have time to
learn a new language. Does anyone know how this could be done with
Perl?
Desperate for any help anyone could give me -- even a link to a good
source of info. Thanks.
Mike Polikoff
michael@uss.net
mpolly@miint.net
------------------------------
Date: Sun, 22 Jun 1997 16:30:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: professor katz <prof@katz.com>
Subject: Re: POssibly Dumb Question: qq() and qw()...
Message-Id: <Pine.GSO.3.96.970622162945.13872J-100000@kelly.teleport.com>
On Sun, 22 Jun 1997, professor katz wrote:
> I see this a lot:
> qq{} and qw{} and qq() and qw()...
>
> What is it? I'm trying to find it in documentation, but I can't find it
> anywhere.
It should be in perlop(1). Let us know if you can't find it there. Good
luck!
-- 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/
------------------------------
Date: 22 Jun 1997 20:08:05 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: POssibly Dumb Question: qq() and qw()...
Message-Id: <5oklq5$rok@flatland.dimensional.com>
prof@katz.com (professor katz) writes:
> I see this a lot:
> qq{} and qw{} and qq() and qw()...
>
> What is it? I'm trying to find it in documentation, but I can't find it
> anywhere. Just a hint to where to look would be appreciated.
Take a look at the perlop manual page.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Mon, 23 Jun 1997 02:11:24 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: POssibly Dumb Question: qq() and qw()...
Message-Id: <EC7I31.Cz8@nonexistent.com>
professor katz (prof@katz.com) wrote on 1391 September 1993 in
<URL: news:prof-ya02408000R2206971247570001@snews.zippo.com>:
++
++ I see this a lot:
++ qq{} and qw{} and qq() and qw()...
++
++ What is it? I'm trying to find it in documentation, but I can't find it
++ anywhere. Just a hint to where to look would be appreciated.
$ perldoc -f qw
=item qw/STRING/
Generalized quotes. See L<perlop>.
$
I guess I don't have to show you how to type 'man perlop'...
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Sun, 22 Jun 1997 16:18:41 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Moore <jmoore@sober.com>
Subject: Re: Q: an alternative to this use of "goto"?
Message-Id: <Pine.GSO.3.96.970622161245.13872E-100000@kelly.teleport.com>
On Sun, 22 Jun 1997, Jason Moore wrote:
> I've always heard that the function "goto" is outdated,
> and considered bad form since it makes code difficult to
> maintain and usually isn't necessary.
Entirely right. In fact, anybody who has studied computers in the last
twenty-five years or so has probably learned to hate goto. As I say in
most of my Perl classes, "The difference between CS majors and everyone
else is that if you tell CS majors to go to hell, they think that the 'go
to' is the bad part." :-)
> I have found a use of "goto" which I find quite handy, and I would like
> to know if there is a non-goto way of achieving the same thing.
> START: ## a label to "goto"
[ snip ]
> if(&error_check_form) ## checks for errors in
> { ## user input.
> ## Puts messages in
> $param_action = ""; ## @status.
> goto("START"); ## <<< COOL!
> }
I think you could use redo, something like this.
{ # Start of naked block
if (&error_check_form) {
$param_action = ""; # or whatever
redo; # Redoes this block, as needed
}
}
Does that do it? Hope this helps!
-- 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/
------------------------------
Date: Tue, 24 Jun 1997 03:54:02 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: regular expressions
Message-Id: <tcyangEC9HI3.59y@netcom.com>
s/#/add_text/;
Hey, ASUCLA usually has book sales. Grab a copy of the Camel book in
Ackerman Union next time. Last time I got my 2nd edition there, I got a
rose as a freebie.
==============================
Tri Tram typed before Poison Ivy kissed him:
: Can somebody please help me with the regular expressions? I have the
: following:
: text #(text)
: text #(more test)
: test #(text and more text)
: I want to change it to:
: text add_text(text)
: text add_text(more_text)
: test add_text(text_and_more_text)
: thanks for your help.
--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: Mon, 23 Jun 1997 23:43:03 GMT
From: george.pieri@mci.com (George Pieri)
Subject: Remove duplicate values from array
Message-Id: <33af07ec.461009586@news.cs.mci.com>
I would like to remove all the duplicate values from a one dimensional
array... Is there an easy way to do this....?
e.g.
If the array @last_names lists all last names of individuals and the
name Smith is in the array 50 times how can I insure that the array
has only DISTINCT or unique values so Smith is only once in the array
??
Thanks in advance!
------------------------------
Date: Sun, 22 Jun 1997 21:55:43 -0500
From: Wesley Miaw <wesley@woais.com>
Subject: s/Hex/Char/ ? s/Char/Hex/
Message-Id: <33ADE5AF.CAA@woais.com>
I'm having some trouble with my perl CGI. After receiving the input via
either GET or POST, I'm splitting it into the separate values and
storing them. However, for the sake of using the strings, I'm using this
to translate between Hex and Char.
$input =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
Now, in the middle of the CGI, I do want to return a form in case fields
are missing. I use hidden fields to keep track of state. But, since the
text has been translated from Hex -> Char, I am getting fields like:
<INPUT TYPE="hidden" NAME="name" VALUE="value">
where name or value can have characters like a comma, period, or weird
stuff depending on what the user entered in the text fields earlier. The
browser does not seem to be translating these into hex before sending
them, so my parser is getting characters in character format when it
should be getting them in hex. Is there anyway to do another s/// on the
string before writing the hidden field? I'd prefer not to tranlate the
entire string into hex, but that may be necessary.
--
Wesley Miaw wesley@woais.com
World of Artists Internet Services http://www.woais.com/
71 Middlesex Drive Tel: 518-439-0412
Slingerlands, NY 12159 FAX: 518-439-9722
------------------------------
Date: 22 Jun 1997 23:22:22 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: wesley@woais.com
Subject: Re: s/Hex/Char/ ? s/Char/Hex/
Message-Id: <8cyb81rg81.fsf@gadget.cscaper.com>
>>>>> "Wesley" == Wesley Miaw <wesley@woais.com> writes:
Wesley> Now, in the middle of the CGI, I do want to return a form in
Wesley> case fields are missing. I use hidden fields to keep track of
Wesley> state. But, since the text has been translated from Hex ->
Wesley> Char, I am getting fields like:
Wesley> <INPUT TYPE="hidden" NAME="name" VALUE="value">
Wesley> where name or value can have characters like a comma, period,
Wesley> or weird stuff depending on what the user entered in the text
Wesley> fields earlier. The browser does not seem to be translating
Wesley> these into hex before sending them, so my parser is getting
Wesley> characters in character format when it should be getting them
Wesley> in hex. Is there anyway to do another s/// on the string
Wesley> before writing the hidden field? I'd prefer not to tranlate
Wesley> the entire string into hex, but that may be necessary.
CGI.pm handles this stuff rather trivially:
use CGI qw/:form/;
...
print hidden("name");
where "name" is already stolen (value included) from the previous form
submission. No fuss, no muss, and everything is escaped properly.
In another reply, you said you didn't want to use CGI.pm, but methinks
you are needlessly reinventing the wheel, one spoke at a time. Either
you are masochistic, or you just haven't seen enough of what CGI.pm
can do for you.
CGI.pm rules. CGI.pm rocks. Get CGI.pm. CGI.pm is your friend.
It's even already installed when you get 5.004, so there's no
installation issues.
By the way, comp.lang.perl.misc is the WRONG newsgroup for CGI-related
Perl issues. Please go over to comp.infosystems.www.authoring.cgi.
We answer lots of Perl questions there. Yes, even though it's Perl,
it's not appropriate in the Perl "misc" group because there's a more
specific group for CGI-Perl issues. Most of the Web uses Perl, but
most of Perl usage is *not* about the Web. Really.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 435 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@ora.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: Sun, 22 Jun 1997 23:06:48 -0500
From: Wesley Miaw <wesley@woais.com>
To: Tim Smith <trs@AZStarNet.com>
Subject: Re: s/Hex/Char/ ? s/Char/Hex/
Message-Id: <33ADF659.1680@woais.com>
Tim Smith wrote:
>
> In article <33ADE5AF.CAA@woais.com>, Wesley Miaw <wesley@woais.com> wrote:
> >I'm having some trouble with my perl CGI. After receiving the input via
> >either GET or POST, I'm splitting it into the separate values and
> >storing them.
>
> You might want to use the CGI module, which handles all of this for
> you painlessly. It stores the values for you, and to get the value
> you just call a routine:
>
> $query = new CGI; # does all the splitting and storing
> $query->param('field1') # e.g., <INPUT name="field1" type=...>
>
> >Now, in the middle of the CGI, I do want to return a form in case fields
> >are missing.
>
> You might be looking for the URI::Escape module. It works very well
> for this kind of thing, and then you can just call URI::unescape($string)
> to get your original string back.
Thanks for the e-mail. I think I was too verbose, because I don't need
the CGI module, I already have my own personal library of Perl routines,
among which is parsing the input.
The Escape module is probably what I'm looking for. I thought there was
a single command in Perl for it, but that might be Java or JavaScript
and I'm confusing them. Thanks, I'll go find the URI modules.
--
Wesley Miaw wesley@woais.com
World of Artists Internet Services http://www.woais.com/
71 Middlesex Drive Tel: 518-439-0412
Slingerlands, NY 12159 FAX: 518-439-9722
------------------------------
Date: Mon, 23 Jun 1997 06:20:52 GMT
From: Magnus.Bodin@tychonides.se (Magnus Bodin)
Subject: Re: Script to verify email addresses?
Message-Id: <33ae1072.280675890@news1.telenordia.se>
Russ Allbery <rra@stanford.edu> wrote:
>In comp.lang.perl.misc, Jim Esten <jesten@earth.execpc.com> writes:
>
>> Tom Christiansen wrote one called addrcheck earlier this year... I hung
>> onto that one... mail me direct if you can't find it...
>
>Tom Christiansen's addrcheck script produces both false positives and
>false negatives, as he's aware. It's about the best that one can do in
>terms of static verification of e-mail addresses, but it *doesn't* work
>all of the time and has its own caveats and problems.
>
Here it is at deja:
http://xp8.dejanews.com/getdoc.xp?recnum=%3c5e2aqo$3km$1@csnews.cs.colorado.edu%3e&server=db97p1&CONTEXT=866979817.18459&hitnum=2
------------------------------
Date: 23 Jun 1997 06:12:44 GMT
From: "Chizl" <chizl@cyberdude.com>
Subject: Source Code for you and SWLock for Shareware programmers
Message-Id: <01bc7f9b$89f933c0$729112cf@default>
The Source Site
The ONLY Source Code Site that covers Any Platform and Any Language!
http://www.sourcesite.simplenet.com/
Get your source here for FREE and give some source code for others to use
and learn..
This site will soon be going under some major changes so it will be easier
for you to use and find what you need. At the moment I have the first
directories as platforms and then you find the language. I will be
changing this by making the Language the first directory and then the
Platform if the code is specifically made for it.
I have created an OCX called SWLock for all you shareware programmers.
This is a great internet utility that keeps people form changing the date
on the computer to run you SW for much longer than you want and keeps
hackers from cutting it out..
It can be found at http://www.sourcesite.simplenet.com/SWLock/
Have fun!
--
L8r,
Chiz
chizl@cyberdude.com
chizl@sourcesite.simplenet.com
The Source Site
http://www.sourcesite.simplenet.com/
The ONLY site for All platforms and all language source code in one place.
Take code and give code for FREE!
------------------------------
Date: Sun, 22 Jun 1997 16:55:06 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: stdin, stdout, exec
Message-Id: <EC6sBv.FAI@world.std.com>
Clayton Weaver <cgweav@eskimo.com> writes:
>If I assign <STDIN> to <STDOUT>, $| = 1;, print <STDOUT> "$data";, and
>exec, is the data available on <STDIN> of the execed process?
Not quite, assigning STDIN to STDOUT doesn't change STDOUT to an
input. (Also be aware that the names of the filehandles are STDIN and
STDOUT. <STDIN> is the syntax for using the read line operator on the
STDIN filehandle. <STDOUT> is using the read line operating on the
STDOUT filehandle (probably not very useful) and
print <STDOUT> "$data" is a syntax error.)
How about opening a pipe, forking the new process as a child process,
and then writing to its standard input?
$pid = open SOMEPROG, '|-' # parent gets pid
or exec 'someprog', 'iteration_flag' # child exec()s
or die "Can't exec someprog: $!\n"; # or child dies.
print SOMEPROG, $data; # parent write to child's standard input.
close SOMEPROG or die "Something went wrong with someprog: $!\n"; # done
>{process original stdin and @ARGV if any up here}
>while ($ARGV[0] != $someval)
>{
> open(STDIN, ">-");
> $test = "test";
> $| = 1;
> print STDOUT "$test";
> exec('someprog', 'iteration_flag', ' '); # ' ' = "don't use /bin/sh"
>}
>{rest of program}
>Someprog inherits the file descriptors of the process execed from
>(assuming no error on the exec), so it should have the data written on
>it's own stdin. Any obvious problem with doing an exec loop like this
>besides handling error messages from the system call?
I think you have a misunderstanding of exec(). If you have an exec()
then you have no loop. The original process is overlaid by the new
process (so control will never returned back to it. Its gone.)
>(It's just to save some process creation overhead while handling data
>without having the optimizer rearrange expressions that need to be
>evaluated in sequence. Maybe there is a builtin for this?)
Is process creation really that important to avoid? Unix is fork()ing
off processes all day long. Are you talking about the perl
interpreter's optimizer? I can't see why or how it would re-arrange
loop on you. I would hate to think that I can't depend on the order in
which a for or while loop would be executed:
@array = qw(Hello World);
while(@array) {
$elem = shift @array;
print "$elem\n";
}
--
Andrew Langmead
------------------------------
Date: Mon, 23 Jun 1997 12:17:59 +0100
From: "Paul Denman" <pdenman@ims.ltd.uk>
Subject: Strings to Associative Arrays
Message-Id: <72mlo5.vkc.ln@gate.imsport.co.uk>
Hello,
I am receiving a string which I would like to assign to an associative
array as quickly
as possible (IE. without assigning individually)
I have read that you can define an associative array as the value of a
scalar eg;
$test = "One,1,Two,2,Three,3";
%testa = $test;
$value = "One";
print $testa{$value);
But this responds with no value.
Am I suffering from Monday Madness or can't this be done in this way?
Any help would be gratefully appreciated!
Cheers,
Paul Denman
pdenman@ims.ltd.uk
------------------------------
Date: 22 Jun 1997 06:56:56 GMT
From: "Christopher Kings-Lynne" <chriskl@tartarus.uwa.edu.au>
Subject: Re: Why do i get text/octet-stream download when i try to create html document with perl?
Message-Id: <01bc7ed9$d050f1e0$3aa15f82@kings-lynne>
Jonas Thvrnvall <labah@algonet.se> wrote in article
<33ADF120.99@algonet.se>...
> I'm creating a simple guestbook that work excellent on my pc with http
> server, but when i try to configure it for my hompage server at
> www.algonet.se i dont get any documents, netscape just ask me i wan't to
> save the text/octet-stream. Can someone tell me how to fix this, or what
> the problem is?
> This is the string i use in perl to create the document
> print "<!--Content-type: text/html-->\n\n";
>
> Jonas T
>
The first thing that you should print out for a new HTML page should be:
print "Content-type: text/html\n\n";
Chris
------------------------------
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 652
*************************************