[7667] in Perl-Users-Digest
Perl-Users Digest, Issue: 1293 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 9 22:07:16 1997
Date: Sun, 9 Nov 97 19:00:28 -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 Sun, 9 Nov 1997 Volume: 8 Number: 1293
Today's topics:
Re: "compiled perl-scrips" & NT (David Hawkins)
"compiled perl-scrips" <axelkuester@connecta.aal.circular.de>
Re: "compiled perl-scrips" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Re: **why?** perl syscall(&SYS_sbrk,0) != C sbrk(0) <stuartc@ind.tansu.com.au>
Re: anme of arrays <axelkuester@connecta.aal.circular.de>
Re: Can I use Perl to mail form data under NT4/IIS3,4 ? (Martien Verbruggen)
Re: Client / Server stuff (Neil Briscoe)
Re: Client / Server stuff (Jeremy D. Zawodny)
Re: file not found error? (Martien Verbruggen)
FileHandles <corcordt@cs.purdue.edu>
Re: Getting the date from a file. (I R A Aggie)
Re: glob not working (Andrew M. Langmead)
HELP NEEDED: Why won't my script work? <james@atticwebdesign.demon.co.uk>
Re: HELP NEEDED: Why won't my script work? (Jeremy D. Zawodny)
Help Please: Running programs within perl script under <j@ms.com>
Help/newtoPERL/Input files <mikrich@ibm.net>
How do I create a random number with Perl? <e.phillips@mindspring.com>
Re: How do I create a random number with Perl? <smantri@gmu.edu>
Killing (or wounding) ftp abusers (Lozano Mosterin, Jesus)
Re: Killing (or wounding) ftp abusers (Lozano Mosterin, Jesus)
Learning to use Perl to generate code (Cornelius Griffin)
multithreading <thaneles@removethis.cyberus.ca>
Need to speed up s/ / /; <luutran@geocities.com>
Re: Need to speed up s/ / /; (Luu Tran)
Re: Newbie Qu:- NT & Process Ids (Mike Stok)
Re: PATH_INFO (UNIX vs. Novell Webserver 3.1) (Jeremy D. Zawodny)
Single and Double quotes (Ryuji Yokoyama)
Re: Single and Double quotes <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Re: Timezone conversion (Martien Verbruggen)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Nov 1997 18:46:35 -0800
From: dhawk@best.com (David Hawkins)
Subject: Re: "compiled perl-scrips" & NT
Message-Id: <645sib$mco$1@shell3.ba.best.com>
In article <645p1q$s0j@bgtnsc02.worldnet.att.net>,
Creede Lambard <fearless@io.com> wrote:
>According to my friend the real Perl guru, O'Reilly has released their Perl
>Resource Kit for Unix which contains the long-anticipated Perl compiler. The
>NT version is due out next year, and if you're going to get a Perl compiler
>anywhere, that will probably be the place.
www.windows95.com has a 'perl2exe' program (which has its own web page
but all my references are at work) under 'Misc. Programming Tools' or
something like that. But it is for NT, yes.
later, david
--
David Hawkins dhawk@best.com http://www.river.org/~dhawk
Humor is the prelude to faith, and laughter the beginning of prayer.
-- Reinhold Niebuhr
------------------------------
Date: Sun, 09 Nov 1997 20:16:10 +0100
From: "Axel K|ster" <axelkuester@connecta.aal.circular.de>
Subject: "compiled perl-scrips"
Message-Id: <34660BFA.47E44CA5@connecta.aal.circular.de>
Hello,
i have read that there will be a compiler for perl scripts
to generate native machine code or some possibilty to catch the compiled
object.
Does anyone know about this for NT.
Thanks for all hints.
Axel
axelkuester@connecta.aal.circular.de
------------------------------
Date: Sun, 9 Nov 1997 17:46:36 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: "compiled perl-scrips"
Message-Id: <645p1q$s0j@bgtnsc02.worldnet.att.net>
According to my friend the real Perl guru, O'Reilly has released their Perl
Resource Kit for Unix which contains the long-anticipated Perl compiler. The
NT version is due out next year, and if you're going to get a Perl compiler
anywhere, that will probably be the place.
--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
Axel K|ster wrote in message <34660BFA.47E44CA5@connecta.aal.circular.de>...
>Hello,
>
>i have read that there will be a compiler for perl scripts
>to generate native machine code or some possibilty to catch the compiled
>object.
>Does anyone know about this for NT.
>
>Thanks for all hints.
>
>Axel
>
>axelkuester@connecta.aal.circular.de
------------------------------
Date: 10 Nov 1997 10:53:58 +1100
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: **why?** perl syscall(&SYS_sbrk,0) != C sbrk(0)
Message-Id: <yeoaffdfwtl.fsf@kudu.ind.tansu.com.au>
Jozsef Hollosi <hollosi@sbcm.com> writes:
> Hi, I am trying to get an estimate of the running process size as
> it grows in time due to memory leaks.
>
> In C, I can get the current break value with an sbrk(0) call, but the
> perl equivalent syscall(&SYS_sbrk, 0) returns zero.
>
> Is there any remedy to this situation?
>
> Thanks a lot,
> Jozsef
> hollosi@sbcm.com
sbrk(0) returns current break value etc; this is useful when your program
grows its memory through the malloc/calloc/realloc() {ie /(m|c|re)alloc/}
family of system calls but I'm not sure that Perl programs use these calls
(several large programs roll their own memory allocating routines; Perl
might do this too; it's not important right now so I won't waste time
checking).
Anyhow; in the absence of a meaningful sbrk(0); you'll have to use outside
means to check a running process' memory usage. You're on Unix, I guess and
hope. You should find a nice option to ps to also report memory usage;
on my Unix (Solaris 2.5) the '-l' flag to ps gives a SZ size field with
the process size in pages of the process's image in main memory (your ps
flag and meaning may vary; but it'll be something like that). You might
also be able to get memory usage info from possibly-not-on-your-Unix programs
like vmstat or crash or the /proc filesystem.
Anyhow, find out which of these gives you the information and run it in
another session while your Perl script is running and you can get your
memory information that way.
Hope this helps,
Stuart Cooper.
stuartc@ind.tansu.com.au
------------------------------
Date: Sun, 09 Nov 1997 20:31:11 +0100
From: "Axel K|ster" <axelkuester@connecta.aal.circular.de>
To: brian d foy <comdog@computerdog.com>
Subject: Re: anme of arrays
Message-Id: <34660F7F.8B0E0474@connecta.aal.circular.de>
hello,
thanks for the tip
i will try it. I didnt plan to go so deep in the internals but now...
Thanks
Axel
------------------------------
Date: 10 Nov 1997 01:56:28 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Can I use Perl to mail form data under NT4/IIS3,4 ?
Message-Id: <645pkc$pem$1@comdyn.comdyn.com.au>
In article <EJ9n2K.D3s@nonexistent.com>,
nicwolff@angel.net (Nic Wolff) writes:
> Here's code to connect right to a mail server and send your mail...
Alternatively, you can use the Net::SMTP module.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: 9 Nov 1997 17:51:12 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Client / Server stuff
Message-Id: <memo.19971109175110.45853B@skep.compulink.co.uk.cix.co.uk>
In article <34648B3A.1146D62D@students.uiuc.edu>,
rbgreene@students.uiuc.edu (Rawley Greene) wrote:
> Hi, I'm experimenting with programming client and server stuff in
> Perl.. I've got the basic connections and stuff like that down.
>
> But the current limitation is that it only takes one connection at a
> time, and I wouldn't be able to issue any commands or anything
> server-side.
>
> So, my question is, if I can, how can I enable it to have multiple
> connections going and be able to do stuff on the server side?
>
Sounds like you're programming in a Win32 environment to me. Work is
currently going on to support fork() or threads on that platform - one of
which you need to be able to do what you want.
Purportedly, if you compile Perl yourself using the cdk32 toolkit from
www.cygnus.com - then fork() is supported - and you should be able to do
what you want.
I believe the Activeware port is looking more closely into threads.
Regards
Neil
------------------------------
Date: Sun, 09 Nov 1997 18:14:52 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Client / Server stuff
Message-Id: <3465fd3d.1093150377@woody.wcnet.org>
[original author automagically cc'd via e-mail]
On 9 Nov 1997 17:51:12 GMT, neilb@zetnet.co.uk (Neil Briscoe) wrote:
>In article <34648B3A.1146D62D@students.uiuc.edu>,
>rbgreene@students.uiuc.edu (Rawley Greene) wrote:
>
>I believe the Activeware port is looking more closely into threads.
Since the native and ActiveState ports are slated to merge on or
around the 5.005 release, it's safe to say that both sides are working
on this.
Given the recent discussion among the Per5-Porters, a lot of the
threading work is being done on the non-ActiveState side.
But that's just an observation on my part.
Jeremy
--
Jeremy D. Zawodny jzawodn@wcnet.org
Web Server Administrator www@wcnet.org
Wood County Free Net (Ohio) http://www.wcnet.org/
------------------------------
Date: 10 Nov 1997 02:22:17 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: file not found error?
Message-Id: <645r4p$pem$5@comdyn.comdyn.com.au>
In article <34631339.2CF0@cis.ohio-state.edu>,
Michael Reed <mreed@cis.ohio-state.edu> writes:
> I have a snippet of code:
>
> chdir("/export/0/webman/checkin_server/data/") || print "1\n\n";
> @sched = `/bin/cat $username.sched`; print @sched;
>
> Which is the umpteenth version I've written trying to do the same thing.
>
> $username="mreed"
I hope you did this BEFORE the above code, didn't you?
> When executed, this give a cat: file not found error. However, if I
> substitute in an actual username:
>
> chdir("/export/0/webman/checkin_server/data/") || print "1\n\n";
> @sched = `/bin/cat mreed.sched`; print @sched;
>
> Works great. I have verified that there are no hidden characters or
> trailing new lines on $username. I am perplexed. Any idea why
> this may be happening?
If that is the actual code, no. I suspect it isn't though. Try
something like the following to get a bit more of an idea where it
goes wrong:
my $uname = 'mreed';
open(UIN, $uname) or die "cannot open $uname: $!";
@sched = <UIN>;
close(UIN);
More portable, and probably faster (especially if this gets done often,
and reads small files).
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | The gene pool could use a little
Commercial Dynamics Pty. Ltd. | chlorine.
NSW, Australia |
------------------------------
Date: Sun, 09 Nov 1997 21:12:09 -0500
From: David Corcoran <corcordt@cs.purdue.edu>
Subject: FileHandles
Message-Id: <34666D79.5E54@cs.purdue.edu>
$tmp = new IO::Handle;
$remote = accept($tmp,MY_SOCKET);
I have tried this but am having problems printing
to $tmp such as.
print $tmp "hello world\n";
Dave
------------------------------
Date: Sun, 09 Nov 1997 13:10:00 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Getting the date from a file.
Message-Id: <-0911971310010001@aggie.coaps.fsu.edu>
In article <643kh9$37c_002@snews.zippo.com>, curtis_whalen@hotmail.com
(Curtis [Jewell] Whalen) wrote:
+ What I need to do is to get the date and time that a file has been MODIFIED
+ LAST, preferably in Perl..
'stat' should do the trick.
James
% perldoc -f stat
=item stat FILEHANDLE
=item stat EXPR
=item stat
Returns a 13-element array giving the status info for a file, either the
file opened via FILEHANDLE, or named by EXPR. If EXPR is omitted, it
stats $_. Returns a null list if the stat fails. Typically used as
follows:
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);
Not all fields are supported on all filesystem types.
[snip]
8 atime last access time since the epoch
9 mtime last modify time since the epoch
10 ctime inode change time (NOT creation time!) since the epoch
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Sun, 9 Nov 1997 17:34:43 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: glob not working
Message-Id: <EJE3Hv.AEx@world.std.com>
l41484@alfa.ist.utl.pt (Umm) writes:
>what i've discovered is (someone correct me if i'm wrong) perl relies on the
>csh to glob, and i don't have csh installed. :-(
On unix machines, perl uses the shell that it can find when you run
the Configure script, prefering the C-Shell to the Bourne shell if it
can find it.
If perl is trying to use the C shell, and there is none present, then
your perl is misconfigured. (Most likely, it was configured on a
machine that did have csh present and the binary and associated files
were copied to your machine with a different "Configuration".
On other with other operating systems, how it gets done depends on
what the person who did the port decided to do. They may have
implemented globbing internally, they may use a shell on the native
operating system, or may create their own separate executable that
will only the subset of shell functionality that they need.
--
Andrew Langmead
------------------------------
Date: Sun, 09 Nov 1997 17:32:09 GMT
From: "James East" <james@atticwebdesign.demon.co.uk>
Subject: HELP NEEDED: Why won't my script work?
Message-Id: <01bced35$193c8ee0$5632edc1@atticwebdesign>
I need help with this perl script. When I try to run it (through the web
server), I get a "Server Error". What's wrong with it? (OS is Sun Solaris
2.5.1)
Yes, my perl executable IS /usr/local/bin/perl and the script is marked
executable for everybody.
Help would be appreciated,
James East,
Webmaster,
Newport Free Grammar School.
begin 600 homework.cgi
M(R$O=7-R+VQO8V%L+V)I;B]P97)L#0HC#0HC(%!E<FP@-2!#1TD@<V-R:7!T
M(&9O<B!A8V-E<W-I;F<@=&AE($AO;65W;W)K#0HC('1I;65T86)L92!V:6$@
M86X@2%1-3"!F;W)M+@T*(PT*)'P],3L-"G!R:6YT(")#;VYT96YT+51Y<&4Z
M('1E>'0O:'1M;"!<;EQN(CL-"G!R:6YT(#P\(DA%041%4B([#0H\:'1M;#X-
M"CQH96%D/@T*/'1I=&QE/DAO;65W;W)K(%1I;65T86)L93PO=&ET;&4^#0H\
M+VAE860^#0H\8F]D>2!B9V-O;&]R/2(C1D9&1D9&(B!F9V-O;&]R/2(C,# P
M,# P(CX-"CQC96YT97(^/&@Q/EEO=7(@2&]M97=O<FL@5&EM971A8FQE/"]H
M,3X\+V-E;G1E<CX\<#X-"@T*2$5!1$52#0H-"FEF("@D14Y6>R=215%515-4
M7TU%5$A/1"=](&5Q(")'150B("D@>PT*"7!R:6YT(#P\(D=%5$524D]2(CL-
M"@D\:#(^/&-E;G1E<CY3;W)R>2P@=&AE<F4@:&%S(&)E96X@86X@97)R;W(N
M/"]H,CX-"B @(" @(%!L96%S92!E+6UA:6P@=&AE('=E8FUA<W1E<B H=V5B
M;6%S=&5R0&YF9W,N97-S97@N<V-H+G5K*0T*"7%U;W1I;F<@97)R;W(@8V]D
M92!H=V=E=# Q+CPO8V5N=&5R/@T*"3PO8F]D>3X-"@D\+VAT;6P^#0I'151%
M4E)/4@T*"65X:70[#0H)?0T*96QS:68@*"1%3E9[)U)%455%4U1?34542$]$
M)WT@97$@(E!/4U0B("D@>PT*"7)E860H4U1$24XL)&9O<FTL("1%3E9[)T-/
M3E1%3E1?3$5.1U1()WTI.PT*?2!E;'-E('L-"@EP<FEN=" \/")03U-415)2
M3U(B.PT*"3QC96YT97(^17)M;6TN+BX@5&AE<F4@<V5E;7,@=&\@8F4@82!P
M<F]B;&5M+CQB<CX-"@D\:#(^66]U)W9E(#QB/F=O=#PO8CX@=&\@9FEL;"!I
M;B!Y;W5R(&1E=&%I;',A/"]H,CX\+V-E;G1E<CX-"@D\+V)O9'D^#0H)/"]H
M=&UL/@T*4$]35$524D]2#0H)97AI=#L-"@E]#0H-"B,-"B,@3F]W('1H92!V
M87)I86)L92 D9F]R;2!H87,@=&AE($9O<FT@1&%T80T*(R!4:&ES(&)I="!C
M<F5A=&5S(&%N(")A<W-O8VEA=&EV92!A<G)A>2(N#0HC#0H)9F]R96%C:" D
M<&%I<B H<W!L:70H)R8G+" D9F]R;2DI('L-"B @(" @(" @(" @(" @("!I
M9B H)'!A:7(@/7X@+R@N*BD]*"XJ*2\I('L@(" @(",@1FEN9',@:V5Y/79A
M;'5E('!A:7)S.PT*"0DH)&ME>2PD=F%L=64I(#T@*"0Q+"0R*3L)(R!'971S
M(&ME>2P@86YD(&ET)W,@=F%L=64N#0H)"21V86QU92 ]?B!S+UPK+R O9SL)
M"2,@4W5B<W1I='5T92!S<&%C97,@9F]R("LN#0H)"21V86QU92 ]?B!S+R4H
M+BXI+W!A8VLH)V,G+&AE>"@D,2DI+V5G.PT*"0DD:6YP=71S>R1K97E](#T@
M)'9A;'5E.PD)(R!#<F5A=&5S(&%R<F%Y+@T*"0E]#0H)?0T*#0HC($%S<VEG
M;B!T:&4@:6YP=70@9G)O;2!T:&4@9F]R;2!T;R!V87)I86)L97,-"B1Y96%R
M(#T@)&EN<'5T<WLB>65A<B)].PT*)&AO=7-E(#T@)&EN<'5T<WLB:&]U<V4B
M?3L-"B1W965K(#T@)&EN<'5T<WLB=V5E:R)].PT*)&1A>2 ]("1I;G!U='-[
M(F1A>2)].PT*#0HC(%!R:6YT('1H92!F;W)M(')E<W5L=',-"G!R:6YT(#P\
M(D9/4DU215-53%13(CL-"EEE87(Z(" D>65A<CQB<CX-"DAO=7-E.B D:&]U
M<V4\8G(^#0I7965K.B @)'=E96L\8G(^#0I$87DZ(" @)&1A>3QB<CX-"D9/
M4DU215-53%13#0H-"B,@0V]R<F5C="!A(&QI='1L92!M:7-T86ME($D@;6%D
M90T*:68@*"1H;W5S92!E<2 B9G)A;FML86YD(BD@>PT*"21H;W5S92 ](")F
M<F%N:VQA;B([#0H)?0T-"FEF("@D9&%Y(&5Q(")W961N97-D87DB*2W961N97-D82([#0H)?0T*#0HC($]P96X@=&AE(&%P<')O<')I
M871E(&9I;&4-"F]P96XH5$%"3$4L(F1A=&$O:&]M97=O<FLO>65A<BXD>65A
M<B\D:&]U<V4O=V5E:RXD=V5E:R\D9&%Y(BD[#0H-"B,@4')I;G0@2&]M97=O
M<FL@5&%B;&4-"G!R:6YT("(\:#(^66]U<B!(;VUE=V]R:W,@9F]R(%=E96L@
M)'=E96LL("1D87D@87)E.CPO:#(^/' ^(%QN(CL-"B1L:6YE(#T@/%1!0DQ%
M/CL-"G!R:6YT("(D;&EN93QB<CX@7&XB.PT*)&QI;F4@/2 \5$%"3$4^.PT*
M<')I;G0@(B1L:6YE/&)R/B!<;B([#0HD;&EN92 ](#Q404),13X[#0IP<FEN
M=" B)&QI;F4\8G(^(%QN(CL-"@T*(R!%;F0@=&AE($A434P@<&%G90T*<')I
M;G0@/#PB14Y$24Y'(CL-"@T*/&AR/@T*/&-E;G1E<CY086=E($-O<'ER:6=H
M=" F8V]P>3L@,3DY-R!*86UE<R!%87-T+TYE=W!O<G0@1G)E92!'<F%M;6%R
M(%-C:&]O;#QB<CX-"D-'22!S8W)I<'0@=W)I='1E;B!I;B!097)L(#4@8GD@
M2F%M97,@16%S="P@0V]P>7)I9VAT("9C;W!Y.R Q.3DW/&)R/@T*/"]C96YT
C97(^#0H-"CPO8F]D>3X-"CPO:'1M;#X-"D5.1$E.1PT*#0IR
`
end
------------------------------
Date: Sun, 09 Nov 1997 18:23:21 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: HELP NEEDED: Why won't my script work?
Message-Id: <3468ff6d.1093710302@woody.wcnet.org>
[original author automagically cc'd via e-mail]
On Sun, 09 Nov 1997 17:32:09 GMT, "James East"
<james@atticwebdesign.demon.co.uk> wrote:
>I need help with this perl script. When I try to run it (through the web
>server), I get a "Server Error". What's wrong with it? (OS is Sun Solaris
>2.5.1)
>
>Yes, my perl executable IS /usr/local/bin/perl and the script is marked
>executable for everybody.
Check the Idiot's Guide to Solving Perl/CGI Problems for pointers on
debugging your script.
You can find it on the Perl web site, http://www.perl.com/
Jeremy
--
Jeremy D. Zawodny jzawodn@wcnet.org
Web Server Administrator www@wcnet.org
Wood County Free Net (Ohio) http://www.wcnet.org/
------------------------------
Date: 9 Nov 1997 20:59:14 GMT
From: "pd" <j@ms.com>
Subject: Help Please: Running programs within perl script under IIS
Message-Id: <01bced49$9e814a00$b2456bc7@music.ni.net>
apologies to all for the OS (NT4.0), however I'm trying to run a Dataflex
program (DFRUN HELLO) from a perl script running under NT4.0 and IIS3.0.
The scipt runs fine from the command line, eg perl index.pl and Dataflex
runs and the script runs in IIS when called from an HTML page, however the
Dataflex program does not run. I've played with file/directory permissions
and paths until I'm blue in the head - still no luck. Any ideas anyone?
All assistance much appreciated.
------------------------------
Date: Sun, 09 Nov 1997 15:17:39 +0000
From: mike rich <mikrich@ibm.net>
Subject: Help/newtoPERL/Input files
Message-Id: <3465D413.18FFE99B@ibm.net>
4 days into Perl - have the camel & llama books - can't find the answer
to my problem.
Have used MacPerl to extract clean data from Quark & EPS files - (great
language!)
Have two files - one containing company names - the second containing
company data.
Want to read a company name from one file/ read the co. data from
another file
-combine the two into one record and write it out to a third file.
Script at moment looks like this:
open(NFILE, "preA.csv");
open(PSFILE, "tagtxt.ps");
open (CSVFILE, ">miketest.csv");
$mark1=0;
while($conam=<NFILE>){
while(<PSFILE>){
if($mark1==0){
$/="syzergy";
$desc=$_;
$mark1=2;
}
}
$newlin="\"UK,\"".$conam."\",".$desc;
print CSVFILE "NEWLINE $newlin\n";
$/=";";
$mark1=0;
}
close PSFILE;
close NFILE;
close CSVFILE;
Apart from the cumsiness, obviously missed something blindingly obvious!
What this does - as you all realise - is print the co. names with the
same bit
of company detail
Cd some kind soul point me in the right direction.
Many thx.
------------------------------
Date: Sat, 8 Nov 1997 17:42:33 -0800
From: "Eric Phillips" <e.phillips@mindspring.com>
Subject: How do I create a random number with Perl?
Message-Id: <645e6b$kqq@camel21.mindspring.com>
Hello all, I have a question about Perl. I am no expert, just an amateur,
so please explain in detail.
How do I create a random number with Perl, so it can be use later in the
script?
Please let me know. Thanks!
--
Eric Phillips
e.phillips@mindspring.com
------------------------------
Date: Sun, 9 Nov 1997 19:37:14 -0500
From: shiva mantri <smantri@gmu.edu>
To: Eric Phillips <e.phillips@mindspring.com>
Subject: Re: How do I create a random number with Perl?
Message-Id: <Pine.OSF.3.95q.971109193141.28158A-100000@osf1.gmu.edu>
have to use srand and rand functions.
#!where_perl_is -w
srand;print int(rand 10);
#srand without argrument takes time as argument and it is used as seed
#for the rand fucntion, which returns a fractional number between 0 and
#val of the +ve argument. make it int to get an integer as a random number
On Sat, 8 Nov 1997, Eric Phillips wrote:
:Hello all, I have a question about Perl. I am no expert, just an amateur,
:so please explain in detail.
:
:How do I create a random number with Perl, so it can be use later in the
:script?
:
:Please let me know. Thanks!
:
:--
:Eric Phillips
:e.phillips@mindspring.com
:
:
:
:
Shiva Mantri
---
7032738119,7039938736
------------------------------
Date: 9 Nov 97 17:28:21 +0100
From: lozano@opalo.etsiig.uniovi.es (Lozano Mosterin, Jesus)
Subject: Killing (or wounding) ftp abusers
Message-Id: <t+dYv0Relmmf@opalo.etsiig.uniovi.es>
Here is a script to kill a connection on ftp if the disk
ocuppation is greater than x %
It's pourpouse is to annoy those ftp abusers which wants
to use (abuse) of your writable /incoming space up to fullfill
your disk
I were pleased if someone wants to reply improving the
patch. Tom, it's your chance again.
#!/usr/bin/perl -w
while(1){
$hay = `ps -aux | cut -c 1-4 | grep "ftp "`;
if (index($hay,"ftp",0)>=0){
$por = `df | grep "mnt2" | cut -c 50-52`;
if ($por>96){
$supid = `ps -aux | grep "ftp" | grep "-" | cut -c 9-14`;
system "kill -9 $supid";
chomp($hay);
printf("The %s was killed (pid %i) because disk occupation
is %i",$hay,$supid,$por);
print "%","\n";
}
}
sleep(30);
}
Cheers
---
perl -e 'print pack "B77",
"00111001001110000010110100110101001100010011100000110010001100010011000000111";'
------------------------------
Date: 10 Nov 97 02:05:44 +0100
From: lozano@opalo.etsiig.uniovi.es (Lozano Mosterin, Jesus)
Subject: Re: Killing (or wounding) ftp abusers
Message-Id: <zgmD6r1A67XM@opalo.etsiig.uniovi.es>
In article <t+dYv0Relmmf@opalo.etsiig.uniovi.es>, lozano@opalo.etsiig.uniovi.es (Lozano Mosterin, Jesus) writes:
>
> Here is a script to kill a connection on ftp if the disk
> ocuppation is greater than x %
>
> It's pourpouse is to annoy those ftp abusers which wants
> to use (abuse) of your writable /incoming space up to fullfill
> your disk
>
> I were pleased if someone wants to reply improving the
> patch. Tom, it's your chance again.
>
...
And here is another (improved) version, for changing parameters on-line
it uses /etc/ftpabusers, a comma delimited file
#DISK PERCENT ACTION OPTIONS SOURCE TARGET
/dev/hdc2 ,88 ,ls ,-la ,/home/ftp/incoming ,>>/tmp/list
#!/usr/bin/perl -w
while(1){
open DAT, "/etc/ftpabusers";
while (<DAT>) {
if (/^\//){
chomp($_);
($partition,$percent,$action,$opt,$src,$tgt) = split(/\,/,$_);
last;
}
}
$hay = `ps -aux | cut -c 1-4 | grep "ftp "`;
if (index($hay,"ftp",0)>=0){
$por = `df | grep $partition | cut -c 50-52`;
if ($por>=$percent){
$supid = `ps -aux | grep "ftp" | grep "-" | cut -c 9-14`;
kill 9, $supid;
chomp($hay);
printf("The %s was killed (pid %i) because disk occupation is %i",$hay,$supid,$por);
print "%","\n";
# Here for taking mayor remedies. More suggestions?
if ($por>$percent){
system $action." ".$opt." ".$src." ".$tgt;
#system "rm -f $src";
print "And ",$src,"was wiped out after displacing it's contents\n";
print "with ",$action," ",$opt," to ",$tgt,"\n";
}
}
}
sleep(30);
}
Resulting, as expected
ftp> ls
421 Service not available, remote server has closed connection
and
The ftp was killed (pid 1073) because disk occupation is 89%
And /home/ftp/incoming was wiped out after displacing it's
contents
with ls -la to >>/tmp/list
Cheers
---
perl -e 'print pack "B77",
"00111001001110000010110100110101001100010011100000110010001100010011000000111";'
------------------------------
Date: Sun, 9 Nov 1997 16:57:55 -0500
From: Escrubb@att.net (Cornelius Griffin)
Subject: Learning to use Perl to generate code
Message-Id: <645bts$efd@bgtnsc03.worldnet.att.net>
Anyone,
I have become much more interested in using Perl to write other
code, specifically Java. Can anyone recommend a resource for learning
more on this topic.
Thanks.
Cornelius
------------------------------
Date: 9 Nov 1997 22:35:35 GMT
From: "Thane & Leslie Eisener" <thaneles@removethis.cyberus.ca>
Subject: multithreading
Message-Id: <01bced60$074f1d80$18b186cf@cyberus.cyberus.ca>
I have a script that gathers data from the network for me three times.
Currently these are performed in series. How can I make these three
function all at the same time?
Thanks in advance,
Thane
(thaneles@nospam.cyberus.ca => remove nospam)
------------------------------
Date: 9 Nov 1997 18:19:40 GMT
From: "Luu Tran" <luutran@geocities.com>
Subject: Need to speed up s/ / /;
Message-Id: <35743.4307118056luutrangeocitiescom@207.217.241.29>
Hi,
I have for input html-formatted text (as one long string). I need to
prepare it to be included in another html file. I need to strip comments,
<html><head><body> tags, and forms.
# strip all comments
s#<!--(.|\n)*?-->##g;
s#<!(.|\n)*?>##g;
# strip headers <html> ... <body ... >
s#(<html>(.|n)*)?<body(.|\n)*?>##gsi;
# no forms, please!
s#<form(.|\n)*?>(.|\n)*</form>##gsi;
# remove end tag
s#</body>##gi;
s#</html>##gi;
return $_;
Problem is this takes a VERY long time for all but very short input. Since
it's part of a CGI app, it tends to cause the client to time out. Is there
anything I can do to optimize this? For that matter, is there something
wrong with the code? (It compiles fine with -wc.)
TIA
-- luu
[CC by mail appreciated]
------------------------------
Date: Sun, 09 Nov 1997 19:01:25 GMT
From: luutran@geocities.com (Luu Tran)
Subject: Re: Need to speed up s/ / /;
Message-Id: <645194$2ea@bolivia.earthlink.net>
In article <35743.4307118056luutrangeocitiescom@207.217.241.29>, "Luu Tran" <luutran@geocities.com> wrote:
> # strip headers <html> ... <body ... >
> s#(<html>(.|n)*)?<body(.|\n)*?>##gsi;
Oops, that should be
s#(<html>(.|\n)*)?<body(.|\n)*?>##gsi;
-- luu
------------------------------
Date: 9 Nov 1997 14:34:17 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Newbie Qu:- NT & Process Ids
Message-Id: <644hl9$feg@news-central.tiac.net>
In article <34629dd6.2599235@news.demon.co.uk>,
Andrew Terry <Andrew@nospam.andyt.demon.co.uk> wrote:
>Hello!
>
>Can someone tell me if there is a way to trap a parent process id. I've
>figured out that $0 shows me the current id, but if there is a way to
>check the id of a process which has called the current process, I could
>stop banging my head against this wall.... 8)
>
>By the way, I new to this Perl lark, so go easy on me with the replies!
Perl has getppid. the perlfunc man page includes
getppid Returns the process id of the parent process.
so you can say something like:
$ppid = getppid;
If you're using a recent perl then you should have fairly comprehensive
docs on line...
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Sun, 09 Nov 1997 18:17:26 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: PATH_INFO (UNIX vs. Novell Webserver 3.1)
Message-Id: <3466fdbd.1093278341@woody.wcnet.org>
[original author automagically cc'd via e-mail]
On Sun, 9 Nov 1997 07:56:12 -0600, "Rick" <rlluhman@netins.net> wrote:
>The Novell Webserver 3.1 appears to not be completely compatible with the
>UNIX PATH_INFO command.
PATH_INFO is not a command. It's an environment variable set by the
web server for each CGI process it initiates.
>The following script works on a UNIX machine but
>not on the Novell Webserver. Is there any tweaking that needs to be done to
>this script to allow it to run on the Novell Webserver?
>
>print "Content-type: text/html\n\n";
>print "Path Info = <b>$ENV{'PATH_INFO'}</b>\n";
You'd best ask in a web server newsgroup or check the relevant FAQs.
Jeremy
--
Jeremy D. Zawodny jzawodn@wcnet.org
Web Server Administrator www@wcnet.org
Wood County Free Net (Ohio) http://www.wcnet.org/
------------------------------
Date: Sun, 09 Nov 1997 22:26:43 GMT
From: rqy1319@is4.nyu.edu (Ryuji Yokoyama)
Subject: Single and Double quotes
Message-Id: <3467389f.610808@netnews.nyu.edu>
Hello All!
I just started to learn Perl by myself and have a question about
strings. What is the different single quote and double quote? When
do I have to use single quote and double?
Thanks!
Ryuji Yokoyama
rqy1319@is4.nyu.edu
------------------------------
Date: Sun, 9 Nov 1997 17:38:53 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Single and Double quotes
Message-Id: <645oja$pvq@bgtnsc02.worldnet.att.net>
I can give you a brief explanation, but you'll get a better one by checking
the FAQs, documentation, etc. for your distribution. I also recommend
getting O'Reilly's Programming Perl (the Camel Book) and Learning Perl (the
Llama Book), which are a cheap and entertaining education (and will save you
from people gently flaming you about doing your homework first :D).
Behold the following examples:
$one = "foo";
$two = "bar";
print "You'll soon learn that $one and $two are generic example
parameters.\n";
print 'You\'ll soon learn that $one and $two are generic example
parameters.';
print "\n";
This program produces the following output:
You'll soon learn that foo and bar are generic example parameters.
You'll soon learn that $one and $two are generic example parameters.
See the difference? The single quote produces the literal string contained
within it. The double quote "expands" the variables inside the string.
The two exceptions to the single-quote rule is that you need to put \' into
the string to get a single quote (like we did in the second print example),
and \\ into the string to display a backslash.
HTH (hope this helps)
--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
Ryuji Yokoyama wrote in message <3467389f.610808@netnews.nyu.edu>...
>Hello All!
>
>I just started to learn Perl by myself and have a question about
>strings. What is the different single quote and double quote? When
>do I have to use single quote and double?
>
>Thanks!
>
>Ryuji Yokoyama
>rqy1319@is4.nyu.edu
------------------------------
Date: 10 Nov 1997 02:15:31 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Timezone conversion
Message-Id: <645qo3$pem$3@comdyn.comdyn.com.au>
In article <34650B08.45D1@vianet.net.au>,
Gene Kraybill <kraybill@vianet.net.au> writes:
> I'd like to automatically convert a local time into GMT when a new event
> is recorded, and on display, I'd like to automatically convert the GMT
> times into the local time of the viewer. Can anyone help with pointers
> to scripts or methods?
look at time(), localtime() and gmtime().
time always returns the number of seconds since epoch, GMT (except
maybe on a mac...), and localtime() and gmtime() will return a list
(sort of equivalent to a c struct tm), for either local or GMT.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
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 1293
**************************************