[7056] in Perl-Users-Digest
Perl-Users Digest, Issue: 681 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 29 08:07:15 1997
Date: Sun, 29 Jun 97 05:00:30 -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 Sun, 29 Jun 1997 Volume: 8 Number: 681
Today's topics:
'fork && exit;' and '$SIG{'HUP'} = \&restart;' problem (Hekan Lindholm)
Re: calling subroutines with part of a $ as a name <pdcawley@aladdin.net>
CGI.PM or cgi-lib.pl? and strange errors? <guitarweb@hotmail.com>
Re: CGI.PM or cgi-lib.pl? and strange errors? <guitarweb@hotmail.com>
Re: Hash vs. DBM (Paul Marquess)
HELP: Programming an IRC Client for X Window <moh@geocities.com>
I just dont't get this -- opening a new filehandle topaz56@one.net
Re: Learning Perl <sandler@501.yc.yu.edu>
Re: Learning Perl (Chester Wong)
Re: Multi-Line Record into One line (Honza Pazdziora)
Re: Multi-Line Record into One line (Clay Irving)
Re: Perl and PGP interface <rra@stanford.edu>
Re: problem running a C shell program in PERL.. <rra@stanford.edu>
Problems with HTTP_REFERER bglenn@swanmedia.com
Re: tchrist's insulting email <rra@stanford.edu>
Re: Threads in perl ? <kueh@students.uiuc.edu>
Re: Variable help please (brian d foy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Jun 1997 11:08:51 GMT
From: hakan@af.lu.se (Hekan Lindholm)
Subject: 'fork && exit;' and '$SIG{'HUP'} = \&restart;' problem
Message-Id: <5p5fo3$f9v$1@news.lth.se>
Hi,
I'm working on a daemon, and want it to reload itself when SIGHUP:ed. I
don't really know if I've got the "FAQ: How do I fork a daemon process?"
thing right either, but I use:
#!/usr/local/bin/perl -w
open(TTYP, '>/dev/tty');
ioctl(TTYP, TIOCNOTTY, 0);
close(TTYP);
chdir('/');
open(STDIN, '-');
open(STDOUT, '>/dev/console');
open(STDERR, '>&STDOUT');
fork && exit;
sub restart {
my $signame = shift;
exec $0 || die "Couldn't respawn";
exit;
}
while (true) {
$SIG{'HUP'} = \&restart;
sleep 30;
}
SIGHUP:ing this rereads the script from disk, but the new process ignores
SIGHUP's. Why ?
--
Hekan Lindholm interAF Email:Hakan@af.lu.se
Kdmndrsvdgen 15 H:22 Sandgatan 2 Fax:046-2112505
SE-226 46 LUND SE-223 50 LUND http://purl.oclc.org/NET/hakan
046-391492 046-132630 StudentDatorRedgivare Mac
------------------------------
Date: 27 Jun 1997 09:49:56 +0100
From: Piers Cawley <pdcawley@aladdin.net>
Subject: Re: calling subroutines with part of a $ as a name
Message-Id: <54k9jgh1l7.fsf@gunnar.aladdin.net>
Clark Dorman <clark@s3i.com> writes:
> Randal Schwartz <merlyn@stonehenge.com> writes:
> >
> > %routine_map = (
> > "apa" => \&start_apa,
> > "bepa" => \&start_bepa,
> > );
>
> I'm still learning about hashes, but why do you use the quotes when
> you are also using => ? I thought that one of the spiffy things
> about => was that it double quotes the left side?
>
> Frankly, though, I still don't understand why => was added to the
> language at all.
Useful syntactic sugar (use 'em properly and you can make the
structure of your, um, structures far more apparent), with extra value
as a potentially obfuscatory tool.
--
Piers Cawley -- Systems Genie for Aladdin
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: Sun, 29 Jun 1997 04:38:17 -0700
From: perl perl perl <guitarweb@hotmail.com>
Subject: CGI.PM or cgi-lib.pl? and strange errors?
Message-Id: <33B64929.4878@hotmail.com>
i know i need to read up on this, but i have a program running now
people are using. i only want to know (as i've heard), that cgi.pm is
far better then using the cgi-lib.pl?
if so, does anything need to be changed in my script or otherwise?
sorry that's so dumb., i've looked in deja news and i get a million
things matching that has nothing to do with this, and all the onlien
info seems to be over my head, when i just want to know what is better.
please offer my advice.
also, if someone is kind enough to tell me about the following errors?
i'm getting the following errors in my error log, and i believe this
might be part of the problem with the cgi-lib.pl?
i get this every once in a great while.
shell-init: could not get current directory: getwd: cannot access parent
directories
this a lot, but i'm not sure why? (these aren't _that_ often)--
Invalid URI in request image/pjpeg (and other strange paths at the end
every now and then)
-- such as --
Invalid URI in request
e+should+play+one-on-one.&submit_message=Chat%2FUpdate
and another rarely--
Invalid URI in request application/x-www-form-urlencoded
also, a lot i get this--
cgi-lib.pl: Unknown Content-type:
and this --
copy script args timed out for (host here)
and these i think are common. but i get a LOT --
lingering close lost connection to client (host)
send body lost connection to client (blah)
read request line timed out for (blah host)
other then that, i get this error, but i believe this to be, because (i
have a chat i'm trying to build), i think people's "session" files are
gone after the "prune file" takes effect, and they are trying to update
their info. --
Modification of non-creatable array value attempted, subscript -1 at
/home/path/blah
thanks for anything and everything. i am only asking about the errors.
most (i assuem) are common, but i'd like to make sure everything is
working as well as it can. thank you again!
and yes., i am constantly looking in dejanews, docs, and faq's all over
the net for what i need, even the "idiots-guides", but it seems to be
very difficult to find the answere's for the easier questions. is their
an "idiot" archive that isn't filled up with tons of archives that have
nothing to do with what you're looign for? or maybe one that is better
monitored? anyway, just curious. thank again, again. :^)
-- roy--
guitarweb@hotmail.com
------------------------------
Date: Sun, 29 Jun 1997 04:42:51 -0700
From: perl perl perl <guitarweb@hotmail.com>
Subject: Re: CGI.PM or cgi-lib.pl? and strange errors?
Message-Id: <33B64A3B.577F@hotmail.com>
perl perl perl wrote:
>
> i know i need to read up on this, but i have a program running now
> people are using. i only want to know (as i've heard), that cgi.pm is
> far better then using the cgi-lib.pl?
> if so, does anything need to be changed in my script or otherwise?
> sorry that's so dumb., i've looked in deja news and i get a million
> things matching that has nothing to do with this, and all the onlien
> info seems to be over my head, when i just want to know what is better.
> please offer my advice.
>
> also, if someone is kind enough to tell me about the following errors?
> i'm getting the following errors in my error log, and i believe this
> might be part of the problem with the cgi-lib.pl?
>
> i get this every once in a great while.
>
> shell-init: could not get current directory: getwd: cannot access parent
> directories
>
> this a lot, but i'm not sure why? (these aren't _that_ often)--
> Invalid URI in request image/pjpeg (and other strange paths at the end
> every now and then)
> -- such as --
> Invalid URI in request
> e+should+play+one-on-one.&submit_message=Chat%2FUpdate
>
> and another rarely--
>
> Invalid URI in request application/x-www-form-urlencoded
>
> also, a lot i get this--
> cgi-lib.pl: Unknown Content-type:
>
> and this --
> copy script args timed out for (host here)
>
> and these i think are common. but i get a LOT --
> lingering close lost connection to client (host)
>
> send body lost connection to client (blah)
>
> read request line timed out for (blah host)
>
> other then that, i get this error, but i believe this to be, because (i
> have a chat i'm trying to build), i think people's "session" files are
> gone after the "prune file" takes effect, and they are trying to update
> their info. --
>
> Modification of non-creatable array value attempted, subscript -1 at
> /home/path/blah
>
> thanks for anything and everything. i am only asking about the errors.
> most (i assuem) are common, but i'd like to make sure everything is
> working as well as it can. thank you again!
>
> and yes., i am constantly looking in dejanews, docs, and faq's all over
> the net for what i need, even the "idiots-guides", but it seems to be
> very difficult to find the answere's for the easier questions. is their
> an "idiot" archive that isn't filled up with tons of archives that have
> nothing to do with what you're looign for? or maybe one that is better
> monitored? anyway, just curious. thank again, again. :^)
>
> -- roy--
>
> guitarweb@hotmail.com
geez, please take in mind, it's almost 5 Am here, and i may have
mispelled more then i see already *sigh*. %%coffee%%
--roy--
------------------------------
Date: 29 Jun 1997 10:00:40 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: Hash vs. DBM
Message-Id: <5p5bo8$79b$1@pheidippides.axion.bt.co.uk>
[ Posted & Mailed]
Otis Gospodnetic (otisg@puma.middlebury.edu) wrote:
: Hi,
: I was wondering if somebody can tell me which of the following two
: options/approaches is better.
: I have to collect some data and as I collect it I need to store it. As I
: store it I also have to retrieve that data, and delete it from the storage.
: So I'm wondering which storage option is better:
: Should I store the data in a simple hash/associative array and let the array
: grow as I add key-value pairs, or should I open a DBM file and have my script
: add the data to the DBM file?
: The important requirement is performance - if I collect some data I need to be
: able to quickly determine if I already collected this data before.
: And the other important requirement is memory usage - this script should not
: require/consume more and more memory as I collect more and more data and
: become a huge memory hog.
: I tried using a hash, which gave me good results as far as performance goes
: (because I can quickly check if data, which is the hash key, is already in the
: hash). However, as I collect more data this script grows from 5-10-20+ MB (of
: RAM).
: I haven't tried using a DBM yet because I'm not sure if when I tie() the DBM I
: end up with the same thing. In other words, I'm not sure if when I tie()
: a DBM file to some %hash this %hash is then loaded into memory? If it is,
: then I really don't gain anything at all by using a DBM, right?.
No. If you tie a hash to a DBM, there will only be a small part in
memory at any given time.
: Another thing I'm afraid of is disk access. With a plan hash (the first
: option) I know the memory usage will grow, but I also know I won't have to
: access the disk. With a DBM I guess I will have to do that. How fast are
: those disk accesses?
Depends how fast you disk is :-)
A DBM solution is going to be slower. Whether that is acceptable
depends on what performance you require.
The only way to find out is to try it, I'm afraid.
: I need to be able to make rouchly 1-2 lookups per
: second. I plan on using Berkeley DB 2.1.0.
If you are going to use 2.1.0, you will have to fetch DB_File-1.51Beta
from CPAN. The version that currently ships with Perl does not support
DB version 2.
Paul
------------------------------
Date: Sun, 22 Jun 1997 19:59:50 +0200
From: Moh <moh@geocities.com>
Subject: HELP: Programming an IRC Client for X Window
Message-Id: <33AD6816.F3CC6134@geocities.com>
-----BEGIN PGP SIGNED MESSAGE-----
Dear people!
I intent to program an IRC client for X Window for
Linux. The reason is beside I could not still find
a client I like 100% to learn networking programming
in TCP/IP and creating an application which belongs
to that field. I am sure that it is not easy but it
will be fun (hopefully ;)), interesting and it *is*
possible. When I joined several channels on different
networks I just got stupid comments or the people
there just ignored me. For me it was clear that most
of them just had not idea and were to proud to admit
this. Well (at the moment!) I have *no idea* so that
I have to ask you all for help. Could you send me
tips, information, source code smaples (the source
codes for ircII for a network beginner is a little bit
tough but I hope to understand everything one day),
ideas, URLs, etc. etc. etc. written in any following
programming language/script: C/C++, Java, Pascal, Perl,
Basic, Tcl/Tk. Furthermore all kind of FAQs, RFCs and
readmes could also help me. Just all stuff you have ;-)
I don't know *if* and when I will successful but I
won't give up now. Please do not reply to this if
you just have stupid comments like got on IRC e.g.
"Use mIRC and be happy, it is too difficult!".
I hope I can rely on you :-) Thanks in advance.
Richard Moh Samar, Frankfurt Germany
<moh@geocities.com>
PS: I am going to send this to several groups so that
it would be great to *email* me the stuff instead of
sending it to the groups as I don't know if I can look
through all of them and filter out the stuff. Thanks :)
....and in German written material is as helpful as
in English written meterial, just both langs.
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
iQEVAwUBM60aPs+dArVYypCVAQF7AggAqJ35bVjlC14CQ9l5lRVABcRdbAMZYdTe
y4gQkh6+ij0sQfQgwnxQvlEBRqt3WvuZ6HjFKKJSfikM4Mwtw+roCKxFJLgM+sWJ
nP0reNLRGptp5bKxZ1yw2qHqtPz7o6Xn+zyLiLZmMznEqMEu/jpM95J8yG9eylbt
FTklVROSIcCx/k3XcxBxc/Pi1Pm8vJNCAxFsVLk4wFhtopJzfXbSmtxUNEDYkG5l
RCa6XK9ACmn9fL/BsQw9a851RdpU93O9+6oB3ZnloVxv1soq0VMtyetu5vLH/HFH
zmdKr0XEeQO1c2ctCnCSiBsfqx/425kUcwVhde/K65qUK4/e7tu1cw==
=WCDz
-----END PGP SIGNATURE-----
--
,+040+,8,+040+,88,+040-040+,88,+040+,8,+040+,8,+040+,8,+040+,8
+ Moh ,8
++040+,8,+040+,88,+040-040+,88,+040+,8,+040+,8,+040+,8,+040+,8
+ E-Mail: moh@geocities.com ,8
+ Homepage: http://moh.home.ml.org ,8
+ Undernet: #Iran #Java #Star_Trek #Delphi ,8
+ EU Efnet: #Star_Trek ,8
+ ,8
+ IPhone: PrinceOfPersia@pub1.ipn.vocaltec.com ,8
,+040+,8,+040+,88,+040-040+,88,+040+,8,+040+,8,+040+,8,+040+,8
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.3i
mQENAzOK+JUAAAEIAK5EWU4AEUHaBAPF8aFhkcUKHbf0Mi0RoA6R8vQuEGtexNhr
/O1fuWzYSNkkSQG3QfG7/X2VMLNfZCK3npeHsxdenVes/q3F+3/AlvkdrdgMW6wK
ul31FGhkny40loa/IpSN96UjVR7D+QmepfmiUjz4vcmeIdsMEk2Vsb/mijM/lozF
rS90DiVHjmtlCccalUqYzwesB82mSpGks7E2m9uiW81xdR2l0/Rp5G2jkUyMF6Fe
i67I9BqOZubVx8kaKfdf2yv8itOqmsVs2iumA23gTah4bxBUfw87GiYiB7bEgd58
YME1lNrJeFVoXpUl06mr76gnop9Yz50CtVjKkJUABRG0A01vaIkBFQMFEDOK+JXP
nQK1WMqQlQEBROYH/3dbIlPVpAQ93TjrVISifgbUpIyyO5EVZHy7w3Pwmuhhi9Ia
bRvZevx6kJH+JTgPMzJnVe+i1ZF/GCobscPIfe0up+DTFRGz1TQUOJhapnQM9mw1
N36eVPY2HUjPS9BR7N8WZixR5diCWvr+fhZ3ALFgK59vux7jK3GTJdpiW4JCDFwm
HQl3WLN/AhXiFvya5szXD1E3EXL556eamwIxKOcVpfoPBybTC3D/5LhfGkBPfyxx
W/ADgDgh1O9yIlgW45dLCVpGN20A/wUnZOAnBUDtPtiPOw/yBHjOEq+AadPrlCgd
wl7a550yOGYuF2KjKdq4KuUsaxmCnRd2WvHvlC8=
=qBZk
-----END PGP PUBLIC KEY BLOCK-----
------------------------------
Date: Sun, 29 Jun 1997 08:13:38 GMT
From: topaz56@one.net
Subject: I just dont't get this -- opening a new filehandle
Message-Id: <33b6163f.188327561@news.mindspring.com>
First, I want to thank those in this group that have helped w/ this --
you know who you are. Now for the next question...
I'm importing some POST data, dumping all the wierd http chars,
then matching a ulf & name, then pushing this to a web page.
My problem is that the POST data that come in on STDIN and is dumped
into $datafile. The script chomps on $datafile for awhile so that
it's formatted properly for a long regex, and then I try to open a new
filehandle that the regex can match against. The problem is (& I've
tried ~ 10^6 different ways to do this) is that I can not open the new
filehandle. I keep getting "document contains no data", & in the
error_log it's clear where this script hangs. Can anyone enlighten
me? It's past 4am again & I still can't get this to work over the
net. The script follows:
Thanks to all for the help... Best, Tom
--------------------------------------------------------------------------------
#!/usr/local/bin/perl5.003 -w
#
# **** URL Grabber ****
#
# $$Date 6.26.97 rev 1.03
# Thomas Porter
#
# Flush stdout buffer
#$|=1;
# Print out a content-type for HTTP/1.0 compatibility
print "Content-type:text/html\n\n";
# Slurp the source file into one scalar
$datafile = "";
read(STDIN, $datafile, $ENV{'CONTENT_LENGTH'});
# Get rid of http encoding stuff
$datafile =~ tr/+/ /;
$datafile =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$datafile =~ s/<!--(.|\n)*-->//g;
$datafile = chop($datafile);
# Dump $datafile into new filehandle "DATAFILE" <---NOT WORKING
undef $/;
open (DATAFILE, $datafile) || die "Can't read $datafile: $!\n";
$datafile = <DATAFILE>;
close (DATAFILE);
# Match and replace
while(<DATAFILE>) {
while (
m{
<\s*a\s #match the <a with optional whitespace
#before and at least some whitespace
after
#(don't want to match <address or
<applet)
[^>]* #match any other options that may
intervene
href= #match the href option
(?: #match one of the following:
"([^"]+)" #quotes around
things-that-aren't-quotes
| #or
([^\s>]+) #whitespace-delimited stuff
)
[^>]* #match any other stuff up to the >
> #here's the >
((?:\n|.)*?) #match anything up to the first </a>
(minimally)
<\s*/a\s*> #match the </a> tag with optional
whitespace
}gix #x allows whitespace and comments in
regex
)
{
($url,$name) = ($1?$1:$2,$3);
$name =~ s/\s/ /g; #compress whitespace, kill
newlines
$name =~ s/<[^>]+>//g; #remove tags e.g. <b>
# Now the DATAFILE we want is ":" delimited
$html = "<a href=\"$url\">$name</a>\n";
#print $html; #DEBUG
}
}
#########################################################################
#
#
# Output results to browser
#
print<<"print_tag";
<html>
<head>
<title>URL RESULTS</title>
</head>
<body bgcolor="#ffffff">
<br><br><br><br>
<center><font size=5 face="HELVETICA,ARIAL"><b>
Your Hypertext Links
</b></font></center>
<br><br>
<hr size=3 width=80% align=center>
$html
<br><br><br><br>
</body>
</html>
print_tag
=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, 29 Jun 1997 02:22:04 -0500
From: Ben Sandler <sandler@501.yc.yu.edu>
Subject: Re: Learning Perl
Message-Id: <33B60D1C.7E22@501.yc.yu.edu>
> error message of "perl1[4]: syntax error at line 5 : `;' unexpected"
two problems with this script:
> #!/usr/dist/exe/perl
> @words = ("camel", "llama", "oyster");
> print "What is your name?";
> $name=<STDIN>;
> chop($name);
> if ($name eq "Chris") {
> print "Hello Chris! You smell terrific!\n"
line above should and with ; (this is what is causing the error)
> } else {
> print "Hello $name! You are a big dummy!\n";
> print "What is the secret word?.....dum dum";
> $guess = <STDIN>;
> chop($guess);
you are missing ending brace here (})
unless this is not the end of the script :)
------------------------------
Date: Sun, 29 Jun 1997 06:36:27 GMT
From: cpw10@columbia.edu (Chester Wong)
Subject: Re: Learning Perl
Message-Id: <33b90244.43778500@news.cc.columbia.edu>
On Sat, 28 Jun 1997 22:21:16 -0600, chris.deehan@east.sun.com wrote:
>Hi--I am learning Perl from scratch with the O'Reilly book "Learning
>Perl".
>
>I am using the Korn shell and perl is located in /usr/dist/exe/perl.
>
>I am copying the script right out of the book and I continually get the
>error message of "perl1[4]: syntax error at line 5 : `;' unexpected"
>
>FYI--I attempted to remove the ";" from line 5 (and I assuming line 5 is
>chop($name);) and I got the same error. I also got the same error when I
>commented out the line??
>
>Any ideas why this error keeps on harassing me?
>
>Here is the script:
>
>#!/usr/dist/exe/perl
>@words = ("camel", "llama", "oyster");
>print "What is your name?";
>$name=<STDIN>;
>chop($name);
>if ($name eq "Chris") {
> print "Hello Chris! You smell terrific!\n"
you forgot a ";" at the end of that line.
>} else {
> print "Hello $name! You are a big dummy!\n";
you forgot the ending "}" to close your if-else statement.
>print "What is the secret word?.....dum dum";
>$guess = <STDIN>;
>chop($guess);
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sun, 29 Jun 1997 09:04:34 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Multi-Line Record into One line
Message-Id: <adelton.867575074@aisa.fi.muni.cz>
neil_@droopy.com (Neil Moore) writes:
> open ( INPUT, "<input.tfile" ) || die "Could Not OpenFile :$!\n";
> while (<INPUT>)
> {
> # chop;
> (@tmp_name) = split(',',$_);
> chop(@tmp_name[6]);
> if ($tmp_name[0] == "NEW")
^^
Here you probably want eq instead of ==, to
compare strings. And of course the same below.
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
DES is dead. Let's fight RC5 now. --> http://rc5.distributed.net/
------------------------------
Date: 29 Jun 1997 06:08:38 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Multi-Line Record into One line
Message-Id: <5p5c76$sjh@panix.com>
In <33b5a5d0.67339012@news.ocslink.com> neil_@droopy.com (Neil Moore) writes:
>open ( INPUT, "<input.tfile" ) || die "Could Not OpenFile :$!\n";
>while (<INPUT>)
>{
># chop;
> (@tmp_name) = split(',',$_);
> chop(@tmp_name[6]);
> if ($tmp_name[0] == "NEW")
> {
>printf("%s,$s,%s,%s,$s,%s,%s,",$tmp_name[0],$tmp_name[1],$tmp_name[2],$tmp_name[3],$tmp_name[4],$tmp_name[5],$tmp_name[6]);
> }
> if ($tmp_name[0] == "OLD")
> {
>printf("%s,$s,%s,%s,$s,%s,%s\n",$tmp_name[0],$tmp_name[1],$tmp_name[2],$tmp_name[3],$tmp_name[4],$tmp_name[5],$tmp_name[6]);
> }
>}
>close (INPUT);
>--------------------------
>Results in the same line coming into the array twice
>What am I doing wrong?
>Please remove the _ from the email address to reply
You're using "==" instead of "eq" -- The test should be:
if ($tmp_name[0] eq "NEW") {
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: 29 Jun 1997 00:54:48 -0700
From: Russ Allbery <rra@stanford.edu>
To: roustan@wwa.com (Yvon D. Roustan)
Subject: Re: Perl and PGP interface
Message-Id: <m3radlyhbr.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Yvon D Roustan <roustan@wwa.com> writes:
> The problem I encounter is that the bits I am trying to filter from the
> variable $CryptFile within the perl script (not an actual file in the
> directory), through the pgp -f filter, are not processed as a filter as
> a subroutine such as the following for example:
> pgp -feat her_userid < $CryptFile > $outputfile
use FileHandle;
use IPC::Open3;
# Takes a string to encrypt (which can contain embedded newlines, of
# course, so could potentially be an entire message) and a user ID and
# returns the encrypted version.
sub pgp_encrypt {
my ($data, $userid) = @_;
my $pgp = new FileHandle;
my $result = new FileHandle;
my $errors = new FileHandle;
open3 ($pgp, $result, $errors, 'pgp', '-feat', $userid);
print $pgp $data;
close $pgp;
return join ('', <$result>);
}
Hope this helps!
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 29 Jun 1997 00:19:38 -0700
From: Russ Allbery <rra@stanford.edu>
To: scoler@earthlink.net
Subject: Re: problem running a C shell program in PERL..
Message-Id: <m3vi2xyiyd.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Stephen Cole <scoler@earthlink.net> writes:
> Now, within my code, I used a system command like I did for the other 10
> programs on the menu:
> system "cshellprogram $arg1 $arg2";
> What happens is that the C Shell program bombs out on a line that uses
> the "!" as a NOT expression. (i.e. if !(-f file) ). If you are at a
> prompt in UNIX & type cshellprogram $arg1 $arg2, the program works.
Let me guess -- the C shell script doesn't start with the line:
#!/bin/csh -f
Let me guess further -- csh is your interactive shell, and if you tried to
run the shell script from an account that used /bin/sh as its shell, it
wouldn't work, and in fact would die on exactly the same line.
Shell scripts are run under the "current" shell. For anything run from
inside Perl, this is *always* /bin/sh since its behavior is predictable
and more reliable than csh and because it can do things csh can't. If you
want a shell script to always run under the same shell regardless of what
shell is used to invoke it, it *has* to start with a #! line.
Try putting:
#!/bin/csh -f
(the -f so that the user .cshrc file won't be read) at the beginning of
the script and see if that fixes the problem.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sun, 29 Jun 1997 01:01:47 -0600
From: bglenn@swanmedia.com
To: bglenn@swanmedia.com
Subject: Problems with HTTP_REFERER
Message-Id: <867563627.2402@dejanews.com>
I am using a couple of PERL scripts to accomplish a task of checking user
and password info to related fields in a database. Once the user
information is verified the first script spits out other information to
an assigned variable which represents the URL that will be sent to the
second script. The first script spits out html that contains a "refresh"
command that sends the request header of the second script. My problem
is that I am trying to make sure that the user's HTTP_REFERER is the URL
of my first script. However I did a little debugging and found that the
$ENV{'HTTP_REFERER'} variable is blank when the referer is from a *.cgi
file extension. Why is this happening. I have tested the HTTP_REFERER
from .html file extentions and the HTTP_REFERER shows up.
For Example:
1. login.html (sends user and password)--->first.cgi (is HTTP_REFERER
../login.html if NOT--> ERROR MESSAGE=END OF NAVIGATION if YES--> then
2. Open database-->USER and PASS (VERIFIED)-->first.cgi spits out html
including a "refresh" command that sends second.cgi?needed=someinfo
3. second.cgi-->$ENV{'HTTP_REFERER'} is blank! no checking can be done
PROBLEM is $ENV{'HTTP_REFERER'} in second.cgi does not return anything
therefore letting the user bookmark the URL or type in the URL in their
browser. I want to know how I can stop this from happening eventhough the
HTTP_REFERER is empty. I have thought about having dummy hidden variables
needed to run the second script. Any help will be appreciated.
Bo Glenn
Swan Interactive Media
bglenn@swanmedia.com
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 29 Jun 1997 03:10:42 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: tchrist's insulting email
Message-Id: <m3iuyxyb19.fsf@windlord.Stanford.EDU>
Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:
> Netusa.net is *NOT* a "spam-hosting site". I generally killfile people
> who send me these things. IT IS VERY INSULTING TO BE BOUNCED BECAUSE OF
> A SUPERFICIAL SIMILARITY IN DOMAIN NAME THAT COULD BE NOTICED BY
> CHECKING WORD BOUNDRIES.
Why on earth are you posting this here?
First off, your message wasn't rejected from perlbug. If you look at
where perlbug@perl.com goes, it goes to perl5-porters, and that part
doesn't have a filter on it. It was rejected from Tom's personal mailbox,
which he is certainly allowed to apply whatever filter he chooses to.
Second, this newsgroup isn't the appropriate place to deal with problems
like this anyway. If you have a problem with Tom's mail filtering, take
it up with Tom. The only reason for posting this is to try to convince
this newsgroup that Tom's done something wrong, and I highly doubt you'll
have any effect with that. Most people who have been reading this
newsgroup for a while know perfectly well that Tom has some strongly-held
opinions about a few things and can be cantankerous about them.
Third, how do you know, just from this, that the problem is with checking
word boundaries or that Tom hasn't received some sosrt of spam from
NetUSA.Net in the past? NetUSA appears to be a commercial ISP, and I
therefore presume that it isn't under your total control; it's quite
possible that spam has been sent to Tom from there in the past. In any
event, if you think he has the domain misfiled, you can send *him* mail
and tell him that (from some other address, presumably). He doesn't even
read this newsgroup any more.
Finally, this isn't "insulting e-mail from tchrist." It's e-mail from a
mailer daemon, and if you consider it insulting then I respectfully
suggest you reconsider your reaction. It's an error message. People who
are insulted by error messages don't generally get along well with either
Unix or Perl. People who are insulted by incorrect error messages, rather
than taking the steps necessary to fix them and writing them off as
generated by a confused program, are going to have great difficulty
programming. They're a fact of life, and people have to fix them as they
happen.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sun, 29 Jun 1997 02:25:33 -0500
From: "Kueh, Anthony" <kueh@students.uiuc.edu>
Subject: Re: Threads in perl ?
Message-Id: <Pine.SOL.3.91.970629022501.16434A-100000@ux8.cso.uiuc.edu>
On Sun, 22 Jun 1997, Larry D'Anna wrote:
> Budi Rahardjo wrote:
>
> > On 19 Jun 1997 03:00:07 GMT, Zenin <zenin@best.com> wrote:
> >
> > If I can't use thread in perl, I am forced to use Java :-(
> >
>
> My god! We actualy found something that you can't do in perl!
>
Gimme Perl 6. :)
+------------------------------------------------------------+
Anthony Kueh Department of Computer Sciences
kueh@uiuc.edu Univ. of Illinois-Urbana/Champaign
Nearly all men can stand adversity, but if you want to test
a man's character, give him power. -- Abraham Lincoln
+------------------------------------------------------------+
------------------------------
Date: Sun, 29 Jun 1997 03:04:10 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Variable help please
Message-Id: <comdog-ya02408000R2906970304100001@nntp.netcruiser>
In article <19970629050601.BAA19488@ladder02.news.aol.com>,
citicentr@aol.com (CitiCentr) wrote:
> I was hoping someone could help me with a quick problem- is there anyway
> in Perl to have one variable become part of another variable name? For
> instance, if I wanted to test ($cat1 eq 1) but I wanted the 1 to be
> dependent on a variable $calendar (ie, if $calendar was 2 then the
> expression would be ($cat2 eq 1)...is that possible?
there's more than one way to do it. for this example, we'll choose the
variable name (\$cat$number) on the fly using eval, then assign that
variable's value to $test, which we'll use in the conditional statement.
see the man pages for more details on eval :)
#!/usr/bin/perl -w
use strict;
use vars qw($test $number);
my $cat0 = 0;
my $cat1 = 1;
my $cat2 = 2;
my $cat3 = 3;
foreach $number (0..3)
{
eval( "\$test = \$cat$number" );
if ($test == 1)
{
print "\$cat$number is 1\n";
}
else
{
print "\$cat$number is not 1\n";
}
}
__END__
$cat0 is not 1
$cat1 is 1
$cat2 is not 1
$cat3 is not 1
--
brian d foy <URL:http://computerdog.com>
------------------------------
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 681
*************************************