[9098] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2716 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 25 15:07:17 1998

Date: Mon, 25 May 98 12:00:30 -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           Mon, 25 May 1998     Volume: 8 Number: 2716

Today's topics:
    Re: "print" and web-clients <aqumsieh@matrox.com>
    Re: Any build-in function to get the host name? <aqumsieh@matrox.com>
    Re: Clearly define "free software" Klaus.Schilling@home.ivm.de
    Re: Clearly define "free software" (le Fanttme)
    Re: DEBUG and Perl Win32 <rootbeer@teleport.com>
    Re: Encoding URLs with CGI.pm.  How? <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: GNU attacks on the open software community (Chris Nandor)
    Re: GNU attacks on the open software community (Chris Nandor)
    Re: GNU attacks on the open software community <vroonhof@frege.math.ethz.ch>
    Re: GNU attacks on the open software community (Fergus Henderson)
    Re: GNU attacks on the open software community <vroonhof@frege.math.ethz.ch>
    Re: GNU attacks on the open software community <vroonhof@frege.math.ethz.ch>
    Re: GNU attacks on the open software community <nathanh@chirp.com.au>
        Homepage <koffiepauze@usa.net>
    Re: How to create nonblocking socket in Perl ? <aqumsieh@matrox.com>
    Re: how to install CPAN modules (LWP)? <aqumsieh@matrox.com>
    Re: Need a "word-count" <rootbeer@teleport.com>
    Re: perl variables <aqumsieh@matrox.com>
    Re: Please Help <aqumsieh@matrox.com>
    Re: Please Help <rootbeer@teleport.com>
    Re: Possible to "skip" a record? (Mike Stok)
    Re: Possible to "skip" a record? <zenin@bawdycaste.org>
    Re: Randon files in Perl 5? <aqumsieh@matrox.com>
    Re: Randon files in Perl 5? <aqumsieh@matrox.com>
    Re: Randon files in Perl 5? <rootbeer@teleport.com>
    Re: Randon files in Perl 5? <hash@email.infotrade.co.uk>
    Re: replace line in file <aqumsieh@matrox.com>
    Re: Return via call-by-value in OLE function (Jan Dubois)
    Re: Send keystrokes to another app <JKRY3025@comenius.ms.mff.cuni.cz>
        Trouble with Script arguments <lemaitre@club-internet.fr>
    Re: Trouble with Script arguments <rootbeer@teleport.com>
    Re: Why does "each" not go thru entire hash?? <aqumsieh@matrox.com>
    Re: Zip code searching with perl <rootbeer@teleport.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 25 May 1998 13:02:00 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: "print" and web-clients
Message-Id: <3569A408.5F198302@matrox.com>

Guido Mensching wrote:

