[8476] in Perl-Users-Digest
Perl-Users Digest, Issue: 2093 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 13 18:07:48 1998
Date: Fri, 13 Mar 98 15:00:29 -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 Fri, 13 Mar 1998 Volume: 8 Number: 2093
Today's topics:
Accessing Ethernet packets directly (Or: userland netwo (Brian Wheeler)
Re: Accessing Ethernet packets directly (Or: userland n (Gregory Travis)
Re: Accessing Ethernet packets directly (Or: userland n (Scott Hutton)
Bad free() <mike@unival.com>
Re: Contents of a file into checkbox's [CGI.pm] (William R. Ward)
Re: Contents of a file into checkbox's [CGI.pm] <dimaclen@novice.uwaterloo.ca>
Deleting and copying files in Win95 qvanegeren@frxsoft.com
Re: difference between 's' and 'tr' <horowitz@ulb.ac.be>
Does STDIN ever close? <rik@csc.liv.ac.uk>
Re: Help sought with web programming security problem <barber@ccrwest.org>
HELP! Getting Remote File Size <jesse@savalas.com>
Re: How to use Perl for Win95? scott@softbase.com
Re: Is there a "Newsgroup" for Newbies to Perl? <jason@primal.ucdavis.edu>
Re: Is there a "Newsgroup" for Newbies to Perl? <ptimmins@netserv.unmc.edu>
Re: Is there a "Newsgroup" for Newbies to Perl? mchunziker@us.fortis.com
Re: Is there a "Newsgroup" for Newbies to Perl? (Al Thomas)
Re: Is there a "Newsgroup" for Newbies to Perl? (Mike Heins)
Re: ls -l to an array and pull 3 columns on data <kmiles@erols.com>
newbie's 1st question <john@apte.com>
please help make cookies <Dpaladin@ix.netcom.com>
regexp list context substitution <ryanpc@lbin.com>
sendmail (Quoc Nguyen)
Re: User-interface Quandary <quentin@jihad.amd.com>
Re: User-interface Quandary <scribble@pobox.com>
Re: User-interface Quandary <tchrist@mox.perl.com>
Re: User-interface Quandary desmond@flash.net
Re: User-interface Quandary <jstern@world.northgrum.com>
Re: User-interface Quandary <ajohnson@gpu.srv.ualberta.ca>
Re: Way of testing whether a variable is blessed <dgoddard@us.oracle.com>
Re: Weak references? (Dominic Dunlop)
Weird? problems with perldoc (Marcus P Hertlein)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Mar 1998 22:02:34 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Accessing Ethernet packets directly (Or: userland network protocol)
Message-Id: <6ecadq$1ua$1@jetsam.uits.indiana.edu>
I'm considering playing around with implementing a samba-like fileserver for
DECnet. Is there any way to transmit/recieve raw ethernet packets from
userland?
Since speed isn't really an issue for what I'm doing, could it be prototyped
in perl?
Thanks,
Brian Wheeler
bdwheele@indiana.edu
------------------------------
Date: 13 Mar 1998 17:17:49 -0500
From: greg@sherrill.kiva.net (Gregory Travis)
Subject: Re: Accessing Ethernet packets directly (Or: userland network protocol)
Message-Id: <6ecbad$2a3$1@sherrill.kiva.net>
In article <6ecadq$1ua$1@jetsam.uits.indiana.edu>,
Brian Wheeler <bdwheele@indiana.edu> wrote:
>I'm considering playing around with implementing a samba-like fileserver for
>DECnet. Is there any way to transmit/recieve raw ethernet packets from
>userland?
Yes, you simply set the SOCK_RAW option in the socket() call. Heh, I
can't believe I said "simply."
>Since speed isn't really an issue for what I'm doing, could it be prototyped
>in perl?
Hmm. I think so; check out crashme.pl
greg
------------------------------
Date: 13 Mar 1998 22:24:23 GMT
From: shutton@habanero.ucs.indiana.edu (Scott Hutton)
Subject: Re: Accessing Ethernet packets directly (Or: userland network protocol)
Message-Id: <slrn6gjcgo.dpt.shutton@habanero.ucs.indiana.edu>
On 13 Mar 1998 22:02:34 GMT, Brian Wheeler <bdwheele@indiana.edu> wrote:
| I'm considering playing around with implementing a samba-like fileserver for
| DECnet. Is there any way to transmit/recieve raw ethernet packets from
| userland?
|
| Since speed isn't really an issue for what I'm doing, could it be prototyped
| in perl?
I believe tcpdump now includes a library that you can use to access
the packets and perform your own filtering.
I thought someone had already written a packet capture module for
Perl, but a quick search on the CPAN didn't turn up anything.
-Scott Hutton, Indiana University Computer Security Office
PGP key available: finger shutton@pobox.com ...or...
https://www.ucso.iu.edu/staff/shutton/
------------------------------
Date: Fri, 13 Mar 1998 14:49:21 -0800
From: Mike Hitchcock <mike@unival.com>
Subject: Bad free()
Message-Id: <3509B7F1.7ED01CDE@unival.com>
I have a Perl (5.004_01) CGI script that calls another
Perl (5.004_01) CGI.
Before calling the second script, I need to make
sure $ENV{'QUERY_STRING'} is empty or undef. I have
used the following:
delete $ENV{'QUERY_STRING'};
undef $ENV{'QUERY_STRING'};
$ENV{'QUERY_STRING'} = undef;
$ENV{'QUERY_STRING'} = "";
All of these have the same results: the QUERY_STRING is
emptied, but an entry appears in the httpd error_log:
Bad free() ignored at /usr/local/httpd/cgi-bin/app.mh line 287.
Line 287 is one of the above variants.
I have three questions: what does this mean, what is the severity,
and how do I fix it?
TIA,
--
Mike Hitchcock
mike@unival.com
hitchcock@earthling.net
------------------------------
Date: 13 Mar 1998 14:26:00 -0800
From: hermit@cats.ucsc.edu (William R. Ward)
Subject: Re: Contents of a file into checkbox's [CGI.pm]
Message-Id: <waa3egmqlc7.fsf@ese.UCSC.EDU>
td@lavalink.com.au (tony) writes:
> Hi,
> I'm trying to get a script to read the contents of a file and produces a
> series of checkboxes (html file that is), depending on the contents of a
> file.
> One checkbox for each item within the file.
> The file is space separated and in a single line.
Try @my_file_contents = split(/\s+/, <INPUT>) instead. Also put "-w"
on the #! line, and "use strict;" at the top of the file. You'll have
to add "my" statements for the new variables, though.
--Bill.
--
William R Ward Bay View Consulting http://www.bayview.com/~hermit/
hermit@bayview.com 1803 Mission St. #339 voicemail +1 408/479-4072
hermit@cats.ucsc.edu Santa Cruz CA 95060 USA pager +1 408/458-8862
PGP Key 0x2BD331E5; Public key at http://www.bayview.com/~hermit/pubkey.txt
------------------------------
Date: Fri, 13 Mar 1998 17:30:32 -0500
From: "D. Ian MacLennan" <dimaclen@novice.uwaterloo.ca>
Subject: Re: Contents of a file into checkbox's [CGI.pm]
Message-Id: <3509B387.B4AE436B@novice.uwaterloo.ca>
If you are space separating the elements they will all be in one line of the file.
You need to use the split command. Try the following:
open (INPUT, $input); # $input is a file name
$items = <INPUT>;
@items = split($items, ' ');
Or if you want to do a tab delimited:
open (INPUT, $input);
$items = <INPUT>;
@items = split($items, "\t");
Good luck!
Ian
------------------------------
Date: Fri, 13 Mar 1998 15:33:49 -0600
From: qvanegeren@frxsoft.com
Subject: Deleting and copying files in Win95
Message-Id: <6ec8l0$r5c$1@nnrp1.dejanews.com>
When I attempt to delete files in Win95, using the following
command :
system 'del file.txt';
I get an Invalid switch error... It appears to remove the
file but this makes it impossible for me to validate whether
it executed directly, because it always returns false. I run
into the same problem when trying to copy a file from one
place to another. Again, the copy appears to work, but the
error returned keeps me from reporting on the copy correctly.
It's also pretty ugly for a user to see the 'Invalid Switch'
message on the screen. Any help would be greatly appreciated.
Quenten Van Egeren
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 13 Mar 1998 15:43:26 -0600
From: Joel Horowitz <horowitz@ulb.ac.be>
Subject: Re: difference between 's' and 'tr'
Message-Id: <6ec96v$rtt$1@nnrp1.dejanews.com>
In article <17F16749CS86.CHADM1@UConnVM.UConn.Edu>,
CHADM1@UConnVM.UConn.Edu (Carl David) wrote:
>
> I have been attempting to create pages for readers to learn aspects of Perl
> vis-a-vis CGI programming, and came across a problem which I can not solve.
> I wonder if someone can lend me a hand?
> http://www.sp.uconn.edu/~cdavid/cgi-bin/regexp.pl is the URL in question,
and
> it works for substitution.
> But, when I attempt a translation using the same basic scheme:
> http://www.sp.uconn.edu/~cdavid/cgi-bin/tr_test.pl
> I get very strange results.
> If in the perl program one write tr/a/A one gets uppercase translation, but
if
> one writes:
> $a = 'a';
> $A = 'A';
> $b =~ tr/$a/$A/;
> well, to be honest, nothing happens.
It's strange. I wrote the following lines:
$a='a';
$A='A';
$b="abcdabcdabcd";
print "$b\n";
$b=~tr/$a/$A/;
print "$b\n";
and the output was:
$ perl tr.pl
abcdabcdabcd
AbcdAbcdAbcd
which is what I expected, and not quite what you describe... Concerning the
difference between s/ and tr/ I suppose that tr is a translation operator,
which means that if you have
b=~tr/abc/ABC/ it will turn any a into a A, any b into a B, etc..
f.i. bca --> BCA, which is quite different from
b=~s/abc/ABC/, which replaces the first occurrence of abc into an ABC.
So your b=~tr/$a/$A/ replaces $'s by $'s and a's by A's. If your question is:
'How to have a variable interpolation in a tr// operator', then I don't know
the answer, and I'd like to know it...
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 13 Mar 1998 17:43:17 GMT
From: Rik Turnbull <rik@csc.liv.ac.uk>
Subject: Does STDIN ever close?
Message-Id: <35097035.FD203368@csc.liv.ac.uk>
Here's a simple CGI program that works OK on a UNIX box but hangs
my NT server (IIS 4.0/NT 4.0):
#! /usr/local/bin/perl
print "Content-type: text/html\n\n";
print "Hello World\n";
while(<>) {
print $_;
}
---------------------------------------------------------------
Question is: how do you know when there's no more input
to STDIN? Surely the above should just return immediately
when it's called with a GET URL? I can't even use alarm()
to time it out...
So what's the obvious thing that I'm missing here?
Cheers,
Rik Turnbull.
rik@connect.org.uk.
Connect.
------------------------------
Date: Fri, 13 Mar 1998 14:35:14 -0800
From: Tim Barber <barber@ccrwest.org>
To: wdl@isporg.com
Subject: Re: Help sought with web programming security problem
Message-Id: <Pine.SUN.3.96.980313142500.2129A-100000@opus.ccrwest.org>
On Fri, 13 Mar 1998, Woody Durham wrote:
> I am in need of a way of providing web page readers with a visual
> certification that they are viewing an "official" web page and
> not someone's copy of it. I have been thinking along the lines
> of developing a "seal of approval" gif file image which will be kept
> secure. At the top of each web page using this scheme would be a request
> to a CGI program for the "seal of approval" image. If the requesting
> page were a "proper" one (i.e. located on the secured server rather
> than on someone's own server) the program would return the gif file.
> Otherwise, the program would return a different "seal of unapproval"
> gif file contents.
>
> So, can one do this and if so how or what might be another approach?
Stamping with a gif is not sufficient -- anyone can copy the gif and
stick it on their own version of your page.
Thus far the only way to accomplish what you want is to deliver the
page from your secure server, and pre-educate the user to check that
the domain name is correct.
More flexible would be to digitally sign the web page, so that the
author's identity could be verified with a public key. I am not
aware of any browser-integrated software that makes this process
convenient for end-users.
T Barber
barber@ccrwest.org
------------------------------
Date: Fri, 13 Mar 1998 13:48:45 -0800
From: Jesse Rosenberger <jesse@savalas.com>
Subject: HELP! Getting Remote File Size
Message-Id: <6ec9fn$jnp@bgtnsc02.worldnet.att.net>
How would you go about righting a perl script that would open a remote
image (from a url: ex. http://www.yourdomain.com/myimage.gif) and and
get a local perl script to get the file size (in bytes) and print it out
to the browser? If someone could provide an example of how to do
this...it would be greatly appreciated. Thanks in advance.
Thanx,
Jesse Rosenberger
Webmaster - Savalas Productions, Inc.
http://www.savalas.com
webmaster@savalas.com
------------------------------
Date: 13 Mar 1998 22:09:41 GMT
From: scott@softbase.com
Subject: Re: How to use Perl for Win95?
Message-Id: <6ecar5$fus$1@scully.new-era.net>
Another great way to capture output is to use the Win32 port
of GNU Emacs and use M-x shell. This opens a shell buffer
that lets you do command prompt stuff and capture all the
output in a buffer. This is the best way to do Perl programming,
and I couldn't live without it.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: Fri, 13 Mar 1998 13:10:13 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <Pine.OSF.3.95.980313130144.29355Q-100000@primal.ucdavis.edu>
On Fri, 13 Mar 1998, Ed Jamison wrote:
> Long ago (Fri, 13 Mar 1998 09:33:15 -0800), in a land far far away,
> jason@primal.ucdavis.edu spouted nonsense similar to this...
^^^^^^^^^^^^^^^^ Forsooth! You wound me!
> > On Fri, 13 Mar 1998, Mark P Stackhouse wrote:
> > >
> > > > There are pleanty of mentors at the University. They get paid, and
> > > ^
> >
> > Good won. Spelling flames, especially directed at possible typos, will
> > win you won ton of friends.
> Of course, when you spell something wrong while criticizing the spelling
> of others, you really look like an ass....
Pun notice issued above. I *really* wish to point out that *I*
discussed nobody's spelling. The caret ('^') was written by Mr.
Stackhouse, who then complained about "well-educated people who can't
spell," or words to that effect.
Y'all need some lessons in reading attributions and other topics in
Unenet etiquette at least as much as you need a "help desk."
For my part, I am willing to venture a few suggestions for "Newbie"
perlies, and have yet to advise anyone to just look at the fact
dammit. It *would* help, however, if the "help desk" customers would
be a little more polite.
---------------------------------------------------------------------------
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: Fri, 13 Mar 1998 13:54:37 -0600
From: Patrick Timmins <ptimmins@netserv.unmc.edu>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <35098EFD.733F@netserv.unmc.edu>
Mark P Stackhouse wrote:
... snip ...
> My point exactly! We need a "helpdesk"!
... snip ...
The "I/me" count was up to 27 in your previous post. Are you proposing a
"comp.lang.perl.help.mark" news group?
ps, note that a "we" counts if "I" or "me" can be reasonably
substituted.
--
Patrick Timmins
U. Nebraska Medical Center
Your results are below:
My point exactly!
We need a "helpdesk"!
I have, and am reading "Learning Perl"
I still get confused
my mind isn't a steel trap!
I DO, use the resources available on-line but they're not very friendly
All we get from the docs is the syntax
I guess
I'm a little impatient
my original post
I ALREADY HAVE IT
I'd think you could at LEAST spell
I'm not a student (literally)
I do believe life is about learning
Believe me
if I can find an on-line class
I'll be the first one in line
I'm on the "job" and expected to produce results now
Excuse me
how dare you label me a "street beggar"
my background
where I come from
my education
I didn't ask for any of YOUR quarters
I'm starting to think
we just might learn
we're both wasting bandwidth
------------------------------
Date: Fri, 13 Mar 1998 15:32:27 -0600
From: mchunziker@us.fortis.com
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6ec8ie$r37$1@nnrp1.dejanews.com>
> >I've only been playing with Perl for about a week now but
> >I'm amazed by it's power and versatility! Using this
> >"Newsgroup" (as the book 'Learning Perl' suggests) seems to
> >offend some of you "old timers". Sorry... but we
> >have no place else to go! If someone would start a group
> >for "Newbies", I'd unsubscribe from this one in a minute.
<snip>
David Oswald wrote:
<snip>
> Your attitude is the Internet's version of a street beggar, who with
> his ragged appearence manages to avoid all of the legitimate channels
> for assistance in favor of bumming quarters off of unsuspecting
> citizens on the street corner. Make something of yourself, don't
> expect our pittance to carry you through your education. We're fresh
> out of quarters.
I have to disagree, I'm quite new to perl but am picking it up at a pretty
good pace. Once I have a better understanding I won't mind sharing my
knowledge with people who are new and struggling. I've never seen such an
elitist bunch as the folks who populate this newsgroup. I'm not trying to be
insulting but I've run into things that I could not find in the FAQ or the
books and perhaps they really were there, but if I can't find the answer,
what good do these resources do for me? Many times these resources answer the
questions but not always. Newsgroups are for everybody, this isn't an
exclusive country club, I'd rather see the experts guide new users with some
advice and examples than say "read the docs jackass". If you don't have
something constructive to offer, why even reply?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 13 Mar 1998 22:03:04 GMT
From: althomas@together.net (Al Thomas)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <3509abf8.4375950@news.together.net>
On Fri, 13 Mar 1998 19:50:25 GMT,
edwardt@i.really.really.hate.spam.jamison.com (Ed Jamison) wrote:
>Long ago (Fri, 13 Mar 1998 09:33:15 -0800), in a land far far away,
>jason@primal.ucdavis.edu spouted nonsense similar to this...
>> On Fri, 13 Mar 1998, Mark P Stackhouse wrote:
>> >
>> > > There are pleanty of mentors at the University. They get paid, and
>> > ^
>>
>> Good won. Spelling flames, especially directed at possible typos, will
>> win you won ton of friends.
>Of course, when you spell something wrong while criticizing the spelling
>of others, you really look like an ass....
>
<snip>
The major problem with [humor||sarcasm] is the requisite presumption
of intelligence on the part of the audience.
------------------------------
Date: 13 Mar 98 22:26:17 GMT
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <3509b289.0@news.one.net>
Mark P Stackhouse <stackhou@elk.cray.com> wrote:
> David Oswald wrote:
>>
>> But don't you understand? This isn't a helpdesk.
> My point exactly! We need a "helpdesk"!
>> I've been putting in the effort; got a minor in Comp. Sci., read cover
>> to cover (and re-read) the Camel, Llama, Owls, and Mouse books, spent
>> a lot of time at www.perl.com, worn holes in the soles of DejaNews,
> Do you really expect a "Newbie" to buy and read 4 books at the same
> time? I have, and am reading "Learning Perl", but I still get confused
> sometimes. Sorry, but my mind isn't a steel trap! I DO, use the
> resources available on-line but they're not very friendly... to a
> "Newbie", the answer can be more confusing than the question. All we
> get from the docs is the syntax...very few examples to learn from.
I would like the world to have more good Perl programmers. So
when I see one who has promise, I try to help when I can. I am
trying to find one now for full-time employment, and it isn't easy.
But I need steel traps. Having worked with some who aren't, I know
that holding hands:
1. Takes my time.
2. Ultimately prevents them from learning.
3. Lengthens the time until the unsuccessful student finds
out they aren't programmer material.
Note that I am not commenting on the overall worth or ability of
someone. As an example, I know some great graphic designers who will
never be good programmers. I am a fair programmer who will never be a
great graphic designer. The twain often does not meet.
If you want to be an occasional programmer, you should expect occasional
help. If you have desire to be a real programmer, you will find plenty
of people to help you -- if YOU do your homework.
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
This post reflects the opinion 131 Willow Lane, Floor 2 | || _ \
of my employer. Oxford, OH 45056 | || |_) |
<mikeh@minivend.com> |___| _ <
513.523.7621 FAX 7501 |_| \_\
------------------------------
Date: Fri, 13 Mar 1998 16:47:42 -0500
From: Kevin Miles <kmiles@erols.com>
Subject: Re: ls -l to an array and pull 3 columns on data
Message-Id: <3509A97E.444A@erols.com>
I didn't have any luck with this, try it this way:
@files = `ls -l`;
foreach (@files) {
@rows = split /\s+/,$_;
print "$rows[0]\t$rows[1]\t$rows[2]\n";
}
Also, consider using opendir and readdir instead of `ls -l`
Collin Rogowski wrote:
>
> On Fri, 13 Mar 1998 08:01:30 -0600, grindrod@tfn.com wrote:
>
> @files = `ls -l`;
> foreach (@files) {
> @rows = split/\s/$_/9;
> print $rows[0]; print $rows[5]; #...
> }
>
> >I am trying to send the output of the ls -l command to and array or filehandle
> >and the print only 3 of the 9 columns of the output for each line. I did not
> >see anything in the FAQ or recent messeges addressing this and have exhaused
> >mey efforts to get the desired result. Can some shed light on how to do this?
> >I am using perl 5 on SCO Unix.
> >
> >-----== Posted via Deja News, The Leader in Internet Discussion ==-----
> >http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 13 Mar 1998 21:14:17 GMT
From: "John Hibscher" <john@apte.com>
Subject: newbie's 1st question
Message-Id: <01bd4ec4$39a4cc60$8fa7f9c7@hamachi.apte.nunet.net>
Hello,
Is there any recommended code to simulate a web page counter out there?
I'm trying to use the counter to generate unique file names. I've been
looking at the man pages for perl and it seems I may need to go buy a book
to understand perl functions.
My approach would be to have a file containing the current count. Then
each time the page is accessed, the count would be incremented and
re-written back to the file. It seems like no problem, but I'm lost in
syntax. Any help is greatly appreciated.
Thanks,
John Hibscher
john@hibs.com
------------------------------
Date: Fri, 13 Mar 1998 14:13:14 -0800
From: Douglas Nusbaum <Dpaladin@ix.netcom.com>
Subject: please help make cookies
Message-Id: <3509AF7A.521F872D@ix.netcom.com>
To all:
I am running apache on NT locally using Netscape 4.0x. I can create
cookies in the cookies.txt
using javascript, but have not figured how to do this with perl. The
following code, taken from a book, and other similar items seem to
create only temporary cookies that exist only during the
session. I would appreciate any help anyone could give.
Dpaladin@ix.netcom.com
--------------------
This code works, but does NOT create PERMANENT cookies in the
cookies.txt file
---------------------
#!I:/perl_NT/bin/perl.exe
# cookie1.pl
use strict;
my($expDate) = "Wed, 10-Nov-99 00:00:00 GMT";
my($theDomain) = ".localhost";
my($path) = "/gvp3/cgi-bin";
setCookie("user", "Myself", $expDate, $path, $theDomain);
if (defined($ENV{'REMOTE_HOST'})){
setCookie("User_addr", $ENV{'REMOTE_HOST'}, $expDate, $path,
$theDomain);
}
setCookie("flag", "black", $expDate, $path, ".localhost");
setCookie("car", "honda:accord:88:LXI:green",$expDate, $path,
$theDomain);
my(%cookies) = getCookies();
print "Content-type: text/html\n\n";
print <<THE_TOP;
<HTML>
<HEAD><TITLE>The cookie Display</TITLE></HEAD>
<BODY>
<H1>Cookies</H1>
<TABLE BORDER=1 CELLPADDING=10>
THE_TOP
foreach (sort(keys(%cookies))) {
print("<TR><TD>$_</TD><TD>$cookies{$_}</TD></TR>");}
print "http cookie = $ENV{'HTTP_COOKIE'}<br>";
print("</TABLE>");
print("</BODY>");
print("</HTML>");
sub setCookie{
my($name, $val, $exp, $path, $dom, $secure) = @_;
print("Set-Cookie: ");
print("$name=$val, expires=$exp, path=$path, domain=$dom");
print(", $secure") if defined($secure);
print("\n"); }
sub getCookies {
my(%cookies);
foreach (split (/; /,$ENV{'HTTP_COOKIE'})){
my($key) = split(/=/,$_);
$cookies{$key} = substr($_, index($_, "=")+1); }
return(%cookies);
}
What am i leaving out or doing wrong????
------------------------------
Date: Fri, 13 Mar 1998 14:14:29 -0800
From: ryan pc gibson <ryanpc@lbin.com>
Subject: regexp list context substitution
Message-Id: <3509AFC4.D9F2372C@lbin.com>
hello,
how can i apply a substitution regexp to an array? for example:
@html = <FH>;
@html =~ s/<tr>(.*)<\/tr>/<tr align=center>$1<\/tr>/sm;
...perl compiler complains that it can't modify array deref in
substitution. any ideas?
i am tired of coding around this, and have been unable to unearth
anything regarding why it can not be done. this seems like it would be
a common enough task.
going loopy looping - ryanpc.
--
::__________ Ryan PC Gibson __________________________
::__webmaster:
::___________ lightbinders, inc., san francisco, ca__
------------------------------
Date: 13 Mar 1998 21:57:14 GMT
From: nguyenqv@engr.csulb.edu (Quoc Nguyen)
Subject: sendmail
Message-Id: <6eca3q$5nc@hatathli.csulb.edu>
Hi,
I have a perl script which take the users' input from the WWW. I'd like
my perl script to automatically send me and the users an email when they
add to my GuestBook. My script is in one server(heart) and I make a
symbolic link to another server(grover). On grover, the path of
"sendmail" is "/usr/lib/". If I type sendmail CR in anywhere
other than in "/usr/lib/" path, sendmail won't be executed. If I type
/usr/lib/sendmail, then it's executed. Note: All of this is done via
command line. Here is what i put in my perl script:
!/usr/bin/perl -w
$mailprog = "/usr/lib/sendmail";
$re = "";
$re = $form{'email'};
sub sendEmail {
open(MAIL,"| $mailprog $re") || die "Can't open $mailprog\n";
print MAIL <<EOT;
Thank you for visting my website.
EOT
close(MAIL);
}
My program is really long. I just include this module that doesn't work.
The whole program itself works perfectly, but the send mail module doesn't
seem to work. You can test it out by visiting my website
www.engr.csulb.edu/~nguyenqv. Also, I have a counter script, I'd like to
use the system command "exec()" but it's been disable by sysadmin. Is
there a way to get around it. I mean is there a way to launch the website
and have it run automatically without using "exec()"? Thanks for your
help. I really appreciate your help. BTW, if I am in the wrong group,
please tell me so.
Email me if you could
nguyenqv@engr.csulb.edu
Quoc Nguyen
------------------------------
Date: 13 Mar 1998 15:12:09 -0600
From: Quentin Fennessy <quentin@jihad.amd.com>
Subject: Re: User-interface Quandary
Message-Id: <ximen06mh1y.fsf@jihad.amd.com>
>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
Good question. Regexp concepts can be difficult to
describe concisely.
How about:
Match Exactly
Match Completely and Exactly
Match Field Contents
Match Entire Field
I suggest 'Match Exactly', although 'Match Completely and Exactly' is
more precise.
--
Quentin Fennessy AMD, Austin Texas
------------------------------
Date: 13 Mar 1998 15:41:30 -0600
From: Tushar Samant <scribble@pobox.com>
Subject: Re: User-interface Quandary
Message-Id: <6ec96a$n24@tekka.wwa.com>
tchrist@mox.perl.com writes:
>In short, they compile into this, searching for "Fred"
>
> Anywhere /Fred/
> Whole Words Only /\bFred\b/
> Entire Field /^Fred$/
>
>My problem is that I have not in several years come up with anything
>conveys the /^Fred$/ case.
You might give up on calling it a search or match, set
it slightly apart and call it something like "Go To".
------------------------------
Date: 13 Mar 1998 21:28:34 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: User-interface Quandary
Message-Id: <6ec8e2$8pf$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Quentin Fennessy <quentin@jihad.amd.com> writes:
:>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
:>>>>>> [ moxperl database at http://mox.perl.com/cgi-bin/MxScreen ]
:Good question. Regexp concepts can be difficult to
:describe concisely.
Here are the cases
CODE ENGLISH
--------------------- -----------------------------------------
FIELD =~ /foo/ field contains foo anywhere
FIELD !~ /foo/ field doesn't contain foo anywhere
FIELD =~ /\bfoo\b/ field contains foo as a whole word
FIELD !~ /\bfoo\b/ field doesn't contain foo as a whole word
FIELD =~ /^foo$/ field contains exactly foo and absolutely
nothing else
FIELD !~ /^foo$/ field doesn't contain exactly foo and
absolutely nothing else
Imagine you have a field called TYPE, that may contain "Summon Dragon",
"Summon Dragonfly", or "Summon Elder Dragon Legend".
I think I shouldn't say "matches" or "doesn't match". That may be the
start of the mistake. The problem is I have one button (call it BUTTON#1)
for "matches/doesn't match", which determines whether it's successful if
the thing is there or successful if the thing is *not* there. Then I
have another button (call it BUTTON#3) that gives the choice of "case
matters" (no /i flag) or "case doesn't matter" (add a /i at the end).
The hard one is BUTTON#2, which has "Anything/Whole Words/Entire/Regexp"
(things not regexen go through \Q...\E).
If you look at the screen at moxperl maybe it will be more obvious.
Maybe the matches/doesn't-match button should instead be does/does-not,
and then I can use Contain instead of Anywhere. Hm... that still
doesn't fit together.
Ug.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
All language designers are arrogant. Goes with the territory... :-)
--Larry Wall in <1991Jul13.010945.19157@netlabs.com
------------------------------
Date: 13 Mar 1998 16:22:37 -0600
From: desmond@flash.net
Subject: Re: User-interface Quandary
Message-Id: <ylfkafaup6xe.fsf@goalie.i-did-not-set--mail-host-address--so-shoot-me>
Perhaps:
Match substring
Match word
Match phrase
-Lance
--
desmond@flash.net (work)
------------------------------
Date: Fri, 13 Mar 1998 21:58:23 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: User-interface Quandary
Message-Id: <3509ABFF.FB99DE36@world.northgrum.com>
Tom Christiansen wrote:
> [... His GUI search engine provides these search modifiers:]
>
> Anywhere
> Whole Words Only
> Entire Field
> [...]
> In short, [the choices] compile into this, searching for "Fred"
>
> Anywhere /Fred/
> Whole Words Only /\bFred\b/
> Entire Field /^Fred$/
> [...]
> [The problem: How to express 'Entire Field' so that users understand
> it. Some of them confuse it with 'Anywhere'.]
I think I heard somewhere that the New York Times requires each headline
to contain a verb. It's good advice. Who can say whether poor,
verbless 'Entire Field' means
Search the Entire Field [i.e., everywhere] for a Match
or
Find an Entire Field Matching
Supply the verb and enlighten your reader:
Find a Complete Field Matching
(I think "complete" is more idiomatic than "entire" here.)
With the text box following the prompt, the meaning should be obvious.
I am assuming that the reader knows what a "field" is. I don't play
Magic so I can't say whether this is a term of art. If not, would
"phrase" better express your intent?
>
> For an example of all this, see
>
> http://mox.perl.com/cgi-bin/MxScreen
>
> and select the Text query button.
>
> Any insights would be *greatly* appreciated.
>
--
Jim Stern -- Views here are my own, not my employer's. (Hawthorne, CA)
------------------------------
Date: Fri, 13 Mar 1998 16:42:52 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: User-interface Quandary
Message-Id: <3509B66C.5B94893F@gpu.srv.ualberta.ca>
Tom Christiansen wrote:
!
[snip]
! Anywhere /Fred/
! Whole Words Only /\bFred\b/
! Entire Field /^Fred$/
!
! My problem is that I have not in several years come up with
! anything conveys the /^Fred$/ case. I've tried `Entire', but the
! users always think that it means search the entire field, which
! of course is what `Anywhere' does. I've tried `Exact' as in
When thinking from a user perspective who might be unfamiliar with
search terminology, the word 'Only' springs to mind as indicative
of searching for a field that contains only the string entered and
nothing else:
Contains:
Anywhere /Fred/
Whole Words /\bFred\b/
Only /^Fred$/
regards
andrew
------------------------------
Date: Fri, 13 Mar 1998 14:35:24 -0800
From: Denis Goddard <dgoddard@us.oracle.com>
Subject: Re: Way of testing whether a variable is blessed
Message-Id: <3509B4AC.F54D0D1B@us.oracle.com>
John Porter wrote:
>
> > Is there a standard way of testing whether a variable is blessed or not?
> >
>
> sub is_blessed {
> eval { $_[0]->can('can') };
> ! length($@);
> }
Damn, that's cool :-)
If you can 'can', you're a blessed object.
That is just *so cool*!
--
__ __ _ __ __
~~~~(__)|-< /-\(__ |__(-_ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Denis Goddard, Senior Member, Tech. Staff |"I see the heads of men arise
email: dgoddard@us.oracle.com |with hungry minds and open eyes!"
ourworld.compuserve.com/homepages/d_goddard| -Rush, from 2112: _The Oracle_
------------------------------
Date: Fri, 13 Mar 1998 22:23:42 +0100
From: domo@tcp.ip.lu (Dominic Dunlop)
Subject: Re: Weak references?
Message-Id: <1d5tvm1.1j8s5zbn5qki6N@ppp121.vo.lu>
Jean-Louis Leroy <jll@skynet.be> wrote:
> I'm working on a persistence layer. Given the ID of an object, I need
> to find out whether it is already present in memory. This is to
> ensure object unicity:
A recent discussion and experimental patch on the perl5-porters mail
list may or may not be relevant. Take a look at <
http://www.rosat.mpe-garching.mpg.de/mailing-lists/perl-porters/1998-03/
msg00302.html> and <
http://www.rosat.mpe-garching.mpg.de/mailing-lists/perl-porters/1998-03/
msg00263.html> to decide for yourself.
--
Dominic Dunlop
------------------------------
Date: Fri, 13 Mar 1998 21:11:57 GMT
From: hertlein@umich.edu (Marcus P Hertlein)
Subject: Weird? problems with perldoc
Message-Id: <xihO.901$cD5.4319169@news.itd.umich.edu>
I seem to be having a bit of a problem with my installation of perl
on our unix system: perl works, but perldoc doesn't, for some reason.
I'm not sure whether it's a unix or a perl problem, really...
No matter what I type in any directory, I get "Command not found."
What's going on? Is this a unix problem? My path seems to be set up
correctly...
Here's what I've tried:
-------------------------------
gomez:/usr/local/bin [37]: perl -e 'print "Hello\n"'
Hello
gomez:/usr/local/bin [38]: ls perl*
perl@ perl4* perl5.00404@ perlbug@ perldoc@
gomez:/usr/local/bin [39]: ls -l perldoc
lrwxrwxrwx 1 root 36 Nov 25 21:25 perldoc -> /ourapp/perl5.004install
/bin/perldoc*
gomez:/usr/local/bin [40]: ls -l /ourapp/perl5.004install/bin/perldoc
-rwxr-xr-x 1 mph 12727 Mar 4 00:25 /ourapp/perl5.004install/bin/perldo
c*
gomez:/usr/local/bin [41]: /ourapp/perl5.004install/bin/perldoc perldoc
/ourapp/perl5.004install/bin/perldoc: Command not found.
gomez:/usr/local/bin [42]: head -5 /ourapp/perl5.004install/bin/perldoc
#!/ourapp/perl5.004install/bin/perl
eval 'exec /ourapp/perl5.004install/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
@pagers = ();
gomez:/usr/local/bin [43]: perl perldoc
Usage: perldoc [-h] [-v] [-t] [-u] [-m] [-l] PageName|ModuleName|ProgramName
perldoc -f PerlFunc
We suggest you use "perldoc perldoc" to get aquainted
with the system.
-------------------------------
So the last thing works...
One thing that might have been weird is that I installed perl in the
perl5.004install directory as above, because I didn't want all the programs
copied into /usr/local/bin because of disk space reasons.
Maybe some internal perl variables got set up incorrectly during install?
How can I find out? I'm at a loss as to where to look next...
--- Marc
------------------------------
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 2093
**************************************