[8198] in Perl-Users-Digest
Perl-Users Digest, Issue: 1816 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 5 11:12:55 1998
Date: Thu, 5 Feb 98 08:00:41 -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 Thu, 5 Feb 1998 Volume: 8 Number: 1816
Today's topics:
Re: >> CGI QUESTIONS? READ THIS <<< <joseph@5sigma.com>
Re: A problem - please help <jdporter@min.net>
Re: Advice needed. <jdporter@min.net>
Re: Advice needed. (Clay Irving)
Re: dir/file attributes <barnett@houston.Geco-Prakla.slb.com>
Re: Don't use signal handlers (was Re: Child processes) <jdporter@min.net>
Re: eval FAQ??? Hardest part of perl to figure out (Bart Lateur)
Re: eval FAQ??? Hardest part of perl to figure out (Bart Lateur)
Re: Help - need telnet client in perl (Frank da Cruz)
HELP - Proxy Authentication <sullivan.gill@twice.icl.co.uk>
Help needed for using redirect in Perl <kbo@kmd.dk>
how to access remote systems registry <pdore@nortel.com>
Re: Is file locking necessary? (Andrew M. Langmead)
Re: Is Perl 5 year 2000 compliant? (Jeffrey R. Drumm)
Re: Is Perl 5 year 2000 compliant? <jdporter@min.net>
Re: Is Perl 5 year 2000 compliant? (Andrew M. Langmead)
Re: Is Perl 5 year 2000 compliant? <lamber45@EGR.msu.edu>
Re: Is this correct? File Locking <joseph@5sigma.com>
Re: Is this correct? File Locking (Andrew M. Langmead)
Re: Moron Newbie <<Please Help!>> (Andrew M. Langmead)
Re: need help bad! <jdporter@min.net>
Re: Newbie about plunge into Perl asks... <jdporter@min.net>
Newbie question re: Sorting (Chris Raettig)
Re: Passing Javascript variables to Perl CGI? (Kenny A. Chaffin)
Re: Perl ISAPI Build 315 for NT & Arguments <carloshd@coqui.net>
Re: Question: Searching files. (TVR WebMart)
rename directory ... solution (WIN NT) <mauro@franchisetech.com>
Re: replacing things i perl <marthy@feskar.net>
Re: replacing things i perl <real@earthling.net>
reverse mirror script wanted <t.ursic@hrt.hr>
Re: reverse mirror script wanted <xxTony.Curtis@vcpc.univie.ac.at>
Re: run another process in backgorund <real@earthling.net>
Re: run another process in backgorund (Michael Wang)
Search takes Forever <orangutan@grungyape.com>
Re: signal problems on solaris 2.6 for perl 5.00 <jdporter@min.net>
Re: solution for multiline comments??? (Earl Hood)
Re: split /\s*,\s*/ (Gabor)
The perl institute still alive ? (Periat Henri)
Re: Tie-Dee-Perl (Cleanliness is next to Goodliness, or (I R A Aggie)
unable to capture info. resulting from a system() call <bhanu@usl.edu>
Using flock? <gedavis3@vt.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 05 Feb 1998 04:55:47 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: >> CGI QUESTIONS? READ THIS <<<
Message-Id: <34D9A8C2.2F24C723@5sigma.com>
You could make it even more convenient, and put news: in front,
so it will only be a mouse-click away. :-)
-joseph
Chip Salzenberg wrote:
>
> CGI is not the subject of this group.
>
> You want comp.infosystems.www.authoring.cgi, down the hall to the left.
> --
> Chip Salzenberg - a.k.a. - <chip@pobox.com>
> "Nice shooting, Zanthar!" "Thanks, Denise." // MST3K
> -> Ask me about Perl training and consulting <-
> Like Perl? Want to help out? The Perl Institute: www.perl.org
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
------------------------------
Date: Thu, 05 Feb 1998 10:02:34 -0500
From: John Porter <jdporter@min.net>
Subject: Re: A problem - please help
Message-Id: <34D9D48A.30C3@min.net>
Ya gotta remember that Perl treats these things as signed
integers (or reals, depending).
If you want 0xFFFF to map to -1, then simply subtract 0x10000.
Here's my version of your routine.
sub calculatePolarity {
my( @dataArray ) = @_;
my $sum = 0;
foreach $data (@dataArray) {
printf( "Before: %d %x \n", $data, $data ) if $debug;
if ($data > 0x7fff) {
$data -= 0x10000;
}
printf( "After : %d %x \n", $data, $data ) if $debug;
$sum += $data;
}
printf( "Sum = %d %x \n", $sum, $sum ) if $debug;
my $polarity = ( $sum >= 0 ) ? 1 : -1;
print "Polarity = $polarity\n\n" if $debug;
$polarity;
}
The other thing that occurs to me is, how are you reading the
data? If you get the two-byte 'string' that encodes each datum,
then you could get the signed integer you want by simply using
unpack("s"...
hth,
John Porter
------------------------------
Date: Thu, 05 Feb 1998 07:32:12 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Advice needed.
Message-Id: <34D9B14C.3054@min.net>
Sergio Loscialo wrote:
>
> I really could have done without your condescending post.
Think again.
> I don't see you going around posting that message
> to everyone who writes simple subject lines.
Then you must be new to this group. He does it all too often.
> If an individual is inclined to give advice, they'd look.
That is what happened!
John Porter
------------------------------
Date: 5 Feb 1998 10:28:55 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Advice needed.
Message-Id: <6bclrn$7q2@panix.com>
In <6ba1lr$ln1@sidney.chubb.com> "Sergio Loscialo" <nospam_sloscialo@chubb.com_nospam> writes:
>I am looking for advice on a date/time module. Which one
>would best suit my purposes to simply check if the date
>entered is a valid date. I don't want users to simply key in
>anything...but I want to accept things like "1/1/98", "1/1/1998"
>or "01/01/98" or even "Jan. 1, 1998". I will also need to compare
>that date with the system date to determine the number
>of days different.
>I found a few modules on the web, but want to know which
>one would be the best.
use Date::Manip;
$date=&ParseDate("today");
$date=&ParseDate("1st thursday in June 1992");
$date=&ParseDate("05/10/93");
$date=&ParseDate("12:30 Dec 12th 1880");
$date=&ParseDate("8:00pm december tenth");
if (! $date) {
# Error in the date
}
See: http://reference.perl.com/wrap.cgi?date-manip
ps. and you still need to choose a better subject! :)
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Thu, 05 Feb 1998 08:45:48 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: dir/file attributes
Message-Id: <34D9D09C.5A5C1CDF@houston.Geco-Prakla.slb.com>
Paul Mone wrote:
>
> 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?
I don't have any way to test this, but would this work for you?
Put the expensiveproduct.zip in some other directory (outside the range
of your DOCUMENTROOT directory). Perl is not restricted to only
accessing a certain area, unless chroot has been run. Once the user has
been 'authorized', the Perl script goes out, grabs the file, and starts
sending it.
If the user is not authorized, they cannot get to the file because it is
not in the realm of the web server (it is outside of DOCUMENTROOT).
Sounds like a good idea, and a fairly reasonable one if you ask me, but
may have some hidden drawbacks of which I am unaware.
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Thu, 05 Feb 1998 08:50:58 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <34D9C3C2.7B73@min.net>
Abigail wrote:
>
> Andrew M. Langmead (aml@world.std.com) wrote:
> ++
> ++ Which language do you want to write the signal handler in?
>
> In the same language of the rest of the code preferably.
Um... Ada?
------------------------------
Date: Thu, 05 Feb 1998 12:54:41 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: eval FAQ??? Hardest part of perl to figure out
Message-Id: <34d9b5e3.2532811@news.tornado.be>
"Joseph N. Hall" <joseph@5sigma.com> wrote:
>Huh? There is no need for string eval in any data structures
>problem in perl 5, period.
>Bart Lateur wrote:
>> >I can't see any reason why you can't do this with references.
>> I can. Soft references (= lookup by name) don't work with "my"
>> variables.
OK, here's a test script.
#!perl
$\="\n"; $,=": ";
$var = "global";
{
my $var = 'unset';
my $varname = 'var';
$$varname = 'local';
print "local",$var;
}
print 'global',$var;
And here's the output:
local: unset
global: local
Now, tell me again that there is no problem?
Bart.
------------------------------
Date: Thu, 05 Feb 1998 13:16:31 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: eval FAQ??? Hardest part of perl to figure out
Message-Id: <34d9ba03.3586602@news.tornado.be>
sherman@unx.sas.com (Chris Sherman) wrote:
>I haven't found a way of using the block version of eval (that is,
>using curly braces).
That is because ( eval { } ) is not what you think it is. Your code has
to compile properly, as if the "eval" word wasn't there.
All it does is errortrapping. It catches most otherwise fatal errors
(die). Most, not all: it can't prevent you from pulling the plug on the
computer.
That used to be one of the things ( eval string ) used to be used for,
hence the name. For the rest, both usages of eval have nothing on
common. (Yes, errortrapping works in ( eval string ) too!)
HTH,
Bart.
------------------------------
Date: 5 Feb 1998 15:27:08 GMT
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Subject: Re: Help - need telnet client in perl
Message-Id: <6bcloc$qbf$1@apakabar.cc.columbia.edu>
In article <34D75015.2E68@ps.net>, Richard Karon <richard.karon@ps.net> wrote:
: Does anyone have a telnet client in perl that allows both interactive
: and batch modes?
:
Not Perl, but Kermit programs are Telnet clients (and serial communication
programs too) with their own built-in scripting language, and that also can
transfer files, translate character sets, etc:
http://www.columbia.edu/kermit/
- Frank
------------------------------
Date: Thu, 05 Feb 1998 08:21:20 -0600
From: Sull <sullivan.gill@twice.icl.co.uk>
Subject: HELP - Proxy Authentication
Message-Id: <886688334.659292161@dejanews.com>
>From Web Client Programming with Perl :
$ua->proxy('http', 'http://proxy.ora.com:8080/');
$ua->no_proxy('ora.com');
What syntax do you have to use to the above code to enable the use of a
username and password for proxy authentication ?
Please help because I am at the end of my tether !!
P.S. Can you please reply to my personal mail address. Thanx.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 05 Feb 1998 15:38:20 +0100
From: Kim Bo Hansen <kbo@kmd.dk>
Subject: Help needed for using redirect in Perl
Message-Id: <34D9CEDC.6F9C@kmd.dk>
I am trying to redirect a page in perl by using the following line:
print
redirect(-location=>'http://test.test.dk/scripts/Perl/contract_example.pl');
the URL does exist, but the following error occurs:
"unknown status reply from server: 0!"
and then it tryes to set a cookie containing "-status".
Kim
------------------------------
Date: Thu, 05 Feb 1998 13:45:50 +0000
From: Philip Dore <pdore@nortel.com>
Subject: how to access remote systems registry
Message-Id: <34D9C28E.C01A9AD6@nortel.com>
I am trying to access registry entries on a remote winnt system, I have
a script which works fine on the local system (copied from the O'Reilly
book Learning Perl on Win32 Systems). the book mentions a function
RegConnectRegistry, but I can't seem to find out any information on
this. Can some one please point me in the right direction.
thanks
Philip Dore
Email: pdore@nortel.com
===========================================
I want to move to theory, nothing ever goes wrong in theory
===========================================
------------------------------
Date: Thu, 5 Feb 1998 15:30:14 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Is file locking necessary?
Message-Id: <EnwwEE.JIJ@world.std.com>
efflandt@xnet.com (David Efflandt) writes:
>But I never had any trouble with a script that reads or writes a whole
>file, so maybe file locking is more critical when reading or writing
>one line at a time than an entire file.
That is because you are making the entire write operations
indivisible. One program will fully complete its writing before the
other one. You still have a danger in which you loose data, because
one program may sneak in and perform a read and write in between
anothers read and write.
For example, lets take a hit counter. Each instance of the perl script
reads the entire file increments the number by one, and then writes it
out.
File contains "357"
Process 1: read file.
Process 2: read file.
Process 1: Increments the number to 358.
Process 2: Increments the number to 358.
Process 1: Writes "358" to the file.
Process 2: Writes "358" to the file.
See, two process have accessed the hit counter, but it was only
incremented by one. Good thing that page counts are pretty
meaningless.
For anyone interested in more arguments for file locking, there is a
significant portion of the FAQ devoted to it.
--
Andrew Langmead
------------------------------
Date: Thu, 05 Feb 1998 13:40:50 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <34d9bcb9.1193069393@news.mmc.org>
On Thu, 05 Feb 1998 10:04:41 GMT, Abraxas@hell.com (Tiberius) wrote:
(retreaded argument snipped . . . this ground has been covered SO many times
before)
>You should save the rudeness for the arrogant guy who doesn't want to
>spend 5 minutes searching and reading some docs, and instead asks a NG
>question, not the new guy who doesn't quite have a handle on things.
Please share your apparently foolproof method for telling the difference
between the two.
Regardless, telling someone the LOCATION of the answer is far better than
raising the already-too-high noise level of this group by posting FAAs[1]. I
was a newbie once (still am in many respects), and would much rather be told
where to obtain the definitive answer than get questionable advice from someone
who may not have a clue . . . RTFM/RTFFAQ/Get the
Llamma|Gecko|Camel|Panther|EPP[2] are ALL preferable to diluting the useful
content of this ng further.
[1] Frequently Answered Answers
[2] "Effective Perl Programming" - Hall/Schwartz
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Thu, 05 Feb 1998 09:15:05 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <34D9C969.AC4@min.net>
Abigail wrote:
>
> It certainly is possible to use Perl to write
> non-Y2K complaint programs.
^^^^^^^^^
Yep, I do that all the time.
John Porter
------------------------------
Date: Thu, 5 Feb 1998 15:20:42 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <EnwvyJ.BLC@world.std.com>
Abraxas@hell.com (Tiberius) writes:
>>"the answer to that question is in the documentation - which you should
>>have read before posting here"
>Well, exactly what *isn't* in the documentation? Of course it's in the
>documentation. Virtually everything is. If only questions that had no
>answers in the docs were posted in the newsgroups, there'd be like,
>what, 2 questions a day?
You wouldn't believe the world of questions that go beyond what is in
the documentation. The docs show you the basic building blocks. This
is a variable, this is an output operator, etc. Its once you start
putting these things together that you get interesting questions.
(And that is what everyone who is doing more answering questions than
asking them is doing here, looking for interesting questions.)
>The poster should be given the benefit of the doubt, that is, assume
>that maybe he or she tried to find it in the docs and couldn't quite.
Thats why people often try to encourage people to discuss the research
they have done so far. So we can see where they have gotten mixed up.
--
Andrew Langmead
------------------------------
Date: Thu, 5 Feb 1998 10:46:56 -0500
From: David Lee Lambert <lamber45@EGR.msu.edu>
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <Pine.GSO.3.96.980205104453.27294H-100000@area51>
On Thu, 5 Feb 1998, Cliff Pratt wrote:
> David Lee Lambert wrote:
> >
> > > ++ > Does anyone know of any problems with Perl 5 and Y2K?
> >
> Is this the same thread that was going at least a year ago?
I don't know; I haven't been reading news for a year, just since last
July. I think it started with an original (no Re:) post in c.s.y2k a
couple of days ago.
David Lee Lambert MHm 16x20 Hack Programmer and Student
Admin of lmert.dyn.ml.org http://lmert.dyn.ml.org
My web pages are at http://web.egr.msu.edu/~lamber45
------------------------------
Date: Thu, 05 Feb 1998 04:52:42 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Is this correct? File Locking
Message-Id: <34D9A809.A4F489D@5sigma.com>
It came up on #perl that this behavior is of 5.004_something.
If you're not using 5.004, you should close without releasing
the lock.
-joseph
Joseph N. Hall wrote:
>
> I'm not sure why myself. LOCK_UN *does* flush the filehandle.
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
------------------------------
Date: Thu, 5 Feb 1998 15:03:30 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Is this correct? File Locking
Message-Id: <Enwv5u.LKx@world.std.com>
"Joseph N. Hall" <joseph@5sigma.com> writes:
>I'm not sure why myself. LOCK_UN *does* flush the filehandle.
>Maybe there are some systems where this doesn't work reliably?
>Maybe there are other issues. For example, I don't know whether
>all systems position to EOF before each write in append mode.
As you said in a later post, the automatic flushing of the filehandle
was only added to perl 5.004. Earlier versions of flock acted much
more like its C counterpart.
If you close without removing the lock, you still have the advantage
(if you make use of it) that if the close() fails, you still have the
lock. Then any error recovery you do can be done still with exclusive
access to the file.
If you don't check the return status of close, then it doesn't
matter. (Actually, now that I think of it, it makes it worse. If the
close fails then the file stays locked for the remainder of the
script.)
Of course, if things like flush() and close() are failing, you
probably have bigger problems.
--
Andrew Langmead
------------------------------
Date: Thu, 5 Feb 1998 15:13:30 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Moron Newbie <<Please Help!>>
Message-Id: <EnwvMJ.6pz@world.std.com>
"Robert Murphy: The Next Generation" <robertm@cc.wwu.edu> writes:
> I am attempting to make a sort of pine-like program but I want to
>have extended characters making up the outline (\x80-\xff) I attempted to
>make a quick little program that would for that, two 'for' loops counting
>from 0 to 15 and then changing them with (0..9,'a'..'f')[$var] into hex
>digits. When I got to print out ($var1*16)+$var2 . " =
>\x${var1h}${var2h}\n"; all I see is the numbers! Is there anyway to trick
>perl into treating something like "\xae"? I really don't want to have to
>type out all 256 of these bad boys.
Convert them with pack()
pack 'C', hex '0xae';
Or to make an array of all of them:
@glyphs = map { pack 'C', $_ } 0x80 .. 0xff;
Like the person in the thread "Re: dump bit/hex question" the other
day, you are mixing up the text representation of the script, which
has things like "\xae" and the program as it is being run, which has
set a location in a memory in your computer with a value that
corresponds with our decimal number 174. (Or more accurately some
memory chip has a bit pattern 001100010011011100110100)
--
Andrew Langmead
------------------------------
Date: Thu, 05 Feb 1998 10:24:38 -0500
From: John Porter <jdporter@min.net>
Subject: Re: need help bad!
Message-Id: <34D9D9B6.1000@min.net>
zonpower@zonified.com wrote:
>
> Hello all. I am searching for a perl script that will convetr pcx
> files to gif or jpg. I am looking for it to run on either a unix or
> windows 95/nt system. Please email zonpower@zonified.com Any help or
> info would be appreciated
Why perl? Use Jef Poskanzer's PBM Plus package. You won't
regret it.
http://www.acme.com/software/pbmplus/
hth,
John Porter
------------------------------
Date: Thu, 05 Feb 1998 09:22:46 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Newbie about plunge into Perl asks...
Message-Id: <34D9CB36.6774@min.net>
Robbie Baldock (real email address at foot of message) wrote:
>
> 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?
>
> 2. ... should I buy a book on Win32 Perl (I
> see O'Reilly has one of those too!) as well or will a general Perl
> manual suffice?
The answer to both questions is the same: you're developing to
run on both platforms, so avoid any platform-dependent stuff.
That means don't use (and don't bother learning, imho) the Win32
modules.
There are issues involved with cross-platform development, but
none (that I know of) that are Perl-specific. You've got things
like \ vs. /, environment variables, POSIX functions, access
control, etc. etc.
hth,
John Porter
------------------------------
Date: Thu, 05 Feb 1998 13:01:05 GMT
From: chrisr@cheese.org (Chris Raettig)
Subject: Newbie question re: Sorting
Message-Id: <34ddb73b.240794638@news.demon.co.uk>
Hi there,
I am trying to sort an array in descending numerical order by a substring...
Each element in my array contains something like these...
'Scooby has been slain by Shaka having reached 52100 points'
'Wintermute has been slain by Rincewind having reached 00 points'
The application is an online MUD game. The array is in order of time of kill and
I'd like to sort it in order of people who've died with the most number of
points. I have used the sort command but I'm still very much learning and can't
work out the syntax to do the sorting I described.
Any help would be greatly appreciated,
Regards,
Chris.
------------------------------
Date: Thu, 5 Feb 1998 05:37:58 -0700
From: kenny@kacweb.com (Kenny A. Chaffin)
Subject: Re: Passing Javascript variables to Perl CGI?
Message-Id: <MPG.f43608d5366a88989b9d@news.dimensional.com>
In article <886603945.855572489@dejanews.com>, petcrows@bigfoot.com
says...
> Greetings.
>
> I would like to log to a file all the referring http pages that
> access my site as well as the user's host name. The HTTP_REFERER
> variable is not available in Perl CGI on my ISPs server, but the
> Javascript document.referrer does work ok.
What? Who's your ISP?? I've never seen/heard of this.
Document.referrer does not work on all browsers/versions.
>
> Thus how to I pass JScript document.referrer to a Perl CGI, and if I
> wanted to pass other JScript items how can that be done? Some people
> have suggested that JScript variables can be accessed in Perl CGI
> by simple using $variable_name in the Perl. However I have tested that
> and it doesn't seem to work. I declare a var testing = "yes"; in JScript
> and then do a print $testing in Perl, but nothing comes out. Is that
> method really supposed to work?
>
> Here is the logger.cgi program I'm basing the project on:
>
> #!/usr/local/bin/perl
> # logger.cgi
> # version 1.0
> #
> # Copyright Rod Clark rclark@wolfenet.com
> # Create a file called main.log. Must have write permissions
> # set to main.log
> $mainlog = "main.log";
> $shortdate = `date +"%D %T %Z"`;
> chop ($shortdate);
> print "Content-type: text/plain\n\n";
> print "This is a test";
> open (MAINLOG, ">>$mainlog");
> print MAINLOG "Time: $shortdate\n";
> print MAINLOG "User: $ENV{'REMOTE_IDENT'}\n";
> print MAINLOG "Host: $ENV{'REMOTE_HOST'}\n";
> print MAINLOG "Addr: $ENV{'REMOTE_ADDR'}\n";
> print MAINLOG "With: $ENV{'HTTP_USER_AGENT'}\n";
> print MAINLOG "Page: $ENV{'DOCUMENT_URI'}\n";
> print MAINLOG "From: $ENV{'HTTP_REFERER'}\n\n";
> print "Time: $shortdate\n";
> print "User(REMOTE_IDENT): $ENV{'REMOTE_IDENT'}\n";
> print "Host(REMOTE_HOST): $ENV{'REMOTE_HOST'}\n";
> print "Addr(REMOTE_ADDR): $ENV{'REMOTE_ADDR'}\n";
> print "With(HTTP_USER_AGENT): $ENV{'HTTP_USER_AGENT'}\n";
> print "Page(DOCUMENT_URI): $ENV{'DOCUMENT_URI'}\n";
> print "From(HTTP_REFERER): $ENV{'HTTP_REFERER'}\n\n";
> print $testing;
> close (MAINLOG);
> exit;
>
> -----
>
> Jonathan Higbee
> http://www.ieighty.net/~jhigbee
> petcrows@bigfoot.com
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
>
--
KAC
Website Design, Programming, Graphics --> http://www.kacweb.com
kenny@kacweb.com
------------------------------
Date: Thu, 05 Feb 1998 10:03:14 -0400
From: "Carlos Dmaz" <carloshd@coqui.net>
To: john_helt@hp.com
Subject: Re: Perl ISAPI Build 315 for NT & Arguments
Message-Id: <34D9C6A2.A1A8EC3F@coqui.net>
Try this:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Argument= $env['QUERY_STRING'] \n";
Note: I'm using the Activeware port for Win32.
Take care,
Carlos Dmaz
------------------------------
Date: Thu, 05 Feb 1998 14:59:07 GMT
From: email@business-links.co.uk (TVR WebMart)
Subject: Re: Question: Searching files.
Message-Id: <34d9d228.428957@news.skynet.co.uk>
Thanks to everyone who replied - THANKS :)
but I do seem to have upset a few people with my typo - http:\\ -
hey, in those immortal words - "shit happens".
Once again many thanks to all concern.
Rich.
------------------------------
Date: Thu, 05 Feb 1998 14:52:28 +0100
From: Mauro Quartini <mauro@franchisetech.com>
Subject: rename directory ... solution (WIN NT)
Message-Id: <34D9C41C.424B@franchisetech.com>
I'll speak about win NT world.
We can not call directly:
$some_dir="C:\\one_dir";
$other_dir="C:\\two_dir";
$cmd="move $some_dir $other_dir";
because and error occurrs.
we had to make a batch command to place in a visible directory (ie in
the
PATH) like this:
mv.bat
____________________________
move %1 %2
____________________________
and call via perl
$cmd="mv $some_dir $other_dir";
(do not call $cmd="c:\dos\mv.bat $some_dir $other_dir"; else an error
occurrs)
bye
Mauro Quartini
------------------------------
Date: Fri, 6 Feb 1998 13:34:21 +0100
From: Martin Raknerud <marthy@feskar.net>
To: Richard Bellavance <charlot@CAM.ORG>
Subject: Re: replacing things i perl
Message-Id: <Pine.LNX.3.95.980206132621.21554A-100000@torsk.feskar.net>
On 4 Feb 1998, Richard Bellavance wrote:
Thanx for all the answers, btw.
> open(IN, $n) || die("Can't open $n: $!");
> while(<IN>) {
> s/keyword1/value_of_keyword1/g;
> s/keyword2/value_of_keyword2/g;
> print;
> }
> close(IN);
Thanx.
But what if i want to add something ex after the keyword. Ex:
I have a text containing headlines looking like this
@headline: Fish shot dead in street
And i want it replace with
<h1>Fish shot dead in street</h1>
If i try putting the </h1>-tag into your sentence it either just ignores
it and never prints it anywere or it prints it at _every_ sentence it the
text.
Martin
- 50% lamer
- 50% confused
------------------------------
Date: 5 Feb 1998 14:36:21 GMT
From: "Real" <real@earthling.net>
Subject: Re: replacing things i perl
Message-Id: <01bd3243$54d84860$822c57c0@pc0130.pica.nl>
Martin Raknerud <marthy@feskar.net> wrote in article
<Pine.LNX.3.95.980206132621.21554A-100000@torsk.feskar.net>...
> On 4 Feb 1998, Richard Bellavance wrote:
>
> But what if i want to add something ex after the keyword. Ex:
> I have a text containing headlines looking like this
> @headline: Fish shot dead in street
>
> And i want it replace with
> <h1>Fish shot dead in street</h1>
>
> If i try putting the </h1>-tag into your sentence it either just ignores
> it and never prints it anywere or it prints it at _every_ sentence it the
> text.
Then, you must try something like this.
$header = "Fish shot dead in street";
open(FILE, "<$n") or die;
while (<FILE>)
{
s/(^$header)/<h1>$1<\/h1>/;
print;
}
Hope it'll bring you further.
Real
(99% sure)
> Martin
> - 50% lamer
> - 50% confused
------------------------------
Date: Thu, 05 Feb 1998 14:21:27 +0100
From: Tomislav Ursic <t.ursic@hrt.hr>
Subject: reverse mirror script wanted
Message-Id: <34D9BCD7.978DE90A@hrt.hr>
I need a script that would behave just like the mirror, but in oposite
way, it should put a local directory tree to a number of other sites. It
would be great if it could be configured in separate file (hostname,
paths, username, passwd, etc) and started as a cron job. Does anyone
knows of such a script, or at least something to start from (for now,
all I found was ftpput - to simple, and mirror - to comlex to do
anything with it in short time).
Thanks in advance,
--
Tomislav Ursic
HRT - Croatian Radio Television
Prisavlje 3, 10000 Zagreb, Croatia
tel:+385 01 6163375, fax:+385 01 6112425
------------------------------
Date: 05 Feb 1998 15:15:51 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: t.ursic@hrt.hr
Subject: Re: reverse mirror script wanted
Message-Id: <7xhg6ecf3c.fsf@beavis.vcpc.univie.ac.at>
Re: reverse mirror script wanted, Tomislav <t.ursic@hrt.hr>
said:
Tomislav> I need a script that would behave just like the
Tomislav> mirror, but in oposite way, it should put a local
Tomislav> directory tree to a number of other sites. It
You don't have to use perl for everything (HERESY!! :-)
You could use `cfengine' or `rdist' here to good effect.
hth,
tony
------------------------------
Date: 5 Feb 1998 13:55:17 GMT
From: "Real" <real@earthling.net>
Subject: Re: run another process in backgorund
Message-Id: <01bd323d$b04d6d20$822c57c0@pc0130.pica.nl>
Daryl Sayers <daryl@stonemicro.com.au> wrote in article
<u54t2domg6.fsf@marge.stone.oz.au>...
>
> I want to spawn off a process from my perl script that will run
> in the background. I dont wish to wait for its return etc. The
> child process should be run as a background process and may last
> longer than the life of the perl script it was started from. Basically
> I want the same function as the & on a shell.
>
> eg:
>
> #/usr/bin/perl
>
> @args = ( "myapp", "Here i am with a comment", "&");
> system ( @args, );
> print "Here I am non blocked after running app\n";
>
> PS: This dont work.....
Hay Daryl Sayers,
This piece of Perl comes directly from a tutorial (forgot which one).
# - - fork - -
if ($pid = fork)
{
# Parent
print "Parent: this command is executed by the PARENT process (pid
$$)\n";
}
elsif ($pid == 0)
{
# Child
print "Child: this command is executed by the CHILD process (pid
$$)\n";;
# The child must end with an exit!!
exit;
}
else
{
# Error
die "$0: Fork did not work\n";
}
I guess this will help,
Real
------------------------------
Date: 5 Feb 1998 15:21:54 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: Re: run another process in backgorund
Message-Id: <6bclei$ipi$1@news.ml.com>
>> I want to spawn off a process from my perl script that will run
>> in the background. I dont wish to wait for its return etc. The
>> child process should be run as a background process and may last
>> longer than the life of the perl script it was started from. Basically
>> I want the same function as the & on a shell.
The utility "submit" does exactly this, it can be ftp'ed from
ftp://ftp.mindspring.com/users/mwang/submit
The unix command does not really runs in background, but as a daemon.
The problem with using & is you have to worry about I/O, for example,
rsh host "nohup command 2>&1 > /dev/null < /dev/null &" 2>&1 > /dev/null < /dev/null
Usage: submit unix_command
submit allows you disconnect from the system after submitting a
unix_command. submit spawns a child process to execute unix_command,
and then exits. The child process is adopted by init, and runs
independent of the parent.
The stdout and stderr of the unix_command is saved in the LOGFILE
($HOME/submit.log for normal users, and /opt/local/log/submit.log).
Send comments to Michael Wang, mwang@mindspring.com.
version 1.0, Feb 1998.
Examples:
submit make
submit "make > make.log"
submit 'make CC="gcc" CFLAGS="-g -O2"'
submit make \> make.log
submit make CC=\"gcc\" CFLAGS=\"-g -O2\"
------------------------------
Date: Thu, 5 Feb 1998 08:25:01 -0500
From: "Franklin L. Petersen" <orangutan@grungyape.com>
Subject: Search takes Forever
Message-Id: <6bcei8$hj7$1@cletus.bright.net>
I need some help, and I hope it's simple.
I have a web form, where people can enter part numbers. It then searches a
flat txt file outputted nightly for all matches (some partnumbers have
multiple responces). I wanted to simply just query the database, but this
question assume it cannot be done. Instead, it searches this text file that
is about 3 megs in size. As you can guess, it takes way too long.
I need to break that file up, say into 4 smaller sections(maybe more) and
then have the perl script search the appropriate file. I assume it would
analyze the partnumber entered and use some table to determine which file it
was associated with. My big problem is how do I do something like
this...the partnumbers are not real cooperative as some contain numbers and
some numbers and letters.
Can anyone assist?
e-mail please
orangutan@grungyape.com
------------------------------
Date: Thu, 05 Feb 1998 09:30:03 -0500
From: John Porter <jdporter@min.net>
Subject: Re: signal problems on solaris 2.6 for perl 5.00
Message-Id: <34D9CCEB.5B6D@min.net>
Bill Spencer wrote:
>
> 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.
1. What is your code? Do you *set* any sig handlers, even if
they don't get called? Let's see it.
2. What is your perl -V, please.
John Porter
------------------------------
Date: 5 Feb 1998 15:34:50 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: solution for multiline comments???
Message-Id: <6bcm6q$fjv@news.service.uci.edu>
In article <34df80a4.6150391@news.tornado.be>,
Bart Lateur <bart.mediamind@tornado.be> wrote:
>mgjv@comdyn.com.au (Martien Verbruggen) wrote:
>
>>BTW. Would you ask on comp.lang.c if it maybe was possible to have
>>shell style comments in c source?
>
>Weeellllll.... "//" style comments are a pretty common feature.
C++. gcc lets you get away with it with C code because gcc is a C++/C
compiler in one. However, ANSI C and K&R C do not official support the
"//" style, unless changes to the language have been done that I am not
aware of.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 5 Feb 1998 14:02:38 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: split /\s*,\s*/
Message-Id: <slrn6djhcf.8n7.gabor@vnode.vmunix.com>
In comp.lang.perl.misc, Steven Smith <steves@wco.com> wrote :
# 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
use
@foo = split /\s*,\s*/,$_,-1;
gabor.
--
There are many times when you want it to ignore the rest of the
string just like atof() does. Oddly enough, Perl calls atof().
How convenient. :-)
-- Larry Wall in <1991Jun24.231628.14446@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: 5 Feb 1998 13:13:45 GMT
From: periat@ens.ascom.ch (Periat Henri)
Subject: The perl institute still alive ?
Message-Id: <6bcdu9$9e6@ascomax.hasler.ascom.ch>
Does any body know if the perl institute is still alive ?
since a long time i haven't heard anything from it. Months a go i
send mails and got no response. And when ever i try to have a look
at their home page, the browser keeps telling me: "server not reachable".
Henri
------------------------------
Date: Thu, 05 Feb 1998 10:42:09 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Tie-Dee-Perl (Cleanliness is next to Goodliness, or Perl-White Code)
Message-Id: <fl_aggie-0502981042100001@aggie.coaps.fsu.edu>
In article <34D94E2C.7CD08196@gpu.srv.ualberta.ca>, Andrew Johnson
<ajohnson@gpu.srv.ualberta.ca> wrote:
+ open SOMETHING, 'somefile' or die "Kant $!";
+ works fine...
+ you want parentheses if using the '||' operator though.
+ open(SOMETHING,'somefile')||die "Kant $!";
Ah, that's it. Thanks for clarifying that. Of course, there's always
this bit of advice:
When in doubt, parenthesize. At the very least it will let some poor
schmuck bounce on the % key in vi.
-- Larry Wall in the perl man page
James - I like it, anyway...
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Thu, 05 Feb 1998 07:35:39 -0600
From: "Bhanu P. Suravarapu" <bhanu@usl.edu>
Subject: unable to capture info. resulting from a system() call
Message-Id: <34D9C02B.41C67EA6@usl.edu>
Hi,
I have system() call in my cgi program (perl script). After this
call is made the script prints out some html text onto the web
browser by default.
But, I want to store the text in a variable without displaying it.
I want to do some preprocessing before displaying the text to the user.
Is it possible to do so?
If not is there a way around it?
Thank you,
bhanu.
bhanu@usl.edu
----My perl program is here------
#!/usr/local/bin/perl
$result
=~(system("/local/marsh/Isite-1.08/Isearch/Isearch-cgi/isrch_srch
/home/swamp1/raghavan/bps8527/MOM/MOMspider-1.00/index"));
# here I would like to do some processing on the stuff printed out
# by the system command
exit 0;
------------------------------
Date: Thu, 5 Feb 1998 10:34:40 -0500
From: "Jerry Davis" <gedavis3@vt.edu>
Subject: Using flock?
Message-Id: <6bcm82$1tb$1@solaris.cc.vt.edu>
In the past I have used lock files to restrict access to a file while making
changes (like a counter script)
currently I am writing a large perl script and it is getting cumbersome to
check, write the delete the lockfiles.
I recently learned their is a command called flock that locks files.
Question 1)
Does flock work on NT systems or is it a unix command?
Question 2)
As I understand it the syntax for using flock is:
open(FILE, ">file.txt");
flock(FILE, 2);
##make changes##
flock(FILE,8);
close(FILE);
Do you need to check is the file is locked or is that something flock
handles automaticly?
If a file is flocked (i.e I run the above script, and while the file is
flocked, I run another copy
of the script) and a perl script tries to open a file what happens? Does it
wait, until the lock is
released?
Question 3)
the second argument in the flock command is the type of lock:
1 = shared
2 = exclusive
4 = no wait
8 = unlock
I understand #2, and #8. Can someone explain what the other two are used
for?
Thank you for the help.
If flock works the way I think it does, it will save me a bunch of time!
Jerry Davis
------------------------------
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 1816
**************************************