> Using the 'print'-command, some information is printed to the
> web-client, while other is not. E.g.
>
>   print $string;
>
> works but the following does not:
>
>   if (pos $string > 1) {print "No result"};
>
> If I run the program locally under UNIX, both of them work.
> Can anybody help me?
>
> (You'll have noticed that I'm a beginner, so pardon me if the question
> is too simple. I didn't find anything in the FAQs I read).
>
> Thanks in advance.

I believe the problem is with output buffering. print() statements don't
actually appear until the output buffer becomes full, or until you reach an
end of line \n character.so .. try the following

if (pos $string > 1) {print "No result\n";}

Alternatively, you might want to disable the buffering. Check out the $|
variable.

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Mon, 25 May 1998 11:37:33 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Any build-in function to get the host name?
Message-Id: <3569903D.9697D0F7@matrox.com>

Alex Dong Li wrote:

> Hello, there,
>
> Is there a build-in function to get the host name?
>
> chop($hostname=`hostname`); works on unix and NT, but is there a perl-build-in
> function to do so?
>
> Regards,
>
> ALex

 I think you need Sys::Hostname

alternatively,
On a unix machine, you might be able to get the host name by looking at the
variable $ENV{HOST}

Hope that helps,

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: 25 May 98 17:36:31 GMT
From: Klaus.Schilling@home.ivm.de
Subject: Re: Clearly define "free software"
Message-Id: <3569ac1f.0@news.ivm.net>

>
>                      Re: Clearly define "free software"
>                                       
>   From: fantome/@/usa/./net (le Fanttme)
   References:
>          <3567cffc.0@news.ivm.net> 
>          <6k9s4d$qi0$1@Venus.mcs.net> 
>          <35691F35.6B5E@imag.fr>
>On Mon, 25 May 1998 09:35:17 +0200, Yann Kieffer
><Yann.Kieffer@imag.fr> wrote:
>
>>Leslie Mikesell wrote:
>>>
>>> In article <3567cffc.0@news.ivm.net>,  <Klaus.Schilling@home.ivm.de> wrote:
>>
>>> >Proprietary software like oracle is immoral.
>>>
>>> Why do you think that?  I can understand the concept that you do
>>> not want to pay for software that someone else developed and therefore
>>> owns.  I don't understand the concept that the existence of
>>> this work is immoral.  Is someone harmed by the fact that this
>>> work, which wouldn't otherwise exist, is available to people willing
>>> to help recover the cost of it's development and encourage further
>>> such work?

Intellectual property is theft from the collective consciousness, thus evil.

>>
>>Many people buy win95. Do you thing people buy it to help
>>MS recover the cost of its development and encourage further
>>such work?
>
>Your point? This does not make proprietary software immoral. People
>buy Win95 because it runs the programs that they need in order to get
>their jobs done. I've asked before, and I'll ask again -- what's a
>small business person like my father to do? Where is the open source
>version of WordPerfect? Of Quattro Pro? Of Quicken? Of WinFax? By
>golly and by gosh, they don't exist! And the two "best" editors that
>the open source community has to offer are both too difficult for the
>average person to use, as well as the fact that they don't produce
>formatted output without using a non-WYSIWYG presentation. My dad got
>over that after we got rid of the Commodore 64.
>
>So where are they?

Irrelevant. Anyone who has not been spoilt by multimedia junk and evil 
proprietarists like M$, Lotu$, Apple, Oracle, ... , and is not a 
fool or teenie, can use the best software of all times, the GNU Emacs on a
vt100, instead of all the wysiwyg junk. 

          Klaus Schilling





















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

Date: Mon, 25 May 1998 18:17:36 GMT
From: fantome/@/usa/./net (le Fanttme)
Subject: Re: Clearly define "free software"
Message-Id: <997CCB718383D4DB.B8B6A4B53111C201.0288E5C98E1547B8@library-proxy.airnews.net>

On 25 May 98 17:36:31 GMT, Klaus.Schilling@home.ivm.de once again
proves himself a fool:

>>>> Why do you think that?  I can understand the concept that you do
>>>> not want to pay for software that someone else developed and therefore
>>>> owns.  I don't understand the concept that the existence of
>>>> this work is immoral.  Is someone harmed by the fact that this
>>>> work, which wouldn't otherwise exist, is available to people willing
>>>> to help recover the cost of it's development and encourage further
>>>> such work?
>
>Intellectual property is theft from the collective consciousness, thus evil.

So, Mr. Schilling ... do you read the newspaper? Do you read novels?
Do you read other books? More to the point, I should ask if you pay
for what you read or if you steal it because you believe that IP is
theft.

>>Your point? This does not make proprietary software immoral. People
>>buy Win95 because it runs the programs that they need in order to get
>>their jobs done. I've asked before, and I'll ask again -- what's a
>>small business person like my father to do? Where is the open source
>>version of WordPerfect? Of Quattro Pro? Of Quicken? Of WinFax? By
>>golly and by gosh, they don't exist! And the two "best" editors that
>>the open source community has to offer are both too difficult for the
>>average person to use, as well as the fact that they don't produce
>>formatted output without using a non-WYSIWYG presentation. My dad got
>>over that after we got rid of the Commodore 64.
>>
>>So where are they?
>
>Irrelevant. Anyone who has not been spoilt by multimedia junk and evil 
>proprietarists like M$, Lotu$, Apple, Oracle, ... , and is not a 
>fool or teenie, can use the best software of all times, the GNU Emacs on a
>vt100, instead of all the wysiwyg junk. 

Obviously.

Yes, O Great And Wise Schilling. I Am SOOOOOO Sorry That I Have
Transgressed Against Your Great Church Of So-Called Free Software.

Fool.

<plonk>

-f
-- 
austin ziegler * fantome*@*vnet*.*net   * http://fantome.vnet.net/
---------------* aziegler*@*vcela*.*com * -------------------------
Remove the stars to email me            * Ni bhionn an rath ach
my words my opinions my ideas           * mar a mbionn an smacht
  -- I Argue Ideas, Not Beliefs: Give Up Your Dogma --


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

Date: Mon, 25 May 1998 17:22:57 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: DEBUG and Perl Win32
Message-Id: <Pine.GSO.3.96.980525101105.26181C-100000@user2.teleport.com>

On Mon, 25 May 1998, David Shapiro wrote:

> I want to use perl to read debug information and display its output in
> a readable fashion. 

I think you're talking about the output of a program called "debug", not
the Perl built-in debugger. Right? Presumably, "debug" debugs things other
than Perl scripts.

> For example, I want to extract out bios versions using debug.  How do
> you convert the mumbo jumbo to something readable?  Is the debug info
> binary or hex?  I think it has something to do with hex() or oct() and
> maybe sprintf or printf, but I do not know for certain.

Maybe somebody who knows more about that program could help you more with
it, if the docs don't tell you about it. But you can match all sorts of
data with Perl's patterns. For example, this code might be useful in
interpreting a line with hex data. 

    if (/Address:\s+([\dA-Fa-f]+)/) {
	$address = hex($1);
    }

Perl is very good at working with the output of just about any program.
Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 25 May 1998 19:59:53 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: Encoding URLs with CGI.pm.  How?
Message-Id: <356A3029.11AC@comenius.ms.mff.cuni.cz>

Luke Steele wrote:
> 
> Hi,
> 
> I'm having real difficulty working out how to encode URLs with CGI.pm.
> If I've got a scalar (called $var, say):
> 
> $var = "A string containing spaces, &ampersands & and various other
> charaters!!#%$&";
> 
> How do convert this into a string suitable for use in a URL?  I've
> read all the documentation and FAQs I've been able to lay my hands on
> but to no avail, so any help would be greatly appreciated!
> 
> --
> Luke Steele
> ljs@cableinet.co.uk

TIMTOWDI, as usual.

use Enurl; #http://www.fmi.cz/private/Jenda

print "script.cgi?param=",enurl("Some text with & and = and whatever
#&^%#*^&%."),
 "&email=",enurl('"Jan Krynicky" <Jenda@McCann.cz>'), "\n";

or

print "script.cgi?",
 enurl(
  {
   param => "Some text with & and = and whatever #&^%#*^&%.",
   email => '"Jan Krynicky" <Jenda@McCann.cz>'
  }
 ),"\n";

or

use Interpolation  #http://www.plover.com/~mjd/perl/Interpolation
  '?' => sub { enurl({ split /$;/o, $_[0] })};

print "script.cgi$?{
   param => "Some text with & and = and whatever #&^%#*^&%.",
   email => '"Jan Krynicky" <Jenda@McCann.cz>'
  }\n";

Cheers, Jenda


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

Date: Mon, 25 May 1998 17:04:35 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: GNU attacks on the open software community
Message-Id: <pudge-2505981259000001@dynamic265.ply.adelphia.net>

In article <6kc3do$sn1$1@mulga.cs.mu.OZ.AU>, fjh@cs.mu.oz.au (Fergus
Henderson) wrote:

# You may be right when talking about a single new CD.
# But if Tom wants to prevents all further distribution of PerlFAQ on
# CDs, then I think this would clearly have a market effect. 

He could try, but it would be tough.  How can you stop people from
distributing something on CD-ROM that everyone already has on CD-ROM? 
Good luck trying.

# >Tom has allowed this market to change, knowingly.  He cannot, therefore,
# >come back and say that continued infringement affects his market,
# 
# Why not?  After all the continued infringments *do* affect his market.
# Why is the fact that Tom did not pursue the infringements earlier
# relevant?

It is very relevant.  By not pursuing them, he thus allows the market to
become saturated with CD-ROMs containing perlfaq, and thus is a party to
the circumstances that destroy any market effect further distribution
would have.


In article <slrn6mivms.7js.hgoldste@bbs.mpcs.com>, hgoldste@bbs.mpcs.com wrote:

# On Mon, 25 May 1998 14:08:20 GMT, Chris Nandor <pudge@pobox.com> wrote:
#  : In article <slrn6mistj.7js.hgoldste@bbs.mpcs.com>, hgoldste@bbs.mpcs.com 
# wrote:
#  : # 
#  : # C doesn't follow.  You appear to be relying on a sort of
#  : # commutative-laches theory.  A cite, please.
#  : 
#  : Feel free to show how Tom could prove that a new CD with perlfaq could
#  : impact his market when the market is already saturated with CDs he has
#  : knowingly allowed to be distributed with perlfaq on them.  
# 
# It's incumbent upon you to disclose the grounds of your, umm, creative
# reliance on Tom's mental state vis-a-vis the various remedies provided
# for in the Copyright Act.   

Not really.

#  : Please, I am
#  : all ears/eyes.
# 
# So asking you for a cite is asking too much, yes?

Salinger v. Random House, 1987; J.D. Salinger had a bunch of letters that
someone wanted to publish.

The works were not published anywhere previously, and market effect was
key; to publish it meant to destroy any potential for sale by the copyght
owner.

Another interesting case involving market effect is Universal Studios v.
Sony, 1979, involving home recording of TV shows for personal,
noncommercial use, but that does not have much specifically to do with the
matter here, except to give another example of the main principle of
market effect.

If Salinger's letters had (1) not been valued by the court at $500,000,
and (2) not been unpublished, he likely would not have been able to stop
Random House.  perlfaq is both "published" on thousands of CD-ROMs, and
not worth very much as a monetary amount, simply because it is on all
those CDs and distributed already -- without cost -- with every full
distribution of perl.

Remember that market effect is THE most important factor, usually, in
determining fair use.  And I cannot see how anyone could argue that
putting perlfaq on a CD could at all impact Tom's potential market for it,
considering that it is given away for FREE -- without cost -- in the perl
distribution and on CD-ROMs, with Tom's explicit or implicit permission.

Now print is another matter, or an "added value" version might be another
matter too (I don't know what that would be ... maybe some "Multimedia
perlfaq CD-ROM" or something).  That would hurt his potential market,
because something like that is not already out there.  But putting
perlfaq*.pod on a CD-ROM does nothing whatsoever to his market, and must
be construed as fair use.

Any continued argument against this should simply show how distribution on
CD-ROM could affect his potential market.  OTOH, this getting far into the
hyopthetical now, and maybe does not even belong on this newsgroup. 
That's OK, I really don't have anything left to say.  If you don't get it
by now, oh well.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Mon, 25 May 1998 17:06:21 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: GNU attacks on the open software community
Message-Id: <pudge-2505981300470001@dynamic265.ply.adelphia.net>

In article <m2iumu8n70.fsf@mailhost.neuroinformatik.ruhr-uni-bochum.de>,
David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de> wrote:

# pudge@pobox.com (Chris Nandor) writes:
# 
# > In article <6kat3l$3tu$1@mulga.cs.mu.OZ.AU>, fjh@cs.mu.oz.au (Fergus
# > Henderson) wrote:
# > 
# > # The only way that a for-profit CD vendor can prove that no profit
# > # was received for the perlfaq itself is to sell the whole CD at cost.
# > 
# > You don't have to prove anything at all.  The hypothetical plaintiff
# > does.  So if this would go to court, the plaintiff would have to prove
# > that there was profit to be made from the inclusion of perlfaq, which I
# > must say would be damned near impossible.
# 
# Nonsense.  There is a profit made from the entire CD, the CD consists
# of a lot of stuff just like the Perl FAQ (software, docs, etc.).  What
# makes the Perl FAQ special with regard to the other stuff on the CD,
# so that you can say the other stuff will turn a profit, but not the
# Perl FAQ?  Is its quality as bad as that?  The gist of this discussion
# would suggest otherwise.

I have never seen a CD-ROM that put a value on the free software or
documentation contained therein.  They put a value on the fact that it is
on a CD-ROM with lots of other things, which is a very different animal.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 25 May 1998 19:46:18 +0200
From: Jan Vroonhof <vroonhof@frege.math.ethz.ch>
Subject: Re: GNU attacks on the open software community
Message-Id: <byzpg6i6qd.fsf@bolzano.math.ethz.ch>

fantome/@/usa/./net (le Fanttme) writes:

> on the CD. I would bet heavily that the Perl stuff doesn't raise the
> consumer cost of the RedHat CDs at all, making it a legal inclusion.

Well, I certainly do not see that in the licence. What if Redhats CD
was a CD full of Perl snippets? What if it was "The Stonhenge CD of
perldocs brought to you by INTEL" for $250? For all of these putting the
perlfaq/perltoot raises the production costs by equal amount.

I understand (I yhink) why and what tom wants to protect himself from
however as I read it the licence seems to forbid quite a lot more.

Jan


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

Date: 25 May 1998 18:06:40 GMT
From: fjh@cs.mu.oz.au (Fergus Henderson)
Subject: Re: GNU attacks on the open software community
Message-Id: <6kcbvg$2oe$1@mulga.cs.mu.OZ.AU>

pudge@pobox.com (Chris Nandor) writes:

>In article <6kc3do$sn1$1@mulga.cs.mu.OZ.AU>, fjh@cs.mu.oz.au (Fergus
>Henderson) wrote:
>
># You may be right when talking about a single new CD.
># But if Tom wants to prevents all further distribution of PerlFAQ on
># CDs, then I think this would clearly have a market effect. 
>
>He could try, but it would be tough.  How can you stop people from
>distributing something on CD-ROM that everyone already has on CD-ROM? 

Well, you send the commercial CD-ROM vendors letters threatening to sue
if they don't stop, and if they don't stop, then you sue them
(for copyright infringement, of course).

It doesn't matter that a lot of people have it on CD-ROM already --
stopping the commercial distributors will still make it much harder
for people to get.  That will have a market effect -- some of the
people who would have bought it on CD-ROM from the commercial CD-ROM
distributors will instead buy your book.

(The market for this stuff is expanding, anyway, so
if the supply is plugged, then the fixed amount of existing CD-ROMs
will become smaller relative to the market size as time goes buy.)

># >Tom has allowed this market to change, knowingly.  He cannot, therefore,
># >come back and say that continued infringement affects his market,
># 
># Why not?  After all the continued infringments *do* affect his market.
># Why is the fact that Tom did not pursue the infringements earlier
># relevant?
>
>It is very relevant.  By not pursuing them, he thus allows the market to
>become saturated with CD-ROMs containing perlfaq,

But the market has not become saturated with such CD-ROMs,
or at least if the supply is blocked, then it will not remain
saturated.

Yes, this is all hypothetical.  The point is that based on the written
license, Tom C. would have a reasonable case to argue in court.
Maybe he'd win, maybe he'd lose, but as a CD-ROM distributor you
would be foolish to take the risk, unless you had explicit permission
from Tom C.

--
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3        |     -- the last words of T. S. Garp.


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

Date: 25 May 1998 20:06:14 +0200
From: Jan Vroonhof <vroonhof@frege.math.ethz.ch>
Subject: Re: GNU attacks on the open software community
Message-Id: <bysolyi5t5.fsf@bolzano.math.ethz.ch>

James Youngman <JYoungman@vggas.com> writes:

>   Jan> Huh? Most gnu stuff comes with documentation under the same
>   Jan> licence as the software.
> 
>    --- No, it doesn't! ---

Woops you are right. If effects are almost the same as that of the
LGPL of course...

Jan


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

Date: 25 May 1998 19:56:26 +0200
From: Jan Vroonhof <vroonhof@frege.math.ethz.ch>
Subject: Re: GNU attacks on the open software community
Message-Id: <bywwbai69h.fsf@bolzano.math.ethz.ch>

abigail@fnx.com (Abigail) writes:

> The URL is <URL:http://www.gnu.org/prep/tasks_3.html>.

Well it must be obvious that this page is just a part of a WWW
reproduction of a texinfo document. A "page" on any hypertext system
should never be considered on its own. 
Every "page" of that part of gnu.org 
also links back to the gnu.org page which has "What is free software?" almost
directly after the task lits.

Yes it would be better if the hypertext system was used even more  and any 
use of free would point to that.

> the page it is explained what they mean by free? Could you also point
> out why 'free' isn't mentioned for the manuals of Ghostscript, tcsh,
> PIC, X-window applications and the various X-window managers?

Maybe because there is no comment following about non-free books with
wich to contrast?

I think you are beying silly here. 

Jan

P.S. Yes the entry should be updated.


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

Date: 24 May 1998 02:11:12 +1000
From: Nathan Hand <nathanh@chirp.com.au>
Subject: Re: GNU attacks on the open software community
Message-Id: <m3k97d7ysf.fsf@stoli.spirits.org.au>

smcnabb@interlog.com (Steve McNabb) writes:

> In article <6k1ker$fkv$1@mulga.cs.mu.OZ.AU>, fjh@cs.mu.oz.au says...
>
> >My dictionary has an addendum.  I never check it. 
> >Why not?  Because it is a pain.  Chances are, if the word isn't in the
> >main dictionary, it won't be in the addendum anyway.
> >
> >The same applies to software documentation.  It is much
> >easier for users if all the documentation is in one place.
> >If it is not, then the documentation is less than optimal.
>
> Booooooo......Hisssssss
>
> Sorry, but "i never bother to read the addendum" is possibly _the_
> lamest of the lame excuses for not reading the docs.  If you can't
> be bothered to spend a precious mouse click or a few keystrokes to
> find out the information, then don't expect _anyone_ to spend an
> extra 15 seconds to make your life easier.  Try a little and maybe
> you'll find that people are a litte more willing to accommodate you.

If there are a thousand bug fixes, then there a thousand addendums
and their total volume would possibly exceed the original quantity
of the book being addended!

> Welcome to my killfile :)

What nonsense is this?

-- 
Modern computers have advanced to the point where they are extremely
intuitive, though obviously you have to spend a lot of time learning
how to use them first.


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

Date: Mon, 25 May 1998 19:35:44 +0200
From: Vriend <koffiepauze@usa.net>
Subject: Homepage
Message-Id: <3569ABF0.6AE4@usa.net>

Hi, my name is Klaas and I have a brand new Homepage. I want many hits
this week and i want to ask visit my site.....

http://www.angelfire.com/ak/vriend

Thanks a lot, friends....

Klaas


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

Date: Mon, 25 May 1998 13:08:01 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to create nonblocking socket in Perl ?
Message-Id: <3569A571.9A60DB0E@matrox.com>

Sun Qinghe wrote:

> Hi,
>
>     I want to modify the sample client program in Programming Perl so that
> I can set timeout for connect(). i.e., if the server doesn't respond in
> (say) 4 seconds, then I will give up the connection to avoid deadlock.
>
>     Any help would be really appreciated.
>
> Sun

 I am not the best person to give you an advice in this case, but I think you
can make use of the alarm() function. Have this function and the connect()
function inside the same block and try to capture the SIGALARM signal.
Hope that helps.

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Mon, 25 May 1998 13:11:39 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: how to install CPAN modules (LWP)?
Message-Id: <3569A64B.5825F100@matrox.com>

brz@hotmail.com wrote:

> #!/usr/local/bin/perl
> BEGIN {
>   unshift(@INC, "/export/home/brz/lib");
> }

try :use lib '/export/home/brz/lib';

instead of the BEGIN block. No guarantee it would work though!

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Mon, 25 May 1998 17:28:15 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Need a "word-count"
Message-Id: <Pine.GSO.3.96.980525102556.26181D-100000@user2.teleport.com>

On 24 May 1998, Gabor wrote:

>     $cnt += s/(word)/$1/g;

Checking for word breaks with \b may also be appropriate, unless you wish
to also count "wordy", "password", and "swordfish". Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 25 May 1998 11:30:35 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: perl variables
Message-Id: <35698E9B.DDD778F2@matrox.com>

Mike Stok wrote:

> In article <6jvh3c$kin@bgtnsc03.worldnet.att.net>,
> Jeff & Rebecca Jo Isom  <jeffyjo-isom@worldnet.att.net> wrote:
>
> >Mike Stok wrote:
>
> >> In article <6jv9e8$23t@bgtnsc02.worldnet.att.net>,
> >> Jeff & Rebecca Jo Isom  <jeffyjo-isom@worldnet.att.net> wrote:
> >> >Is there a way to check the contents of a variable to see if it contains
> >> >a specific character?
> >> >
> >> >For example if I have a variable from a form that stores an email
> >> >address and I want to make sure the variable contains a @.  How would I
> >> >accomplish this?
> >>
> >> One way to do it is to say
> >>
> >>   if (index ($var, '@') >= $[) {
> >>     ...
> >>   }
> >
> >This actually needs to be
> >
> >    if (index ($var, '@') <= $[) {
> >      ...
> >    }
> >
> >to work right

Ever heard of regular expressions?if ($var =~ /\@/) {
    ...
}--

Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Mon, 25 May 1998 12:56:04 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Please Help
Message-Id: <3569A2A4.B06AC90@matrox.com>

Ann wrote:

> exec "/bin/echo", $fw > "/home/$user/.forward";

 You might wanna try:

exec "/bin/echo", "$fw", ">", "/home/$user/\.forward";

Although .. there are simpler ways!

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Mon, 25 May 1998 18:44:52 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Please Help
Message-Id: <Pine.GSO.3.96.980525114204.26181K-100000@user2.teleport.com>

On Mon, 25 May 1998, Ala Qumsieh wrote:

> Ann wrote:
> 
> > exec "/bin/echo", $fw > "/home/$user/.forward";
> 
>  You might wanna try:
> 
> exec "/bin/echo", "$fw", ">", "/home/$user/\.forward";
> 
> Although .. there are simpler ways!

Yes; and some of them actually redirect the output of the prorgam
which was exec'ed . :-)

Seriously, why did you quote $fw? Why did you backwhack the period? And
why do you recommend exec'ing /bin/echo, when Perl is totally capable of
printing? (Okay, only half seriously. :-) 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 25 May 1998 16:53:28 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Possible to "skip" a record?
Message-Id: <6kc7m8$atp@news-central.tiac.net>

In article <35699b30.277073@news.interlog.com>,
coop <jcoop-no-spam@interlog.com> wrote:
>Hi,
>
>I'm writing a small application that will parse a number of HTML
>files.  Files are similar in layout, with minor variations.  I am
>looping through the file line by line and grabbing what I want.  Is it
>possible, say, when I get to a section where I want to process a
>number of lines, I can skip records and process the line.  For
>example:
>
>while <FILE>

 [...]
  
>if (/Address/) {
>             # get first line of address
>             # go to next line in file and get second line, don't want
>	# to say "next" here as it will take me back up to "while" at
>             # beginning of program?
>}

You can just say something like this:

  if (/Address/) {
    # stash first line

    chomp ($secondLine = <FILE>);
    if (defined $secondLine) {
      # stash second line
    }
    else {
      # end of file, unexpected too...
    }
  }

if you like.

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: 25 May 1998 17:11:50 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Possible to "skip" a record?
Message-Id: <896116751.169402@thrush.omix.com>

coop <jcoop-no-spam@interlog.com> wrote:
: if (/Address/) {
:              # get first line of address
:              # go to next line in file and get second line, don't want
: 	# to say "next" here as it will take me back up to "while" at
:              # beginning of program?
: }

	$_ = <FILE>; # Grab next line

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Mon, 25 May 1998 11:59:41 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Randon files in Perl 5?
Message-Id: <3569956D.C6B3F865@matrox.com>

Scott Vetter wrote:

> Is it possible to have random files that can be read and written to
> by a Perl 5 programs?

 There might be a module for this (as a matter of fact I am almost sure
there is). Try looking in CPAN.

But, if you prefer a quick (and possibly not so secure) way, you might
try something like this:

1) Generate a random file name. Your best bet is to use a combination of
the processid ($$) and the local time to create your random seed.
srand( time() ^ ($$ + ($$ << 15)) );
$name = int rand ($$ + 1);

2) Open the file for writing
open FILE, "$name.txt" or die "Can't open $name.txt: $!";

Or some variation of that! Hope that helps.

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Mon, 25 May 1998 12:00:59 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Randon files in Perl 5?
Message-Id: <356995BB.8AF9539E@matrox.com>

Ala Qumsieh wrote:

> 2) Open the file for writing
> open FILE, "$name.txt" or die "Can't open $name.txt: $!";

