[8701] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2318 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 14 16:07:34 1998

Date: Tue, 14 Apr 98 13:00:35 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 14 Apr 1998     Volume: 8 Number: 2318

Today's topics:
        'cat'ing binary  files together (Ali Mehdizadeh)
    Re: A SSI question :-) (Matt Taylor)
    Re: Bill Gates should be invited to O'Reilly's "Free So (Michael Schuerig)
    Re: Bill Gates should be invited to O'Reilly's "Free So <ben@hayamasa.demon.co.uk>
    Re: Bill Gates should be invited to O'Reilly's "Free So <ben@hayamasa.demon.co.uk>
    Re: Bill Gates should be invited to O'Reilly's "Free So <ben@hayamasa.demon.co.uk>
    Re: Bill Gates should be invited to O'Reilly's "Free So (Chris Nandor)
    Re: Easy way to count lines in a file <jefpin@bergen.org>
    Re: Easy way to count lines in a file (Mike Wescott)
    Re: Error number Help wanted <Mike_Lacey@Cargill.Com>
    Re: File download problem in IE4.0 bidyut@yahoo.com
        greed (Scott Stark)
        HELP!!! Script to perform website search kmyers@syneractive.com
    Re: Help <Mike_Lacey@Cargill.Com>
    Re: How do I format Local Date? <mschout@gkg.net>
        How to call external C++ libraries in Perl? (advanced) <jsun@geoworks.com>
        How to execute more than one command via System (Greg Gershowitz)
    Re: Info Regarding Perl 5.005 (Malcolm Beattie)
    Re: Info Regarding Perl 5.005 (Ilya Zakharevich)
    Re: Ksh to Perl conversion <Mike_Lacey@Cargill.Com>
        multiple file/directory transfer with Net::FTP <mislam@mindspring.net>
    Re: Numeric validation (Ken Fox)
        Perl and NT PWS Path problems <jhermann@ricochet.net>
        PERL and Win32 email <jsgines@uu.net>
    Re: PERL and Win32 email <jim.michael@gecm.com>
    Re: perl and win95 (Andrew M. Langmead)
    Re: Perl Libraries @INC Problems <mishra.aditya@emeryworld.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 13 Apr 1998 21:33:09 GMT
From: amehdiza@joule.ee.calpoly.edu (Ali Mehdizadeh)
Subject: 'cat'ing binary  files together
Message-Id: <6gu0al$o0$1@isnews.csc.calpoly.edu>


What is the best way to concatinate a bunch of binary files together?
I was thinking of just using 

$catResults = `cat file1 >> file 2`

but I am not sure how efficient this method is and how cat handles
EOF and thinks like that. I can't afford any extra characters
(like an EOF) in the middle of the two binary files.

Another thought is to just read from one file handle and write to another 
inside a loop.
I am on NT BTW.

Any ideas?

Thanks,
-Ali M.


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

Date: Tue, 14 Apr 1998 15:54:23 GMT
From: nospam@rnoc.com (Matt Taylor)
Subject: Re: A SSI question :-)
Message-Id: <3536861b.32066001@news.realnews.net>

On Wed, 1 Apr 1998 02:04:19 +0100, "Ben" <ben@wallroyds.demon.co.uk>
wrote:

>Hello all :-) ...
>
>First of all ... I'm so sorry about my bad English.
>
>I have a .shtml webpage. It runs a CGI script ... The script is to detect
>the surfer's IP address and look up the "Banned surfers" database and if
>it's matched ... It will print "Sorry, but you're banned from viewing the
>page" ... But, the problem is, it also show the *.shtml page in which it
>shouldn't ...
>
>I wonder if anyone can tell me how to tell them that they're banned and NOT
>showing the .shtml page?


Actually this wont work version 1.0 browsers but most of the modern
browsers support this HTML meta tag

print("<META
HTTP-EQUIV=\"refresh\"CONTENT=\"0;URL=http://www.losergoaway.com\">" )
;

This will send the user to www.losergoaway.com after 0 seconds. I use
it alot when creating cgi as it keeps me from having to write my html
into my perl scripts.

