[8193] in Perl-Users-Digest
Perl-Users Digest, Issue: 1811 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 4 18:07:36 1998
Date: Wed, 4 Feb 98 15:00:21 -0800
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, 4 Feb 1998 Volume: 8 Number: 1811
Today's topics:
Re: [utility] submit "unix_command" <*@qz.to>
Re: Converting data to a string? (Craig Berry)
Re: Destroying any and all elments of an array.. how? <vladimir@cs.ualberta.ca>
dir/file attributes <pjmone@symbioticinc.com>
Re: dir/file attributes (Abigail)
Re: Don't use signal handlers (was Re: Child processes) (Andrew M. Langmead)
Re: Don't use signal handlers (was Re: Child processes) (Abigail)
Re: Help! 255-char URL limit passing form values to cgi (Abigail)
Re: Help! 255-char URL limit passing form values to cgi <palincss@nicom.com>
Re: help: open an existing page and replace parts of it (Johnny Fingers.)
Re: How Do I Tell Whether a Key Is Valid for an Associa (Abigail)
Re: input file to hash (Mike Stok)
Re: Is Perl 5 year 2000 compliant? (Abigail)
Is there a WILDCARD variable in PERL??? <webmaster@pclightning.com>
Mail checker.... <vidyanan@pilot.msu.edu>
Re: Newbie about plunge into Perl asks... <jason@primal.ucdavis.edu>
Re: newbie question (Abigail)
Re: Optimizing regular expression <pdcawley@bofh.org.uk>
Re: Perl - Oracle Interface (Mike Stok)
Post vs. Submit Problems <shill@ipa.net>
Re: Question: Searching files. <freter@freter.com>
Re: Question: Searching files. (Greg Bacon)
Re: Question: Searching files. (Abigail)
Re: Quickie: regexp for valid e-mail addresses (Devin L. Ganger)
Re: Quickie: regexp for valid e-mail addresses (Greg Bacon)
Re: Sending files to STDOUT (Mike Stok)
signal problems on solaris 2.6 for perl 5.00 <bill@inta.demon.co.uk>
split /\s*,\s*/ <steves@wco.com>
Tie-Dee-Perl (Cleanliness is next to Goodliness, or Per <jason@primal.ucdavis.edu>
Trouble building perl modules on HPUX 10.20 <bja@insight.att.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 4 Feb 1998 21:02:28 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: [utility] submit "unix_command"
Message-Id: <qz$9802041547@qz.little-neck.ny.us>
Michael Wang <mwang@alhena.ibk.ml.com> wrote:
> Eli the Bearded <*@qz.to> wrote:
> >Did you just reinvent "nohup unix_command &"?
> >fails to see the advantage of this over nohup anyway
> advantages:
> 0. It does accept hangup signal
Just use an '&' then.
> 1. It does not need &
I fail to see this being such a problem that you consider it an
advantage.
> 2. It works with rsh
That is a rather restricted shell, yes. But most people probably
are not using it.
> 3. It recognize the command sequences: submit ./configure\; make
( ./configure; make ) &
> 4. It checks the return value from system() call
( ./configure && make ) &
> 5. It has self trimming log file
Okay, if you want that.
> 6. It send both stdin and stderr to log file
nohup does that, too.
> 7. much much more :-)
Except for use in rsh environments you still haven't made it clear why
this is useful;, IMHO.
Elijah
------
feel free to ignore this
------------------------------
Date: 4 Feb 1998 21:20:17 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Converting data to a string?
Message-Id: <6bam2h$se1$1@marina.cinenet.net>
Jason Christian (jason@primal.ucdavis.edu) wrote:
: On 4 Feb 1998, dragonfyre wrote:
: > In addition to my earlier post about converting data into an array...how
: > would one convert a data file into a string?
: >
: > eg: the data file number.data looking like:
: >
: > one
: > two
: > three
: >
: > in the string $numbers ?
:
: Howzabout:
:
: open (NUMBERS, "numbers.txt") || die "Could not open numbers.txt :$!";
: @numbers=<NUMBERS>;
: $numbers=join(' ',@numbers);
Or even
undef $/; # No line delimiter, pull in entire file on scalar read.
open NUMBERS, "< numbers.txt" or die "Can't open numbers.txt: $!";
$numbers = <NUMBERS>;
close NUMBERS;
Now $numbers is "one\ntwo\nthree\n", just like the input file.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 04 Feb 1998 13:45:25 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
To: cberry@cinenet.net (Craig Berry)
Subject: Re: Destroying any and all elments of an array.. how?
Message-Id: <om1zxjayl7.fsf@tees.cs.ualberta.ca>
In article <6b88u3$o8s$1@marina.cinenet.net> cberry@cinenet.net (Craig Berry) writes:
> undef @ary; ...
> @ary = (); This is almost but not quite the same thing; rather than
> an undefined array (which will trigger warnings if you try to use it
> to do array-ish things)
Wrong: undef@a; $a[3]=5; results in an array with 3 undef elements,
then the element 5. No warnings. 5.004.
------------------------------
Date: Wed, 04 Feb 1998 16:10:25 -0500
From: Paul Mone <pjmone@symbioticinc.com>
Subject: dir/file attributes
Message-Id: <6balih$eok@bgtnsc02.worldnet.att.net>
I have pages on my web which are secure via a cgi password script
that I wrote...On these pages users can download certain products which
I would not want the average user to download. the problem is that
anyone can download these files if they type in the complete URL (i.e.
www.company.com/files/paid/expensiveproduct.zip)
Is there a way to change file or directory attributes on the fly? I
suspect not because they will be user "nobody". Does anyone have any
suggestions on how to secure these products and "un-secure" them, when
approproate, with a perl script?
------------------------------
Date: 4 Feb 1998 22:08:27 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: dir/file attributes
Message-Id: <6baosr$lk$2@client2.news.psi.net>
Paul Mone (pjmone@symbioticinc.com) wrote on 1618 September 1993 in
<URL: news:6balih$eok@bgtnsc02.worldnet.att.net>:
++ I have pages on my web which are secure via a cgi password script
++ that I wrote...On these pages users can download certain products which
++ I would not want the average user to download. the problem is that
++ anyone can download these files if they type in the complete URL (i.e.
++ www.company.com/files/paid/expensiveproduct.zip)
You can save yourself a lot of trouble by reading the manual of
your browser. There's no need for cgi password scripts and files
still being available.
Go to comp.infosystems.www.servers.{your-os|misc}
Abigail
--
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
------------------------------
Date: Wed, 4 Feb 1998 21:18:07 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <EnvHu8.6Hv@world.std.com>
abigail@fnx.com (Abigail) writes:
>There's nothing wrong with writing with mixed languages.
>But I don't want to write in C. The choice wouldn't be
>(Perl + C) or (Language X + C) but (Perl + C) or (Language X).
Which language do you want to write the signal handler in? Can it
generate an object file? The first example in the perlxs man page
show interfacing with and existing library, no C coding necessary.
--
Andrew Langmead
------------------------------
Date: 4 Feb 1998 22:04:58 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <6baoma$lk$1@client2.news.psi.net>
Andrew M. Langmead (aml@world.std.com) wrote on 1618 September 1993 in
<URL: news:EnvHu8.6Hv@world.std.com>:
++
++ Which language do you want to write the signal handler in?
In the same language of the rest of the code preferably.
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=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 4 Feb 1998 21:29:32 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help! 255-char URL limit passing form values to cgi
Message-Id: <6bamjs$s99$4@client2.news.psi.net>
James Munroe and Tricia O'Neill (eccles@astral.magic.ca) wrote on 1618
September 1993 in <URL: news:34D8562F.4F59@astral.magic.ca>:
++ When sending the contents of an HTML form's textarea to a Perl cgi, or a
++ large number of form fields with their associated values to a Perl cgi,
++ anything after the first 255 characters gets truncated, because Netscape's
++ URL line is limited to that size. Is there any other way to communicate
++ form field values from the browser to a cgi, in such a way that the
++ _complete_ string of form names and values is preserved?
That would be Netscape's bug department where you need to be.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: Wed, 04 Feb 1998 17:36:23 -0800
From: Steve Palincsar <palincss@nicom.com>
Subject: Re: Help! 255-char URL limit passing form values to cgi
Message-Id: <34D91797.374E@nicom.com>
Abigail wrote:
>
> James Munroe and Tricia O'Neill (eccles@astral.magic.ca) wrote on 1618
> September 1993 in <URL: news:34D8562F.4F59@astral.magic.ca>:
Was this stuck in a time warp?
> ++ When sending the contents of an HTML form's textarea to a Perl cgi, or a
> ++ large number of form fields with their associated values to a Perl cgi,
> ++ anything after the first 255 characters gets truncated, because Netscape's
> ++ URL line is limited to that size. Is there any other way to communicate
Perhaps in 1993 POST method hadn't been invented yet. But then, neither
was Netscape. The problem here is that he's using the GET method
when he should be using POST.
> ++ form field values from the browser to a cgi, in such a way that the
> ++ _complete_ string of form names and values is preserved?
>
> That would be Netscape's bug department where you need to be.
More likely he needs to be in a CGI group.
>
> Abigail
> --
> perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: Wed, 4 Feb 1998 17:08:55 -0500
From: wyldkard@total.net (Johnny Fingers.)
Subject: Re: help: open an existing page and replace parts of it
Message-Id: <MPG.f42b10120794d22989680@news.total.net>
In article <#E3#WgcK9GA.59@upnetnews03>, ilia@detoronics.net says...
> Hello, I'm a beginner in Perl, and was wondering if there is an easy way to
> open an existing html page, replace specific parts of it, and return the new
> page to client.
>
> So if the page has something like this:
>
> <HEAD><TITLE>%%title%%</TITLE></HEAD>
>
> I want to replace %%title%% with something else.
>
> Is there a pre-made function that does this?
>
> Something like
> &f_ReplaceAll (@Array, $html_page);
> where @Array can be an associative array with placeholders and corresponding
> replacements?
>
>
>
Hey
I don't know of any pre-existing libraries to do this. But I've done it
already in a few projects and have my own libs for it. Here's an example
of what it looks like. I know ther are other ways to do it, but hey..
this works! :)
Let me know if this helps.
#!/usr/bin/perl
########## global variables.
$HtmlFile = "htmlpage.html";
$ListingDir = "/usr/home/wyldkard/TestingZone/";
$AbsPath = $ListingDir . $HtmlFile;
$ReplaceVariable = "THIS IS THE TITLE\n";
########## end global.
########## Main programming.
&CreateNew();
########## End Main programming.
sub CreateNew {
my($ReadReference) = &ReadFile($AbsPath);
$fileline = <$ReadReference>;
while (!eof()) {
chop($fileline);
if ($fileline =~ '%%title%%'){
$fileline =
"<HEAD><TITLE>$ReplaceVariable</TITLE></HEAD>\n";
}
push(@GoodLines,$fileline);
$fileline = <$ReadReference>;
}
close($ReadReference);
my($WriteReference) = &WriteFile($AbsPath);
foreach $GoodLines (@GoodLines) {
print $WriteReference ("$GoodLines\n");
}
undef(@GoodLines);
}
sub WriteFile {
my($path) = @_;
#$path =~ tr/A-Z/a-z/;
unless(open(WRITEFILE,">$path")) {
if (-w $path) {
print "Error: File is NOT WRITEABLE by user.\n";
}
print "Filename: $path\n";
die("Problem creating the write file.\n");
}
return \*WRITEFILE;
}
sub ReadFile {
my($Path) = @_;
unless(open(DIRLIST,$Path)) {
if (-e $Path) {
print "Error: File DOES NOT exist.\n";
}
if (-o $Path) {
print "Error: File is NOT OWNED by user.\n";
}
if (-r $Path) {
print "Error: File is NOT READABLE by user.\n";
}
if (-z $Path) {
print "Error: File is EMPTY.\n";
}
}
return \*DIRLIST;
}
------------------------------
Date: 4 Feb 1998 22:10:41 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How Do I Tell Whether a Key Is Valid for an Associative Array?
Message-Id: <6bap11$lk$3@client2.news.psi.net>
Vladimir Alexiev (vladimir@cs.ualberta.ca) wrote on 1618 September 1993
in <URL: news:om3ehzazde.fsf@tees.cs.ualberta.ca>:
++ In article <6b677j$3cu@bgtnsc03.worldnet.att.net> Joe Gottman <joegottman@nospam.worldnet.att.net> writes:
++
++ undef()? That's a weird way to write the constant undef.
There is no constant undef. undef is a function. RTFM.
Abigail
--
perl -we '%_ = map {local $_ = $_; y/a-z/n-za-m/; ($_, $_)} @_ = map {lc} <>;\n print grep {$_{$_}} @_' < /usr/dict/words
------------------------------
Date: 4 Feb 1998 16:49:35 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: input file to hash
Message-Id: <6banpf$1vs$1@stok.co.uk>
In article <34D8CE1D.794B@mci.com>, scott ranzal <scott.ranzal@mci.com> wrote:
>I am trying to read a text file into a hash. I would like to use a
>substring from the file as the index. I am new to perl and am not sure
>how to pull out the substring as the index and then place the rest of
>the string into the hash as a value.
A snippet of code might be
$string = 'foo bar baz';
$hash{substr $string, 4, 3} = $string;
but you might want to check that $string isn't too short, and remember
that (unless you've messed with $[) the first character of the string is
at offset 0.
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@colltech.com | Collective Technologies (work)
------------------------------
Date: 4 Feb 1998 21:15:25 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <6balpd$s99$3@client2.news.psi.net>
David Lee Lambert (lamber45@EGR.msu.edu) wrote on 1618 September 1993 in
<URL: news:Pine.GSO.3.96.980204143907.25744H-100000@area51>:
++ On 4 Feb 1998, Abigail wrote:
++
++ > David Lee Lambert (lamber45@EGR.msu.edu) wrote on 1618 September 1993 in
++ > <URL: news:Pine.GSO.3.96.980204083422.25250D-100000@area51>:
++ > ++ On Wed, 4 Feb 1998, Matthew Rock wrote:
++ > ++
++ > ++ > Does anyone know of any problems with Perl 5 and Y2K?
++ > ++
++ > ++ Perl itself is date-independent. RTFM, and you'll see that the only way
++ > ++ to get a date is with `date`
++ >
++ > RTFM yourself, specially the entries called 'time', 'gmtime' and 'localtime'.
++
++ I grepped the manpages for date, not time. Those are compliant too, are
++ they not?
That of course depends on the date you are executing. But it certainly
isn't "the only way". As for `date` it all depends on your PATH which
date is executed.
++ In c.s.y2k we just had a long discussion on Unix that ended up
++ concluding that all the POSIX time/date calls will work fine in 2000, but
++ programmers might have decided, for their own strange reasons, to use
++ their own noncompliant date formats. Is the same the case for perl?
It certainly is possible to use Perl to write non-Y2K complaint programs.
Just as you can write code that does addition wrong.
Abigail
--
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: Wed, 04 Feb 1998 15:37:39 -0600
From: David Cline <webmaster@pclightning.com>
Subject: Is there a WILDCARD variable in PERL???
Message-Id: <886627668.313393166@dejanews.com>
I have over a hundred variables within the same CGI file called
$xxxxxxxx_r --- with the xxxxxxxxx being over a hundred different words,
but the "_r" is constent with them all. I want to add the values
contained within these variables together. As a DOS man, I could best
explain this like so:
$sum = $*_r;
If you get my drift. Is there a PERL wildcard or equivalent???
Like I said before, I have just recently started learning PERL. This is
my first attempt at understanding a programming language (except for HTML
--- but that doesn't count).
David K. Cline
webmaster@pclightning.com
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Wed, 4 Feb 1998 17:26:08 -0500
From: Premgith Vidyanandan <vidyanan@pilot.msu.edu>
Subject: Mail checker....
Message-Id: <Pine.GSO.3.96.980204171857.23992A-100000@arctic.cps.msu.edu>
I want to write a perl program that goes through my mail folder and based
on the header of the mail or using the from address it puts the mail into
separate folders..... I know that the mail file is kept in /var/mail... I
just want to know the best way to read mail by mail as opposed to line by
line and then to move the create a file and move the mail into that
file...
The programming part I can do but I would like to know how to access
mail by mail as opposed to line by line....
Thanks...
Premgith Vidyanandan
Tel -: Res (517) 333-4201
Off (517) 355-4500 ext(193)
E-mail - vidyanan@pilot.msu.edu
------------------------------
Date: Wed, 4 Feb 1998 13:21:18 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Re: Newbie about plunge into Perl asks...
Message-Id: <Pine.OSF.3.95.980204131115.29487E-100000@primal.ucdavis.edu>
On Wed, 4 Feb 1998, Robbie Baldock (real email address at foot of message) wrote:
> After having built up a reasonable knowledge of Java and JavaScript
> I'm about to add to my repertoire by attempting to learn Perl.
> However, I have a couple of questions:
>
> 1. I've installed the Win32 port of Perl 5 but the machine that will
> be running the scripts is a Unix machine. Am I likely to run into
> troubles developing in Win95 and running in Unix?
Time for the canonical economist's answer:
"It Depends." On what the scripts are supposed to do.
Another non-answer is "why would you want to do that?" If you have a
half-gig of hard-disk capacity and $50, go buy a linux setup, install it
on your peecee, and develop in unix. If (as I suspect) you are doing
CGI stuff, you can get apache running, and try your scripts out in the
safety of your own home.
I would think that "install linux (or equivalent)" would be canonical
advice for peecee owners learning Perl. Note that your linux setup
*will* have access to your Win95 filesystems.
---------------------------------------------------------------------------
Jason Christian University of California, Davis
jason@primal.ucdavis.edu Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614 Davis, CA 95616
------------------------------
Date: 4 Feb 1998 21:31:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbie question
Message-Id: <6bammv$s99$5@client2.news.psi.net>
James (james.@jwtech.net/) wrote on 1618 September 1993 in
<URL: news:6ba9dr$77v$1@columbine.singnet.com.sg>:
++ I trie to open a text file at my cgi-bin how come i get Server error 500
Mail you webmaster. He'd be delighted to answer your question.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: 04 Feb 1998 21:47:49 +0000
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: Optimizing regular expression
Message-Id: <m3btwnavp6.fsf@tower.bofh.org.uk>
4 Feb 1998 19:56:39 GMT jsd@bud.com (Jon Drukman) comp.lang.perl.misc
> I have two types of input line, from a web server logfile.
>
> 210.112.32.10 - - [01/Feb/1998:23:59:06 -0800] "GET /rotations/graphics/kesmai_9e8c212346efebcd85256555007a11ff_a_DDC_62534.gif HTTP/1.0" 200 1507 "http://www.gamespot.com/strategy/civiliz2/demos.html" "Mozilla/4.0 (compatible; MSIE 4.01; Windows 95) via proxy gateway CERN-HTTPD/3.0 libwww/2.17"
>
> 203.134.252.140 - - [01/Feb/1998:23:59:35 -0800] "GET /cgi-bin/clickoff.pl?kesmai_8dcaa9e06fbdbc728525657600739d8b_a.gif+http://www.gamestorm.com HTTP/1.0" 302 177 "http://www.gamespot.com/" "Mozilla/3.0Gold (Win95; I)"
>
> i need to get the ip address, the first part of the GET statement
> (either /rotations/graphics/ or /cgi-bin/clickoff.pl?), the ad code
> (which is the part after /rotations/graphics/ or /cgi-bin/clickoff.pl?
> up to and including the _a) and the result code. here's the regex i'm
> using:
>
> my ($ip, $type, $adcode, $status) = m{
> ([0-9.]+) # ip address
> .* # skip stuff
> (/rotations/graphics/|/cgi-bin/clickoff.pl\?) #anything up to /rotation or /cgi
> (.*_a) # the Ad ID code is here
> .*?\s # skip some more
> (\d+) # until we see the result code
> }x;
How about:
while (<LOGFILE>) {
my ($ip_part, $request, $status) = (split / /, $_)[0,6,8];
next unless $request =~
m{(/rotations/graphics|/cgi-bin/clickoff.pl\?)(.*_a)}
my ($type, $adcode) = ($1, $2);
# Do stuff;
}
This gets rid of doing all those nasty .* matches on lines that are
going to fail anyway.
--
Piers Cawley
If a `religion' is defined to be a system of ideas that contains
unprovable statements, then Godel taught us that mathematics is not
only a religion, it is the only religion that can prove itself to be
one. -- John Barrow
------------------------------
Date: 4 Feb 1998 16:30:45 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Perl - Oracle Interface
Message-Id: <6bamm5$1u8$1@stok.co.uk>
In article <34d8bf7e.0@blushng.jps.net>,
Murali Kazhipurath <murali@jps.net> wrote:
>Where can I get some information about using PERL against an Oracle
>database.
Perl 5 has a standard database interface layer implemented as a module
(DBI) and that talks to databases through various database driver modules
(DBD) There is a DBD for Oracle, and a place to look for information is
http://www.hermetica.com/technologia/perl/DBI/index.html
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@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 04 Feb 1998 15:48:34 -0600
From: Shane Hill <shill@ipa.net>
Subject: Post vs. Submit Problems
Message-Id: <34D8E232.560D9EDB@ipa.net>
Hi,
I'm trying to get a query form to call a perl script, but my problem
is that everytime I use the ACTION=POST in the form to call the script,
ALL the variables never have values, although they get set. If I use an
ACTION=SUBMIT in my form everything works okay. Why am I losing the
values?
This a readily available script and I know it should work without having
to change POST to SUBMIT.
I am using IIS 3.0.
I would appreciate any help,
Shane Hill
shill@ipa.net
------------------------------
Date: Wed, 04 Feb 1998 21:13:47 GMT
From: Craig Freter <freter@freter.com>
To: email@business-links.co.uk
Subject: Re: Question: Searching files.
Message-Id: <34D8DA40.4227@freter.com>
Richard,
> I've got a file of tab delimited information in the following format:
>
> aa bb cc dd http:\\www.website1.com
> ee ff gg hh http:\\www.website1.com
> ii aa pp qq http:\\www.website1.com
> yy xx aa zz http:\\www.website1.com
>
> I'd like to be able (via a form) to search for all the, for example aa
> entries and return the url's (the last data in that line) as a html
> list.
Try this.
$find = "aa";
while (<>) {
push @urls, (split)[4] if /$find\s.*?http:\\/;
}
--
Craig Freter <freter@freter.com> <http://www.freter.com>
PGP fingerprint 61 A5 E2 51 F5 AC 9D 79 DD 15 56 90 F2 0A 97 25
Axis Data Management <http://www.admc.com>
------------------------------
Date: 4 Feb 1998 21:17:07 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: email@business-links.co.uk
Subject: Re: Question: Searching files.
Message-Id: <6balsj$cl$2@info.uah.edu>
[Posted and mailed]
In article <34d8c959.2467378@news.skynet.co.uk>,
email@business-links.co.uk writes:
: I've got a file of tab delimited information in the following format:
:
: aa bb cc dd http:\\www.website1.com
: ee ff gg hh http:\\www.website1.com
: ii aa pp qq http:\\www.website1.com
: yy xx aa zz http:\\www.website1.com
You're using the wrong slash, and you've omitted slashes too!
: I'd like to be able (via a form) to search for all the, for example aa
: entries and return the url's (the last data in that line) as a html
: list.
Something like
my @fields;
my @hits;
while (<FILE>) {
chomp;
@fields = split;
if (grep { $_ eq 'aa' } @fields[0,1,2,3]) {
push @hits, pop @fields;
}
}
@fields;
might be a step in the right direction.
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 4 Feb 1998 22:23:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Question: Searching files.
Message-Id: <6bappv$lk$4@client2.news.psi.net>
email@business-links.co.uk (email@business-links.co.uk) wrote on 1618
September 1993 in <URL: news:34d8c959.2467378@news.skynet.co.uk>:
++ I can handle the forms and opening and closing the data file, but the
++ search loops are proving a problem. Can anyone help?
map {$_ -> [1]}
grep {$_ -> [0] =~ /\Q$query/}
map {[map {reverse} reverse split /\t/, reverse, 2]} <FILE>;
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: 4 Feb 98 20:59:03 GMT
From: devin@premier1.net (Devin L. Ganger)
Subject: Re: Quickie: regexp for valid e-mail addresses
Message-Id: <slrn6dhlka.fh1.devin@blacktower.premier1.net>
<flashy-thing!> Remember only that on Wed, 04 Feb 1998 14:44:01 GMT,
in comp.lang.perl.misc Bart Lateur wrote:
> Perhaps I didn't make myself clear. How do mails get delivered? Via
> programs. These seem to work. If these can figure out where to send the
> mail, it must be possible to the same in Perl. Right?
They don't and you can't.
You can extract the portion of the email address behind the "@", look up
the appropriate MX record via DNS (if one exists), and then you know which
host is supposed to (assuming that DNS and that host aren't misconfigured)
handle it, but you cannot accurately predict whether that particular address
is valid on that host.
Mail servers basically say "it's not my problem, it's yours" and hand it
off -- and get bounces if it isn't valid.
--
Devin L. Ganger <devin@premier1.net>
Chief Systems Administrator
Premier1 Internet Services
------------------------------
Date: 4 Feb 1998 21:04:12 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Quickie: regexp for valid e-mail addresses
Message-Id: <6bal4c$cl$1@info.uah.edu>
[Posted and mailed]
In article <Pine.GSO.3.96.980204083217.6372D-100000@user1.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> writes:
: Someone will make a module to do this one day. Then the big problem will
: be that there are valid addresses which don't match RFC822!
I wonder what Goedel's email address is... :-)
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 4 Feb 1998 16:00:55 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Sending files to STDOUT
Message-Id: <6baku7$1rq$1@stok.co.uk>
In article <886612502.172806@nn1>,
Jonah Olsson <jonah@gsoft.lindesign.se> wrote:
>How do I send files from my CGI script to my users via the Content-type:
>application/octet-stream and STDOUT?
If you're using a recent perl then you should have the CGI module as part
of the distribution (if not, you can get it from a CPAN site)
use CGI;
$query = new CGI;
print $query->header ('application/octet-stream');
# then print your data.
If you know how much data there is you might want to add some arguments to
the header call e.g.
print $query->header('text/html','200 OK','Content-Length: 3002');
is mentioned in the CGI documentation.
CPAN can be reached through http://www.perl.com or by ftp to ftp.funet.fi
and looking in /pub/languages/perl/CPAN (there's a list of mirror sites in
there as well as loads of perl goodies.)
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@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 04 Feb 1998 21:35:13 GMT
From: "Bill Spencer" <bill@inta.demon.co.uk>
Subject: signal problems on solaris 2.6 for perl 5.00
Message-Id: <01bd31b4$84016480$503f989e@inta.demon.co.uk>
Hi There,
I have a small problem with signal handling on a solaris patform (2.6)
running perl 5.00.
When using the -w switch a warning is given : -
No such signal SIQQUIT, SIGINT, SIGHUP.
These are valid signals, so does anyone know the problem.
By the way the signal handler does not get called.
Yours
Bill.
------------------------------
Date: Wed, 04 Feb 1998 13:33:18 -0800
From: Steven Smith <steves@wco.com>
Subject: split /\s*,\s*/
Message-Id: <34D8DE9E.3966@wco.com>
I'm trying to use split to separate fields on an input string
that sometimes has ,,, in it. when this happens and my split
pattern is /\s*,\s*/, I get a 0 element array back. If I
split on /,/, things work as I expect. What am I missing?
This seems to work as expected with substitute, i.e.
$_ = ',,,'; s/\s*,\s*/, /g; print $_ gives ', , , ';
Thanks
Steve Smith
------------------------------
Date: Wed, 4 Feb 1998 14:33:09 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Tie-Dee-Perl (Cleanliness is next to Goodliness, or Perl-White Code)
Message-Id: <Pine.OSF.3.95.980204141710.29487F-100000@primal.ucdavis.edu>
On 4 Feb 1998, Craig Berry wrote:
> open NUMBERS, "< numbers.txt" or die "Can't open numbers.txt: $!";
> $numbers = <NUMBERS>;
> close NUMBERS;
Following the age-old advice to lurk before posting, I did manage to
avoid breaking cplm rule number one, which reads "never say 'open'
without saying 'die'," or something like that. That rule is more about
practicality than simply cleanliness: it is nice to know what broke.
But how about closing files? Being sloppy, I confess that in the
privacy of my own home I occasionally leave doors open; it may be the
case that I do this occasionally in a Perl script. What is the cost of
this sloppiness? If following Craig's slurp (but before his proper
'close') I were to
open NUMBERS, "irrationals.txt" or die "Damn irrationals.txt is big: $!";
Perl would close the old (and now empty) door into numbers.txt and open
the new door. If the script ended right there, I wouldn't care if the
file was open. What about if it went on for a while? Is there overhead
associated with open-if-empty (or at least finished) files? Or is there
some other reason to obsessively close things we have opened?
The spam-bots got my name a long time ago, so mangling my address would
be like shutting the barn door after the horse had left...and I
apparently like open doors.
---------------------------------------------------------------------------
Jason Christian University of California, Davis
jason@primal.ucdavis.edu Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614 Davis, CA 95616
------------------------------
Date: Wed, 04 Feb 1998 16:06:33 -0500
From: Bill Anderson <bja@insight.att.com>
Subject: Trouble building perl modules on HPUX 10.20
Message-Id: <34D8D859.6A06CB9F@insight.att.com>
I've built and installed perl5.004_04 on HPUX 10.20 and am trying to
build some modules to use with it (Compress::Zlib for example). I'm
doing the module building through the CPAN module, and when it runs
"make test", I'm getting errors involving dld.dl. Specifically, I see
/usr/lib/dld.sl: Permission denied
and /usr/lib/dld.sl: Call to mmap() failed - TEXT <shared library path>
I've haven't had any problems building any modules under Solaris 2.x or
Irix 6.2, so I don't think that the problems lie with perl or the
modules I'm attempting to build.
Has anybody else had this problem? Does anybody have a solution?
Any help would be appreciated.
Thanks,
Bill
PS - this happens with both static and dynamic libperl
PPS - this is another item in my list of reasons not to like HPUX
------------------------------
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 1811
**************************************