That should've been:

open FILE, ">$name.txt" or die "Can't open $name.txt: $!";

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Mon, 25 May 1998 18:37:30 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Randon files in Perl 5?
Message-Id: <Pine.GSO.3.96.980525112813.26181H-100000@user2.teleport.com>

On Mon, 25 May 1998, Ala Qumsieh wrote:

> 1) Generate a random file name. Your best bet is to use a combination of
> the processid ($$) and the local time to create your random seed.

Actually, with modern versions of Perl, the default seed is fine for most
purposes. It already incorporates the time and process ID, among other
magic numbers.

> srand( time() ^ ($$ + ($$ << 15)) );
> $name = int rand ($$ + 1);

Hmmm... Are you sure that that's what you want? The process ID might be,
for example, 10. (!)

> 2) Open the file for writing
> open FILE, "$name.txt" or die "Can't open $name.txt: $!";

That's not opening the file for writing!

Cheers...

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 25 May 1998 19:39:44 +0100
From: "Alex Barilo" <hash@email.infotrade.co.uk>
Subject: Re: Randon files in Perl 5?
Message-Id: <6kc831$fsn@news3.force9.net>


>> Is it possible to have random files that can be read and written to
>> by a Perl 5 programs?
>
> There might be a module for this (as a matter of fact I am almost sure
>there is). Try looking in CPAN.
>
>But, if you prefer a quick (and possibly not so secure) way, you might
>try something like this:
>
>1) Generate a random file name. Your best bet is to use a combination of
>the processid ($$) and the local time to create your random seed.
>srand( time() ^ ($$ + ($$ << 15)) );
>$name = int rand ($$ + 1);