Disclaimer: I dont know if losergoaway.com is a real domain.


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

Date: Tue, 14 Apr 1998 20:10:07 +0200
From: schuerig@acm.org (Michael Schuerig)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <1d7hnup.7sq3tv1475i0mN@rhrz-isdn3-p30.rhrz.uni-bonn.de>

Chris Nandor <pudge@pobox.com> wrote:

> # (I think talking about software "wanting to be free" is at least
> # defensible as such a simplifying fiction, but may not work for some).
> 
> I agree.  I am just guarding against the notions that information in
> actuality desires something, or does something, anything, at all.

This is now utterly of topic, but at least on topic for this thread.
You might want to have a look at the work of the philosopher Daniel
Dennett. See <http://www.tufts.edu/as/cogstud/pubslist.htm>. Of
particular interest is his paper "Real Patterns" (he even employs some
examples from computing: Game of Life, compression algorithms).

Michael

-- 
Michael Schuerig
mailto:schuerig@acm.org
http://www.uni-bonn.de/~uzs90z/


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

Date: Tue, 14 Apr 1998 19:10:57 +0100
From: Ben Bullock <ben@hayamasa.demon.co.uk>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <3533A6B1.23EBEC90@hayamasa.demon.co.uk>

Donovan Rebbechi wrote:

> I think that our disagreement ultimately boils down to the question of
> whether you believe that companies have a valid role to play in backing
> free software

No, you are completely wrong in your assumption about what I think.

I think commercial concerns can have a very valid role 
to play in backing free software.  For example the company
Red Hat says they will sell 400,000 CD roms this year, which means
$400,000 for the Free Software Foundation to spend on more
free software development:  I think that is 
excellent news.

-- 
Ben Bullock


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

Date: Tue, 14 Apr 1998 18:26:09 +0100
From: Ben Bullock <ben@hayamasa.demon.co.uk>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <35339C31.1DE4DA3A@hayamasa.demon.co.uk>

Nathan V. Patwardhan wrote:
> 
> Ben Bullock (ben@hayamasa.demon.co.uk) wrote:
> 
> : I don't have exact data as to how many copies of the books they
> : sell this way, but you don't have any real sales figures to back up
> : your opinion either, so I don't see this discussion getting
> : anywhere.
> 
> But then again, you brought the X-Windows books up.  Since you don't
> have any evidence to backup your claims, you shouldn't have ever
> mentioned such a topic.

I do have evidence, but I don't have inconclusive proof, that
the X windows books are a major part of O'Reilly's business.

I don't see why anyone would regard this as a topic worth debating.

Perhaps some people disagree with my opinions about free software
and its documentation, but can't think of a good rebuttal, so they
decide to quibble about things like this.


-- 
Ben Bullock


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

Date: Tue, 14 Apr 1998 18:37:55 +0100
From: Ben Bullock <ben@hayamasa.demon.co.uk>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <35339EF3.37AE2A23@hayamasa.demon.co.uk>

Ben Bullock wrote:
> I do have evidence, but I don't have inconclusive proof, that

Sorry,  I meant ``incontrovertable'' here not ``inconclusive''.

-- 
Ben Bullock


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

Date: Tue, 14 Apr 1998 14:08:08 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <pudge-1404981408240001@ppp-36.ts-1.kin.idt.net>

In article <35339C31.1DE4DA3A@hayamasa.demon.co.uk>, Ben Bullock
<ben@hayamasa.demon.co.uk> wrote:

# I don't see why anyone would regard this as a topic worth debating.

# Perhaps some people disagree with my opinions about free software
# and its documentation, but can't think of a good rebuttal, so they
# decide to quibble about things like this.

Perhaps.  Perhaps not.  I don't see why anyone would regard this as a
topic worth debating.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: Tue, 14 Apr 1998 12:25:24 -0400
From: Jeff Pinyan <jefpin@bergen.org>
To: Harold Reed <hareed@bellsouth.net>
Subject: Re: Easy way to count lines in a file
Message-Id: <Pine.SGI.3.95.980414122444.9182B-100000@vangogh.bergen.org>

