[13294] in Perl-Users-Digest
Perl-Users Digest, Issue: 704 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 2 17:07:22 1999
Date: Thu, 2 Sep 1999 14:05:16 -0700 (PDT)
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, 2 Sep 1999 Volume: 9 Number: 704
Today's topics:
Re: -F/foobar/ on #! line <aqumsieh@matrox.com>
Re: appending one file to another (Gyepi SAM)
Re: appending one file to another (Larry Rosler)
Re: ATTENTION EXPERIENCED PROGRAMMERS ONLY!!! <ljp@209.204.251.8>
Re: beginner in for loop (Gyepi SAM)
Re: CGI DownLoad File on the PC Client <gellyfish@gellyfish.com>
Help another Perl newbee <contact@novacrystals.ns.ca>
LOKKING FOR PERL/CGI PROGRAMMER <info@sportsmatchonline.com>
need help with &GetFTP <vnataraj@mail.ford.com>
Re: Need your help here. <dimitri@oerlnow.com>
Re: Need your help here. <dimitri@oerlnow.com>
Re: newbi needs help (Marcel Grunauer)
Password Protection? <firebrand@mail.usa.com>
Re: Password Protection? <nolenj@worldnet.att.net>
Re: Password Protection? <meowing@banet.net>
Perl for HP 1000 thucdat1143@my-deja.com
Re: PerlIS.dll won't work for me Steve@rossbyweather.com
Re: Porting 'select' system call from UNIX to NT <ehpoole@ingress.com>
Ports <jelliott@baymedical.org>
Process Cancellation inlandpac@my-deja.com
Re: Process Cancellation inlandpac@my-deja.com
Re: Q: How to communicate with the serial port? <gellyfish@gellyfish.com>
Re: Question <aqumsieh@matrox.com>
Re: Regex's, null, and the "&&" operator <tbornhol@prioritytech.com>
Re: SCRIPTS!! <Allan@due.net>
Re: SCRIPTS!! <uri@sysarch.com>
Re: Sendmail fading away? (was Re: Perl5 sendmail) (Kenneth Graves)
Re: shebang question for Win32 Perl/Apache <gellyfish@gellyfish.com>
Re: Size <jimmy@blackhole-designs.com>
Re: Size (Marcel Grunauer)
Re: Size <flavell@mail.cern.ch>
Re: sticky undef $/ <aqumsieh@matrox.com>
Re: sticky undef $/ <radu@netsoft.ro>
Re: Using split on a variable <aqumsieh@matrox.com>
Re: Where a subroutine gets called from? <aqumsieh@matrox.com>
Re: Where a subroutine gets called from? <meowing@banet.net>
Re: Where a subroutine gets called from? <bivey@teamdev.com>
Re: Where a subroutine gets called from? (Bill Moseley)
Re: Where a subroutine gets called from? (Larry Rosler)
Re: Where a subroutine gets called from? <pmikal@cisco.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 2 Sep 1999 13:45:34 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: -F/foobar/ on #! line
Message-Id: <x3yemghw6kh.fsf@tigre.matrox.com>
Colin R. DeVilbiss <crdevilb@mtu.edu> writes:
> Ala Qumsieh <aqumsieh@matrox.com> wrote:
>
> > > the error returned is:
> > > syntax error at foo.pl line 3, near BEGIN
> > >
> > > commenting the BEGIN {} block just moves the compile error to ``chomp''.
>
> > I don't get this error on my version of Perl:
> > This is perl, version 5.004_04 built for sun4-solaris
> > What is your version of Perl?
>
> 5.005_03--sorry for forgetting to post it the first time.
I don't have that version of Perl handy. Maybe someone else can help
here.
--Ala
------------------------------
Date: Wed, 1 Sep 1999 21:13:17 -0400
From: gyepi@magnetic.praxis-sw.com (Gyepi SAM)
Subject: Re: appending one file to another
Message-Id: <slrn7srk03.5q7.gyepi@magnetic.praxis-sw.com>
On Wed, 01 Sep 1999 17:30:34 GMT, marcza@my-deja.com <marcza@my-deja.com> wrote:
>If I want to append the contents of one file to another I could do that
>by
>...
> open(OUTF, ">>app.out") || die "Error";
> open(WORKFILE, "<in.dat") || die "Error";
> print OUTF <WORKFILE>;
> close(WORKFILE);
> close(OUTF);
>...
>
>But is there a better (faster) way? I've looked into the manuals
>and didn't found an append() built-in function.
$ cat in.dat >> app.out
Oh, you want a perl solution.
Your solution, with more error checking, is probably the fastest.
All other solutions I can think of are more complex but not necessarily
faster.
--
Gyepi Sam --+-- Designer/Programmer --+-- Network/System Administrator
gyepi@praxis-sw.com --+-- http://www.praxis-sw.com/gyepi
F u cn rd ths u cnt spl wrth a dm!
------------------------------
Date: Thu, 2 Sep 1999 13:40:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: appending one file to another
Message-Id: <MPG.12388088d51ebb14989f12@nntp.hpl.hp.com>
In article <slrn7srk03.5q7.gyepi@magnetic.praxis-sw.com> on Wed, 1 Sep
1999 21:13:17 -0400, Gyepi SAM <gyepi@magnetic.praxis-sw.com> says...
> On Wed, 01 Sep 1999 17:30:34 GMT, marcza@my-deja.com <marcza@my-deja.com> wrote:
> >If I want to append the contents of one file to another I could do that
> >by
> >...
> > open(OUTF, ">>app.out") || die "Error";
> > open(WORKFILE, "<in.dat") || die "Error";
> > print OUTF <WORKFILE>;
...
> All other solutions I can think of are more complex but not necessarily
> faster.
print OUTF while <WORKFILE>;
works without reading the whole file into memory at once. This may have
a significant impact if the file is large.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 02 Sep 1999 13:15:59 -0600
From: ljp <ljp@209.204.251.8>
Subject: Re: ATTENTION EXPERIENCED PROGRAMMERS ONLY!!!
Message-Id: <wkso4xruog.fsf@209.204.251.8>
you do realize just by shouting the subject, in this ng, you were
killfiled by the most experienced perl programmers?
------------------------------
Date: Wed, 1 Sep 1999 21:37:45 -0400
From: gyepi@magnetic.praxis-sw.com (Gyepi SAM)
Subject: Re: beginner in for loop
Message-Id: <slrn7srldv.5q7.gyepi@magnetic.praxis-sw.com>
On Wed, 1 Sep 1999 20:27:29 -0400, Ben Horowitz <bzhaainc@erols.com> wrote:
>i don't understand how it works?
>print "\n how many in your party?";
>chomp ($num = <>);
>for ($i = 1;$i<= $num;$i==){
^^ syntax error
>print "like the movie,person #$i? ":
^^ another error
>chomp ($choice =<>);
>push (@choices,$choice);
>}
>
>it comes up, unterminated <> operater at line 9,why dosn't it work.
See above.
>i don't understand,when you the <>,operater and you don't?am a
>newbie,learning from a book ,perl 5 interactive, and it's getting very
>frustrating,could any one explain it to me,in simple terms how the for loop
>works ,and arrays?
The problem is not in the for loop but in the errors I pointed out.
A for loop is a loop with three control parts: the initialization, the
test, and the increment. While these parts usually consist of simple
numerical expressions, they do not have to. The can be any kind of
expression. They can even be empty. The initialization part is evaluated before
the first iteration. The test part is evaluated before each iteration
and the increment is evaluated after each iteration. If the test part
returns a false value, the loop exits.
For example, your loop above begins by initialing $i to 1 then testing
to see if $i <= $num. The loop exits when this test fails. This means
that if you enter 0 for $num, the loop will not iterate.
Assuming $n > 0, the loop iterates. After each iteration, the increment
$i++ is evaluated. This process continues until the test fails.
While the for loop may seem complex, it is
actually quite simple and a basic part of many programming languages.
You realize its power when you are forced to program in a language that
does not have the construct.
Instead of explaining arrays, I would suggest that you get yourself a
basic intro to programming book which will explain these concepts and
many others you are bound to run into.
--
Gyepi Sam --+-- Designer/Programmer --+-- Network/System Administrator
gyepi@praxis-sw.com --+-- http://www.praxis-sw.com/gyepi
Chaos is King and Magic is loose in the world.
------------------------------
Date: 2 Sep 1999 21:07:49 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI DownLoad File on the PC Client
Message-Id: <7qmov5$7g$1@gellyfish.btinternet.com>
On Wed, 1 Sep 1999 13:51:22 -0700 Larry Rosler wrote:
> In article <37CD5C0D.CB1DCC62@tinet.ie> on Wed, 01 Sep 1999 17:02:05
> +0000, Edouard Ouin <Edouard.Ouin@tinet.ie> says...
>> Is it a way to download a file directly to the client via the "save as"
>> generic window to save a file on the local machine.
>>
>
> The only reliable way I know of is to send the file with Content-Type
> 'application/octet-stream'. Then the client browser will ask the user
> what to do with the file.
>
Or indeed 'application/x-youse-gonna-save-me-sucka' ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Thu, 02 Sep 1999 18:35:49 -0300
From: Nova Crystals <contact@novacrystals.ns.ca>
Subject: Help another Perl newbee
Message-Id: <37CEEDB5.41C6@novacrystals.ns.ca>
Hello all,
I just started looking a perl today. The problem I wish to solve
is to take the date from the last line of my apache access_log
convert it the epoch seconds value (since 1/1/1970) and set it as
an ENVIRONMENT variable.
so far I have a bash script
LASTL=$(tail -1 access_log | cut -d " " -f 4 | perl epochsecs.pl)
now I want epochsecs.pl to take for standard input:
[31/Aug/1999:12:34:56
and output:
93xxxxxx
I have tried several variations, my latest is:
#!/usr/bin/perl5
require "timelocal.pl";
%month = ( 'Jan' => 0,
'Feb' => 1,
'Mar' => 2,
'Apr' => 3,
'May' => 4,
'Jun' => 5,
'Jul' => 6,
'Aug' => 7,
'Sep' => 8,
'Oct' => 9,
'Nov' => 10,
'Dec' => 11);
$line = <STDIN>
$line =~ /\[(\d?)\/([a-zA-Z]*)\/(\d*):(\d?):(\d?):(\d?)/;
$epoch = timelocal($6,$5,$4,$1,$month{$2},$3);
print $epoch, '\n';
It doesn't work...
Any suggestions? I have looked at online references all afternoon,
and today, this is my best attempt.
Thanks for any and all help
Derek Cole
=======================================================================
Derek Cole | Nova Crystals Ltd. is a producer of custom
| glassware and ceramic products.
Nova Crystals Ltd. |
5265 Morris Street, | Ph: +1 (902) 422 6752
Halifax, Nova Scotia, | Fax: +1 (902) 425 7216
Canada, B3J 1B6 | Web: www.novacrystals.ns.ca
=======================================================================
------------------------------
Date: Thu, 2 Sep 1999 11:56:10 -0700
From: "Bart Block" <info@sportsmatchonline.com>
Subject: LOKKING FOR PERL/CGI PROGRAMMER
Message-Id: <_Jzz3.275$e8.39161@news.uswest.net>
Looking for Perl/Cgi programmer in the Phoenix area to work on my web site.
Needs to be experienced and have the next 8-10 weeks free for a contract
project.
Barry
mediawks@netzone.com
------------------------------
Date: Thu, 02 Sep 1999 16:22:48 -0400
From: Moorthi Natarajan <vnataraj@mail.ford.com>
Subject: need help with &GetFTP
Message-Id: <37CEDC98.45C159BF@mail.ford.com>
Hello there:
I am using the &GetFTP subroutine in my CGI-program to transfer file(s)
from
client to the server. In the <form> element I have a <select multiple>
for attribute.
The problem is, the &GetFTP just returns, only one name=value pair
instead of
name=value,value,etc....
When I looked the &ReadParse routine it does provide multiple value
separated by "0 (ZERO)" but not the &GetFTP.
Please help me out. Thanks in advance.
Moorthi Natarajan.
------------------------------
Date: Thu, 02 Sep 1999 18:07:49 GMT
From: Dimitri Ostapenko <dimitri@oerlnow.com>
Subject: Re: Need your help here.
Message-Id: <37CEBD23.B74D939@oerlnow.com>
Lex wrote:
> Hi Everyone;
>
> I need to run a batch job everyday at specified time with a date parameter
> such as
> startjob.bat 0831
> for the 31th of August if that is the today's
> date or
> Startjob.bat 0901.
> (The date should be the today's date).
>
> I know that I can schedule the job to run at the specific time using the
> 'at' scheduler in NT but how can I automate the part where I have to type
> the date everyday and of course I would like to use perl and also may be
> utilizing the date modules.
>
> Thanks very much for your support and please send reply's to
> dazimi@oradev.csis.csd.metrotor.on.ca
Read help on at command. nt is brain damaged but it still can run dos commands
regularly without intervention.
--
Dimitri Ostapenko,
dimitrio@sympatico.ca
------------------------------
Date: Thu, 02 Sep 1999 18:12:16 GMT
From: Dimitri Ostapenko <dimitri@oerlnow.com>
Subject: Re: Need your help here.
Message-Id: <37CEBE2F.B6209A97@oerlnow.com>
Lex wrote:
> Hi Everyone;
>
> I need to run a batch job everyday at specified time with a date parameter
> such as
> startjob.bat 0831
> for the 31th of August if that is the today's
> date or
> Startjob.bat 0901.
> (The date should be the today's date).
>
> I know that I can schedule the job to run at the specific time using the
> 'at' scheduler in NT but how can I automate the part where I have to type
> the date everyday and of course I would like to use perl and also may be
> utilizing the date modules.
>
> Thanks very much for your support and please send reply's to
> dazimi@oradev.csis.csd.metrotor.on.ca
Oh, almost forgot. Help is in a left-hand corner of your screen. Click on
start menu, then on help, index, type schedule and select 1-st topic. See text
on at command.
If you have any more questions feel free to post... into another group.
--
Dimitri Ostapenko,
dimitrio@sympatico.ca
------------------------------
Date: Thu, 02 Sep 1999 19:25:24 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: newbi needs help
Message-Id: <37cfdbd6.37966553@news>
On Thu, 02 Sep 1999 08:45:58 -0400, Michael Godfred
<mtg82814@ratheon.com> wrote:
> I have a form, that when submitted it brings up a new window which calls
> a java applet. Is there a way to have the window controlling the applet
> to be minimized automatically. I tried the javascript newsgroup to see
> if they knew how to minimize a window, but all they told me was how to
> close one.
I can just feel the combined wrath of some frequent posters descending
on this hapless "newbi", like a dark and thunderous storm overhead...
"Begone, wretch!", a powerful female voice echoes from the top of a
distant mountain.
Marcel (rolling his d20 and checking his THAC0)
------------------------------
Date: Thu, 2 Sep 1999 16:29:33 -0300
From: "Yellow Beetle" <firebrand@mail.usa.com>
Subject: Password Protection?
Message-Id: <7qmj6u$b1f$1@garnet.nbnet.nb.ca>
Hi,
I have a site at:
http://members.tripod.com/theromroom/
I have a password that uses JavaScript, and I
don't like it. The reason is that when you go to:
http://members.tripod.com/theromroom/ and
type in the password, it links you to:
http://members.tripod.com/theromroom/index3.html
Now anyone who has any brains can bookmark that site,
and never need the password again. Is there any Perl
script that is better and will prevent this?
If you want to look at the site the password is CBS ,or
you can just skip the lousy JavaScript password and go to:
http://members.tripod.com/theromroom/index3.html
Can anyone please help me?
Thank You,
Jimmy
------------------------------
Date: Thu, 2 Sep 1999 15:27:00 -0500
From: "Debbie Johnson" <nolenj@worldnet.att.net>
Subject: Re: Password Protection?
Message-Id: <7qmlmf$e30$1@bgtnsc01.worldnet.att.net>
If you were to write a script which would check the HTTP_REFERER
environment variable for
http://members.tripod.com/theromroom/index3.html then I would think that if
the variable didn't
hold the content http://members.tripod.com/theromroom/ (or whatever the
HTTP_REFERER variable holds when accessing that page legally) as the referer
then you could refuse
connection to that page.
I'm relatively new at the perl language but my logic tells me this is the
way to go about it.
If there's a better way someone in this group will be sure to let you know.
HTH
Yellow Beetle <firebrand@mail.usa.com> wrote in message
news:7qmj6u$b1f$1@garnet.nbnet.nb.ca...
> Hi,
>
> I have a site at:
> http://members.tripod.com/theromroom/
>
> I have a password that uses JavaScript, and I
> don't like it. The reason is that when you go to:
> http://members.tripod.com/theromroom/ and
> type in the password, it links you to:
> http://members.tripod.com/theromroom/index3.html
>
> Now anyone who has any brains can bookmark that site,
> and never need the password again. Is there any Perl
> script that is better and will prevent this?
>
> If you want to look at the site the password is CBS ,or
> you can just skip the lousy JavaScript password and go to:
> http://members.tripod.com/theromroom/index3.html
>
> Can anyone please help me?
>
> Thank You,
>
> Jimmy
>
>
>
------------------------------
Date: 02 Sep 1999 16:23:45 -0400
From: meow <meowing@banet.net>
Subject: Re: Password Protection?
Message-Id: <874shdkqpa.fsf@banet.net>
Debbie Johnson <nolenj@worldnet.att.net> wrote:
> If you were to write a script which would check the HTTP_REFERER
> environment variable for
> http://members.tripod.com/theromroom/index3.html then I would think
> that if the variable didn't hold the content
> http://members.tripod.com/theromroom/ (or whatever the HTTP_REFERER
> variable holds when accessing that page legally) as the referer then
> you could refuse connection to that page.
That's no more reliable. One browser I often use doesn't generate a
Referer header unless I ask it to, and in fact I can set it to use any
arbitrary referer I like.
------------------------------
Date: Thu, 02 Sep 1999 20:00:23 GMT
From: thucdat1143@my-deja.com
Subject: Perl for HP 1000
Message-Id: <7qml0e$1pm$1@nnrp1.deja.com>
Dear all,
Does a port of Perl for the HP 1000 exist?
Thanks,
Dat
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 20:14:16 GMT
From: Steve@rossbyweather.com
Subject: Re: PerlIS.dll won't work for me
Message-Id: <7qmlqd$2a2$1@nnrp1.deja.com>
In article <37CDB4A5.2EC9BB0B@ingress.com>,
ehpoole@ingress.com wrote:
> Steve@rossbyweather.com wrote:
> >
> > I have read through newsgroups and multiple FAQ's with no solution.
> > While trying to speed things up using PerlIS.DLL instead of
Perl.exe on
> > IIS 4.0 I ran into a problem. I downloaded the newest build of Perl
> > from ActiveState and my old CGI programs work fine, but when I
change
> > the mappings on IIS 4.0 from .cgi perl.exe %s %s to .cgi perlis.dll
the
> > scripts don't work properly. I added the HTTP/1.0 200 OK line in
there
> > and that didn't work. I added the proper script map in the registry
> > and nothing works. I created the simple helloworld.cgi file and ran
> > that, and now I get an error saying the helloworld script produced
no
> > output.
>
> The PerlIS.dll for Perl 5.005, unlike earlier perl verisons, does not
have
> the "HTTP/1.0 200 OK\n" bug that it's predecessors did.
>
> There are some scripts which simply will not run properly under
PerlIS.dll
> becuase it does not provide an interface that is 100% equivalent to a
CGI
> environment. However, a simple "Hello World" script should work just
> fine. Are you remembering to print the HTTP Header "Content-type"
first?
>
> #!/usr/bin perl
> print "Content-type: text/plain\n\n";
> print "Hello World!";
> exit (0);
>
> Now if the above does not work, there is definitely something wrong
with
> the way your server is configured. Did you remember to specify the
full
> path to PerlIS.dll? (e.g.: c:\perl5\bin\PerlIS.dll )
>
> --
> Ethan H. Poole **** BUSINESS ****
> ehpoole@ingress.com ==Interact2Day, Inc.==
> (personal) http://www.interact2day.com/
>
Ethan, thank you for the response. I can run scripts fine now, but the
problem is inside the code (I believe). Maybe things need to be
phrased differently in order for it to run properly using the
PerlIS.dll. You can look at
http://www.rossbyweather.com/cities/tallahasee2.cgi to see what it
looks like using perl.exe and to see what it looks like using
perlis.dll look at
http://www.rossbyweather.com/cities/tallahassee2.plx. The problem must
be in reading and decoding the file that puts out this information. Do
you have any ideas?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 16:13:49 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: Porting 'select' system call from UNIX to NT
Message-Id: <37CEDA7D.AE9664E2@ingress.com>
Lokesh Setia wrote:
>
> Hi all,
>
> I recently wrote a perl tcp/ip server in unix, which i have to now
> port to agghhh... Windows NT. Most of the perl portion is portable
> except for these three (at least):
>
> 1. Since the server handles multiple connections at the same time, i
> chose to multiplex sockets using select() system call. What's the
> equivalent in NT?
Can't help you with that question since I haven't needed to work with
that. You might see if any of the IO::* routines are helpful (I haven't
had a need to use these either, but there is an IO::select() and
IO::socket(), don't know whether it will be interchangeable or not).
> 2. Since the data transferred is binary, I use sysread() instead of
> <HANDLE> to read from the socket. Will it work unchanged in NT?
Only if you opened the stream as binary. Otherwise sysread will treat the
data as the default type (most likely text). However, since sysread()
does use a filehandle just as read() does, you should already have used
bindmode(HANDLE) to set the filehandle to binary. If your script contains
the common bug of using binary data without having set the filehandle to
binary mode, then you will need to add a line to binmode() it.
read() also works with binary data and relieves you of some of the work of
using sysread() (but don't use both, choose one).
> 3. I needed to get system time accurate atleast upto milliseconds. I
> currently use syscall(&SYS_gettimeofday, $buffer, undef); for this,
> which is unportable. Kindly tell the equivalent function for NT perl.
There is Win32::GetTickCount() which is documented as having a resolution
of about 10ms on NT, 55ms on WIn95.
If you don't mind interfacing to some C routines (you'll likely need to
write your own module), you might wish to look into the following calls:
timeGetSystemTime() - System time in ms since last boot.
QueryPerformanceFrequency() - Frequency of high-resolution counter
QueryPerformanceCounter() - Current value of high-resolution counter
QueryPerformanceCounter() has sub-microsecond accuracy on most modern
systems (on Intel processors it usually has the same frequency as the
processor, AMD and Cyrix may run at different clock speeds).
--
Ethan H. Poole **** BUSINESS ****
ehpoole@ingress.com ==Interact2Day, Inc.==
(personal) http://www.interact2day.com/
------------------------------
Date: Thu, 2 Sep 1999 15:40:08 -0500
From: "Jay Elliott" <jelliott@baymedical.org>
Subject: Ports
Message-Id: <7qmnd8$gu3$1@isrv1.hbocvan.com>
All,
I am new to perl and I use HP 10.20. My objective is to write a perl program
that will send unix files to a pc's ip address and port. Once it gets there
it will automatically be printed out. I'm only concerned with getting the
files over to that port because the pc is setup to be a printer. Does anyone
have any programming suggestions or script examples using perl, csh, or ksh
for this scenario?
Thanks,
Jay
------------------------------
Date: Thu, 02 Sep 1999 18:04:25 GMT
From: inlandpac@my-deja.com
Subject: Process Cancellation
Message-Id: <7qme71$s5q$1@nnrp1.deja.com>
I have a script that as results become available, those results are
printed to the screen.
A sample of one result is:
Engine: Altavista
_____________________________________________________
|RANK| URL | 1 | 2 | 3 | 4 | DOMAIN |
_____________________________________________________
| 1 |http://me.com| 4 | 10| 5 | 0 | me.com |
_____________________________________________________
Each cell has a link to specific information pertaining to the results
in that cell. When a viewer clicks on the link, a new window pops up
with that information.
What happens, is that most of the reports generated are huge (20 search
engines), so results are being provided while the script is still
running. When a viewer clicks on one of the links, the script is
interrupted and stops processing.
What I would like to find out is if there is any way that the viewer
can click on these results while the script is still processing and the
process will not be interrupted.
Thanks.
CLH
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 18:24:32 GMT
From: inlandpac@my-deja.com
Subject: Re: Process Cancellation
Message-Id: <7qmfch$t4b$1@nnrp1.deja.com>
You can run a sample here:
12.7.178.145/emm/keyword_search.htm
Thanks,
CLH
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 2 Sep 1999 20:36:29 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Q: How to communicate with the serial port?
Message-Id: <7qmn4d$7a$1@gellyfish.btinternet.com>
On Thu, 2 Sep 1999 16:38:02 +0200 Marcus Hudritsch wrote:
> How can I communicate with the serail port ?
> If possible in a platform independent way.
>
There may be a module available from CPAN that has sufficient abstraction
to do that in a Platform independent way - but generally you will have
to do it in the way described in perlfaq8:
=head2 How do I read and write the serial port?
Which will *not* be platform independent.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Thu, 2 Sep 1999 13:32:04 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Question
Message-Id: <x3yiu5tw771.fsf@tigre.matrox.com>
twarren10@aol.com (Twarren10) writes:
> > chop($new_line) if $new_line =~ /\n$/;
> >
> > Would this do the same as chomp and be less dangerous in certain
> >circumstances? or is there a problem with this also? Thanks!
>
> Yes
Your answer was directed to which question?
--Ala
------------------------------
Date: Thu, 2 Sep 1999 15:10:43 -0500
From: "Tim Bornholtz" <tbornhol@prioritytech.com>
Subject: Re: Regex's, null, and the "&&" operator
Message-Id: <1B5E7A6DA2A06262.662244E818F2E5E6.0874898DCE3BCA12@lp.airnews.net>
Gary Valley <gvalley@mitre.org> wrote in message
news:37CE81DC.F155E6C7@mitre.org...
> If I do the following:
>
> $a = "someword";
> if(( $c =~ /$d/ ) && ( $a =~ /word/ )) {
> #this will get printed in this case
> print "It's true!!!\n";
> }
>
> Then, the print statement is executed. But, if I flip the expressions
> in the parenthesis then it's not. Like this:
>
> $a = "someword";
> if(( $a =~ /word/ ) && ( $c =~ /$d/ )) {
> #this will *NOT* get printed in this case
> print "It's true!!!\n";
> }
>
> Anyone know why null must be matched first?!?!?!
In perlop there is the following:
If the PATTERN evaluates to a null string, the last successfully
executed regular expression is used instead
What this means is that since /$d/ evaluated to a null string, the previous
regular expression of /word/ will be used instead. $c does NOT contain
'word' so the if fails. As an easy example of this, if you set $c =
"someword" then the second example will work too.
In the first example there is no previous regular expression so it is left
as a null string so it matches fine with $c.
hth,
Tim Bornholtz
tbornhol@prioritytech.com
------------------------------
Date: Thu, 2 Sep 1999 12:52:27 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: SCRIPTS!!
Message-Id: <7qma6f$na$1@nntp3.atl.mindspring.net>
Webmaster wrote in message <7qm83m$n9n$1@nnrp1.deja.com>...
:http://www.the-monolith.com/thescriptring/
:
:Do you have a web site containing information in any of the following
:areas:
:-samples scripts (Javascript, dHTML, VBScript, etc.)
[snip]
"Webmaster" must have thought that this was comp.lang.perl.etc.
As I look at his ring there seems to be only two nodes (other than the
ring site itself). Does that make it a web line?
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
echo "Hmmm...you don't have Berkeley networking in libc.a..."
echo "but the Wollongong group seems to have hacked it in."
- Larry Wall in Configure from the perl distribution
------------------------------
Date: 02 Sep 1999 16:20:47 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: SCRIPTS!!
Message-Id: <x7hfldt68w.fsf@home.sysarch.com>
>>>>> "W" == Webmaster <jwanla@my-deja.com> writes:
W> Do you have a web site containing information in any of the following
W> areas:
W> -samples scripts (Javascript, dHTML, VBScript, etc.)
perl isn't listed there so why did you post here? perl ain't no etc.!
W> -help sections including tutorials or help pages
you need lots of help.
W> Sent via Deja.com http://www.deja.com/
W> Share what you know. Learn what you don't.
or in your case vise versa.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Thu, 02 Sep 1999 18:47:56 GMT
From: kag@kag.citysource.com (Kenneth Graves)
Subject: Re: Sendmail fading away? (was Re: Perl5 sendmail)
Message-Id: <slrn7sthdb.jj.kag@kag.citysource.com>
In article <eBwz3.48$K4.5894@news.shore.net>, Scratchie wrote:
>Is Sendmail becoming less common than it used to be? What's replacing it?
Postfix, exim, qmail, probably others I'm forgetting.
Sendmail is still more common that those three combined, but it
isn't as ubiquitous as when I started programming.
Some of the above put in a symlink to fake the presence of sendmail,
so that old scripts assuming it would be there still work.
I prefer to use Net::SMTP in my own scripts, but even that assumes
there is an SMTP server available.
--kag
------------------------------
Date: 2 Sep 1999 21:15:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: shebang question for Win32 Perl/Apache
Message-Id: <7qmpe0$7k$1@gellyfish.btinternet.com>
On Wed, 1 Sep 1999 16:57:51 -0700 Larry Rosler wrote:
> In article <37CDA466.ADF1033B@bottom.in.sig> on Wed, 01 Sep 1999
> 15:10:46 -0700, Daniel Kirkdorffer <see.email.address@bottom.in.sig>
> says...
>> Got it. My problem was all the examples I saw were on C: and of course
>> I've installed Apache on E:. #!\usr\bin\perl works fine now that
>> I've made a usr\bin\ directory on E: with perl.exe in it.
>
> I assume you mean #!/usr/bin/perl, because your Unix systems won't be
> happy with backslashes.
>
I would also suggest that he properly install Perl into that directory -
I.E specify E:\usr as the target directory when asked otherwise its highly
likely that there will be surprises ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Thu, 02 Sep 1999 18:41:58 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: Re: Size
Message-Id: <37CEC5A8.2D7B98E6@blackhole-designs.com>
I have not yet written the file to the server, otherwise I'd just use
the stat() function.
Jimmy
------------------------------
Date: Thu, 02 Sep 1999 19:32:09 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Size
Message-Id: <37d0de80.38648062@news>
On Thu, 2 Sep 1999 10:04:00 -0700, lr@hpl.hp.com (Larry Rosler) wrote:
> If you want to get the size first, replace 'GET' by 'HEAD' above. Then,
> if you wish, proceed to GET the whole file.
LWP::Simple has a head($url) function, but AFAIK it doesn't follow
redirects.
head($url)
Get document headers. Returns the following 5 values if
successful: ($content_type, $document_length, $modified_time,
$expires, $server)
Returns an empty list if it fails. In scalar context returns
TRUE if successful.
Marcel
Perl Padawan
--
sub AUTOLOAD{($_=$AUTOLOAD)=~s,^.*::,,;y,_, ,;print} Just_Another_Perl_Hacker();
------------------------------
Date: Thu, 2 Sep 1999 22:15:30 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Size
Message-Id: <Pine.HPP.3.95a.990902220833.6784J-100000@hpplus03.cern.ch>
On Thu, 2 Sep 1999, Marcel Grunauer wrote:
> LWP::Simple has a head($url) function, but AFAIK it doesn't follow
> redirects.
But if it returns the headers for a redirection (status 301, 302), then
the next move would seem kind'a obvious, no?
(Might want to set a counter to break any infinite redirections ;-)
Lynx behaves in the same way: "lynx -head http://whatever" will deliver
the redirection headers, not the headers of the final document. Sorry,
that's off-topic for here, but it seemed somehow vaguely relevant.
------------------------------
Date: Thu, 2 Sep 1999 13:43:07 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: sticky undef $/
Message-Id: <x3yg10xw6ok.fsf@tigre.matrox.com>
eric@fruitcom.com (Eric Smith) writes:
> Oh I just saw that putitng the $/="\n"; _above the second open statement
> works.
>
> So there is the fix but I thought the $/ was set per file read, clearly
> not.
You are right. I vaguely remember a discussion on p5p about this. I
can't remember what was the conclusion finally. Perhaps you could dig
into the archives and see for yourself.
The best workaround would be to localize the change to $/ (as well as
any of Perl's special vars) to the smallest scope you can.
I have bitten by this several times, the last of which was
yesterday. my() and lexical vars have spoiled me so much that I assume
all vars are lexical :-)
Note that something like this will give you trouble:
sub read_file {
my $file = shift;
open F, $file or die $!;
local $/ = ';';
while (<F>) {
process($file2, $_);
}
close F or die $!;
}
sub process {
my $file2 = shift;
my $line = shift;
open FF, $file2 or die $!;
while (<FF>) { # here, $/ is still ';', not "\n"
# bla bla
}
close FF or die $!;
}
(ok. this might not be the best example, but it sure points out what I
am trying to show)
--Ala
------------------------------
Date: 02 Sep 1999 22:45:09 +0300
From: Radu Greab <radu@netsoft.ro>
Subject: Re: sticky undef $/
Message-Id: <m3g10xdrne.fsf@busy.netsoft.ro>
"James A Culp III" <admin@futuristic.net> writes:
> Eric Smith <eric@fruitcom.com> wrote in message
> news:slrn7ssjqg.k25.eric@plum.fruitcom.com...
> :
> : Hi
> :
> : I have a for loop that nest two file reads thus:
> :
> : #!/usr/bin/perl -w
>
> use strict; ## should probably be here I came up with a few errors
> which i will try to correct in my comments for you but i might miss one
> or 2.
>
> : for $var(1..3){
> ^
> my
> :
> : open ONE, "/home/eric/fill";
> : while (<ONE>) {
> : undef $/;
>
> local $/ = undef; ### this will only undef $/; within this
> block I think that's what you want.
>
> : print "This is a line $_";
> : }
> : close ONE;
> :
Pointless to use local in this case. Reading from the file happens
outside the scope of that local, so $/ will not be undefined but will
have the original value...
Radu Greab
------------------------------
Date: Thu, 2 Sep 1999 13:33:41 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Using split on a variable
Message-Id: <x3yhfldw74a.fsf@tigre.matrox.com>
George Taylor <cain@datasync.com> writes:
> Is is possible to "split" a variable in perl? This is my attempt thus
> far.
>
> @varione = split {/./, {$ENV'REMOTE_HOST'}};
Aha. And what are your observations?
It is possible to split a variable in Perl. And you seem to have
stumbled upon the correct function. Now, all you need is to understand
that the first argument to split() is a regexp, and to understand
something about regexps. Read perlre for more info.
--Ala
------------------------------
Date: Thu, 2 Sep 1999 13:03:32 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Where a subroutine gets called from?
Message-Id: <x3yk8q9w8ik.fsf@tigre.matrox.com>
moseley@best.com (Bill Moseley) writes:
> Denis Kotseba (kdl@softhome.net) seems to say...
> > How can I find out which subrotine (a or b) called c without passing an
> > extra parameter?
>
> try perldoc -f caller and see if that returns what you want.
No. That will not work.
The only solution I can think of is to pass a variable to sub c()
which indicates who called it. Example:
sub c {
my ($who, @params) = @_;
print "I was called by '$who'.\n";
# bla bla
}
sub a {
# bla bla
$c('a', $x, $y);
# bla bla
}
sub b {
# bla bla
$c('b', $x, $y);
# bla bla
}
HTH,
--Ala
------------------------------
Date: 02 Sep 1999 16:10:41 -0400
From: meow <meowing@banet.net>
Subject: Re: Where a subroutine gets called from?
Message-Id: <87906pkrb2.fsf@banet.net>
Ala Qumsieh <aqumsieh@matrox.com> wrote:
> moseley@best.com (Bill Moseley) writes:
>> Denis Kotseba (kdl@softhome.net) seems to say...
>> > How can I find out which subrotine (a or b) called c without passing an
>> > extra parameter?
>>
>> try perldoc -f caller and see if that returns what you want.
> No. That will not work.
Did you try it?
> The only solution I can think of is to pass a variable to sub c()
> which indicates who called it. Example:
[...]
#!/usr/local/bin/perl -w
use strict;
sub c { print "I was called by '", (caller(1))[3], "'.\n" }
sub a { c() }
sub b { c() }
a();
b();
c();
__END__
$ perl caller.pl
I was called by 'main::a'.
I was called by 'main::b'.
I was called by ''.
------------------------------
Date: 2 Sep 1999 20:18:12 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: Where a subroutine gets called from?
Message-Id: <01bef57f$eb8eab40$583c08cf@bill.jump.net>
Ala Qumsieh <aqumsieh@matrox.com> wrote in article
<x3yk8q9w8ik.fsf@tigre.matrox.com>...
> No. That will not work.
>
> The only solution I can think of is to pass a variable to sub c()
> which indicates who called it. Example:
Huh? Caller worked for me in an assert routine I
wrote using this snippet:
# Previous stack frame has name of sub that called us
my ($subname) = (caller(1))[3];
-Wm
------------------------------
Date: Thu, 2 Sep 1999 13:26:31 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Where a subroutine gets called from?
Message-Id: <MPG.12387d566f2f74949896f9@nntp1.ba.best.com>
Ala Qumsieh (aqumsieh@matrox.com) seems to say...
>
> moseley@best.com (Bill Moseley) writes:
>
> > Denis Kotseba (kdl@softhome.net) seems to say...
> > > How can I find out which subrotine (a or b) called c without passing an
> > > extra parameter?
> >
> > try perldoc -f caller and see if that returns what you want.
>
> No. That will not work.
Oh, really? I thought they were talking about this:
sub a {
c();
}
sub b {
c();
}
sub c {
print "Called from: ", (caller(1))[3], "\n";
}
a();
b();
%perl test.pl
Called from: main::a
Called from: main::b
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Thu, 2 Sep 1999 13:36:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Where a subroutine gets called from?
Message-Id: <MPG.12387fac45f7b2d3989f11@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <x3yk8q9w8ik.fsf@tigre.matrox.com> on Thu, 2 Sep 1999
13:03:32 -0400 , Ala Qumsieh <aqumsieh@matrox.com> says...
>
> moseley@best.com (Bill Moseley) writes:
>
> > Denis Kotseba (kdl@softhome.net) seems to say...
> > > How can I find out which subrotine (a or b) called c without passing an
> > > extra parameter?
> >
> > try perldoc -f caller and see if that returns what you want.
>
> No. That will not work.
Yes it will.
Try perldoc -f caller and see if that returns what you want.
#!/usr/bin/perl-w
use strict;
sub c { print +(caller(1))[3], "\n" }
sub a { c() }
sub b { c() }
a();
__END__
Output:
main::a
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 02 Sep 1999 13:46:04 -0700
From: Web Database Developer <pmikal@cisco.com>
Subject: Re: Where a subroutine gets called from?
Message-Id: <37CEE20B.40554DF@cisco.com>
Denis Kotseba wrote:
> How can I find out which subrotine (a or b) called c without passing an
> extra parameter?
use the caller function.
http://www.perl.com/pub/doc/manual/html/pod/perlfunc/caller.html
-philip
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 V9 Issue 704
*************************************