I was always wondering is it safe enough to make random file name from
memory address on HP-UX. For example like this
($FName = \$AnyVar) =~ s/\((.+)\)/$1/;

Cheers,
Alex.
--
All you need is PERL





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

Date: Mon, 25 May 1998 12:27:14 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: replace line in file
Message-Id: <35699BE2.475FC8E5@matrox.com>

Ryan McGuigan wrote:

> for example, if I try to replace testing with kill, I'll end up with
> killing.
>
> here's a small bit of code
> open TEST, '+<testfile' or die "can't open it. $!\n";
> while (<TEST>) {
>         if ($_ =~ /$search/) {
>                 print TEST "kill";
>         }
> }
> close TEST;
>
> thanks,
> Ryan

 Maybe you'de like to investigate the \b (boundary) assertion.

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Mon, 25 May 1998 20:23:45 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Return via call-by-value in OLE function
Message-Id: <356cb5c7.3333122@news2.ibm.net>

[mailed & posted]

Daniel Warren <dwarren@starnetinc.com> wrote:

>How can I use an OLE function that returns values via references or
>pointers in the arguments?  I am trying to determing the bounding box

Your terminology seems slightly off: You want to pass parameters by reference
(so that the called function can change them). Call by value is the default and
doesn't allow this.

>for some graphics in a Visio document.  The Visio selection class has a
>method that returns the bounding box:
>
>$VisioDoc->ThisDocument->Selection->BoundingBox($btype, $b, $l, $t, $r);
>
>Where b,l,t, and r are the (bottom, left) and (top, right) coordinates
>of the box. $btype is an integer constant indicating the type of box.