#while (<ACCESS>) { counter++; }
$counter = (<ACCESS>); # this should work, I think
print "You have $counter lines in this file\n";
--
For the life of me, I cannot remember what made us think that we
were wise and we'd never compromise.
	                                             - Verve Pipe
Jeff Pinyan | users.bergen.org/%7Ejefpin | techmaster@bergen.org
ICQ# 10222129 | 10222129@pager.mirabilis.com | qw[jeff] on EFnet
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
  jp{for$w(@_){$_=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print;}}



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

Date: 14 Apr 1998 13:53:01 -0400
From: wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott)
To: "Harold Reed" <hareed@bellsouth.net>
Subject: Re: Easy way to count lines in a file
Message-Id: <x4ra309toi.fsf@cygnus.ColumbiaSC.NCR.COM>

In article <OlBY.155$GO6.554867@news3.atl.bellsouth.net> "Harold Reed" <hareed@bellsouth.net> writes:
> Is there an easy way to count the number of lines a file has?

Not really. As pointed out by others you have to count them all.

> I am working
> with several access log files that are routinely larger than 300MB and I
> have developed a crude update that lets the user know every 1000 lines that
> are processed by the script - so you can get an idea of where the script is
> in it duties (a stdout update, if you will).

Perhaps you need to rethink the problem. If you are looking for a simple way
to keep the user informed on how much processing has been done, is it really
necessary that it be by count of lines? You can get the size of a file (in
bytes) using stat(). And you can get the current position in the file (again,
in bytes) using tell(). Simple arithmetic produces a percent complete.

-- 
	-Mike Wescott
	 mike.wescott@ColumbiaSC.NCR.COM


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

Date: Tue, 14 Apr 1998 16:47:57 +0100
From: "Mike Lacey" <Mike_Lacey@Cargill.Com>
Subject: Re: Error number Help wanted
Message-Id: <6h00f5$110@wind.cargill.com>

Hi,

Try the 'man errno' command

