[17903] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 63 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 15 11:05:46 2001

Date: Mon, 15 Jan 2001 08:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <979574708-v10-i63@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 15 Jan 2001     Volume: 10 Number: 63

Today's topics:
        8 letters <Per-fredrik.Pollnow@epk.ericsson.se>
    Re: 8 letters <josef.moellers@fujitsu-siemens.com>
    Re: 8 letters <josef.moellers@fujitsu-siemens.com>
    Re: FAQ 8.44:   How do I open a file without blocking? (Reto Hersiczky)
        File Handle Pipe question geek@microgeek.com
    Re: File Handle Pipe question (Rafael Garcia-Suarez)
        Limits on array and hash storage <EUSWMCL@am1.ericsson.se>
    Re: Limits on array and hash storage (Rich Lafferty)
    Re: LWP::UserAgent with HTTP::Cookies not keeping cooki <zarathustra@enviroweb.org>
    Re: name of var $_ is pointing to? <bernie@fantasyfarm.com>
    Re: name of var $_ is pointing to? (Rafael Garcia-Suarez)
        New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
    Re: Perl working with Java??? (Cameron Laird)
    Re: Price Comparison script? (Rich Lafferty)
        Random Numbers with a Twist <coppocks@bellsouth.net>
    Re: Regular Expression Question <bob_simon@my-deja.com>
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
        Troubleshooting flock failure [CODE] <kj0@mailcity.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 15 Jan 2001 15:46:15 +0100
From: "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
Subject: 8 letters
Message-Id: <93v2lq$ov$1@newstoo.ericsson.se>

Hi,
I was wondering if you guy's could help me out. This is my mini scipt:
user strict;
my = ($name);
print "Enter you name: ";chomp($name = <STDIN>);
but if the name is longer than 8 letters, I want it to die !!,




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

Date: Mon, 15 Jan 2001 16:09:03 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: 8 letters
Message-Id: <3A63128F.BCAF6DA7@fujitsu-siemens.com>

Per- Fredrik Pollnow wrote:
> =

> Hi,
> I was wondering if you guy's could help me out. This is my mini scipt:
> user strict;
> my =3D ($name);
> print "Enter you name: ";chomp($name =3D <STDIN>);
> but if the name is longer than 8 letters, I want it to die !!,

I'll try:

die "Name too long" if ($name =3D~ /........./);


-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize (T.  Pratchett)


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

Date: Mon, 15 Jan 2001 16:11:26 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: 8 letters
Message-Id: <3A63131E.F051AD9A@fujitsu-siemens.com>

Josef Moellers wrote:
> =

> Per- Fredrik Pollnow wrote:
> >
> > Hi,
> > I was wondering if you guy's could help me out. This is my mini scipt=
:
> > user strict;
> > my =3D ($name);
> > print "Enter you name: ";chomp($name =3D <STDIN>);
> > but if the name is longer than 8 letters, I want it to die !!,
> =

> I'll try:
> =

> die "Name too long" if ($name =3D~ /........./);

Oops, and since TIMTOWTDI:

die "Name too long" if (length($name) > 8);

Sorry to follow up on myself, but how am I supposed to reacht the Top 10
of the most frequently posters B-{)

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize (T.  Pratchett)


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

Date: 15 Jan 2001 14:47:39 GMT
From: fight_against_spam_cut_here_retoh@dplanet.ch (Reto Hersiczky)
Subject: Re: FAQ 8.44:   How do I open a file without blocking?
Message-Id: <Xns902AA9AA1fightagainstspamcuth@195.141.200.222>


Could pls. somebody explain any sense for reading a file without blocking
besides a real-time application? As far as I can imagine, this mode makes
no sense in a CGI/modperl-based application. Tell me, if I'm wrong.
--Reto



PerlFAQ Server <faq@denver.pm.org> wrote in 
<hFh86.941$B9.191605248@news.frii.net>:

>+
>  How do I open a file without blocking?
>
>    If you're lucky enough to be using a system that supports non-blocking
>    reads (most Unixish systems do), you need only to use the O_NDELAY or
>    O_NONBLOCK flag from the Fcntl module in conjunction with sysopen():
>
>        use Fcntl;
>        sysopen(FH, "/tmp/somefile", O_WRONLY|O_NDELAY|O_CREAT, 0644)
>            or die "can't open /tmp/somefile: $!":
>


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