You need Win32::OLE from libwin32-0.12. Earlier versions do not support this.
Try the following code:

use Win32::OLE::Variant;
my $b = Variant(VT_I4|VT_BYREF, 0);
my $l = Variant(VT_I4|VT_BYREF, 0);
my $t = Variant(VT_I4|VT_BYREF, 0);
my $r = Variant(VT_I4|VT_BYREF, 0);
$VisioDoc->ThisDocument->Selection->BoundingBox($btype, $b, $l, $t, $r);

Use whatever type Visio requires for its BYREF parameters. After the method
returns, these variable will contain the returned values. Win32::OLE::Variant
objects have overloaded conversions to string and numeric format. You can use
them now (mostly) like normal scalar values. See the included POD in Variant.pm
for more information.

-Jan


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

Date: Mon, 25 May 1998 20:16:01 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: Send keystrokes to another app
Message-Id: <356A33F1.1E8@comenius.ms.mff.cuni.cz>

jstephan@my-dejanews.com wrote:
> 
> Hi,
> 
> Does anyone out there know how to send keystrokes to an application
> using perl on a Win32 system.
> 
> I'm trying to talk to another application that doesn't have OLE support
> and will respond to single keys.
> 
> Thanks,
> -Jon Stephan
> 
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading

In case you use the AS port you may 
use Win32::Setupsup; # ftp://ftp.roth.net/pub/ntperl/SetupSup/