Error  number 8 is "Exec format error" on my system but might be different
on yours (probably isn't though) these numbers are defined in
'/usr/include/sys/errno.h' on my system - it will be something simlar on
yours.

Regards

Mike

romei@sprynet.com wrote in message <6gvk5e$sf2$1@juliana.sprynet.com>...
>I'm  writing a perl pgm in perl 5.001 in a unix envir and keep getting
>a "error number 8" in my system error log. I can find no reference to
>any error numbers anywhere.
>
>If you know what this error is or where I can get a list of error
>numbers, I sure would appreciate it.!





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

Date: Tue, 14 Apr 1998 11:51:49 -0600
From: bidyut@yahoo.com
Subject: Re: File download problem in IE4.0
Message-Id: <6h0476$f77$1@nnrp1.dejanews.com>

Hi guys,

One more point i have found out after doing a lot of work on that. If I
hardcode the filename is CGI script, then IE is able to download and show the
file in browser. But if i try to get the filename dynamically(i.e passing
through post method from a form and obtaining it by using
$query->param('filename')), then IE fails in showing up the file. So, this
means there is some problem in the filename due to the different way of
processing.

Now, i am certain, the problem is in CGI script. Any help for this now.. at
least..

thanks
Bidyut

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 14 Apr 1998 16:44:56 GMT
From: sstark@informix.com (Scott Stark)
Subject: greed
Message-Id: <6h03q8$623@news.informix.com>

Hi, I have a sort of beginner perl question about greediness. I'm trying to get 
my script to select some text within a string that may appear twice in the same 
string. I only want to grab the first occurrence; but my script grabs 
everything between the first and second occurrence. The text string looks like:

JHicon[UNIX]JH some more text some more text JHicon[DOS]JH some more text etc.

I want the script to extract the text between the [] brackets in the first 
instance, in this case the string 'UNIX'. My code looks like this:

	elsif ($line =~ /JHicon\[(.*)\]JH/) {
                $gifname=$1;
	}

But for some reason it grabs everything between the first bracket and the last 
one, so $gifname becomes 'UNIX]JH some more text some more text JHicon[DOS'.

I've tried putting a question mark in several positions but can't get it to 
work correctly. How do I make it 'non-greedy'?

BTW, I've looked through both of the Schwartz books and found them so poorly 
indexed I couldn't find anything useful about greediness.

Thanks in advance for any help you can give!

Scott Stark
sstark@informix.com



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

Date: Tue, 14 Apr 1998 13:01:14 -0600
From: kmyers@syneractive.com
Subject: HELP!!! Script to perform website search
Message-Id: <6h0899$lf0$1@nnrp1.dejanews.com>

Can anyone tell me where I can find a script which when given a keyword and
domain (ex. usatoday.com) returns all links to pages which contain the
keyword?

Thanks.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 14 Apr 1998 16:52:27 +0100
From: "Mike Lacey" <Mike_Lacey@Cargill.Com>
Subject: Re: Help
Message-Id: <6h00nk$2bk@wind.cargill.com>

If you'd like some help we need some more detail


Mike Lacey



Bug wrote in message <35331ff5.0@ruby.hknet.com>...
>I want to know how to perform search , ASCII, double-bytes.
>Thank you for your stop by.
>If you know, e-mail me bugking@usa.net





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

Date: Tue, 14 Apr 1998 11:55:25 -0500
From: Michael J Schout <mschout@gkg.net>
To: Chocolate <poohba@io.com>
Subject: Re: How do I format Local Date?
Message-Id: <353394FD.76ABBBAA@gkg.net>

Chocolate wrote:
> 
> How do I format the $ENV{'LOCAL_DATE'} so that it will be:
> $day $date $month $year
> or can I format the /usr/bin/date?

I think the best way to do this is to use strftime() from the Posix
module. strftime() can format the time information just about anyway you
want it to.  I think the strftime, strptime combination is the most
powerful date formatting methods out there.  Perl does not provide
strptime() (takes a formatted time, and returns a value like localtime()
does), but it does provide strftime(which takes a localtime value, and
formats it).

For example, say I wanted to format the time to "04-05-1998 10:22 am".

I could do this with: 

#!/usr/bin/perl -w
use POSIX;
print strftime("%m-%d-%Y %I:%M %p", localtime());

See you system man page for strftime() to see what it will allow you to
do.  You can get just about anything using this function.

Mike


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

Date: Tue, 14 Apr 1998 11:23:55 -0700
From: Jun Sun <jsun@geoworks.com>
Subject: How to call external C++ libraries in Perl? (advanced)
Message-Id: <3533A9BA.2D74040A@geoworks.com>

I scan through some man pages about XSUB etc, and still feel a lot of
questions unanswered.

1. Can one call C++ directly in Perl?  Or it has to go though some C
wrapper functions?
2. I understand the corresponding Perl extion module can be either
statically linked or dynamically loaded.  What about the original C/C++
library.  I assume it must be linked to the perl interpretor image as
well.
3.  If the assumption in 2 is correct, is it possible for me to compile
the C/C++ library
into a DLL/shared library and let it be invoked in Perl through a
dynamic loaded Perl module?  The whole purpose here is to keep the
current perl interpretor not changed
while I can add a extension module which calls a C library.

Thanks in advance.  And really appreciate it if you can cc your reply to
my email account.

--
Jun



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

Date: Tue, 14 Apr 1998 15:59:11 GMT
From: gregg@charlotte.computex.com (Greg Gershowitz)
Subject: How to execute more than one command via System
Message-Id: <3533872e.510415248@client.news.psi.net>


I am trying to use the system() function under Windows NT.  I am using
it to call 'copy' to concatenate some files.  However, I don't want to
see the output from 'copy'.  How can I issue the '@echo off' in the
same system call?  Nothing I have tried (putting in \n's and such
things) seems to work.

Thanks.

-Greg G

--
Greg Gershowitz                         mailto:gregg@charlotte.computex.com
International CompuTex, Inc.            http://www.computex.com
(704)547-7383 x230                      FAX: (704)548-1948


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

Date: 14 Apr 1998 16:02:51 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: Info Regarding Perl 5.005
Message-Id: <6h01bb$ej1$1@news.ox.ac.uk>

In article <8czphtuo5k.fsf@gadget.cscaper.com>,
Randal Schwartz  <merlyn@stonehenge.com> wrote:
>>>>>> "Jason" == Jason Gloudon <jgloudon@manitoba.bbn.com> writes:
>
>Jason> Allen Choy <achoy@us.oracle.com> wrote:
>>> Anyone know what kind of features will be available in perl 5.005?
>
>Jason> Big new feature : Multi-Threading.
>
>... but only on platforms that support it.  And it slows down your
>perl (whether you're using it or not) by 30%.

Er, that was a development release over two months ago when tested on
one particular platform. The latest releases reduce that to 5%-10%
slowdown. Roughly half of that is down to an extra indirection whereby
many perl variables are no longer global but are in a structure
(per-thread for multithreaded perl) whose address is passed
around. That helps for embedding perl on some systems too (and many
people already accept the overhead of EMBED for perl). The other half
is from picking up that per-thread pointer and depends on how well
tuned the underlying O/S version of pthread_get_specific (or
equivalent) is. Many aren't particularly good but may be able to be
improved. Any extra slop is from additional locking to protect
between threads but that (unlike the indirection overhead) can be
kept down to an acceptable level when there's only one thread running.

>Unix users have already had threads for three decades now, though --
>  It's called "fork".

Yeah, but it doesn't really work doing

    exit({value => 42, name => "Smith", callback => sub { foo() }});

when you try to return a value from a separate process ;-)
With a threaded perl, you can do things like:

    $t = async { get_person("Fred") };
    ... # do other stuff while the lookup is proceeding
    $result = $t->join;
    print "surname is $result->{name}\n";
    &{$result->{callback}}();

Think of threads as a way to do fork but still have synchronised
access (read/write where necessary) to the parent's variables plus
the ability to return arbitrary perl structures to the caller.

Plus you get event loops for free:

    $q = new Thread::Queue;
    async {
        while (1) {
            $event = $q->dequeue();    
            do_something($event);
        }
    };
    ...
    $q->enqueue("my event");
    ...

Plus (if I get around to finishing off the implementation), you can
do pools of tasks in parallel easily with

    $pool = new Thread::Pool; # can limit low- and high- watermarks
    for ($i = 0; $i < 100; $i++) {
        $pool->do(\&something, $i);
    }
though it's been so long I've forgotten the API I did.

The sort of people who are intending to use threads are those who
want to do big database lookups in the background and then come
back later to pick up the results (not easily passed back from
forked processes) or else want numerous worker threads to append
continuously produced results onto a queue handled by one or more
other threads.

Since the original requestor wanted to know about the new features
in 5.005, not just the multithreading, I probably ought to mention
the bundled compiler (which has a Lint module and a (naive)
cross-reference module along with its "real" compiler parts) and
some support for strong typing and parse-time optimised access to
array refs via hash key syntax. Ilya's added some new regexp features.
Plus there's the Win32 merge stuff (which has been the main cause of
the delayed release).

