[10822] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4423 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 14 19:07:31 1998

Date: Mon, 14 Dec 98 16:00:29 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 14 Dec 1998     Volume: 8 Number: 4423

Today's topics:
    Re: 'lock' get compiler error <r28629@email.sps.mot.com>
    Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/) <merlyn@stonehenge.com>
    Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos (Martien Verbruggen)
    Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos <dgris@moiraine.dimensional.com>
    Re: ARGV (Martien Verbruggen)
    Re: array initialisation <aqumsieh@matrox.com>
        Best way to test perl scripts offline? (john)
    Re: Best way to test perl scripts offline? <uri@ibnets.com>
    Re: Best way to test perl scripts offline? <due@murray.fordham.edu>
    Re: Best way to test perl scripts offline? (Tad McClellan)
    Re: Bug (array ref in a "void" context) (Bart Lateur)
    Re: disable ^C ????? (Martien Verbruggen)
        Ensuring only one of me is running? (Barry Edwards)
        Execute multi commands in one line mbrich@my-dejanews.com
    Re: Flock <aqumsieh@matrox.com>
    Re: foo bar <fishers@cc.wwu.edu>
    Re: foo bar <jeromeo@atrieva.com>
    Re: fork and defunct processes (Mark-Jason Dominus)
    Re: Get an Html page from another server (Greg Ward)
        Getting IP of connecting station <carvdawg@patriot.net>
    Re: how can script get file http://... (Martien Verbruggen)
    Re: How to extract emails from HTML page (Erik)
    Re: How to extract emails from HTML page (Greg Ward)
        How to tell if a process is running? (Barry Edwards)
        Ip number <torsten_l@hotmail.com>
    Re: Loop Timing <r28629@email.sps.mot.com>
    Re: ls -l in perl? <aqumsieh@matrox.com>
        Matching, Saving, Removing, and Holding (a word from an (Jim Matzdorff)
    Re: non-blocking socket connect question <aqumsieh@matrox.com>
    Re: Perl2EXE (Ethan H. Poole)
        References, Clients, and scope <stampes@xilinx.com>
    Re: Saving Multidimentional Hash's? <aqumsieh@matrox.com>
    Re: site_perl Migration (Greg Ward)
    Re: Sorting a Two-dimensional Numerical Array <ludlow@us.ibm.com>
    Re: Splitting a line at |'s <aqumsieh@matrox.com>
    Re: timelocal and localtime with negative values? (I R A Aggie)
        trapping ^C on NT? <kin@symmetrycomm.com>
        Web Store and SQL? <Webmaster@detour.co.uk>
        What can't a file handle Have in it? <support@counter.w-dt.com>
        Windows NT  $scratch <luvbeingmamaNOSPAM@home.com>
    Re: Writing in a file ... <aqumsieh@matrox.com>
    Re: Writing Perl with Notepad (Martien Verbruggen)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 14 Dec 1998 16:20:09 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: 'lock' get compiler error
Message-Id: <36758F19.9B5F9B72@email.sps.mot.com>

Allan M. Due wrote:
> 
> Tk Soh wrote in message <36756B07.FC02788B@email.sps.mot.com>...
> >Is 'lock' a keywork/function? I named a experiemental sub with 'lock'
> >but I am getting compiler error:
> >-------------------------------------------------------
> >  DB<1> lock
> >Not enough arguments for lock at (eval 4) line 2, at EOF
> >[106] % perldoc -f lock
> >No documentation for perl function `lock' found
> >[107] % perl -v
> >This is perl, version 5.005_01 built for PA-RISC1.1
> >Copyright 1987-1998, Larry Wall
> >-------------------------------------------------------
> >Thanks.
> >-TK
> 
> Hmm, under 5.004_02  no problems.  Version 5.005_02, I get the same error.
> Curious.  It only happens when I declare the sub after the first time I call
> it, and the error goes away if I use &lock instead of lock().
> 
> AmD

I found this in my perldelta:

      New lock keyword

      The lock keyword is the fundamental synchronization primitive in
      threaded perl.  When threads are not enabled, it is currently a
noop.

but nothing in perlsyn. And keywords should be covered by perlsyn,
right????

-TK


------------------------------

Date: Mon, 14 Dec 1998 23:39:06 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
Message-Id: <8cyaoamgz9.fsf@gadget.cscaper.com>

>>>>> "Tad" == Tad McClellan <tadmc@metronet.com> writes:

Tad>    My guess is that you have no history of reading Randal's
Tad>    past postings. Many folks here are snipers (e.g me, when
Tad>    I'm being an ass), but Randal is not one of those folks.

You are too kind Tad.  There have been times that I've posted here
that for whatever reason (usually not the poster's fault), I've let go
a little steam.  I can admit that without hesitation.

print "Just another Perl hacker, and FAQ-whacker," :)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


------------------------------

Date: Mon, 14 Dec 1998 22:14:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <m5gd2.80$g15.153@nsw.nnrp.telstra.net>

In article <36754F0E.10E4C4D3@gatewest.net>,
	Andrew Johnson <ajohnson@gatewest.net> writes:
> Daniel Grisinger wrote:
> !
> ! mgjv@comdyn.com.au (Martien Verbruggen) writes:
> ! 
> ! > The few CPAN mirrors I just tried mention that 5.005_02 is the latest,
> ! > and the stable release. 5.004_05 doesn't even get a mention, and is
> ! > not available in the src/5.0 directory.
> ! 
> ! 5.004_05 is currently in testing and should be showing up in final
> ! form Real Soon Now[tm].  You can find the trial versions of it in Tim
> ! Bunce's CPAN directory.
[snip]

Ok, so this FAQ was indeed incorrect in that it was giving us a
glimpse of the future, as opposed to actually reflecting the currect
state, which is latest is 5.005_02, stable is 5.005_02.

> note also, maintenance versions (including trial maint. releases) are
> available in the 'src/5.0/maint/' directory --- on the mirror I use
> there are currently trial versions including 5.004_05-MAINT-TRIAL-7
> and 5.005_03-MAINT-TRIAL-1 (among others).

I know this, but the paragraph I was asking about contained the words
'stable' and 'latest' for these versions. Not 'trial' :)

Just making sure I wasn't going mad. :)

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd.       | selective about its friends.
NSW, Australia                      | 


------------------------------

Date: 14 Dec 1998 15:43:40 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <m3af0ql4yr.fsf@moiraine.dimensional.com>

mgjv@comdyn.com.au (Martien Verbruggen) writes:

> Just making sure I wasn't going mad. :)

Going?  :-)

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


------------------------------

Date: Mon, 14 Dec 1998 22:18:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: ARGV
Message-Id: <t8gd2.83$g15.153@nsw.nnrp.telstra.net>

In article <3676c919.3025488@news.skynet.be>,
	bart.lateur@skynet.be (Bart Lateur) writes:

> Just try this CGI script:
> 
> 	#!/usr/local/bin/perl
> 	print "Content-type: text/plain\n\n";
> 	$" = '|'; 
> 	print "Data line: @ARGV\n";	
> 
> I ran this with
> 
> 	htpp://.../test.cgi?Be+prepared+to+be+amazed!
> 
> And this is what I got:
> 
> 	Data line: Be|prepared|to|be|amazed!

<OFFTOPIC>
Server dependent behaviour. The CGI specification does not at all
mention that a server has to translate a bunch of CGI parameters into
arguments.
</OFFTOPIC>

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 
Commercial Dynamics Pty. Ltd.       | Curiouser and curiouser, said Alice.
NSW, Australia                      | 


------------------------------

Date: Mon, 14 Dec 1998 15:01:44 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: array initialisation
Message-Id: <x3yd85mwl07.fsf@tigre.matrox.com>


Michael Renshaw <michaelr@lndn.tensor.pgs.com> writes:

> 
> does anyone know how to preallocate an array size within a hash array ?

my %hash;
keys %hash = 100;



------------------------------

Date: Mon, 14 Dec 1998 22:02:22 GMT
From: sulis@telinco.co.uk (john)
Subject: Best way to test perl scripts offline?
Message-Id: <36758ab2.22285529@news.telinco.co.uk>

Is there a way to test perl scripts offline?

john


------------------------------

Date: 14 Dec 1998 17:19:02 -0500
From: Uri Guttman <uri@ibnets.com>
To: sulis@telinco.co.uk
Subject: Re: Best way to test perl scripts offline?
Message-Id: <39iufemko9.fsf@ibnets.com>

>>>>> "j" == john  <sulis@telinco.co.uk> writes:

  j> Is there a way to test perl scripts offline?  john

offline what? you could simulate them by hand. you build a mechanical
difference engine (babbage would be proud) and port perl to it and that
would be off line.

it is a programming language. it has to be on a computer somewhere to run.

OHH! i get it, you mean off the web!! well perl is NOT the web nor is it
CGI. it can run on almost any computer system out there. so it can be
tested off line (if you mean the web).

please, next time pose your answer in the form of a question. or make it
less clear what you want to know so you can get more confused responses.

am i confounded yet?

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


------------------------------

Date: 14 Dec 1998 22:45:00 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: Best way to test perl scripts offline?
Message-Id: <7544dc$n72$0@206.165.165.164>

john wrote in message <36758ab2.22285529@news.telinco.co.uk>...
|Is there a way to test perl scripts offline?


Ok, lets get one thing straight, online/offline has nothing to do with how
perl runs.  If you want to test your webcentric scripts you probably need a
web server to try them out  (I am guessing you already have perl).  Which
server is best?  The same server that will be serving up your scripts when
they are ready for the world at large.  If that is not an option, then free is
always good.  Try www.apache.org for a wonderful, free server.

HTH

AmD

(You are using CGI.pm aren't you?)




------------------------------

Date: Mon, 14 Dec 1998 16:23:49 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Best way to test perl scripts offline?
Message-Id: <l53457.0i7.ln@magna.metronet.com>

john (sulis@telinco.co.uk) wrote:

: Is there a way to test perl scripts offline?


   Yes.


   1) set the shebang line to point to where perl is on your system:

         #!/usr/bin/perl

      that works on Unix which must be fine with you, since you
      didn't specify any operating system at all.


   2) make the file containing the program and the above shebang
      line executable:

         chmod 755 my_prog


   3) type the name of the program file at the shell prompt


   Have fun!


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Mon, 14 Dec 1998 23:06:48 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Bug (array ref in a "void" context)
Message-Id: <367898fb.11711218@news.skynet.be>

Tad McClellan wrote:

>   Does this fix the "bug"?
>
>      $aryref ||= ($updated++ ,[1,2,3]);

Yes, as I found out all by myself and wrote, ooh, 7 hours before your
follow-up. :-)

I expected the assignment to have the lowest precedence of all, except
maybe the artificially low precedences of "or" and "and".

The comma operator is not the same as the comma separators in a function
parameter list. Or is it?
      
I still find it bizarre that the comma operator, which I think is a
typical scalar operator, generates a "void context".

	Bart.


------------------------------

Date: Mon, 14 Dec 1998 22:26:26 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: disable ^C ?????
Message-Id: <mggd2.86$g15.153@nsw.nnrp.telstra.net>

In article <367522B8.5B06@hotmail.com>,
	Mark Draper <swampmidget@hotmail.com> writes:
> How can i disable control C user input so they can not terminate the
> script?

depends on your platform. On most unices, you can trap the signal that
corresponds to ctrl-c, by using the %SIG hash.

# perldoc perlvar

You may also want to use the pragma sigtrap

# perldoc sigtrap

Martien

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
NSW, Australia                      | 


------------------------------

Date: Mon, 14 Dec 1998 22:16:30 GMT
From: barry@edw.u-net.com (Barry Edwards)
Subject: Ensuring only one of me is running?
Message-Id: <36758e27.12257315@news.u-net.com>


Sorry for the cryptic subject line -- could not think of a better one.

Perhaps somebody can help. I am relatively new to Perl, so there maybe
trivial  answer.

I am doing a perl script which must run under both  Win32 and UNIX. 

The question is this:-

What is the best way a perl script can ensure that only one instance
of itself is running?

Under UNIX, my guess is to use the trick which I have used with shell
scripts, that is grep the  ps command and look for $0.

What is the best way under Win32?

Replies gratefully received.

Barry Edwards

##############################################################
# Barry  Edwards                                               
# barry@edw.u-net.com           
##############################################################


------------------------------

Date: Mon, 14 Dec 1998 22:00:02 GMT
From: mbrich@my-dejanews.com
Subject: Execute multi commands in one line
Message-Id: <7541p0$n4q$1@nnrp1.dejanews.com>

I sure my subject wasn't clear but here is goes:  I have the following command
that I wish to execute in a perl script.

cvs status | $ grep 'Status:' | grep -v 'Up-to-date' | awk '{print $2}'

Do I have to break this up into indivdual actions, or is there a way to do
this using exec() or system().

I have tried with my limited knowledge but perls seems to stop after the first
executable statement(i.e. cvs status).



--------------------
Matt Rich

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 14 Dec 1998 16:02:01 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Flock
Message-Id: <x3yaf0qwi7s.fsf@tigre.matrox.com>


Mike <support@counter.w-dt.com> writes:

> 
> I looked at many docs, somepeople would say if you don't want to help, without
> being snobbish, get the hell off the news group. A news group is where people
> go for help. I looked up in many perl books, just because it has flock
> (filehandle, 2); to me doesn't just come out and say it has to go after open.
> 

Could you please point out the docs and perl books you looked up? 
Someone has to notify their authors in order to correct them.

(shhhh!)



------------------------------

Date: Mon, 14 Dec 1998 15:16:16 -0800
From: Shane Fisher <fishers@cc.wwu.edu>
Subject: Re: foo bar
Message-Id: <Pine.SOL.3.96.981214151343.5763A-100000@titan.cc.wwu.edu>

On Mon, 7 Dec 1998, Todd Smith wrote:

> where's this foo-bar stuff come from? I heard it in that "Search for
> Private Ryan" movie. What's it mean?, and what's it got to do with Perl?

Although it's called foobar in computer-lingo, I always understood it to
be fu-bar, or fully expanded:

	F**ked Up Beyond All Repair

Regards,
Shane
-------------------------------------------------------------------------
        Shane M. Fisher
        Student Intern, Administrative Computing Services,
        Western Washington University
        EMail: fishers@admcs.wwu.edu		  Ext:3362
-------------------------------------------------------------------------





------------------------------

Date: Mon, 14 Dec 1998 15:46:28 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Shane Fisher <fishers@cc.wwu.edu>
Subject: Re: foo bar
Message-Id: <3675A354.8FC582F@atrieva.com>

Shane Fisher wrote:
> 
> On Mon, 7 Dec 1998, Todd Smith wrote:
> 
> > where's this foo-bar stuff come from? I heard it in that "Search for
> > Private Ryan" movie. What's it mean?, and what's it got to do with Perl?
> 
> Although it's called foobar in computer-lingo, I always understood it to
> be fu-bar, or fully expanded:
> 
>         F**ked Up Beyond All Repair

The nice thing about it is 'R' is interpolated based on context.

Talking about the new boss?      R = Reason.
Talking about those new docs?    R = Readability (or Reason).
Talking about the bosse's wife?  R = Recognition.

Etcetera Etcetera...

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


------------------------------

Date: 14 Dec 1998 17:32:44 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: fork and defunct processes
Message-Id: <7543mc$p5e$1@monet.op.net>

In article <36757FB6.41C67EA6@scitec.com>,
Crist J. Clark <cjc@scitec.com> wrote:
>I've had a look through perl manpages and tried some FAQ's but have not
>been able to locate a reference to this type of problem. Thanks for any 
>help.

perlfaq8: 
	How do I avoid zombies on a Unix system?



------------------------------

Date: 14 Dec 1998 23:18:57 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: Get an Html page from another server
Message-Id: <7546d1$aun$2@news0-alterdial.uu.net>

Thomas Cunningham <cunningt@primenet.com> wrote:
> I R A Aggie <fl_aggie@thepentagon.com> writes:
> 
> : perldoc LWP contains the information you seek.
> 
> : James
> 
> Is there an easy way to do this without the LWP module?

I have been known to perpetrate the following hack when I couldn't be
bothered to download and install LWP *and* all of its dependencies (hey,
I was in a hurry):

   $foo = `lynx -source $url`;

Of course, this assumes you have lynx installed, which is somewhat more
of a chore than LWP.  Also, you lose a great deal of control over error-
handling.  But if a quick hack is needed...

But everyone has been saying "Get LWP", and they're absolutely right.
It does everything you need for web client hackery.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


------------------------------

Date: Mon, 14 Dec 1998 18:45:08 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Getting IP of connecting station
Message-Id: <36755CB4.E0556B1@patriot.net>

I have a small server that I am testing out and the server
seems to run fine.  Now, I want to restrict access to this, for
testing purposes, by IP address.

How can I get the IP address of the connecting system?  I've
tried:

 ...$sock->peeraddr()

and this doesn't work.  The only thing I have had that gets an IP
address without crashing is the call to get the IP address of the
server itself.

Thanks,

Carv



------------------------------

Date: Mon, 14 Dec 1998 22:22:05 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: how can script get file http://...
Message-Id: <hcgd2.85$g15.153@nsw.nnrp.telstra.net>

In article <3674AE81.EAA03A3D@infonet.ee>,
	Gleb Ekker <globus@infonet.ee> writes:
> Hi all
> 
> Is it possible to get some file (http://www.somehost.com/file.html) from
> another server without using CPAM library?

Yes, you could use modules from CPAN instead :)

Seriously: you can do it. open a socket, talk the right protocol, and
do the right thing.

Should you do it?

No.

The modules on CPAN normally have been written by people who know what
they're doing, what the issues are, and what to not do. They've spent
a lot of time getting things right.

If you imagine that you can do it better than them, then by all means,
go ahead. But I really can't see any reason whatsoever to do a lot of
work when someone else has already done it.

Besides that: The fact that you have to ask the question whether it's
possible at all, signals to me that you would most likely not do a
better job, and that you probably don't even know where to start.

Just use the modules on CPAN.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.       | cynical. It's perfectly easy to be
NSW, Australia                      | cynical.


------------------------------

Date: 14 Dec 1998 22:44:09 GMT
From: eln@cyberhighway.net (Erik)
Subject: Re: How to extract emails from HTML page
Message-Id: <7544bp$com$1@news.cyberhighway.net>

In article <753vhk$ojf$3@bw107zhb.bluewin.ch>,
	"Philip Class" <philip.class@popcorn-studio.ch> writes:
> Does anyone know if there's a module that extracts email-adresses from a
> huge textfile or html page and stores these emailadresses in a file.
> The output should be a list (file) containing all emails, that originally
> have been somewhere in the html-file.

Why don't you add yourself to the RBL now and save everyone a lot of
trouble?
Never mind that your question is not appropriate for this forum (this
is a help group for perl programmers, not a script repository),
it's quite obvious you're attempting to suck email addresses off
the web, almost certainly for the purpose of spamming them.

-- 
Erik Nielsen, Cyberhighway Internet Services NOC
There's something to be said for returning the whole syntax tree.
             -- Larry Wall in <199710221833.LAA24741@wall.org>


------------------------------

Date: 14 Dec 1998 23:23:57 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: How to extract emails from HTML page
Message-Id: <7546md$aun$3@news0-alterdial.uu.net>

Philip Class <philip.class@popcorn-studio.ch> wrote:
> Does anyone know if there's a module that extracts email-adresses from a
> huge textfile or html page and stores these emailadresses in a file.
> The output should be a list (file) containing all emails, that originally
> have been somewhere in the html-file.

<sarcasm degree="heavy">
Not as such, but it should be a snap to cobble something together with
LWP and Mail::Internet.  Maybe you could call it Spam::Web and submit it
to CPAN!  Has anyone written Spam::Usenet to troll a news spool for
email addresses?
</sarcasm>

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


------------------------------

Date: Mon, 14 Dec 1998 22:17:20 GMT
From: barry@edw.u-net.com (Barry Edwards)
Subject: How to tell if a process is running?
Message-Id: <36788e5b.12309960@news.u-net.com>


Perhaps somebody can help. I am relatively new to Perl, so there maybe
trivial  answer.

I am doing a perl script which must run under both  Win32 and UNIX.
The question is this:-

Knowing a process id (PID), how does one tell if that process is
running. Note that this PID  is a process (maybe a another perl
script), but not created by a "father" perl script (for the want of a
better phrase).

 I know the UNIX method  --- Kill(), with a signal 0. 

However, what is the Win32 method one would use in a Perl script?

Replies gratefully received.

Barry Edwards

##############################################################
# Barry  Edwards                                               
# barry@edw.u-net.com           
##############################################################


------------------------------

Date: Tue, 15 Dec 1998 00:55:25 +0100
From: Torsten Lund <torsten_l@hotmail.com>
Subject: Ip number
Message-Id: <3675A56D.8CF4A490@hotmail.com>

Is it possible to log the IP of the person that has accessed a
perlscript through http?
I have a web site on a linux server, using Apache httpd.
-- 
                                    _                            
                            }===---^-\>_
             ~...**.*..   __/__\_\\\_/  \
                            \__/     \__/


------------------------------

Date: Mon, 14 Dec 1998 16:22:10 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Toe Jam <toejam@nirvana.net>
Subject: Re: Loop Timing
Message-Id: <36758F92.3B7B91D2@email.sps.mot.com>

[posted to clp.misc and copy emailed]

Toe Jam wrote:
> 
>         I'm looking for the command or code to run a loop on a
> user-defined timer, so if the user instructs the loop to run every 15
> seconds, it would.  Please forward any ideas or resources to
> toejam@nirvana.net
> 
> Thank you.

perldoc -f sleep

HTH.

-TK


------------------------------

Date: Mon, 14 Dec 1998 15:03:16 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: ls -l in perl?
Message-Id: <x3ybtl6wkxn.fsf@tigre.matrox.com>


emclean@slip.net (Emmett McLean) writes:

> 
> How about :
> 
> @ls = qx/ls -l/;
> 
> Emmett

On winblows??



------------------------------

Date: 14 Dec 1998 15:04:10 -0800
From: syran@shell1.ncal.verio.com (Jim Matzdorff)
Subject: Matching, Saving, Removing, and Holding (a word from an array in a line)
Message-Id: <7545ha$5g2$1@shell1.ncal.verio.com>

I'm confused as to most of pattern matching.  I read the long, complicated article by Tom
Christiansen, and it didn't really help me (perhaps because I was confused most of the way).
Anyone have a solution:

I have an array, let's say @words = ("one","two","three");

I have multiple lines such as:

one:howdy
two:bye
one:next
three:new
(and on...)

What I want to do is essentially seach the line (beginning) for any of the words in @words.
If I find a match, save it ($1) and do something with the rest of the line.

I thought perhaps something like (given $_ = one of those lines):

if (s/^($TELNET[++])//) { 
  ($1 eq "one") { dosomething }
  (etc...)
}

but obviously, that won't work.  how can i do this?  I don't understand (in looking at other
examples) what the "++" can do for you (i assumed it would look over all elements of the
array).  Any and all help would be appreciated.

--jim


------------------------------

Date: Mon, 14 Dec 1998 16:34:14 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: non-blocking socket connect question
Message-Id: <x3y67bewgq1.fsf@tigre.matrox.com>


adrade@wwa.com (Adam Levy) writes:

>  1. How do I make the socket non-blocking?

Design it to be that way!
PS. Check out the select() command.

>  2. How do I then know when the connection has been made so I can send the
> data? 

listen() for incoming connections and then accept() them.
You should read more about sockets before you go on.

>  3. How do I know when its ready to be read?

Again, check out the select() command.

>  4. And finally, how would I read it? (I read somewhere about using
> sysread when using non-blocking)

use select() to check out if it's readable. If true, read a
chunk. Check if there is something else to do before going back to
check if the filehandle is readable.

> Any help would be so greatly appreciated. Thank you,
>  -Adam Levy

Get a copy of "Advanced Perl Programming" and checkout page 198.



------------------------------

Date: Mon, 14 Dec 1998 23:38:33 GMT
From: ehpoole@ingress.com (Ethan H. Poole)
Subject: Re: Perl2EXE
Message-Id: <Zjhd2.804$9L.6247@news3.ispnews.com>

[Posted and Emailed]  In article <36754db8.0@info.xpoint.at>, 
cb2001@hotmail.com says...
>
>Hi everybody!
>
>Fast HELP wanted!
>Does someone have the fullversion of PERL2EXE? or can someone tell me where
>to download the fullversion (not the shareware trial!)
>
>i need this very much, cuz i have to write a perl script for school, but i
>don't want them to get the source, it was too much work!
>
>so please send it to me (cb2001@hotmail.com) or let me know where i can
>download it!

Why would fellow developers *give* you another developer's commercial product 
without your paying for it?  

You can purchase Perl2Exe online and receive the key via email, seems to me 
that should be sufficiently quick.

-- 
Ethan H. Poole              | Website Design and Hosting,
                            | CGI Programming (Perl & C)..
========Personal=========== | ============================
* ehpoole @ ingress . com * | --Interact2Day--
                            | http://www.interact2day.com/



------------------------------

Date: 14 Dec 1998 21:43:20 GMT
From: Jeff Stampes <stampes@xilinx.com>
Subject: References, Clients, and scope
Message-Id: <7540pp$7p1@courier.xilinx.com>

My brain hurts.  I'll try and keep this explanation simple and clear:

I have a large heterogeneous data structure representing a thousand
or so compile jobs.  I parse through the structure, following rules
of dependency, until I find the next available job.  I print the job
to t TCP client via a socket, and it runs the job.  When it's done,
it makes a new connection and says it's done.

What I am having problems with is marking this job as 'DONE' in my
data when it's complete. Before I send the job to a client, I do
something like this:

$ref->{$_} = $client_name;

What I wanted to do basically was send \$ref->{$_} to the client 
as well.  Later when it finished, it could return this reference
to the server, which could simply do a:

$$ref = $$ref."-DONE";

The structure it points into is persistent, it lasts through the
whole program, but when I get the reference back from the client,
it's always a scalar, and not a reference any more.

I am probably missing something obvious, can someone point me in
the right direction?

Thanks,

Jeff


-- 
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


------------------------------

Date: Mon, 14 Dec 1998 16:07:48 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Saving Multidimentional Hash's?
Message-Id: <x3y90gawhy3.fsf@tigre.matrox.com>


Eric Bohlman <ebohlman@netcom.com> writes:

> MLDBM.  Beg, borrow or steal a copy of Sriram Srinivasan's _Advanced Perl 
> Programming_ (the "panther" book) and read the chapter on "persistence."

why not "buy" ???



------------------------------

Date: 14 Dec 1998 23:13:05 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: site_perl Migration
Message-Id: <754621$aun$1@news0-alterdial.uu.net>

Aravind Subramanian <aravind@genome.wi.mit.edu> wrote:
> We are moving several applications that use Perl 5.00502 to a new
> machine (same OS - solaris). Its easy enough to install Perl on the new
> machine but the site_perl on the old machine has several CPAN module
> installations. Can the site_perl simply be copied over into the new
> machine's Perl lib dir?

If there are no extension modules in your site_perl -- i.e. all
installed third-party modules are pure Perl -- then a straight copy
should work.  

If there is anything compiled under site_perl, though, things get a bit
more stringent.  Not only must the underlying architecture (hardware,
OS) be the same, but the compiler and compiler flags used to build Perl
will have to match on the two installation.  Worse, you can often get
away with compiler mismatches, and you not discover such a problem for
many months.  (Of course, if that happens you can always rebuild the
offending module with the new Perl installation.)

Also, you might conceivably have extension modules that depend on
fourth-party C libraries being installed on the system.  If, perchance,
the module .so file depends on a library .so file (ie. Perl dynamically
loads its extension, which in turn dynamically loads libfoo.so), then
those shared libraries will also have to be installed on the new system.
Whether this scenario pops up depends on how those fourth-party C
libraries, and the Perl modules that depend on them, were built and
installed.  Ahhh, life with shared libraries...

But yeah, in general a straight copy of site_perl for the *same version
of Perl with the same compiler and compiler flags* should work.  Go for it.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


------------------------------

Date: Mon, 14 Dec 1998 16:07:07 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Sorting a Two-dimensional Numerical Array
Message-Id: <36758C0B.4AAE06A5@us.ibm.com>

Tom Briles wrote:
> 
> What's the best (or any!) way to sort the following array on the second
> dimension (in this example 1, 2.5, and 2.5):

This is covered in the FAQ:

http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_sort_an_aray_by_anyth

Other resources that are of great use:
The documentation that came with your distribution of Perl.
http://www.perl.com/
Learning Perl (O'Reilly)
Programming Perl (O'Reilly)
Perl Cookbook (O'Reilly)

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


------------------------------

Date: Mon, 14 Dec 1998 16:10:06 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Splitting a line at |'s
Message-Id: <x3y7lvuwhua.fsf@tigre.matrox.com>


hdiwan@diwanh.stu.rpi.edu () writes:

> 
> In article <750lds$sp2$1@readme.online.no>, Asbjorn Gjemmestad wrote:
> >I've got a plain text data file with several lines containing three pieces
> >of data.
> >The data is separated with |'s, making the data entires value1|value2|value3
> >
> >I need to split these entries into three different variables. I know I need
> >to use the split function, but I'm not quite sure about how to make the
> >statement.
> while (<IN>) {
>   @A=split /|/;
>   $value1=@A[0]; $value2=@A[1];$value3=@A[2];
> }
> There you are... that should work.

Unless you use the '-w' flag which would generate all sorts of
warnings.

$value1 = $A[0];   # not @A[0]

PS. Make sure you use your values before the next iteration of the
while loop or else they'll be over-written.



------------------------------

Date: Mon, 14 Dec 1998 18:29:39 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: timelocal and localtime with negative values?
Message-Id: <fl_aggie-1412981829390001@aggie.coaps.fsu.edu>

In article <753mhc$2p8$1@gellyfish.btinternet.com>, Jonathan Stowe
<gellyfish@btinternet.com> wrote:

+ On Tue, 8 Dec 1998 16:48:08 -0800 Larry Rosler <lr@hpl.hp.com> wrote:
+ > 
+ > So this is Yet Another Y2038 bug.  I must admit that I don't much care. 
+ > :-)
+ > 
+ 
+ Except of course if they finally iron the the problems out of cryogenics :-0

In which case, Larry will be awakened in 2038?

James


------------------------------

Date: 14 Dec 1998 13:26:02 +0000
From: Kin Cho <kin@symmetrycomm.com>
Subject: trapping ^C on NT?
Message-Id: <uiufe6ej9.fsf@server3.symmetrycomm.com>

Hi,

How can one trap ^C on NT?
When running the following code, which uses $SIG{INT},
I hit ^C after I see "blocked..." message,
but catch_zap doesn't get called.

I'm on NT 4.0 running 5.005_02.

Thanks.

-kin

$SIG{INT} = \&catch_zap;

&netblock;

sub catch_zap {
   my $signame = shift;
   $shucks++;
   die "Somebody sent me a SIG$signame";
}

# block for a while
sub netblock {
   use LWP::Simple;
   print "blocked...\n";
   get('http://foo.bar.com/');
   print "done...\n";
}



---
You are currently subscribed to perl-win32-users as: [kin.cho@usa.net]
To unsubscribe, forward this message to
         leave-perl-win32-users-59253J@lyris.activestate.com
For non-automated Mailing List support, send email to  
         ListHelp@ActiveState.com


------------------------------

Date: Mon, 14 Dec 1998 22:19:25 -0000
From: "Sovereign Media" <Webmaster@detour.co.uk>
Subject: Web Store and SQL?
Message-Id: <7542si$q2f$1@news1.cableinet.co.uk>

I have Selena Sol's Web Store working fine but I wanted to make the database
an MSSQL one as it is now growing rather large (86,432 items). I realise
that in the setup files there is one file which will hold the routines I
need but.............

Being pretty new to perl and MSSQL, i'm finding it difficult to get it to
return the values I need. Does anyone have even a basic example of
web_store_db_lib.pl using SQL that I could sneek a peek at?

Ta.




------------------------------

Date: Mon, 14 Dec 1998 17:46:28 -0600
From: Mike <support@counter.w-dt.com>
Subject: What can't a file handle Have in it?
Message-Id: <3675A353.9D890AA7@counter.w-dt.com>

What characters can't a file handle have in it? Can you store the file
handle in a string variable like, $handle = "handle"; and use $handle as
your file handle?
If you don't know can you atleast point me to somewhere to find out. I
have checked the perldocs, its not there. I know I've seen it somewhere
just can't remember where.
Thanks?



------------------------------

Date: Mon, 14 Dec 1998 22:52:34 GMT
From: "Me" <luvbeingmamaNOSPAM@home.com>
Subject: Windows NT  $scratch
Message-Id: <SEgd2.881$qt.658254@news.rdc1.on.wave.home.com>

I can't seem to find any documentation on this. I have been searching the
web for hours!! I am having a problem sending the temp files to the temp
directory.
Should there be more of a file path to get this to work?
$SCRATCH="C:/Temp";  or should it be going to the same file as BASEDIR?

I am very new to this and would appreciate any help or ideas.... :o)

--
Remove the obvious from my email.
Spam is not welcome nor read!




------------------------------

Date: Mon, 14 Dec 1998 16:58:38 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Writing in a file ...
Message-Id: <x3y4sqywfle.fsf@tigre.matrox.com>


from perlfaq5:

     How do I change one line in a file/delete a line in a
     file/insert a line in the middle of a file/append to the
     beginning of a file?

read it.



------------------------------

Date: Mon, 14 Dec 1998 22:09:46 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Writing Perl with Notepad
Message-Id: <K0gd2.75$g15.153@nsw.nnrp.telstra.net>

In article <367316ED.C44079EE@technologist.com>,
	Evan Panagiotopoulos <evanp@technologist.com> writes:
> This is a multi-part message in MIME format.
> --------------61283E92AA214E1434C19D4B
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

Please, don't do this.

> Thanks for the quick reply.  Can I have the first line of the script as
> #!/usr/bin/perl -i -pe 'tr/\r//d;'  ?
> Now that the $PATH has been established for all students is there an
> alternative to automating the line command?

If you don't use FTP to transfer the files, in which case you can use
ascii transfer mode, but instead you do some rcp or direct write on a
shared file system, the easiest thing to do is to make sure you use an
editor that can write unix file formats. There is a whole list of
them. Vim is one (if you like vi), PFE is another good one (if you're
more into traditional windows interfaces). Both are free.

http://www.vim.org/
http://www.lancs.ac.uk/people/cpaap/pfe/

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd.       | make a better idiot.
NSW, Australia                      | 


------------------------------

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 4423
**************************************

home help back first fref pref prev next nref lref last post