Date: Mon, 15 Jan 2001 14:59:16 GMT
From: geek@microgeek.com
Subject: File Handle Pipe question
Message-Id: <93v37u$ffa$1@nnrp1.deja.com>

Can some one please explain to me why the chomp in the following code
stops the program from working.

#!/usr/local/bin/perl

$INFile = "tail -f /usr/scripts/testmulit.txt |";

open(FILE, $INFile) || die "$!";

while (<FILE>)
{
chomp($_);
print($_);
}

If I remove the chomp it outputs what ever is in the fill and new stuff.
 With the chomp (or chop) it just sits there doing nothing.

Thanks,
Louis


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 15 Jan 2001 15:18:30 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: File Handle Pipe question
Message-Id: <slrn96656o.9sc.rgarciasuarez@rafael.kazibao.net>

geek@microgeek.com wrote in comp.lang.perl.misc:
> Can some one please explain to me why the chomp in the following code
> stops the program from working.
> 
> #!/usr/local/bin/perl
> 
> $INFile = "tail -f /usr/scripts/testmulit.txt |";
> 
> open(FILE, $INFile) || die "$!";
> 
> while (<FILE>)
> {
> chomp($_);
> print($_);
> }
> 
> If I remove the chomp it outputs what ever is in the fill and new stuff.
>  With the chomp (or chop) it just sits there doing nothing.

The chomp() removes the trailing \n. The output is then buffered. You
should get the intended behavior with the chomp() if you add at the
beginning of your code
    $| = 1;
(this forces the output to be flushed after every print -- see perlvar
for details).

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Mon, 15 Jan 2001 10:24:37 -0500
From: William Cardwell <EUSWMCL@am1.ericsson.se>
Subject: Limits on array and hash storage
Message-Id: <3A631635.C557DE@am1.ericsson.se>

Hello,

I notice that large arrays and hashes are commonly used in Perl. I do
the same and have not yet hit limits. Am I really using only ram?

Thanks,

Will Cardwell


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

Date: 15 Jan 2001 15:51:01 GMT
From: rich@bofh.concordia.ca (Rich Lafferty)
Subject: Re: Limits on array and hash storage
Message-Id: <slrn966735.env.rich@bofh.concordia.ca>

In comp.lang.perl.misc,
William Cardwell <EUSWMCL@am1.ericsson.se> wrote:
> Hello,
> 
> I notice that large arrays and hashes are commonly used in Perl. I do
> the same and have not yet hit limits. Am I really using only ram?

Possibly swap, also. Depends on your operating system. You'll be able
to see what your program's using with its standard tools, though,
which would be 'ps' and possibly 'top' under Unix.

  -Rich

-- 
Rich Lafferty ----------------------------------------
 Nocturnal Aviation Division, IITS Computing Services
 Concordia University, Montreal, QC
rich@bofh.concordia.ca -------------------------------


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

Date: Mon, 15 Jan 2001 15:06:04 GMT
From: "Vogelfrei" <zarathustra@enviroweb.org>
Subject: Re: LWP::UserAgent with HTTP::Cookies not keeping cookies ???
Message-Id: <wlE86.22244$ag.730319@newsread2.prod.itd.earthlink.net>


<snakedjip@yahoo.com> wrote in message news:93tsv9$igh$1@nnrp1.deja.com...

> So (commenting my code here...), I "GET" the url a first time, I create
> the HTTP::Cookies object to store the received session id, and when I
> try to re-GET the page, for some reason, $cookie_jar->add_cookie_header
> ($req) doesn't do the job.  The cookie is never sent to the server.  In
> fact, the $cookie_jar->as_string method returns NOTHING !

I ran into this same problem recently even though I could verify that a
Set-Cookie header was returned.  So I tried the method suggested in the
"Cookies" section of lwpcook and it worked fine:

    "Some sites like to play games with cookies. By default LWP ignore
cookies provided by the servers it visit. You                 can make it
start collecting them by setting up a cookie jar.

      use LWP::UserAgent;
      use HTTP::Cookies;
      $ua = LWP::UserAgent->new;
      $ua->cookie_jar(HTTP::Cookies->new(file => "lwpcookies.txt",
autosave => 1));

      # and then send requests just as you used to do

      $res = $ua->request(HTTP::Request->new(GET =>
"http://www.yahoo.no";));

      print $res->status_line, "\n";

   As you visit sites that send you cookies to keep, then the file