>Just another guy not waiting for the new release...

Many people seem to be fairly interested in using the new features of
5.005; I'm sorry that there isn't anything in this release that
particularly inspires you.

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"I permitted that as a demonstration of futility" --Grey Roger


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

Date: 14 Apr 1998 18:05:03 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Info Regarding Perl 5.005
Message-Id: <6h08gf$vv$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Malcolm Beattie
<mbeattie@sable.ox.ac.uk>],
who wrote in article <6h01bb$ej1$1@news.ox.ac.uk>:
> Er, that was a development release over two months ago when tested on
> one particular platform. The latest releases reduce that to 5%-10%
> slowdown. Roughly half of that is down to an extra indirection whereby
> many perl variables are no longer global but are in a structure
> (per-thread for multithreaded perl) whose address is passed
> around. That helps for embedding perl on some systems too (and many
> people already accept the overhead of EMBED for perl). 

There is no overhead of EMBED.  Probably you meant MULTIPLICITY, and I
do not think *many* people (including those Macies) use that.

> The other half
> is from picking up that per-thread pointer and depends on how well
> tuned the underlying O/S version of pthread_get_specific (or
> equivalent) is. Many aren't particularly good but may be able to be
> improved.

Did anything happpened with the idea to put pointer to thread
structure (or maybe most used parts of the structure itself) into
atoms?  This may save some indirections.