HTH, Jenda


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

Date: Mon, 25 May 1998 19:17:05 +0200
From: Eric LEMAITRE <lemaitre@club-internet.fr>
Subject: Trouble with Script arguments
Message-Id: <3569A791.8A4D6EBC@club-internet.fr>

Hello !

I have some trouble fetching arguments of a PERL Script on Windows-NT.
Its is a kind of "Program.pl parameter" like command, I would like to fetch
directly the "parameter", which should be normally "$1" for first parameter
while "$0" is the command itself so "Program.pl", but seems no way still
under Windows-NT !
I found out that under MS-DOS command, this is possible with a kind of "$var
= $ARGV[0];" which effectively gives me the "parameter" passed to the
"Program.pl" PERL script, but under HTML, this is ineffective.
So please, what is the proper procedure to fetch parameters passed to
CGI-PERL scripts under HTML ? Could someone forward me with a short example
?
Thanks by advance !

Bye !

--
Eric LEMAITRE, Inginieur CNAM, lemaitre@mail.club-internet.fr
Directeur formation Internet ` la Compagnie des Signaux
(J'attends un motif sympa pour aggrimenter ma signature)




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

Date: Mon, 25 May 1998 18:50:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Trouble with Script arguments
Message-Id: <Pine.GSO.3.96.980525114657.26181L-100000@user2.teleport.com>

On Mon, 25 May 1998, Eric LEMAITRE wrote:

> So please, what is the proper procedure to fetch parameters passed to
> CGI-PERL scripts under HTML ? 

Implement the CGI protocol. Or, better, use a module which does it for
you. The CGI.pm module, which comes with perl, has plenty of
documentation. Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 25 May 1998 11:42:35 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Why does "each" not go thru entire hash??
Message-Id: <3569916B.FA2C8EF7@matrox.com>

Tom Phoenix wrote:

> On Wed, 20 May 1998, Tom Turton wrote:
>
> > I am seeing some bizarre behavior while trying to use a while/each on a
> > hash.  It appears to jump into the middle/end of the hash the first time
> > through.
>
> Do you mean that each() doesn't traverse the entire hash? That's not
> supposed to happen, but perhaps you're not re-setting the iterator
> somewhere.
>
> > %runway = ("DFW18R", 0, "DFW18L", 1, "DFW17R", 2, "DFW17C", 3, "DFW17L",
> > 4,  "DFW13R", 5, "DFW35C", 6, "DFW35R", 7 , "DFW35L", 8, "DFW36L", 9,
> > "DFW36R", 10, "DFW31R", 11, "DFW13L", 12, "DFW31L", 13);
> > .
> > .
> > for ($rwi=0; $rwi<14; $rwi++) {
> >      while( ($m,$n) = each(%runway)){
> >             if ($n == $rwi) {
> >                  print OUTFILE "\$rwi = $rwi, \$n = $n\n";
> >             }
> >      }
> > }
>
> Perhaps you should consider using an inverted hash instead of looping over
> the entire hash. Perhaps not. :-)
>
> > When I run it in my main program, the first time through ($rwi = 0), it
> > appears to check starting with 'values' 3,6,10 then goes on to index
> > $rwi=1
>
> If I'm understanding this correctly, that sounds as if your iterator was
> left set partway through the hash. Could you have been iterating over that
> hash earlier in your program, perhaps? If that's the case, you may reset
> the iterator by simply using keys() in a scalar (or void) context, so
> adding this line before the loop should fix it.
>
>     keys %runway;       # reset hash iterator, just in case
>
> Good luck!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/

 I don't exactly get the question. But I think the "problem" might be with
the way Perl stores its hashes (in an "apparently" random order). Of course,
it does so to maximize memory usage efficiency.

Ignore my comments if I'm totally off :-)

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Mon, 25 May 1998 17:45:11 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Zip code searching with perl
Message-Id: <Pine.GSO.3.96.980525103215.26181F-100000@user2.teleport.com>

On Mon, 25 May 1998, Jake Baillie wrote:

> I would like to insitute a function where it would be able to search by
> zip code, i.e., if I gave it a zip code of 56049 it would find the nearest
> zip code up or down. I can't seem to find out how to do this. Does anybody
> have any ideas on a search routine for this?

Now, you know that zip codes that are numerically close doesn't
necessarily mean locations that are physically close, and vice versa,
right? 

But if you want the nearest zip numerically, just do a linear scan of the
available zip codes, saving the "closest seen so far" as you go along.
Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

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

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