lwpcookies.txt will grow."






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

Date: Mon, 15 Jan 2001 09:47:40 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: name of var $_ is pointing to?
Message-Id: <t5366tkl34jr6baq2ulp9gk4dcfco6ed9v@news.supernews.net>

rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:

} Phil R Lawrence wrote in comp.lang.perl.misc:
} > How can I get the name of the var/glob/inner_thingee that $_ is currently
} > referencing?
  [...]
} > 
} So, reformulating your problem : you want to know to what thingy is
} aliased the loop variable in a foreach loop. Note that this thingy
} hasn't necessarily a name.

} If you really want to, you can use reference comparisons :
} 
}   my ($a,$b,$c) = qw/A B C/;
}   foreach ($a,$b,$c) {
}     print "a: $a\n" if \$_ eq \$a;
}     print "b: $b\n" if \$_ eq \$b;
}     print "c: $c\n" if \$_ eq \$c;
}   }
} 
} but, as you see, this is not very convenient.

Indeed -- but as a fun programming problem, I *think* it could be done: I
can envision opening up the main:: symbol table and iterating through it
(and all nested symtabs, of course0 looking for a reference match.  Of
course, if you hit a hash or an array, you then need to continue the
iteration "deeper" [since the alias might well be to an element of the
array/hash].  Seems like it'd be a pretty complex bit of code, but is
probably doable.  You write "whoami(ref)" and it comes back with a string,
being the best name it could figure out that matches that ref.

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: Mon, 15 Jan 2001 15:13:04 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: name of var $_ is pointing to?
Message-Id: <slrn9664si.9sc.rgarciasuarez@rafael.kazibao.net>

Bernie Cosell wrote in comp.lang.perl.misc:
> rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> 
> } Phil R Lawrence wrote in comp.lang.perl.misc:
> } > How can I get the name of the var/glob/inner_thingee that $_ is currently
> } > referencing?
>   [...]
> } > 
> } So, reformulating your problem : you want to know to what thingy is
> } aliased the loop variable in a foreach loop. Note that this thingy
> } hasn't necessarily a name.
> 
> } If you really want to, you can use reference comparisons :
> } 
> }   my ($a,$b,$c) = qw/A B C/;
> }   foreach ($a,$b,$c) {
> }     print "a: $a\n" if \$_ eq \$a;
> }     print "b: $b\n" if \$_ eq \$b;
> }     print "c: $c\n" if \$_ eq \$c;
> }   }
> } 
> } but, as you see, this is not very convenient.
> 
> Indeed -- but as a fun programming problem, I *think* it could be done: I
> can envision opening up the main:: symbol table and iterating through it
> (and all nested symtabs, of course0 looking for a reference match.  Of
> course, if you hit a hash or an array, you then need to continue the
> iteration "deeper" [since the alias might well be to an element of the
> array/hash].  Seems like it'd be a pretty complex bit of code, but is
> probably doable.  You write "whoami(ref)" and it comes back with a string,
> being the best name it could figure out that matches that ref.

This won't work with my() variables. Also, to be complete you'll have to
handle self-referential data structures and blessed objects. It may be
fun. Looking at the source code for Data::Dumper may help.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
print map substr($_,7).&$_, grep defined &$_, sort values %::;
sub Just {" another "}; sub Perl {" hacker,\n"};


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

Date: Mon, 15 Jan 2001 15:00:56 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <t66458amm4ccc9@corp.supernews.com>

Following is a summary of articles from new posters spanning a 7 day
period, beginning at 08 Jan 2001 14:58:21 GMT and ending at
15 Jan 2001 13:45:56 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2001 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Totals
======

Posters:  135 (35.9% of all posters)
Articles: 262 (23.4% of all articles)
Volume generated: 484.8 kb (23.1% of total volume)
    - headers:    213.1 kb (4,124 lines)
    - bodies:     261.3 kb (9,235 lines)
    - original:   195.4 kb (7,262 lines)
    - signatures: 10.1 kb (219 lines)

Original Content Rating: 0.748

Averages
========

Posts per poster: 1.9
    median: 1 post
    mode:   1 post - 96 posters
    s:      3.5 posts
Message size: 1894.7 bytes
    - header:     832.8 bytes (15.7 lines)
    - body:       1021.5 bytes (35.2 lines)
    - original:   763.8 bytes (27.7 lines)
    - signature:  39.4 bytes (0.8 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   37    69.0 ( 35.4/ 28.5/ 17.6)  tadmc@augustmail.com
    9    13.0 (  7.2/  5.3/  3.0)  brian d foy <comdog@panix.com>
    8    12.1 (  6.7/  5.4/  2.6)  Paul Boardman <peb@bms.umist.ac.uk>
    7    15.7 (  6.4/  9.3/  4.2)  David Kirkpatrick <davidkirk@mediaone.net>
    6    12.4 (  5.4/  5.6/  3.9)  Ilmari Karonen <usenet11335@itz.pp.sci.fi>
    6    11.7 (  4.9/  6.8/  3.0)  iain_hogg@my-deja.com
    6    22.2 (  5.7/ 15.2/  9.9)  Ilmari Karonen <usenet11334@itz.pp.sci.fi>
    5     8.0 (  5.1/  2.9/  1.1)  "stevec" <stevec@ntlworld.com>
    5     7.4 (  3.6/  3.8/  2.1)  Reto Hersiczky <fight_against_spam_cut_here_retoh@dplanet.ch>
    4     5.6 (  2.8/  2.8/  1.8)  zatlas@juno.com

These posters accounted for 8.3% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  69.0 ( 35.4/ 28.5/ 17.6)     37  tadmc@augustmail.com
  22.2 (  5.7/ 15.2/  9.9)      6  Ilmari Karonen <usenet11334@itz.pp.sci.fi>
  15.7 (  6.4/  9.3/  4.2)      7  David Kirkpatrick <davidkirk@mediaone.net>
  13.0 (  7.2/  5.3/  3.0)      9  brian d foy <comdog@panix.com>
  12.4 (  5.4/  5.6/  3.9)      6  Ilmari Karonen <usenet11335@itz.pp.sci.fi>
  12.1 (  6.7/  5.4/  2.6)      8  Paul Boardman <peb@bms.umist.ac.uk>
  11.7 (  4.9/  6.8/  3.0)      6  iain_hogg@my-deja.com
  11.1 (  0.7/ 10.3/  9.9)      1  "robin roos" <robin@dominodata.nl>
  10.4 (  0.8/  9.6/  8.2)      1  "rmerrit" <rmerrit@bigpond.com>
  10.2 (  1.2/  9.0/  8.9)      1  Rich Lafferty <rich@yapc.org>

These posters accounted for 9.0% of the total volume.

Top 10 Posters by OCR (minimum of three posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

1.000  (  1.6 /  1.6)      3  "M.J. Schürhoff" <m.j.schurhoff@chello.nl>
1.000  (  3.7 /  3.7)      3  a565a87@my-deja.com
0.835  (  5.4 /  6.4)      4  Ian Boreham <iboreham@my-deja.com>
0.830  (  3.1 /  3.8)      4  John Galt <ssomneb@my-deja.com>
0.696  (  3.9 /  5.6)      6  Ilmari Karonen <usenet11335@itz.pp.sci.fi>
0.664  (  1.8 /  2.8)      4  zatlas@juno.com
0.663  (  1.9 /  2.8)      3  mintcake@my-deja.com
0.651  (  9.9 / 15.2)      6  Ilmari Karonen <usenet11334@itz.pp.sci.fi>
0.647  (  1.0 /  1.5)      3  Haiyan Wang <qiuminh@my-deja.com>
0.632  (  3.6 /  5.7)      4  "claudio militello" <claudio.militello@infos.es>

Bottom 10 Posters by OCR (minimum of three posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.569  (  3.0 /  5.3)      9  brian d foy <comdog@panix.com>
0.554  (  0.6 /  1.1)      3  "Steve Hancock" <steve+usenet@[24.1.75.184]>
0.547  (  2.1 /  3.8)      5  Reto Hersiczky <fight_against_spam_cut_here_retoh@dplanet.ch>
0.519  (  1.3 /  2.4)      3  "james roads" <zhenghua_li@nj.trendmicro.com>
0.475  (  2.6 /  5.4)      8  Paul Boardman <peb@bms.umist.ac.uk>
0.452  (  4.2 /  9.3)      7  David Kirkpatrick <davidkirk@mediaone.net>
0.445  (  3.0 /  6.8)      6  iain_hogg@my-deja.com
0.367  (  1.1 /  2.9)      5  "stevec" <stevec@ntlworld.com>
0.366  (  0.9 /  2.5)      3  lpj91100@my-deja.com
0.303  (  1.3 /  4.2)      4  "Art" <artd@artd3.com>

21 posters (15%) had at least three posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      10  comp.lang.perl.modules
       9  comp.lang.perl
       4  alt.html
       2  comp.lang.tcl
       2  comp.lang.c
       2  microsoft.public.vinterdev
       2  comp.lang.python
       1  comp.sys.ibm.as400.misc
       1  comp.lang.perl.announce
       1  comp.answers

Top 10 Crossposters
===================

Articles  Address
--------  -------

       2  "chris lamb" <arinagour@yahoo.co.uk>
       2  jeffrhysjones@my-deja.com
       2  webtipzcom@my-deja.com
       2  rjames@higgsgroup.co.uk
       1  "Matt L." <mlaw@talk21.comNOSPAM>
       1  Scott Lindstrom <sclind@my-deja.com>
       1  "Steve Hancock" <steve+usenet@[24.1.75.184]>
       1  Nico Wieland <wieland@netvertising.ch>
       1  leenick@bigfoot.com
       1  Rich Lafferty <rich@yapc.org>


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

Date: 15 Jan 2001 09:57:18 -0600
From: claird@starbase.neosoft.com (Cameron Laird)
Subject: Re: Perl working with Java???
Message-Id: <CCD456233B42B7C1.BB4F5A79ED8604C6.D29EF8CD98137D11@lp.airnews.net>

In article <3A622C54.F8C236D5@mediashell.net>, EN  <leenick@bigfoot.com> wrote:
>Hi,
>
>I need to write a Perl program to do some stuff. Most of the stuff
>that the program has to do is already written in Java. Can anyone
>suggests some ways or point me to some resources that makes Perl work
>with Java?
>
>Two methods come to my mind:
>
>1) Translate Java code into Perl code
>2) Somehow embed a JVM in the Perl program
>
>I haven't been able to find a Java-2-Perl translator, and I haven't
>been able to find a way to embed JVM in Perl. Hope someone can help
>me.
			.
			.
			.
In principle, there's at least one Perl extension already
which scripts Java objects.  My impression, though, is that
none such is safe for use by civilians.  I welcome correction.

My STRONG recommendation is that you consider an architecture
which relies on inter-process communication between Java and
Perl applications.  You might particularly favor SOAP as a
protocol.

Your description leaves many variables free.  You might profit
from brief consultation with an expert in this domain, or you
can, of course, continue with a c.l.p.m dialogue.
-- 

Cameron Laird <claird@NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html


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

Date: 15 Jan 2001 15:45:47 GMT
From: rich@bofh.concordia.ca (Rich Lafferty)
Subject: Re: Price Comparison script?
Message-Id: <slrn9666pb.env.rich@bofh.concordia.ca>

In comp.lang.perl.misc,
stevec <stevec@ntlworld.com> wrote:
> Sorry Rich, you'll have to help me out with that one!! What do you mean?

You asked,

> > > Has anyone worked on or knows of a perl (or any other) script that will
> > > search other web sites and compare prices, amalgamate them and list the
> > > different prices on a web page?

And yes, I've worked on or know of one.

Strange thing to ask, though, if you ask me.

Hope this helps,

  -Rich

-- 
Rich Lafferty ----------------------------------------
 Nocturnal Aviation Division, IITS Computing Services
 Concordia University, Montreal, QC
rich@bofh.concordia.ca -------------------------------


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

Date: Mon, 15 Jan 2001 10:53:08 -0800
From: "Shawn Coppock" <coppocks@bellsouth.net>
Subject: Random Numbers with a Twist
Message-Id: <RZE86.288$zc4.21022@news2.mco>

I can yank random numbers from ranges etc. all day. But now, I need a little
more and I am tripping to solve this one.

#Problem:

Lets say I need to generate 60 random pairs of numbers ($x,$y) ... where $x
is from a range of 1..1200 and $y is from a range of 1..800. Consider these
pairs as a random point or coordinate on a grid of 1200x800.

In addition to this, each pair must be unique, in that
1. no pair can be the same
2. no pair can be within 30 of another

#Example:

Pair 1: 50,100
Pair 2: 32,135
Pair 3: 31,130
etc..

Assuming that the pair numbers are checked before being added to a final
list...

Pair 2 is ok because only one number is within 30 of Pair 1. But, Pair 3 is
NOT ok, because both numbers are within 30 of another pair (Pair 2).


I don't want the pairs/coordinates to be perfectly spaced by 30. There's no
need because at 1200x800 there are 960k available points... and if no two
are within 30 of another, there are still 320k possibilities.

Any assistance here would be greatly appreciated!

Shawn







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

Date: Mon, 15 Jan 2001 14:52:59 GMT
From: Bob Simon <bob_simon@my-deja.com>
Subject: Re: Regular Expression Question
Message-Id: <93v2s7$f9c$1@nnrp1.deja.com>

In article <slrn96403g.acl.tadmc@tadmc26.august.net>,
  tadmc@augustmail.com wrote:
> Bob Simon <bob_simon@my-deja.com> wrote:
>
> >b) [A-Za-z]* means zero or more occurrences of any capital
> >or small letter and appears to match the null string.
> >
> >For consistency, it seems like [A-Za-z]* should match the
> >first n letters in a line, up to the first space, or
> >non-alphabetic char.  Where is the error in this logic?
>
> It matches at the first opportunity.

You realize, of course, that .* does NOT match at the first
opportunity -- it matches the longest string possible.  My
only issue here is one of inconsistency.

> If matching against  '123abc', the first opportunity is the
> empty string before the '1' character, so that is what it
> matches.
>
> Don't allow it to match the empty string if you don't want
> it to match the empty string:
>
>    [A-Za-z]+
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas
>

--
Please address private email replies to bsimon at ATT dot Net.


Sent via Deja.com
http://www.deja.com/


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

Date: Mon, 15 Jan 2001 15:00:51 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <t6645375duecc3@corp.supernews.com>

Following is a summary of articles spanning a 7 day period,
beginning at 08 Jan 2001 14:58:21 GMT and ending at
15 Jan 2001 13:45:56 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2001 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Excluded Posters
================

perlfaq-suggestions\@(?:.*\.)?perl\.com

Totals
======

Posters:  376
Articles: 1118 (453 with cutlined signatures)
Threads:  325
Volume generated: 2095.8 kb
    - headers:    906.3 kb (17,716 lines)
    - bodies:     1124.3 kb (36,960 lines)
    - original:   753.4 kb (26,409 lines)
    - signatures: 64.0 kb (1,433 lines)

Original Content Rating: 0.670

Averages
========

Posts per poster: 3.0
    median: 1.0 post
    mode:   1 post - 212 posters
    s:      4.7 posts
Posts per thread: 3.4
    median: 2 posts
    mode:   1 post - 99 threads
    s:      6.1 posts
Message size: 1919.6 bytes
    - header:     830.1 bytes (15.8 lines)
    - body:       1029.8 bytes (33.1 lines)
    - original:   690.0 bytes (23.6 lines)
    - signature:  58.7 bytes (1.3 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   37    69.0 ( 35.4/ 28.5/ 17.6)  tadmc@augustmail.com
   31    86.2 ( 28.6/ 51.5/ 33.7)  mgjv@tradingpost.com.au
   28    59.5 ( 25.3/ 25.8/ 11.8)  Uri Guttman <uri@sysarch.com>
   27    96.2 ( 20.9/ 74.1/ 74.1)  PerlFAQ Server <faq@denver.pm.org>
   25    44.1 ( 21.2/ 22.5/ 12.2)  Joe Schaefer <joe+usenet@sunstarsys.com>
   22    38.6 ( 16.9/ 21.8/  9.8)  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
   22    34.9 ( 19.0/ 15.8/  9.1)  Bart Lateur <bart.lateur@skynet.be>
   22    40.2 ( 21.1/ 19.1/ 11.0)  Jeff Helman <jhelman@wsb.com>
   17    25.6 ( 12.6/ 12.3/  5.2)  Chris Fedde <cfedde@fedde.littleton.co.us>
   16    65.3 (  9.1/ 50.4/ 35.7)  Chris Stith <mischief@velma.motion.net>

These posters accounted for 22.1% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  96.2 ( 20.9/ 74.1/ 74.1)     27  PerlFAQ Server <faq@denver.pm.org>
  86.2 ( 28.6/ 51.5/ 33.7)     31  mgjv@tradingpost.com.au
  69.0 ( 35.4/ 28.5/ 17.6)     37  tadmc@augustmail.com
  65.3 (  9.1/ 50.4/ 35.7)     16  Chris Stith <mischief@velma.motion.net>
  59.5 ( 25.3/ 25.8/ 11.8)     28  Uri Guttman <uri@sysarch.com>
  44.1 ( 21.2/ 22.5/ 12.2)     25  Joe Schaefer <joe+usenet@sunstarsys.com>
  40.2 ( 21.1/ 19.1/ 11.0)     22  Jeff Helman <jhelman@wsb.com>
  38.6 ( 16.9/ 21.8/  9.8)     22  Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
  36.9 ( 13.6/ 23.3/  6.9)     15  Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl>
  34.9 ( 19.0/ 15.8/  9.1)     22  Bart Lateur <bart.lateur@skynet.be>

These posters accounted for 27.2% of the total volume.

Top 10 Posters by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

1.000  ( 74.1 / 74.1)     27  PerlFAQ Server <faq@denver.pm.org>
0.964  ( 14.1 / 14.6)      5  The WebDragon <nospam@nospam.com>
0.916  ( 17.6 / 19.2)     10  Greg Bacon <gbacon@cs.uah.edu>
0.800  (  3.7 /  4.6)      6  "Merlin" <robert@chalmers.com.au>
0.767  (  5.0 /  6.6)     10  dtbaker_dejanews@my-deja.com
0.728  ( 12.0 / 16.4)     15  abigail@foad.org
0.719  ( 12.0 / 16.7)     14  Mark Jason Dominus <mjd@plover.com>
0.707  ( 35.7 / 50.4)     16  Chris Stith <mischief@velma.motion.net>
0.705  (  3.0 /  4.2)      5  "Michael Mayo" <michael-a-mayo@worldnet.att.net>
0.696  (  3.9 /  5.6)      6  Ilmari Karonen <usenet11335@itz.pp.sci.fi>

Bottom 10 Posters by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.432  (  1.6 /  3.7)      6  Randal L. Schwartz <merlyn@stonehenge.com>
0.427  (  5.2 / 12.3)     17  Chris Fedde <cfedde@fedde.littleton.co.us>
0.416  (  2.3 /  5.5)      7  Colin Watson <cjw44@flatline.org.uk>
0.368  (  2.2 /  5.9)     13  Tony Curtis <tony_curtis32@yahoo.com>
0.367  (  1.1 /  2.9)      5  "stevec" <stevec@ntlworld.com>
0.355  (  3.4 /  9.5)     12  gungeek@my-deja.com
0.338  (  1.3 /  3.7)      5  Ala Qumsieh <aqumsieh@hyperchip.com>
0.334  (  1.4 /  4.3)      9  jerome.oneil@360.com
0.314  (  1.1 /  3.5)      7  Terrence Brannon <brannon@lnc.usc.edu>
0.298  (  6.9 / 23.3)     15  Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl>

50 posters (13%) had at least five posts.

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   47  ASCII to integer conversion
   35  Jobs: Senior Software Engineer
   16  counting lines in a file
   14  Shall use a reference instead?
   14  HTTP::Request encoding query
   13  regex help, please
   12  system() method won't change directories!
   12  left op of && and || only in scalar context ?
   12  What do you call the => operator?
   12  Perl idioms for converting string into list of characters...

These threads accounted for 16.7% of all articles.

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

 108.2 ( 44.8/ 60.3/ 27.8)     47  ASCII to integer conversion
  69.9 ( 30.6/ 34.5/ 18.9)     35  Jobs: Senior Software Engineer
  55.0 (  8.7/ 44.5/ 28.9)      9  Ada feature borrowed for Perl??
  30.8 ( 14.5/ 15.0/  9.0)     14  Shall use a reference instead?
  30.1 ( 12.3/ 17.2/  9.6)     14  HTTP::Request encoding query
  29.9 ( 12.8/ 16.5/  9.2)     16  counting lines in a file
  22.1 ( 10.9/ 10.0/  6.2)     12  Perl idioms for converting string into list of characters...
  21.8 (  9.7/ 11.4/  6.1)     12  system() method won't change directories!
  21.2 (  8.0/ 12.5/  8.0)      8  Problem w/ hash of references to hashes (or maybe scoping?)
  20.8 (  5.4/ 15.3/ 10.1)      7  Can't associate .PL files in Win98

These threads accounted for 19.6% of the total volume.

Top 10 Threads by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.782  (  6.4/   8.2)      5  perl socket programming questions
0.775  (  2.6/   3.3)      5  perlscript: can't figure out what's wrong
0.752  (  4.6/   6.1)      5  CGI vs Javascript dropdowns
0.724  (  4.7/   6.4)      6  Perl crashes on exit
0.717  (  7.4/  10.3)      6  send on a socket returns "operation not supported" but recv works?
0.714  (  1.5/   2.1)      5  Syntactic symbol for continuing one line into another
0.689  (  3.4/   5.0)      9  replacing spaces with %20
0.668  (  4.3/   6.5)      5  Getting files off remote servers
0.663  (  4.0/   6.1)      9  How do I pass an object to a sub-routine
0.659  ( 10.1/  15.3)      7  Can't associate .PL files in Win98

Bottom 10 Threads by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.447  (  1.0 /  2.1)      5  How do I work out a percentage to just one decimal place?
0.434  (  3.0 /  7.0)     12  What do you call the => operator?
0.424  (  2.6 /  6.2)      7  File::Find - how to follow links
0.407  (  2.0 /  4.8)     10  data structure syntax
0.406  (  1.2 /  3.0)      5  regex puzzler
0.406  (  0.8 /  2.1)      5  Perl script
0.385  (  1.5 /  4.0)      9  trying to count words - not working
0.359  (  2.6 /  7.1)      6  Problem connecting to POP3 server
0.351  (  1.1 /  3.1)      5  Strange ?
0.204  (  1.1 /  5.2)      5  Mime parser

75 threads (23%) had at least five posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      10  comp.lang.perl.modules
       9  comp.lang.perl
       4  alt.html
       2  comp.lang.tcl
       2  comp.lang.c
       2  microsoft.public.vinterdev
       2  comp.lang.python
       1  comp.sys.ibm.as400.misc
       1  comp.lang.perl.announce
       1  comp.answers

Top 10 Crossposters
===================

Articles  Address
--------  -------

       3  Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
       3  The WebDragon <nospam@nospam.com>
       2  "Mark Hamlin" <mark.c.hamlin@bt.com>
       2  nobull@mail.com
       2  webtipzcom@my-deja.com
       2  "chris lamb" <arinagour@yahoo.co.uk>
       2  jeffrhysjones@my-deja.com
       2  rjames@higgsgroup.co.uk
       1  Dale Bohl <dbohl@sgi.com>
       1  "Matt L." <mlaw@talk21.comNOSPAM>


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

Date: 15 Jan 2001 09:32:00 -0500
From: kj0 <kj0@mailcity.com>
Subject: Troubleshooting flock failure [CODE]
Message-Id: <93v1l0$rsb$1@panix3.panix.com>



I'm having problems with a hanging flock call requesting an exclusive
lock on a certain file.  I can't see any obvious reason for this lock
request to hang, since to my knowledge, there's no other process
locking the file.  Here's the relevant code snippet:

    # LOGFILE and TIMEOUT are constants.
    
    open INOUT, "+<@{[LOGFILE]}"
      or die "Can't update logfile (@{[LOGFILE]})!\n";
    
    my $orig_sigalrm_handler = $SIG{ALRM};
    $SIG{ALRM} = sub { die "timeout" };
    eval {
      alarm TIMEOUT;
      unless (flock INOUT, LOCK_EX) {
	alarm 0;
	close INOUT;
	die "Couldn't get lock for appending ($!)\n"; 
      }
      alarm 0;
    };
    
    if ($@) {
      if ($@ =~ /timeout/) {
	die "Locking logfile (@{[LOGFILE]}) timed out!\n";
      }
      else {
	alarm 0;
	die "Fatal error during file locking: $@\n";
      }
    }
    $SIG{ALRM} = $orig_sigalrm_handler || 'DEFAULT';


I've set the constant TIMEOUT to ungodly high values (e.g. 300 = 5
min), and stil I get the timeout error.  The constant LOGFILE is set
to the name of a file that exists and should not be locked by anything
else, as far as I know.  How can I find out what is causing this flock
call to hang?

Thanks,

KJ



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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V10 Issue 63
*************************************


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