> Since the original requestor wanted to know about the new features
> in 5.005, not just the multithreading, I probably ought to mention
> the bundled compiler (which has a Lint module and a (naive)
> cross-reference module along with its "real" compiler parts) and
> some support for strong typing and parse-time optimised access to
> array refs via hash key syntax. Ilya's added some new regexp features.

*And* major optimizations.

Ilya

P.S.  Note that adding a malloc-patch could have increase number of
      people wanting to switch.  1/2 ;-)  (Maybe not now, because of
      possibility to prolong alpha cycle.)


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

Date: Tue, 14 Apr 1998 16:59:12 +0100
From: "Mike Lacey" <Mike_Lacey@Cargill.Com>
Subject: Re: Ksh to Perl conversion
Message-Id: <6h0148$3v9@wind.cargill.com>

Try this:

#!/usr/local/bin/perl

open (FTP, "|ftp -niv $server")|| die;
print FTP "quote user ${user}";
print FTP "quote pass ${password}";
print FTP "cd '${filepath}'";
print FTP "get ${filename} ${downloadfilepath}/$filename";
print FTP "bye";


Bob wrote in message <6gvq1q$j3v$1@charm.magnus.acs.ohio-state.edu>...
>How do I convert the following ksh script to perl ??
>
>#!/usr/bin/ksh
>
>ftp -niv <<!
>open ${server}
>user ${user} ${password}
>cd '${filepath}'
>get ${filename} ${downloadfilepath}/$filename
>bye
>!





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

Date: Tue, 14 Apr 1998 13:03:17 -0400
From: Mir S Islam <mislam@mindspring.net>
Subject: multiple file/directory transfer with Net::FTP
Message-Id: <353396D5.BFCD453D@mindspring.net>

Greetings all, is it possible to transfer multiple files and entire
directory structure from one machine to another ? Kind of what mirroring
does, but in this case I want to initiate ftp session with remote host
and dump an entire directory structure in the remote host. Is that
possible either with Net::FTP or with something else ? Help is much much
appreciated.
--


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

Date: 14 Apr 1998 18:02:36 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: Numeric validation
Message-Id: <6h08bs$crk7@eccws1.dearborn.ford.com>

cberry@cinenet.net (Craig Berry) writes:
> ppp-support (ppp-support@canelle.telecom.uqam.ca) wrote:
> : Ok, it's so simple! The email suggestion work with my code
> 
> You see, that's the part Abigail and I don't understand.  The solution 
> you got in email (/^[0-9]+$/) is *identical* in behavior to one of the 
> solutions provided by the faq (/^\d+$/).  We're trying to figure out how 
> it can be that the former works for you but the latter doesn't.

The problem may not be with the regex, it may be with the double negatives
in the FAQ's answer.  I don't know about anybody else, but "unless" is
harder for me to read than "if not" or "if ... else".  Beginners might have
even more trouble with this than I do -- especially if they are coming from
C instead of Lisp.

I'd prefer the FAQ say:

   if (/\D/)            { print "has nondigits\n" }
   if (/^\d+$/)         { print "is a whole number\n" }
   if (/^-?\d+$/)       { print "is an integer\n" }
   if (/^[+-]?\d+$/)    { print "is a +/- integer\n" }
   if (/^-?\d+\.?\d*$/) { print "is a real number\n" }

   ...

After all of the regexps have been introduced, the answer could mention
that a concise check can be written like:

   die "not a number" unless /^\d+$/;

I don't like programming cook books much, but if people are going to
use the FAQ as one, we might as well make the recipes easy to follow.

- Ken

-- 
Ken Fox (kfox@ford.com)                  | My opinions or statements do
                                         | not represent those of, nor are
Ford Motor Company, Powertrain           | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section             | "Is this some sort of trick
                                         |  question or what?" -- Calvin


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

Date: Tue, 14 Apr 1998 11:28:13 -0700
From: "Jeremy Hermann" <jhermann@ricochet.net>
Subject: Perl and NT PWS Path problems
Message-Id: <6h09rs$1co$1@usenet52.supernews.com>

I am trying to run Perl scripts from NT Workstation's PWS.  I made the
appropriate registry settings to have PWS run perl.exe for .pl files.
Everything seems to work fine except that path information is all messed up
when I try to do relative paths.  It seems to think that the perl script is
a directory.

Please email me at jhermann@ricochet.net

Thanks

Jeremy Hermann






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

Date: Tue, 14 Apr 1998 13:57:30 -0400
From: "Jonathan S. Gines" <jsgines@uu.net>
Subject: PERL and Win32 email
Message-Id: <3533A38A.41C67EA6@uu.net>

I am developing a script that will tail a logfile on an NT server and
send an email and/or page to me.  Does anyone know if there is a command
in PERL win32 that is equivalent to UNIX's PERL:

system ("/usr/ucb/mail -s \"Logfile Alert"\ jsgines\@.uu.net");

where the above command shoots an email when a certain condition is
recorded the log files in question.

Basically, Im looking to find out if there is a command line approach to
sending an email from an NT Server without having to depend on an
interactive email application (ie., exchange, eudora, etc.)?  Someone
please help.  

P.S.
Performance monitor might do the trick since the logfile I want
monitored depend on a service, but the alerts are so inflexible and
don't allow trapping of information I want I can get out of PERL.  

Thanks in advance,

Jonathan Gines
Sr. Engineer
UUNET Technologies
703.645.4413


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

Date: Tue, 14 Apr 1998 14:09:26 -0400
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: PERL and Win32 email
Message-Id: <3533A656.2183@gecm.com>

Jonathan S. Gines wrote:
> 
> I am developing a script that will tail a logfile on an NT server and
> send an email and/or page to me.  Does anyone know if there is a command
> in PERL win32 that is equivalent to UNIX's PERL:
> 
> system ("/usr/ucb/mail -s \"Logfile Alert"\ jsgines\@.uu.net");
> 
> where the above command shoots an email when a certain condition is
> recorded the log files in question.

There is a 'net send' command for sending messages over your network but
this is not really email. The SMTP module may be a better choice.

Cheers,

Jim






--


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

Date: Tue, 14 Apr 1998 18:12:33 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: perl and win95
Message-Id: <ErF18x.DnD@world.std.com>

"chris" <ceison@lis.net.au> writes:

>I am experimenting with writting tcp servers written in perl and I have
>come accross a brick wall. I wish to know how to make a multithread server
>that is compatable with win95 (not linux).

The perlipc example will not work because Windows does not support a
fork() system call.

Real true pre-emptive threading won't be availabin perl until 5.005.

Probably your best bet is to use the select() system call to wait on
all the open sockets, and when you get input from them, perform some
action (quickly, since you aren't listening to the other sockets while
you are servicing the current one.) and when done with the current
transaction, loop back to the select call.

Some points of note:

1. You should use sysread() for reading the sockets instead of the
readline (<> or diamond) operator. Otherwise, buffering may cause
deadlock which may cause your client or your server to hang. The
sysread() function may not return complete lines, so you will have to
read as much as sysread has available, store it, and act on it only
when you have a compelete message.

2. You should use the syswrite() function to avoid blocking while
waiting for a client to get all of its data. Since syswrite() may not
take all of its data at once, you'll have to store what you want to
send somewhere,and write only when select() tells you that you can
write without blocking.

3. The accept() call blocks until a connection is available. What you
want to do is call accept only when select() tells you data is
available, call accept() to get a new socket, and then call select()
for all the open sockets.
-- 
Andrew Langmead


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

Date: Tue, 14 Apr 1998 11:28:35 -0700
From: "Mishra Aditya" <mishra.aditya@emeryworld.com>
Subject: Re: Perl Libraries @INC Problems
Message-Id: <6h09sk$5ue@news.cnf.com>

set PERL5LIB=<thedirectorywhereyour.pm resides>





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

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

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